зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1162787 - Make the service worker periodic tests robust to the idle daily service firing its notification when the tests are being run; r=nsm
--HG-- extra : rebase_source : b78061a0cda67e426cdbbef7f89ca006c03a9158
This commit is contained in:
Родитель
a26860eed6
Коммит
71f3e8945e
|
@ -54,8 +54,13 @@ ServiceWorkerPeriodicUpdater::Observe(nsISupports* aSubject,
|
|||
const char* aTopic,
|
||||
const char16_t* aData)
|
||||
{
|
||||
// In tests, the pref is set to false so that the idle-daily service does not
|
||||
// trigger updates leading to intermittent failures.
|
||||
// We're called from SpecialPowers inside tests, in which case we need to
|
||||
// update during the test run, for which we use a non-empty aData.
|
||||
NS_NAMED_LITERAL_STRING(CallerSpecialPowers, "Caller:SpecialPowers");
|
||||
if (strcmp(aTopic, OBSERVER_TOPIC_IDLE_DAILY) == 0 &&
|
||||
sPeriodicUpdatesEnabled) {
|
||||
(sPeriodicUpdatesEnabled || CallerSpecialPowers.Equals(aData))) {
|
||||
// First, update all registrations in the parent process.
|
||||
nsCOMPtr<nsIServiceWorkerManager> swm =
|
||||
mozilla::services::GetServiceWorkerManager();
|
||||
|
|
|
@ -67,7 +67,6 @@ function runTheTest() {
|
|||
["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.periodic-updates.enabled", true],
|
||||
]}, function() {
|
||||
start();
|
||||
});
|
||||
|
|
|
@ -515,7 +515,7 @@ SpecialPowersObserverAPI.prototype = {
|
|||
// at the cost of hard-coding the usage of PeriodicServiceWorkerUpdater.
|
||||
Cc["@mozilla.org/service-worker-periodic-updater;1"].
|
||||
getService(Ci.nsIObserver).
|
||||
observe(null, "idle-daily", "");
|
||||
observe(null, "idle-daily", "Caller:SpecialPowers");
|
||||
|
||||
return undefined; // See comment at the beginning of this function.
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче