From 2adf92413a826dba8470b03c7a4b2ab1d4cb4b9d Mon Sep 17 00:00:00 2001 From: Bobby Holley Date: Mon, 6 Aug 2012 22:38:19 +0200 Subject: [PATCH] Bug 778420 - Fix up tests that don't like the new enablePrivilege, r=jmaher. --HG-- extra : rebase_source : 07565c66b279ba5a58b5902b697110f940c255fd --- .../base/content/test/test_contextmenu.html | 11 +++---- content/base/test/test_bug345339.html | 8 ++--- content/base/test/test_bug422537.html | 17 ++++++----- content/canvas/test/test_canvas.html | 29 ++++++++----------- content/html/content/test/test_bug143220.html | 17 +++++------ content/media/test/manifest.js | 18 +++++------- docshell/test/navigation/NavigationUtils.js | 9 +++--- docshell/test/navigation/file_bug534178.html | 1 - docshell/test/navigation/test_bug386782.html | 3 -- docshell/test/test_bug369814.html | 18 ++++++------ docshell/test/test_bug509055.html | 9 +++--- docshell/test/test_bug529119-1.html | 9 ++---- docshell/test/test_bug529119-2.html | 12 ++------ dom/tests/mochitest/bugs/test_bug317448.html | 8 ++--- .../libeditor/html/tests/test_bug520189.html | 3 +- gfx/tests/mochitest/test_acceleration.html | 9 +++--- layout/base/tests/test_bug450930.xhtml | 12 ++------ .../mixedcontent/mixedContentTest.js | 4 +-- 18 files changed, 82 insertions(+), 115 deletions(-) diff --git a/browser/base/content/test/test_contextmenu.html b/browser/base/content/test/test_contextmenu.html index ad6d29b5b7f6..87086f1d2ead 100644 --- a/browser/base/content/test/test_contextmenu.html +++ b/browser/base/content/test/test_contextmenu.html @@ -18,9 +18,7 @@ Browser context menu tests. /** Test for Login Manager: multiple login autocomplete. **/ -netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); -Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm"); -Components.utils.import("resource://gre/modules/Services.jsm"); +SpecialPowers.wrap(Components).utils.import("resource://gre/modules/InlineSpellChecker.jsm", window); const Cc = Components.classes; const Ci = Components.interfaces; @@ -729,7 +727,7 @@ function runTest(testNum) { case 24: // Context menu for selected text - if (Services.appinfo.OS == "Darwin") { + if (SpecialPowers.Services.appinfo.OS == "Darwin") { // This test is only enabled on Mac due to bug 736399. checkContextMenu(["context-copy", true, "context-selectall", true, @@ -745,7 +743,7 @@ function runTest(testNum) { case 25: // Context menu for selected text which matches valid URL pattern - if (Services.appinfo.OS == "Darwin") { + if (SpecialPowers.Services.appinfo.OS == "Darwin") { // This test is only enabled on Mac due to bug 736399. checkContextMenu(["context-openlinkincurrent", true, "context-openlinkintab", true, @@ -790,8 +788,7 @@ var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2, inputspell, pagemenu, dom_full_screen, plainTextItems, audio_in_video; function startTest() { - netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect'); - chromeWin = subwindow + chromeWin = SpecialPowers.wrap(subwindow) .QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShellTreeItem) diff --git a/content/base/test/test_bug345339.html b/content/base/test/test_bug345339.html index e31c7a51ce74..ac61781f87d8 100644 --- a/content/base/test/test_bug345339.html +++ b/content/base/test/test_bug345339.html @@ -32,15 +32,14 @@ function afterLoad() { iframeDoc.getElementById("password").value = "123456"; iframeDoc.getElementById("hidden").value = "gecko"; - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - var file = Components.classes["@mozilla.org/file/directory_service;1"] + var file = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties) .get("TmpD", Components.interfaces.nsILocalFile); file.append("345339_test.file"); file.createUnique(Components.interfaces.nsIFile.NORMAL_FILE_TYPE, 0666); filePath = file.path; - iframeDoc.getElementById("file").value = filePath; + SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath; /* Reload the page */ $("testframe").setAttribute("onload", "afterReload()"); @@ -62,8 +61,7 @@ function afterReload() { "password field value forgotten"); is(iframeDoc.getElementById("hidden").value, "gecko", "hidden field value preserved"); - netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); - is(iframeDoc.getElementById("file").value, filePath, + is(SpecialPowers.wrap(iframeDoc).getElementById("file").value, filePath, "file field value preserved"); SimpleTest.finish(); diff --git a/content/base/test/test_bug422537.html b/content/base/test/test_bug422537.html index fa897147a4d6..1de938650cf1 100644 --- a/content/base/test/test_bug422537.html +++ b/content/base/test/test_bug422537.html @@ -19,10 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422537