зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset b876444d90a6 (bug 1469036) for causing mochitest failures on test_console_serviceworker_cached.html and test_devtools_track_serviceworker_time.html a=backout
This commit is contained in:
Родитель
208d16134b
Коммит
e46aa1cd0c
|
@ -10,9 +10,10 @@ support-files = importtesting_chromescript.js
|
|||
[test_sanityException2.html]
|
||||
[test_sanityParams.html]
|
||||
[test_sanityRegisteredServiceWorker.html]
|
||||
skip-if = serviceworker_e10s
|
||||
support-files = empty.js
|
||||
[test_sanityRegisteredServiceWorker2.html]
|
||||
skip-if = verify
|
||||
skip-if = verify || serviceworker_e10s
|
||||
support-files = empty.js
|
||||
[test_sanityWindowSnapshot.html]
|
||||
[test_SpecialPowersExtension.html]
|
||||
|
|
|
@ -27,7 +27,6 @@ Services.scriptloader.loadSubScript("resource://specialpowers/SpecialPowersObser
|
|||
function SpecialPowersObserver() {
|
||||
this._isFrameScriptLoaded = false;
|
||||
this._messageManager = Services.mm;
|
||||
this._serviceWorkerListener = null;
|
||||
}
|
||||
|
||||
|
||||
|
@ -110,32 +109,6 @@ SpecialPowersObserver.prototype.init = function() {
|
|||
|
||||
obs.addObserver(this, "http-on-modify-request");
|
||||
|
||||
// We would like to check after each test that there are no left over
|
||||
// ServiceWorkers still registered. However, because that check happens in
|
||||
// the child process, we would have to do IPC after ever test to verify in
|
||||
// the parent process (the source of truth for ServiceWorkers) that our
|
||||
// invariants are correct. To avoid that, we send messages down to the
|
||||
// children when to let them know when ServiceWorkers are registered or
|
||||
// unregistered (and become idle!) to be able to quicky verify this.
|
||||
// If this seems to be randomly failing, make sure that you're waiting for
|
||||
// the unregister promise to resolve before calling SimpleTest.finish.
|
||||
let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
|
||||
.getService(Ci.nsIServiceWorkerManager);
|
||||
let self = this;
|
||||
this._serviceWorkerListener = {
|
||||
cnt: 0,
|
||||
onRegister() {
|
||||
this.cnt++;
|
||||
self.onRegister(this.cnt);
|
||||
},
|
||||
|
||||
onUnregister() {
|
||||
this.cnt--;
|
||||
self.onUnregister(this.cnt);
|
||||
},
|
||||
};
|
||||
swm.addListener(this._serviceWorkerListener);
|
||||
|
||||
this._loadFrameScript();
|
||||
};
|
||||
|
||||
|
@ -148,10 +121,6 @@ SpecialPowersObserver.prototype.uninit = function() {
|
|||
});
|
||||
this._removeProcessCrashObservers();
|
||||
|
||||
let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
|
||||
.getService(Ci.nsIServiceWorkerManager);
|
||||
swm.removeListener(this._serviceWorkerListener);
|
||||
|
||||
if (this._isFrameScriptLoaded) {
|
||||
this._messageManager.removeMessageListener("SPPrefService", this);
|
||||
this._messageManager.removeMessageListener("SPProcessCrashManagerWait", this);
|
||||
|
@ -313,19 +282,3 @@ SpecialPowersObserver.prototype.receiveMessage = function(aMessage) {
|
|||
}
|
||||
return undefined;
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.onRegister = function(cnt) {
|
||||
// Send a message for the transition from 0 => 1.
|
||||
if (cnt === 1) {
|
||||
this._sendAsyncMessage("SPServiceWorkerRegistered",
|
||||
{ registered: true });
|
||||
}
|
||||
};
|
||||
|
||||
SpecialPowersObserver.prototype.onUnregister = function(cnt) {
|
||||
// Send a message for the transition from 1 => 0.
|
||||
if (cnt === 0) {
|
||||
this._sendAsyncMessage("SPServiceWorkerRegistered",
|
||||
{ registered: false });
|
||||
}
|
||||
};
|
||||
|
|
|
@ -25,7 +25,6 @@ function SpecialPowers(window, mm) {
|
|||
this._encounteredCrashDumpFiles = [];
|
||||
this._unexpectedCrashDumpFiles = { };
|
||||
this._crashDumpDir = null;
|
||||
this._serviceWorkerRegistered = false;
|
||||
this.DOMWindowUtils = bindDOMWindowUtils(window);
|
||||
Object.defineProperty(this, "Components", {
|
||||
configurable: true, enumerable: true, value: this.getFullComponents(),
|
||||
|
@ -58,7 +57,6 @@ function SpecialPowers(window, mm) {
|
|||
"SPRequestDumpCoverageCounters",
|
||||
"SPRequestResetCoverageCounters"];
|
||||
mm.addMessageListener("SPPingService", this._messageListener);
|
||||
mm.addMessageListener("SPServiceWorkerRegistered", this._messageListener);
|
||||
mm.addMessageListener("SpecialPowers.FilesCreated", this._messageListener);
|
||||
mm.addMessageListener("SpecialPowers.FilesError", this._messageListener);
|
||||
let self = this;
|
||||
|
@ -146,10 +144,6 @@ SpecialPowers.prototype._messageReceived = function(aMessage) {
|
|||
}
|
||||
break;
|
||||
|
||||
case "SPServiceWorkerRegistered":
|
||||
this._serviceWorkerRegistered = aMessage.data.registered;
|
||||
break;
|
||||
|
||||
case "SpecialPowers.FilesCreated":
|
||||
var createdHandler = this._createFilesOnSuccess;
|
||||
this._createFilesOnSuccess = null;
|
||||
|
@ -240,18 +234,9 @@ SpecialPowers.prototype.nestedFrameSetup = function() {
|
|||
};
|
||||
|
||||
SpecialPowers.prototype.isServiceWorkerRegistered = function() {
|
||||
// For the time being, if parent_intercept is false, we can assume that
|
||||
// ServiceWorkers registered by the current test are all known to the SWM in
|
||||
// this process.
|
||||
if (!Services.prefs.getBoolPref("dom.serviceWorkers.parent_intercept", false)) {
|
||||
let swm = Cc["@mozilla.org/serviceworkers/manager;1"]
|
||||
.getService(Ci.nsIServiceWorkerManager);
|
||||
return swm.getAllRegistrations().length != 0;
|
||||
}
|
||||
|
||||
// Please see the comment in SpecialPowersObserver.jsm above
|
||||
// this._serviceWorkerListener's assignment for what this returns.
|
||||
return this._serviceWorkerRegistered;
|
||||
var swm = Cc["@mozilla.org/serviceworkers/manager;1"]
|
||||
.getService(Ci.nsIServiceWorkerManager);
|
||||
return swm.getAllRegistrations().length != 0;
|
||||
};
|
||||
|
||||
// Attach our API to the window.
|
||||
|
|
Загрузка…
Ссылка в новой задаче