mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 965309 - Test that terminating a sync XHR at loadstart doesn't hang r=test-only
This commit is contained in:
parent
e018840e95
commit
e7b356d3a9
@ -45,6 +45,8 @@ support-files =
|
||||
suspend_iframe.html
|
||||
suspend_worker.js
|
||||
terminate_worker.js
|
||||
terminateSyncXHR_frame.html
|
||||
terminateSyncXHR_worker.js
|
||||
testXHR.txt
|
||||
threadErrors_worker1.js
|
||||
threadErrors_worker2.js
|
||||
@ -122,6 +124,7 @@ skip-if = buildapp == 'b2g' # b2g(Failed to load script: relativeLoad_import.js)
|
||||
[test_suspend.html]
|
||||
skip-if = buildapp == 'b2g' || e10s # b2g(test timed out, might need more time) b2g-debug(test timed out, might need more time) b2g-desktop(test timed out, might need more time)
|
||||
[test_terminate.html]
|
||||
[test_terminateSyncXHR.html]
|
||||
[test_threadErrors.html]
|
||||
[test_threadTimeouts.html]
|
||||
[test_throwingOnerror.html]
|
||||
|
25
dom/workers/test/terminateSyncXHR_frame.html
Normal file
25
dom/workers/test/terminateSyncXHR_frame.html
Normal file
@ -0,0 +1,25 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test for SharedWorker</title>
|
||||
</head>
|
||||
<body>
|
||||
<script type="text/javascript">
|
||||
function doStuff() {
|
||||
var worker = new Worker("terminateSyncXHR_worker.js");
|
||||
|
||||
worker.onmessage = function(event) {
|
||||
parent.postMessage(event.data, "*");
|
||||
};
|
||||
|
||||
worker.onerror = function(event) {
|
||||
parent.postMessage("ERROR!", "*");
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
19
dom/workers/test/terminateSyncXHR_worker.js
Normal file
19
dom/workers/test/terminateSyncXHR_worker.js
Normal file
@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/publicdomain/zero/1.0/
|
||||
*/
|
||||
|
||||
onmessage = function(event) {
|
||||
throw "No messages should reach me!";
|
||||
}
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("GET", "testXHR.txt", false);
|
||||
xhr.addEventListener("loadstart", function ()
|
||||
{
|
||||
// Tell the parent to terminate us.
|
||||
postMessage("TERMINATE");
|
||||
// And wait for it to do so.
|
||||
while(1) { true; }
|
||||
});
|
||||
xhr.send(null);
|
45
dom/workers/test/test_terminateSyncXHR.html
Normal file
45
dom/workers/test/test_terminateSyncXHR.html
Normal file
@ -0,0 +1,45 @@
|
||||
<!--
|
||||
Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/
|
||||
-->
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
Tests of DOM Worker Threads XHR(Bug 450452 )
|
||||
-->
|
||||
<head>
|
||||
<title>Test for DOM Worker Threads XHR (Bug 450452 )</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=450452">DOM Worker Threads XHR (Bug 450452)</a>
|
||||
<p id="display"></p>
|
||||
<div id="content">
|
||||
<iframe id="iframe" src="terminateSyncXHR_frame.html"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
<script class="testbody" type="text/javascript">
|
||||
var ifr = document.getElementById("iframe");
|
||||
|
||||
window.onmessage = function(event) {
|
||||
if (event.data == "TERMINATE") {
|
||||
ok(true, "Got TERMINATE");
|
||||
ifr.parentNode.removeChild(ifr);
|
||||
SimpleTest.finish();
|
||||
} else {
|
||||
ok(false, "Unexpected message: " + event.data);
|
||||
}
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
window.onload = function() {
|
||||
ifr.contentWindow.doStuff();
|
||||
}
|
||||
|
||||
</script>
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
Reference in New Issue
Block a user