mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-17 06:09:19 +00:00
Bug 1112469 - Part 4: Disable periodic updates of service workers when running tests; r=nsm
This is meant to avoid random issues with Gecko suddenly kicking off the periodic updates in the middle of our test runs. This uses a hidden pref intentionally since nobody should be able to discover this pref by going to about:config.
This commit is contained in:
parent
574ec745b0
commit
6cff744014
@ -8,6 +8,7 @@
|
||||
#include "mozilla/ClearOnShutdown.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "nsIServiceWorkerManager.h"
|
||||
|
||||
@ -21,6 +22,8 @@ NS_IMPL_ISUPPORTS(ServiceWorkerPeriodicUpdater, nsIObserver)
|
||||
|
||||
StaticRefPtr<ServiceWorkerPeriodicUpdater>
|
||||
ServiceWorkerPeriodicUpdater::sInstance;
|
||||
bool
|
||||
ServiceWorkerPeriodicUpdater::sPeriodicUpdatesEnabled = true;
|
||||
|
||||
already_AddRefed<ServiceWorkerPeriodicUpdater>
|
||||
ServiceWorkerPeriodicUpdater::GetSingleton()
|
||||
@ -37,6 +40,9 @@ ServiceWorkerPeriodicUpdater::GetSingleton()
|
||||
|
||||
ServiceWorkerPeriodicUpdater::ServiceWorkerPeriodicUpdater()
|
||||
{
|
||||
Preferences::AddBoolVarCache(&sPeriodicUpdatesEnabled,
|
||||
"dom.serviceWorkers.periodic-updates.enabled",
|
||||
true);
|
||||
}
|
||||
|
||||
ServiceWorkerPeriodicUpdater::~ServiceWorkerPeriodicUpdater()
|
||||
@ -48,7 +54,8 @@ ServiceWorkerPeriodicUpdater::Observe(nsISupports* aSubject,
|
||||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
if (strcmp(aTopic, OBSERVER_TOPIC_IDLE_DAILY) == 0) {
|
||||
if (strcmp(aTopic, OBSERVER_TOPIC_IDLE_DAILY) == 0 &&
|
||||
sPeriodicUpdatesEnabled) {
|
||||
// First, update all registrations in the parent process.
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm =
|
||||
mozilla::services::GetServiceWorkerManager();
|
||||
|
@ -36,6 +36,7 @@ private:
|
||||
~ServiceWorkerPeriodicUpdater();
|
||||
|
||||
static StaticRefPtr<ServiceWorkerPeriodicUpdater> sInstance;
|
||||
static bool sPeriodicUpdatesEnabled;
|
||||
};
|
||||
|
||||
} // namespace workers
|
||||
|
@ -140,6 +140,8 @@ class B2GDesktopReftest(RefTest):
|
||||
# Set a future policy version to avoid the telemetry prompt.
|
||||
prefs["toolkit.telemetry.prompted"] = 999
|
||||
prefs["toolkit.telemetry.notifiedOptOut"] = 999
|
||||
# Disable periodic updates of service workers
|
||||
prefs["dom.serviceWorkers.periodic-updates.enabled"] = False
|
||||
|
||||
# Set the extra prefs.
|
||||
profile.set_preferences(prefs)
|
||||
|
@ -62,3 +62,6 @@
|
||||
|
||||
// Make sure SelfSupport doesn't hit the network.
|
||||
branch.setCharPref("browser.selfsupport.url", "https://%(server)s/selfsupport-dummy/");
|
||||
|
||||
// Disable periodic updates of service workers.
|
||||
branch.setBoolPref("dom.serviceWorkers.periodic-updates.enabled", false);
|
||||
|
@ -450,6 +450,8 @@ class B2GRemoteReftest(RefTest):
|
||||
# Disable tiles also
|
||||
prefs["browser.newtabpage.directory.source"] = ""
|
||||
prefs["browser.newtabpage.directory.ping"] = ""
|
||||
# Disable periodic updates of service workers
|
||||
prefs["dom.serviceWorkers.periodic-updates.enabled"] = False
|
||||
|
||||
if options.oop:
|
||||
prefs['browser.tabs.remote.autostart'] = True
|
||||
|
@ -370,6 +370,8 @@ class FirefoxProfile(Profile):
|
||||
# Don't send Telemetry reports to the production server. This is
|
||||
# needed as Telemetry sends pings also if FHR upload is enabled.
|
||||
'toolkit.telemetry.server' : 'http://%(server)s/telemetry-dummy/',
|
||||
# Disable periodic updates of service workers
|
||||
'dom.serviceWorkers.periodic-updates.enabled': False,
|
||||
}
|
||||
|
||||
class MetroFirefoxProfile(Profile):
|
||||
@ -416,6 +418,8 @@ class MetroFirefoxProfile(Profile):
|
||||
# Don't send Telemetry reports to the production server. This is
|
||||
# needed as Telemetry sends pings also if FHR upload is enabled.
|
||||
'toolkit.telemetry.server' : 'http://%(server)s/telemetry-dummy/',
|
||||
# Disable periodic updates of service workers
|
||||
'dom.serviceWorkers.periodic-updates.enabled': False,
|
||||
}
|
||||
|
||||
class ThunderbirdProfile(Profile):
|
||||
|
@ -322,3 +322,6 @@ user_pref("network.proxy.pac_generator", false);
|
||||
// selected by default).
|
||||
user_pref("lightweightThemes.selectedThemeID", "");
|
||||
user_pref("browser.devedition.theme.enabled", false);
|
||||
|
||||
// Disable periodic updates of service workers.
|
||||
user_pref("dom.serviceWorkers.periodic-updates.enabled", false);
|
||||
|
@ -72,6 +72,8 @@ class TPSTestRunner(object):
|
||||
'services.sync.firstSync': 'notReady',
|
||||
'services.sync.lastversion': '1.0',
|
||||
'toolkit.startup.max_resumed_crashes': -1,
|
||||
# Disable periodic updates of service workers
|
||||
'dom.serviceWorkers.periodic-updates.enabled': False,
|
||||
}
|
||||
|
||||
debug_preferences = {
|
||||
|
Loading…
x
Reference in New Issue
Block a user