mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1134518 - Use the globalMM for ContentTask's frame script to prevent it from being loaded twice into a docShell swapped to another browser window r=bustage
This commit is contained in:
parent
6d9ebde0b8
commit
08f3961c3b
@ -15,6 +15,14 @@ Cu.import("resource://gre/modules/Promise.jsm");
|
||||
|
||||
const FRAME_SCRIPT = "chrome://mochikit/content/tests/BrowserTestUtils/content-task.js";
|
||||
|
||||
const globalMM = Cc["@mozilla.org/globalmessagemanager;1"]
|
||||
.getService(Ci.nsIMessageListenerManager);
|
||||
|
||||
/**
|
||||
* Keeps track of whether the frame script was already loaded.
|
||||
*/
|
||||
let gFrameScriptLoaded = false;
|
||||
|
||||
/**
|
||||
* Mapping from message id to associated promise.
|
||||
*/
|
||||
@ -47,12 +55,10 @@ this.ContentTask = {
|
||||
* @rejects An error message if execution fails.
|
||||
*/
|
||||
spawn: function ContentTask_spawn(browser, arg, task) {
|
||||
let mm = browser.ownerDocument.defaultView.messageManager;
|
||||
let scripts = mm.getDelayedFrameScripts();
|
||||
|
||||
// Load the frame script if needed.
|
||||
if (!scripts.find(script => script[0] == FRAME_SCRIPT)) {
|
||||
mm.loadFrameScript(FRAME_SCRIPT, true);
|
||||
if (!gFrameScriptLoaded) {
|
||||
globalMM.loadFrameScript(FRAME_SCRIPT, true);
|
||||
gFrameScriptLoaded = true;
|
||||
}
|
||||
|
||||
let deferred = {};
|
||||
|
Loading…
Reference in New Issue
Block a user