mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 845863: Add a lookup for browser-scripts to allow loading a script only once. r=mbrubeck
--HG-- extra : rebase_source : 4eee7d026ead9cc1b3c5037efd20cda1e14c353f
This commit is contained in:
parent
fee019f92c
commit
f8999bb34b
@ -79,10 +79,10 @@ XPCOMUtils.defineLazyServiceGetter(this, "CrashReporter",
|
||||
* so it is not possible to set a lazy getter for Geometry.jsm.
|
||||
*/
|
||||
Cu.import("resource://gre/modules/Geometry.jsm");
|
||||
|
||||
/*
|
||||
* Browser scripts
|
||||
*/
|
||||
let ScriptContexts = {};
|
||||
[
|
||||
["WebProgress", "chrome://browser/content/WebProgress.js"],
|
||||
["FindHelperUI", "chrome://browser/content/helperui/FindHelperUI.js"],
|
||||
@ -134,12 +134,16 @@ Cu.import("resource://gre/modules/Geometry.jsm");
|
||||
].forEach(function (aScript) {
|
||||
let [name, script] = aScript;
|
||||
XPCOMUtils.defineLazyGetter(window, name, function() {
|
||||
let sandbox = {};
|
||||
Services.scriptloader.loadSubScript(script, sandbox);
|
||||
let sandbox;
|
||||
if (script in ScriptContexts) {
|
||||
sandbox = ScriptContexts[script];
|
||||
} else {
|
||||
sandbox = ScriptContexts[script] = {};
|
||||
Services.scriptloader.loadSubScript(script, sandbox);
|
||||
}
|
||||
return sandbox[name];
|
||||
});
|
||||
});
|
||||
|
||||
#ifdef MOZ_SERVICES_SYNC
|
||||
XPCOMUtils.defineLazyGetter(this, "Weave", function() {
|
||||
Components.utils.import("resource://services-sync/main.js");
|
||||
|
Loading…
Reference in New Issue
Block a user