Bug 755001 - Allow <iframe mozbrowser> to be explicitly in- or out-of-process. r=smaug

This commit is contained in:
Justin Lebar 2012-05-16 01:28:56 -04:00
parent d1f5ba30a6
commit b2be544813
3 changed files with 29 additions and 12 deletions

View File

@ -425,10 +425,12 @@ pref("browser.link.open_newwindow", 3);
// 2: don't divert window.open with features
pref("browser.link.open_newwindow.restriction", 0);
// Enable browser frames, but not OOP.
// Enable browser frames (including OOP), but make in-process browser frames
// the default.
pref("dom.mozBrowserFramesEnabled", true);
pref("dom.mozBrowserFramesWhitelist", "http://homescreen.gaiamobile.org,http://browser.gaiamobile.org");
pref("dom.ipc.tabs.disabled", true);
pref("dom.ipc.tabs.disabled", false);
pref("dom.ipc.browser_frames.oop_by_default", false);
// Temporary permission hack for WebSMS
pref("dom.sms.enabled", true);

View File

@ -1400,11 +1400,18 @@ nsFrameLoader::ShouldUseRemoteProcess()
return false;
}
return OwnerIsBrowserFrame() ||
(bool) mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::Remote,
nsGkAtoms::_true,
eCaseMatters);
// If we're an <iframe mozbrowser> and we don't have a "remote" attribute,
// fall back to the default.
if (OwnerIsBrowserFrame() &&
!mOwnerContent->HasAttr(kNameSpaceID_None, nsGkAtoms::Remote)) {
return Preferences::GetBool("dom.ipc.browser_frames.oop_by_default", false);
}
return mOwnerContent->AttrValueIs(kNameSpaceID_None,
nsGkAtoms::Remote,
nsGkAtoms::_true,
eCaseMatters);
}
nsresult

View File

@ -63,6 +63,14 @@ const browserFrameHelpers = {
this._setBoolPref('dom.ipc.tabs.disabled', value);
},
getOOPByDefaultPref: function() {
return this._getBoolPref("dom.ipc.browser_frames.oop_by_default");
},
setOOPByDefaultPref: function(value) {
return this._setBoolPref("dom.ipc.browser_frames.oop_by_default", value);
},
getPageThumbsEnabledPref: function() {
return this._getBoolPref('browser.pageThumbs.enabled');
},
@ -81,12 +89,14 @@ const browserFrameHelpers = {
this.setEnabledPref(this.origEnabledPref);
this.setWhitelistPref(this.origWhitelistPref);
this.setOOPDisabledPref(this.origOOPDisabledPref);
this.setOOPByDefaultPref(this.origOOPByDefaultPref);
this.setPageThumbsEnabledPref(this.origPageThumbsEnabledPref);
},
'origEnabledPref': null,
'origWhitelistPref': null,
'origOOPDisabledPref': null,
'origOOPByDefaultPref': null,
'origPageThumbsEnabledPref': null,
// Two basically-empty pages from two different domains you can load.
@ -101,19 +111,17 @@ const browserFrameHelpers = {
browserFrameHelpers.origEnabledPref = browserFrameHelpers.getEnabledPref();
browserFrameHelpers.origWhitelistPref = browserFrameHelpers.getWhitelistPref();
browserFrameHelpers.origOOPDisabledPref = browserFrameHelpers.getOOPDisabledPref();
browserFrameHelpers.origOOPByDefaultPref = browserFrameHelpers.getOOPByDefaultPref();
browserFrameHelpers.origPageThumbsEnabledPref = browserFrameHelpers.getPageThumbsEnabledPref();
// Disable tab view; it seriously messes us up.
browserFrameHelpers.setPageThumbsEnabledPref(false);
// OOP must be disabled on Windows; it doesn't work there. Enable it
// everywhere else.
// OOP by default, except on Windows, where OOP doesn't work.
browserFrameHelpers.setOOPByDefaultPref(true);
if (navigator.platform.indexOf('Win') != -1) {
browserFrameHelpers.setOOPDisabledPref(true);
}
else {
browserFrameHelpers.setOOPDisabledPref(false);
}
addEventListener('unload', function() {
browserFrameHelpers.restoreOriginalPrefs();