Bug 1249362 - initialize remote browser's contentPrincipal to a null principal, r?mconley
MozReview-Commit-ID: 4cglQaTLf7l
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -6358,23 +6358,16 @@ function isTabEmpty(aTab) {
function checkEmptyPageOrigin(browser = gBrowser.selectedBrowser,
uri = browser.currentURI) {
// If another page opened this page with e.g. window.open, this page might
// be controlled by its opener - return false.
if (browser.hasContentOpener) {
return false;
}
let contentPrincipal = browser.contentPrincipal;
- if (gMultiProcessBrowser && browser.isRemoteBrowser &&
- !contentPrincipal && uri.spec == "about:blank") {
- // Need to specialcase this because of how stopping an about:blank
- // load from chrome on e10s causes a permanently null contentPrincipal,
- // see bug 1249362.
- return true;
- }
// Not all principals have URIs...
if (contentPrincipal.URI) {
// A manually entered about:blank URI is slightly magical:
if (uri.spec == "about:blank" && contentPrincipal.isNullPrincipal) {
return true;
}
return contentPrincipal.URI.equals(uri);
}
--- a/toolkit/content/widgets/remote-browser.xml
+++ b/toolkit/content/widgets/remote-browser.xml
@@ -368,16 +368,20 @@
* the <browser> 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 to the null principal
+ let Services = Components.utils.import("resource://gre/modules/Services.jsm", {}).Services
+ this._contentPrincipal = Services.scriptSecurityManager.createNullPrincipal({});
+
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);
@@ -387,18 +391,17 @@
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")) {
- Components.utils.import("resource://gre/modules/Services.jsm", {}).Services
- .obs.addObserver(this, "browser:purge-session-history", true);
+ 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);
]]>
</constructor>