Bug 1619872 - Have a test to ensure EventSource works fine with invalid url in workers after shuting down; r=baku

Differential Revision: https://phabricator.services.mozilla.com/D65299

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Tom Tung 2020-03-04 15:21:59 +00:00
Родитель 7681b5f08e
Коммит 5abf94982f
3 изменённых файлов: 41 добавлений и 0 удалений

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

@ -248,6 +248,7 @@ load xhr_html_nullresponse.html
load xhr-with-pagehide-1.html
pref(layout.css.resizeobserver.enabled,true) load 1555786.html
load 1577191.html
load eventSource_invalid_scheme_worker_shutdown.html
load 1291535.html
skip-if(!isDebugBuild||xulRuntime.OS!="Linux") load 1611853.html
load 1619322.html

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

@ -0,0 +1,4 @@
onmessage = function(event) {
close();
let source = new EventSource(`d:`, {});
}

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

@ -0,0 +1,36 @@
<html class="reftest-wait">
<head>
<script type="text/javascript">
const workerURL = "1614339-worker.js";
const Cc = SpecialPowers.Cc;
const Ci = SpecialPowers.Ci;
const wdm = Cc["@mozilla.org/dom/workers/workerdebuggermanager;1"]
.getService(Ci.nsIWorkerDebuggerManager);
function waitForUnregister() {
return new Promise(function(resolve) {
wdm.addListener({
onUnregister(dbg) {
if (dbg.url !== workerURL) {
return;
}
wdm.removeListener(this);
resolve();
},
});
});
}
function boom() {
const worker = new Worker(workerURL);
waitForUnregister().then(function() {
document.documentElement.classList.remove("reftest-wait");
});
worker.postMessage("Start");
}
</script>
</head>
<body onload="boom();"></body>
</html>