diff --git a/dom/workers/test/Makefile.in b/dom/workers/test/Makefile.in
index e55f944c9ef..ceb83c5aa2e 100644
--- a/dom/workers/test/Makefile.in
+++ b/dom/workers/test/Makefile.in
@@ -145,6 +145,7 @@ _CHROME_TEST_FILES = \
chromeWorker_subworker.js \
test_workersDisabled.xul \
workersDisabled_worker.js \
+ dom_worker_helper.js \
$(NULL)
ifneq ($(OS_ARCH),WINNT)
diff --git a/dom/workers/test/dom_worker_helper.js b/dom/workers/test/dom_worker_helper.js
new file mode 100644
index 00000000000..d53ffa0596b
--- /dev/null
+++ b/dom/workers/test/dom_worker_helper.js
@@ -0,0 +1,21 @@
+/**
+ * Any copyright is dedicated to the Public Domain.
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+
+var gRemainingTests = 0;
+
+function waitForWorkerFinish() {
+ if (gRemainingTests == 0) {
+ SimpleTest.waitForExplicitFinish();
+ }
+ ++gRemainingTests;
+}
+
+function finish() {
+ --gRemainingTests;
+ if (gRemainingTests == 0) {
+ SimpleTest.finish();
+ }
+}
+
diff --git a/dom/workers/test/test_chromeWorker.xul b/dom/workers/test/test_chromeWorker.xul
index 3281e503414..35df768beb5 100644
--- a/dom/workers/test/test_chromeWorker.xul
+++ b/dom/workers/test/test_chromeWorker.xul
@@ -11,23 +11,24 @@
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
+