Bug 913950 - close all existing ports on worker termination. r=mixedpuppy

This commit is contained in:
Mark Hammond 2013-09-10 10:31:15 +10:00
parent ac19e1b3bc
commit 907f1d969e

View File

@ -127,12 +127,16 @@ WorkerHandle.prototype = {
return;
}
delete workerCache[url];
// close all the ports we have handed out.
for (let [portid, port] of this._worker.ports) {
port.close();
}
this._worker.ports.clear();
this._worker.ports = null;
this._worker.browserPromise.then(browser => {
browser.parentNode.removeChild(browser);
});
// wipe things out just incase other reference have snuck out somehow...
this._worker.ports.clear();
this._worker.ports = null;
this._worker.browserPromise = null;
this._worker = null;
}