From e7b356d3a92178626bc1a08bd2a1d4cd8ec02d91 Mon Sep 17 00:00:00 2001 From: Kyle Huey Date: Fri, 23 May 2014 06:58:49 +0200 Subject: [PATCH] Bug 965309 - Test that terminating a sync XHR at loadstart doesn't hang r=test-only --- dom/workers/test/mochitest.ini | 3 ++ dom/workers/test/terminateSyncXHR_frame.html | 25 +++++++++++ dom/workers/test/terminateSyncXHR_worker.js | 19 +++++++++ dom/workers/test/test_terminateSyncXHR.html | 45 ++++++++++++++++++++ 4 files changed, 92 insertions(+) create mode 100644 dom/workers/test/terminateSyncXHR_frame.html create mode 100644 dom/workers/test/terminateSyncXHR_worker.js create mode 100644 dom/workers/test/test_terminateSyncXHR.html diff --git a/dom/workers/test/mochitest.ini b/dom/workers/test/mochitest.ini index 87cd1e8a611..16d78af6540 100644 --- a/dom/workers/test/mochitest.ini +++ b/dom/workers/test/mochitest.ini @@ -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] diff --git a/dom/workers/test/terminateSyncXHR_frame.html b/dom/workers/test/terminateSyncXHR_frame.html new file mode 100644 index 00000000000..04bd53ff1dd --- /dev/null +++ b/dom/workers/test/terminateSyncXHR_frame.html @@ -0,0 +1,25 @@ + + + + + Test for SharedWorker + + + + + diff --git a/dom/workers/test/terminateSyncXHR_worker.js b/dom/workers/test/terminateSyncXHR_worker.js new file mode 100644 index 00000000000..37fe67f3baa --- /dev/null +++ b/dom/workers/test/terminateSyncXHR_worker.js @@ -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); diff --git a/dom/workers/test/test_terminateSyncXHR.html b/dom/workers/test/test_terminateSyncXHR.html new file mode 100644 index 00000000000..8f5d0a59133 --- /dev/null +++ b/dom/workers/test/test_terminateSyncXHR.html @@ -0,0 +1,45 @@ + + + + + + Test for DOM Worker Threads XHR (Bug 450452 ) + + + + +DOM Worker Threads XHR (Bug 450452) +

+
+ +
+
+
+
+ + +