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() {}, Components.interfaces.nsIThread.DISPATCH_NORMAL); } let timer = Components.classes["@mozilla.org/timer;1"].createInstance(Components.interfaces.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 = Components.classes["@mozilla.org/remote-web-navigation;1"] .createInstance(Components.interfaces.nsIWebNavigation); this._remoteWebNavigationImpl = this._remoteWebNavigation.wrappedJSObject; this._remoteWebNavigationImpl.swapBrowser(this); // Initialize contentPrincipal to the about:blank principal for this loadcontext let {Services} = Components.utils.import("resource://gre/modules/Services.jsm", {}); let aboutBlank = Services.io.newURI("about:blank", null, null); let ssm = Services.scriptSecurityManager; this._contentPrincipal = ssm.getLoadContextCodebasePrincipal(aboutBlank, this.loadContext); this.messageManager.addMessageListener("Browser:Init", this); this.messageManager.addMessageListener("DOMTitleChanged", this); this.messageManager.addMessageListener("ImageDocumentLoaded", 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.addMessageListener("MozApplicationManifest", 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", true); } 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); }