null null null null null null null null "" "" null null null null 1 1 false null null false 0 { if (msg.data.id != id) { return; } if (msg.data.kind == "start") { responded = true; return; } done(msg.data.permitUnload); }; let observer = subject => { if (subject == mm) { done(true); } }; function done(result) { finished = true; permitUnload = result; mm.removeMessageListener("PermitUnload", msgListener); Services.obs.removeObserver(observer, "message-manager-close"); } mm.sendAsyncMessage("PermitUnload", {id}); mm.addMessageListener("PermitUnload", msgListener); Services.obs.addObserver(observer, "message-manager-close", false); let timedOut = false; function timeout() { if (!responded) { timedOut = true; } // Dispatch something to ensure that the main thread wakes up. Services.tm.mainThread.dispatch(function() {}, Ci.nsIThread.DISPATCH_NORMAL); } let timer = Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer); timer.initWithCallback(timeout, kTimeout, timer.TYPE_ONE_SHOT); while (!finished && !timedOut) { Services.tm.currentThread.processNextEvent(true); } return {permitUnload, timedOut}; ]]> element may not be initialized yet. */ this._remoteWebNavigation = Cc["@mozilla.org/remote-web-navigation;1"].createInstance(Ci.nsIWebNavigation); this._remoteWebNavigationImpl = this._remoteWebNavigation.wrappedJSObject; this._remoteWebNavigationImpl.swapBrowser(this); this.messageManager.addMessageListener("Browser:Init", this); this.messageManager.addMessageListener("DOMTitleChanged", this); this.messageManager.addMessageListener("ImageDocumentLoaded", this); this.messageManager.addMessageListener("DocumentInserted", this); this.messageManager.addMessageListener("FullZoomChange", this); this.messageManager.addMessageListener("TextZoomChange", this); this.messageManager.addMessageListener("ZoomChangeUsingMouseWheel", this); this.messageManager.addMessageListener("DOMFullscreen:RequestExit", this); this.messageManager.addMessageListener("DOMFullscreen:RequestRollback", this); this.messageManager.loadFrameScript("chrome://global/content/browser-child.js", true); if (this.hasAttribute("selectmenulist")) { this.messageManager.addMessageListener("Forms:ShowDropDown", this); this.messageManager.addMessageListener("Forms:HideDropDown", this); this.messageManager.loadFrameScript("chrome://global/content/select-child.js", true); } if (!this.hasAttribute("disablehistory")) { Services.obs.addObserver(this, "browser:purge-session-history", false) } let jsm = "resource://gre/modules/RemoteController.jsm"; let RemoteController = Components.utils.import(jsm, {}).RemoteController; this._controller = new RemoteController(this); this.controllers.appendController(this._controller); ]]> if (this._controller) { this._controller.enableDisableCommands(aAction, aEnabledLength, aEnabledCommands, aDisabledLength, aDisabledCommands); }