diff options
author | Kris Maglione <maglione.k@gmail.com> | 2011-08-12 17:42:08 -0400 |
---|---|---|
committer | Kris Maglione <maglione.k@gmail.com> | 2011-08-12 17:42:08 -0400 |
commit | 500db377081c28370b47ee73e0e213a7aca482a9 (patch) | |
tree | 42cfd63675d0cc205570de4430d4501c7e67a227 /common/modules/contexts.jsm | |
parent | 5e86f4ed939d5eb129488995bbff7db5bf529043 (diff) | |
download | pentadactyl-500db377081c28370b47ee73e0e213a7aca482a9.tar.gz |
Merge the globals of multiple plugins of the same name.
Diffstat (limited to 'common/modules/contexts.jsm')
-rw-r--r-- | common/modules/contexts.jsm | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/common/modules/contexts.jsm b/common/modules/contexts.jsm index 9dad270b..319ccbec 100644 --- a/common/modules/contexts.jsm +++ b/common/modules/contexts.jsm @@ -182,20 +182,24 @@ var Contexts = Module("contexts", { function (dir) dir.contains(file, true), 0); + let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-") + : file.leafName; + let id = name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase()); + let contextPath = file.path; let self = Set.has(plugins, contextPath) && plugins.contexts[contextPath]; + if (!self && isPlugin) + self = Set.has(plugins, id) && plugins[id]; + if (self) { if (Set.has(self, "onUnload")) self.onUnload(); } else { - let name = isPlugin ? file.getRelativeDescriptor(isPlugin).replace(File.PATH_SEP, "-") - : file.leafName; - self = args && !isArray(args) ? args : newContext.apply(null, args || [userContext]); update(self, { - NAME: Const(name.replace(/\.[^.]*$/, "").replace(/-([a-z])/g, function (m, n1) n1.toUpperCase())), + NAME: Const(id), PATH: Const(file.path), |