From 30e9deddd9967a4a760453b8c11b1f25663f601a Mon Sep 17 00:00:00 2001 From: Joel Maher Date: Thu, 6 Oct 2011 10:51:03 -0400 Subject: [PATCH] Bug 676274 - refactor specialpowers so we can use the api in mochitest-chrome without specialpowers. r=ted, a=test-only. --- content/events/test/test_bug648573.html | 8 +- content/events/test/test_bug662678.html | 10 +- docshell/test/chrome/bug293235_window.xul | 10 +- docshell/test/chrome/bug298622_window.xul | 6 + docshell/test/chrome/bug301397_window.xul | 6 + docshell/test/chrome/bug321671_window.xul | 6 + docshell/test/chrome/bug396649_window.xul | 6 + docshell/test/chrome/bug582176_window.xul | 6 + docshell/test/chrome/bug89419_window.xul | 6 + ...rror_events_abort_transactions_iframe.html | 2 +- .../test/event_propagation_iframe.html | 2 +- layout/generic/test/file_bug514732_window.xul | 6 + layout/style/test/test_pointer-events.html | 7 +- testing/mochitest/Makefile.in | 1 - testing/mochitest/browser-test-overlay.xul | 1 + testing/mochitest/browser-test.js | 35 +- testing/mochitest/harness-overlay.xul | 6 + testing/mochitest/jar.mn | 4 +- testing/mochitest/redirect.html | 13 +- testing/mochitest/redirect.js | 45 -- testing/mochitest/runtests.py | 1 - .../components/SpecialPowersObserver.js | 220 +++------ .../specialpowers/content/specialpowers.js | 436 +++--------------- testing/mochitest/specialpowers/jar.mn | 2 + .../tests/SimpleTest/ChromePowers.js | 120 +++++ .../mochitest/tests/SimpleTest/Makefile.in | 2 + .../mochitest/tests/SimpleTest/SimpleTest.js | 5 + .../SimpleTest/SpecialPowersObserverAPI.js | 208 +++++++++ .../mochitest/tests/SimpleTest/TestRunner.js | 2 + .../tests/SimpleTest/specialpowersAPI.js | 391 ++++++++++++++++ 30 files changed, 961 insertions(+), 612 deletions(-) delete mode 100644 testing/mochitest/redirect.js create mode 100644 testing/mochitest/tests/SimpleTest/ChromePowers.js create mode 100644 testing/mochitest/tests/SimpleTest/SpecialPowersObserverAPI.js create mode 100644 testing/mochitest/tests/SimpleTest/specialpowersAPI.js diff --git a/content/events/test/test_bug648573.html b/content/events/test/test_bug648573.html index 1b3f4a9943a8..85043b34a272 100644 --- a/content/events/test/test_bug648573.html +++ b/content/events/test/test_bug648573.html @@ -1,7 +1,7 @@ Test for Bug 648573 @@ -19,7 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=648573 /** Test for Bug 648573 **/ -ok(!SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners, +var utils = SpecialPowers.getDOMWindowUtils(window); + +ok(!utils.mayHaveTouchEventListeners, "There shouldn't be any touch event listeners yet."); ok("createTouch" in document, "Should have createTouch function"); @@ -101,7 +103,7 @@ for (var i = 0; i < events.length; ++i) { runEventTest(events[i]); } -ok(SpecialPowers.DOMWindowUtils.mayHaveTouchEventListeners, +ok(utils.mayHaveTouchEventListeners, "There should be touch event listeners."); diff --git a/content/events/test/test_bug662678.html b/content/events/test/test_bug662678.html index 334baf9bf631..dfcf5dcf8452 100644 --- a/content/events/test/test_bug662678.html +++ b/content/events/test/test_bug662678.html @@ -18,8 +18,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=662678 diff --git a/docshell/test/chrome/bug293235_window.xul b/docshell/test/chrome/bug293235_window.xul index fa003f3f70af..88e73d62d43b 100644 --- a/docshell/test/chrome/bug293235_window.xul +++ b/docshell/test/chrome/bug293235_window.xul @@ -8,13 +8,19 @@ onload="setTimeout(nextTest,0);" title="bug 293235 test"> + diff --git a/dom/indexedDB/test/error_events_abort_transactions_iframe.html b/dom/indexedDB/test/error_events_abort_transactions_iframe.html index a14821b1f2e4..2d385682e80b 100644 --- a/dom/indexedDB/test/error_events_abort_transactions_iframe.html +++ b/dom/indexedDB/test/error_events_abort_transactions_iframe.html @@ -50,7 +50,7 @@ function testSteps() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - let uri = SpecialPowers.getDocumentURIObject(window.document); + let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document); Components.classes["@mozilla.org/permissionmanager;1"] .getService(Components.interfaces.nsIPermissionManager) .add(uri, "indexedDB", diff --git a/dom/indexedDB/test/event_propagation_iframe.html b/dom/indexedDB/test/event_propagation_iframe.html index d90a79d4bf13..7fd1942d5603 100644 --- a/dom/indexedDB/test/event_propagation_iframe.html +++ b/dom/indexedDB/test/event_propagation_iframe.html @@ -89,7 +89,7 @@ function testSteps() { netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - let uri = SpecialPowers.getDocumentURIObject(window.document); + let uri = window.parent.SpecialPowers.getDocumentURIObject(window.document); Components.classes["@mozilla.org/permissionmanager;1"] .getService(Components.interfaces.nsIPermissionManager) .add(uri, "indexedDB", diff --git a/layout/generic/test/file_bug514732_window.xul b/layout/generic/test/file_bug514732_window.xul index 37d5e464b982..d8cad98de3fc 100755 --- a/layout/generic/test/file_bug514732_window.xul +++ b/layout/generic/test/file_bug514732_window.xul @@ -8,6 +8,12 @@ onload="setTimeout(nextTest,0);" title="bug 514732 test"> + diff --git a/layout/style/test/test_pointer-events.html b/layout/style/test/test_pointer-events.html index a90e3c3a8ec9..c274270553a5 100644 --- a/layout/style/test/test_pointer-events.html +++ b/layout/style/test/test_pointer-events.html @@ -4,7 +4,7 @@ Test for pointer-events in HTML - +