Backed out changeset 737f0e3e2f94 (bug 1660057) for xpcshell perma failures. CLOSED TREE

This commit is contained in:
Razvan Maries 2020-09-24 23:25:54 +03:00
Родитель 4f9bc7b6dc
Коммит 8de1e9f262
19 изменённых файлов: 41 добавлений и 334 удалений

Просмотреть файл

@ -9398,8 +9398,10 @@ var ConfirmationHint = {
};
function reportRemoteSubframesEnabledTelemetry() {
let autostart = Services.prefs.getBoolPref("fission.autostart");
let categoryLabel = gFissionBrowser ? "Enabled" : "Disabled";
if (gFissionBrowser == Services.appinfo.fissionAutostart) {
if (autostart == gFissionBrowser) {
categoryLabel += "ByAutostart";
} else {
categoryLabel += "ByUser";
@ -9414,7 +9416,8 @@ if (AppConstants.NIGHTLY_BUILD) {
var FissionTestingUI = {
init() {
// Handle the Fission/Non-Fission testing UI.
if (!Services.appinfo.fissionAutostart) {
let autostart = Services.prefs.getBoolPref("fission.autostart");
if (!autostart) {
return;
}

Просмотреть файл

@ -10,7 +10,7 @@
add_task(async function() {
const isWebRenderEnabled = Services.prefs.getBoolPref("gfx.webrender.all");
const isFissionEnabled = SpecialPowers.useRemoteSubframes;
const isFissionEnabled = Services.prefs.getBoolPref("fission.autostart");
if (isFissionEnabled && !isWebRenderEnabled) {
// This configuration is not supported.
// Also, in this specific configuration, we're displaying a warning, which looks like a flicker.

Просмотреть файл

@ -108,7 +108,7 @@ add_task(async () => {
// Navigate to an url that should switch to another target
// when fission is enabled.
if (SpecialPowers.useRemoteSubframes) {
if (Services.prefs.getBoolPref("fission.autostart")) {
info("Navigate to another page running on content process");
await navigateTo(CONTENT_PROCESS_PAGE2, tab, toolbox, extension);

Просмотреть файл

@ -52,6 +52,7 @@ const FORBIDDEN_IDS = new Set(["toolbox", ""]);
const MAX_ORDINAL = 99;
const CONTENT_FISSION_ENABLED_PREF = "devtools.contenttoolbox.fission";
const FISSION_AUTOSTART_PREF = "fission.autostart";
/**
* DevTools is a class that represents a set of developer tools, it holds a
@ -852,7 +853,10 @@ DevTools.prototype = {
// Checking fission.autostart is not used to check if the current target
// is a Fission tab, but only to check if the user is currently dogfooding
// Fission.
const isFissionEnabled = Services.appinfo.fissionAutostart;
const isFissionEnabled = Services.prefs.getBoolPref(
FISSION_AUTOSTART_PREF,
false
);
this._cachedFissionContentToolboxEnabled =
isFissionEnabled && isContentFissionEnabled;
}

Просмотреть файл

@ -612,7 +612,7 @@ function BuildConditionSandbox(aURL) {
sandbox.verify = prefs.getBoolPref("reftest.verify", false);
// Running with a variant enabled?
sandbox.fission = Services.appinfo.fissionAutostart;
sandbox.fission = prefs.getBoolPref("fission.autostart", false);
sandbox.serviceWorkerE10s = prefs.getBoolPref("dom.serviceWorkers.parent_intercept", false);
if (!g.dumpedConditionSandbox) {

Просмотреть файл

@ -162,11 +162,11 @@ function OnRefTestLoad(win)
var env = Cc["@mozilla.org/process/environment;1"].
getService(Ci.nsIEnvironment);
g.browserIsRemote = Services.appinfo.browserTabsRemoteAutostart;
g.browserIsFission = Services.appinfo.fissionAutostart;
var prefs = Cc["@mozilla.org/preferences-service;1"].
getService(Ci.nsIPrefBranch);
g.browserIsRemote = prefs.getBoolPref("browser.tabs.remote.autostart", false);
g.browserIsFission = prefs.getBoolPref("fission.autostart", false);
g.browserIsIframe = prefs.getBoolPref("reftest.browser.iframe.enabled", false);
g.logLevel = prefs.getStringPref("reftest.logLevel", "info");

Просмотреть файл

@ -10,9 +10,6 @@
# xpconnect tests
[include:../../../../../js/xpconnect/tests/marionette/manifest.ini]
# xre tests
[include:../../../../../toolkit/xre/test/marionette/marionette.ini]
# searchservice tests
[include:../../../../../browser/components/search/test/marionette/manifest.ini]

Просмотреть файл

@ -28,6 +28,8 @@ XPCOMUtils.defineLazyGetter(this, "logger", () => Log.get());
const XHTML_NS = "http://www.w3.org/1999/xhtml";
const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const PREF_E10S = "browser.tabs.remote.autostart";
const PREF_FISSION = "fission.autostart";
const SCREENSHOT_MODE = {
unexpected: 0,
@ -73,8 +75,8 @@ reftest.Runner = class {
this.isPrint = null;
this.windowUtils = null;
this.lastURL = null;
this.useRemoteTabs = Services.appinfo.browserTabsRemoteAutostart;
this.useRemoteSubframes = Services.appinfo.fissionAutostart;
this.useRemoteTabs = Preferences.get(PREF_E10S);
this.useRemoteSubframes = Preferences.get(PREF_FISSION);
}
/**

Просмотреть файл

@ -180,7 +180,7 @@ exports.reloadPageAndLog = async function(name, toolbox, onReload) {
};
exports.isFissionEnabled = function() {
return Services.appinfo.fissionAutostart;
return Services.prefs.getBoolPref("fission.autostart", false);
};
exports.waitForTick = () => new Promise(res => setTimeout(res, 0));

Просмотреть файл

@ -89,8 +89,15 @@ ActorManagerParent.flush();
const { promiseDocumentLoaded, promiseEvent, promiseObserved } = ExtensionUtils;
var REMOTE_CONTENT_SCRIPTS = Services.appinfo.browserTabsRemoteAutostart;
const REMOTE_CONTENT_SUBFRAMES = Services.appinfo.fissionAutostart;
var REMOTE_CONTENT_SCRIPTS = Services.prefs.getBoolPref(
"browser.tabs.remote.autostart",
false
);
const REMOTE_CONTENT_SUBFRAMES = Services.prefs.getBoolPref(
"fission.autostart",
false
);
let BASE_MANIFEST = Object.freeze({
applications: Object.freeze({

Просмотреть файл

@ -172,7 +172,7 @@ const BackgroundPageThumbs = {
},
get useFissionBrowser() {
return Services.appinfo.fissionAutostart;
return Services.prefs.getBoolPref("fission.autostart");
},
/**

Просмотреть файл

@ -10,6 +10,7 @@ var classifierTester = {
FLASHBLOCK_ENABLE_PREF: "plugins.flashBlock.enabled",
FLASH_PLUGIN_USER_SETTING_PREF: "plugin.state.flash",
URLCLASSIFIER_DISALLOW_COMPLETIONS_PREF: "urlclassifier.disallow_completions",
FISSION_PREF: "fission.autostart",
NEVER_ACTIVATE_PREF_VALUE: 0,
ASK_TO_ACTIVATE_PREF_VALUE: 1,
ALWAYS_ACTIVATE_PREF_VALUE: 2,
@ -384,7 +385,7 @@ var classifierTester = {
checkPluginInfo(pluginInfo, expectedClassification, flashSetting) {
// Flashblocking is disabled when fission is enabled, so all the classifications
// should be "unknown"
if (Services.appinfo.fissionAutostart) {
if (Services.prefs.getBoolPref(classifierTester.FISSION_PREF)) {
expectedClassification = "unknown";
}

Просмотреть файл

@ -55,7 +55,7 @@ function canDisableFlashProtectedMode(aPlugin) {
}
function canDisableFlashBlocking() {
return Services.appinfo.fissionAutostart;
return Services.prefs.getBoolPref("fission.autostart");
}
function init() {

Просмотреть файл

@ -15,7 +15,6 @@ if CONFIG['OS_ARCH'] == 'WINNT':
MOCHITEST_MANIFESTS += ['test/mochitest.ini']
BROWSER_CHROME_MANIFESTS += ['test/browser.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell.ini']
MARIONETTE_UNIT_MANIFESTS += ['test/marionette/marionette.ini']
XPIDL_SOURCES += [
'nsINativeAppSupport.idl',

Просмотреть файл

@ -456,86 +456,6 @@ static ArgResult CheckArgExists(const char* aArg) {
bool gSafeMode = false;
bool gFxREmbedded = false;
// Fission enablement for the current session is determined once, at startup,
// and then remains the same for the duration of the session.
//
// The following factors determine whether or not Fission is enabled for a
// session, in order of precedence:
//
// - Safe mode: In safe mode, Fission is never enabled.
//
// - The MOZ_FORCE_ENABLE_FISSION environment variable: If set to any value,
// Fission will be enabled.
//
// - The following preferences:
//
// The current enrollment status as controlled by Normandy. This value is only
// stored in the default preference branch, and is not persisted across
// sessions by the preference service. It therefore isn't available early
// enough at startup, and needs to be synced to a preference in the user
// branch which is persisted across sessions.
static const char kPrefFissionExperimentEnrollmentStatus[] =
"fission.experiment.enrollmentStatus";
//
// The enrollment status to be used at browser startup. This automatically
// synced from the above enrollmentStatus preference whenever the latter is
// changed. It can have any of the values defined in the
// `nsIXULRuntime_ExperimentStatus` enum. Meanings are documented in
// the declaration of `nsIXULRuntime.fissionExperimentStatus`
static const char kPrefFissionExperimentStartupEnrollmentStatus[] =
"fission.experiment.startupEnrollmentStatus";
//
// The "fission.autostart" preference: If none of the above conditions apply,
// and the experiment enrollment status is unknown, then the value of the
// "fisison.autostart" preference is used.
static nsIXULRuntime::ExperimentStatus FissionExperimentStatus() {
static nsIXULRuntime::ExperimentStatus sExperimentStatus = ([]() {
uint32_t value =
Preferences::GetUint(kPrefFissionExperimentStartupEnrollmentStatus);
if (value >
uint32_t(nsIXULRuntime::ExperimentStatus::eExperimentStatusMax)) {
return nsIXULRuntime::ExperimentStatus::eUnknown;
}
return nsIXULRuntime::ExperimentStatus(value);
})();
return sExperimentStatus;
}
static void OnFissionEnrollmentStatusChanged(const char* aPref, void* aData) {
Preferences::SetUint(
kPrefFissionExperimentStartupEnrollmentStatus,
Preferences::GetUint(kPrefFissionExperimentEnrollmentStatus));
}
namespace mozilla {
bool FissionAutostart() {
static bool sFissionAutostart = ([]() {
if (gSafeMode) {
return false;
}
if (EnvHasValue("MOZ_FORCE_ENABLE_FISSION")) {
return true;
}
switch (FissionExperimentStatus()) {
case nsIXULRuntime::ExperimentStatus::eEnrolledControl:
return false;
case nsIXULRuntime::ExperimentStatus::eEnrolledTreatment:
return true;
default:
return StaticPrefs::fission_autostart_AtStartup_DoNotUseDirectly();
}
})();
return sFissionAutostart;
}
} // namespace mozilla
/**
* The nsXULAppInfo object implements nsIFactory so that it can be its own
* singleton.
@ -855,18 +775,6 @@ nsXULAppInfo::Observe(nsISupports* aSubject, const char* aTopic,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsXULAppInfo::GetFissionAutostart(bool* aResult) {
*aResult = FissionAutostart();
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetFissionExperimentStatus(ExperimentStatus* aResult) {
*aResult = FissionExperimentStatus();
return NS_OK;
}
NS_IMETHODIMP
nsXULAppInfo::GetBrowserTabsRemoteAutostart(bool* aResult) {
*aResult = BrowserTabsRemoteAutostart();
@ -4770,9 +4678,6 @@ nsresult XREMain::XRE_mainRun() {
# endif // defined(MOZ_DEFAULT_BROWSER_AGENT)
#endif
Preferences::RegisterCallback(&OnFissionEnrollmentStatusChanged,
kPrefFissionExperimentEnrollmentStatus);
#if defined(HAVE_DESKTOP_STARTUP_ID) && defined(MOZ_WIDGET_GTK)
// Clear the environment variable so it won't be inherited by
// child processes and confuse things.
@ -5296,6 +5201,12 @@ bool BrowserTabsRemoteAutostart() {
return gBrowserTabsRemoteAutostart;
}
bool FissionAutostart() {
return !gSafeMode &&
(StaticPrefs::fission_autostart_AtStartup_DoNotUseDirectly() ||
EnvHasValue("MOZ_FORCE_ENABLE_FISSION"));
}
uint32_t GetMaxWebProcessCount() {
// multiOptOut is in int to allow us to run multiple experiments without
// introducing multiple prefs a la the autostart.N prefs.

Просмотреть файл

@ -1 +0,0 @@
[test_fission_autostart.py]

Просмотреть файл

@ -1,175 +0,0 @@
from __future__ import absolute_import, print_function
from marionette_harness import MarionetteTestCase
class ExperimentStatus:
UNKNOWN = 0
ENROLLED_CONTROL = 1
ENROLLED_TREATMENT = 2
class Prefs:
ENROLLMENT_STATUS = 'fission.experiment.enrollmentStatus'
STARTUP_ENROLLMENT_STATUS = 'fission.experiment.startupEnrollmentStatus'
FISSION_AUTOSTART = 'fission.autostart'
ENV_ENABLE_FISSION = 'MOZ_FORCE_ENABLE_FISSION'
class TestFissionAutostart(MarionetteTestCase):
SANDBOX_NAME = 'fission-autostart'
def execute_script(self, code, *args, **kwargs):
with self.marionette.using_context(self.marionette.CONTEXT_CHROME):
return self.marionette.execute_script(code,
new_sandbox=False,
sandbox=self.SANDBOX_NAME,
*args, **kwargs)
def get_fission_status(self):
return self.execute_script(r'''
let win = Services.wm.getMostRecentWindow("navigator:browser");
return {
fissionAutostart: Services.appinfo.fissionAutostart,
fissionExperimentStatus: Services.appinfo.fissionExperimentStatus,
useRemoteSubframes: win.docShell.nsILoadContext.useRemoteSubframes,
};
''')
def check_fission_status(self, enabled, experiment):
expected = {
'fissionAutostart': enabled,
'fissionExperimentStatus': experiment,
'useRemoteSubframes': enabled,
}
status = self.get_fission_status()
for prop, value in expected.items():
self.assertEqual(
status[prop], value,
'%s should have the value `%r`, but has `%r`'
% (prop, value, status[prop]))
def set_env(self, env, value):
self.execute_script('env.set(arguments[0], arguments[1]);',
script_args=(env, value))
def get_env(self, env):
return self.execute_script('return env.get(arguments[0]);',
script_args=(env,))
def set_enrollment_status(self, status):
self.marionette.set_pref(Prefs.ENROLLMENT_STATUS,
status,
default_branch=True)
startup_status = self.marionette.get_pref(
Prefs.STARTUP_ENROLLMENT_STATUS)
self.assertEqual(startup_status, status,
'Startup enrollment status (%r) should match new '
'session status (%r)' % (startup_status, status))
def restart(self, prefs=None, env=None):
if prefs:
self.marionette.set_prefs(prefs)
if env:
for name, value in env.items():
self.set_env(name, value)
self.marionette.restart(in_app=True, clean=False)
self.setUpSession()
# Sanity check our environment.
if prefs:
for key, val in prefs.items():
self.assertEqual(self.marionette.get_pref(key), val)
if env:
for key, val in env.items():
self.assertEqual(self.get_env(key), val or '')
def setUpSession(self):
self.marionette.set_context(self.marionette.CONTEXT_CHROME)
self.execute_script(r'''
// We're running in a function, in a sandbox, that inherits from an
// X-ray wrapped window. Anything we want to be globally available
// needs to be defined on that window.
ChromeUtils.import("resource://gre/modules/Services.jsm", window);
window.env = Cc["@mozilla.org/process/environment;1"]
.getService(Ci.nsIEnvironment);
''')
def setUp(self):
super(TestFissionAutostart, self).setUp()
self.setUpSession()
def tearDown(self):
self.marionette.restart(clean=True)
super(TestFissionAutostart, self).tearDown()
def test_runtime_changes(self):
"""Tests that changes to preferences during runtime do not have any
effect on the current session."""
self.restart(prefs={Prefs.FISSION_AUTOSTART: True})
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.UNKNOWN)
self.set_enrollment_status(ExperimentStatus.ENROLLED_CONTROL)
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.UNKNOWN)
self.marionette.set_pref(Prefs.FISSION_AUTOSTART,
False)
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.UNKNOWN)
self.restart()
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.ENROLLED_CONTROL)
self.marionette.set_pref(Prefs.ENROLLMENT_STATUS,
ExperimentStatus.UNKNOWN,
default_branch=True)
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.ENROLLED_CONTROL)
self.set_env(ENV_ENABLE_FISSION, '1')
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.ENROLLED_CONTROL)
def test_fission_precedence(self):
self.restart(prefs={Prefs.FISSION_AUTOSTART: False},
env={ENV_ENABLE_FISSION: '1'})
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.UNKNOWN)
self.restart(prefs={Prefs.FISSION_AUTOSTART: True},
env={ENV_ENABLE_FISSION: ''})
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.UNKNOWN)
self.restart(prefs={Prefs.FISSION_AUTOSTART: False})
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.UNKNOWN)
self.set_enrollment_status(ExperimentStatus.ENROLLED_TREATMENT)
self.restart()
self.check_fission_status(enabled=True,
experiment=ExperimentStatus.ENROLLED_TREATMENT)
self.set_enrollment_status(ExperimentStatus.ENROLLED_CONTROL)
self.restart()
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.ENROLLED_CONTROL)
self.restart(prefs={Prefs.FISSION_AUTOSTART: True})
self.check_fission_status(enabled=False,
experiment=ExperimentStatus.ENROLLED_CONTROL)

Просмотреть файл

@ -11,7 +11,7 @@ const MAC = AppConstants.platform == "macosx";
const HAS_THREAD_NAMES =
AppConstants.platform != "win" ||
AppConstants.isPlatformAndVersionAtLeast("win", 10);
const isFissionEnabled = SpecialPowers.useRemoteSubframes;
const isFissionEnabled = Services.prefs.getBoolPref("fission.autostart");
const SAMPLE_SIZE = 10;

Просмотреть файл

@ -41,47 +41,6 @@ interface nsIXULRuntime : nsISupports
*/
readonly attribute boolean inSafeMode;
/**
* The status of a given experiment, as stored in a preference by Normandy.
*/
cenum ExperimentStatus : 8 {
// The experiment status is unknown, and behavior should not be modified.
eUnknown = 0,
// The user is enrolled in the control group, and should see the default
// behavior.
eEnrolledControl = 1,
// The user is enrolled in the treatment group, and should see the
// experimental behavior which is being tested.
eEnrolledTreatment = 2,
eExperimentStatusMax = 2,
};
/**
* Whether Fission should be automatically enabled for new browser windows.
*
* This value is guaranteed to remain constant for the length of a browser
* session.
*/
readonly attribute boolean fissionAutostart;
/**
* The user's enrollment status in the Fission rollout experiment. May be
* one of:
*
* - eUnknown: The user's enrollment status is unknown, and the experiment
* should be ignored.
*
* - eEnrolledControl: The user is enrolled in the control group, and Fission
* should be disabled.
*
* - eEnrolledTreatment: The user is enrolled in the treatment group, and
* Fission should be enabled.
*
* This value is guaranteed to remain constant for the length of a browser
* session.
*/
readonly attribute nsIXULRuntime_ExperimentStatus fissionExperimentStatus;
/**
* Whether to write console errors to a log file. If a component
* encounters startup errors that might prevent the app from showing