Bug 1609443: Part 2 - Fix most dodgy uses of fission.autostart pref. r=mccr8

Differential Revision: https://phabricator.services.mozilla.com/D64435

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kris Maglione 2020-02-26 19:43:32 +00:00
parent 4169e5ed5c
commit 9fe389f830
14 changed files with 24 additions and 20 deletions

View File

@ -1,7 +1,7 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
requestLongerTimeout(2);
}

View File

@ -9,7 +9,9 @@ SpecialPowers.pushPrefEnv({
],
});
let gShouldObserveSubframes;
// When the frames are in different processes, add observers to each frame,
// to ensure that the notifications don't get sent in the wrong process.
const gShouldObserveSubframes = SpecialPowers.useRemoteSubframes;
var gTests = [
{
@ -580,9 +582,6 @@ add_task(async function test_inprocess() {
});
add_task(async function test_outofprocess() {
// When the frames are in different processes, add observers to each frame,
// to ensure that the notifications don't get sent in the wrong process.
gShouldObserveSubframes = Services.prefs.getBoolPref("fission.autostart");
let observeSubFrameIds = gShouldObserveSubframes ? ["frame1", "frame2"] : [];
await runTests(gTests, {
relativeURI: "get_user_media_in_oop_frame.html",

View File

@ -2,7 +2,7 @@
* Bug 1277803 - A test case for testing favicon loading across different first party domains.
*/
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
requestLongerTimeout(2);
}

View File

@ -2,7 +2,7 @@
* Bug 1277803 - A test caes for testing favicon loading across different userContextId.
*/
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
requestLongerTimeout(2);
}

View File

@ -1,4 +1,4 @@
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
requestLongerTimeout(2);
}

View File

@ -2,7 +2,7 @@
* Bug 1270338 - Add a mochitest to ensure Sanitizer clears data for all containers
*/
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
requestLongerTimeout(4);
}

View File

@ -24,7 +24,7 @@ async function testLocalListFrames(tabTarget) {
// tabDescriptors
const { frames } = await tabTarget.listRemoteFrames();
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
// With fission, one frame is running out of process
is(frames.length, 1, "Got one remote frame with fission");

View File

@ -3196,7 +3196,8 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
// frame-ancestors and x-frame-options here in the content process
// but if we run in fission-mode then we do those two security
// checks within DOMSecurityManager::Observe in the parent.
bool fissionEnabled = StaticPrefs::fission_autostart();
bool fissionEnabled =
docShell && nsDocShell::Cast(docShell)->UseRemoteSubframes();
if (!fissionEnabled) {
nsContentPolicyType contentType = loadInfo->GetExternalContentPolicyType();
// frame-ancestor check only makes sense for subdocument and object loads,

View File

@ -7402,9 +7402,9 @@ mozilla::dom::TabGroup* nsGlobalWindowOuter::MaybeTabGroupOuter() {
// in same tabgroup in Fission mode. And if C reference back to A via
// window.open, we hit this assertion. Ignore this assertion in Fission
// given that tabgroup eventually will be removed after bug 1561715.
MOZ_ASSERT_IF(
!StaticPrefs::fission_autostart() && opener && Cast(opener) != this,
opener->TabGroup() == mTabGroup);
MOZ_ASSERT_IF(!nsDocShell::Cast(GetDocShell())->UseRemoteSubframes() &&
opener && Cast(opener) != this,
opener->TabGroup() == mTabGroup);
}
mIsValidatingTabGroup = false;
}

View File

@ -93,7 +93,9 @@ DOMSecurityManager::Observe(nsISupports* aSubject, const char* aTopic,
// additional carveouts for downloads but if we run in
// non-fission-mode then we do those two security checks within
// Document::StartDocumentLoad in the content process.
bool fissionEnabled = StaticPrefs::fission_autostart();
nsCOMPtr<nsILoadContext> loadContext;
NS_QueryNotificationCallbacks(channel, loadContext);
bool fissionEnabled = loadContext && loadContext->UseRemoteSubframes();
if (fissionEnabled) {
nsCOMPtr<nsIContentSecurityPolicy> csp;
nsresult rv =

View File

@ -3,7 +3,6 @@ const { E10SUtils } = ChromeUtils.import(
);
const DOCUMENT_CHANNEL_PREF = "browser.tabs.documentchannel";
const FISSION_PREF = "fission.autostart";
const HISTORY = [
{ url: httpURL("dummy_page.html") },
{ url: fileURL("dummy_page.html") },

View File

@ -6,7 +6,6 @@
var EXPORTED_SYMBOLS = ["FinderParent"];
const kFissionEnabledPref = "fission.autostart";
const kModalHighlightPref = "findbar.modalHighlight";
const kSoundEnabledPref = "accessibility.typeaheadfind.enablesound";
const kNotFoundSoundPref = "accessibility.typeaheadfind.soundURL";
@ -75,6 +74,10 @@ FinderParent.prototype = {
return this._browser.browsingContext;
},
get useRemoteSubframes() {
return this._browser.ownerGlobal.docShell.nsILoadContext.useRemoteSubframes;
},
swapBrowser(aBrowser) {
this._browser = aBrowser;
// Ideally listeners would have removed themselves but that doesn't happen
@ -186,7 +189,7 @@ FinderParent.prototype = {
let useModalHighlighter = Services.prefs.getBoolPref(kModalHighlightPref);
let hasOutOfProcessChild = false;
if (useModalHighlighter) {
if (Services.prefs.getBoolPref(kFissionEnabledPref)) {
if (this.useRemoteSubframes) {
return false;
}

View File

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
// Bug 1586105: these tests could time out in some extremely slow conditions,
// when fission is enabled.
// Requesting a longer timeout should make it pass.

View File

@ -2,7 +2,7 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
if (Services.prefs.getBoolPref("fission.autostart")) {
if (SpecialPowers.useRemoteSubframes) {
// Bug 1586105: these tests could time out in some extremely slow conditions,
// when fission is enabled.
// Requesting a longer timeout should make it pass.