зеркало из https://github.com/mozilla/gecko-dev.git
Bug 778420 - Fix up tests that don't like the new enablePrivilege, r=jmaher.
--HG-- extra : rebase_source : 07565c66b279ba5a58b5902b697110f940c255fd
This commit is contained in:
Родитель
710c56850a
Коммит
2adf92413a
|
@ -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)
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -19,9 +19,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422537
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 422537 **/
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var isupports_string = Components.classes["@mozilla.org/supports-string;1"]
|
||||
var isupports_string = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
isupports_string.data = "foo";
|
||||
|
||||
|
@ -35,13 +34,15 @@ var body = [
|
|||
for each (var i in body) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open("POST", url, true);
|
||||
if (i == isupports_string)
|
||||
SpecialPowers.wrap(xhr).send(i);
|
||||
else
|
||||
xhr.send(i);
|
||||
var chan = SpecialPowers.unwrap(SpecialPowers.wrap(xhr).channel);
|
||||
var chan = SpecialPowers.wrap(xhr).channel;
|
||||
if (!SpecialPowers.call_Instanceof(chan, Components.interfaces.nsIUploadChannel))
|
||||
throw "Must be an upload channel";
|
||||
var stream = chan.uploadStream;
|
||||
if (!stream || !SpecialPowers.call_Instanceof(stream,
|
||||
Components.interfaces.nsISeekableStream))
|
||||
if (!stream || !SpecialPowers.call_Instanceof(stream, Components.interfaces.nsISeekableStream))
|
||||
throw "Stream must be seekable";
|
||||
// the following is a no-op, but should not throw an exception
|
||||
stream.seek(Components.interfaces.nsISeekableStream.NS_SEEK_CUR, 0);
|
||||
|
|
|
@ -6,13 +6,14 @@
|
|||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
|
||||
function IsD2DEnabled() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
enabled = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
} catch(e) {}
|
||||
|
||||
return enabled;
|
||||
|
@ -26,8 +27,7 @@ function IsMacOSX10_5orOlder() {
|
|||
var is105orOlder = false;
|
||||
|
||||
if (navigator.platform.indexOf("Mac") == 0) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var version = Components.classes["@mozilla.org/system-info;1"]
|
||||
var version = Cc["@mozilla.org/system-info;1"]
|
||||
.getService(Components.interfaces.nsIPropertyBag2)
|
||||
.getProperty("version");
|
||||
// the next line is correct: Mac OS 10.6 corresponds to Darwin version 10 !
|
||||
|
@ -43,8 +43,7 @@ function IsAzureEnabled() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend != "none");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -55,8 +54,7 @@ function IsAzureSkia() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "skia");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -67,8 +65,7 @@ function IsAzureCairo() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "cairo");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -126,7 +123,8 @@ ok(ctx.canvas === canvas, "ctx.canvas === canvas");
|
|||
function isPixel(ctx, x,y, r,g,b,a, d) {
|
||||
var pos = x + "," + y;
|
||||
var colour = r + "," + g + "," + b + "," + a;
|
||||
var pixel = ctx.getImageData(x, y, 1, 1);
|
||||
var pixel = SpecialPowers.unwrap(SpecialPowers.wrap(ctx)
|
||||
.getImageData(x, y, 1, 1));
|
||||
var pr = pixel.data[0],
|
||||
pg = pixel.data[1],
|
||||
pb = pixel.data[2],
|
||||
|
@ -19804,9 +19802,8 @@ function test_bug397524() {
|
|||
<script>
|
||||
function test_bug405982() {
|
||||
|
||||
var canvas = document.getElementById('c614');
|
||||
var canvas = SpecialPowers.wrap(document.getElementById('c614'));
|
||||
var ctx = canvas.getContext('2d');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var _threw = false;
|
||||
try {
|
||||
|
@ -21123,7 +21120,6 @@ img.onload = wrapFunction(function ()
|
|||
ctx667.drawImage(img, 0, 25);
|
||||
// (The alpha values do not really survive float->int conversion, so just
|
||||
// do approximate comparisons)
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
isPixel(ctx667, 12,40, 1,3,254,255, 0);
|
||||
isPixel(ctx667, 37,40, 8,252,248,191, 2);
|
||||
isPixel(ctx667, 62,40, 6,10,250,127, 4);
|
||||
|
@ -21250,7 +21246,6 @@ deferTest();
|
|||
img.onload = wrapFunction(function ()
|
||||
{
|
||||
ctx672.drawImage(img, 0, 0);
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
isPixel(ctx672, 12,20, 255,255,0,255, 0);
|
||||
isPixel(ctx672, 50,20, 0,255,255,255, 0);
|
||||
isPixel(ctx672, 87,20, 0,0,255,255, 0);
|
||||
|
|
|
@ -24,9 +24,10 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=143220
|
|||
var leafName;
|
||||
var fullPath;
|
||||
|
||||
|
||||
function initVals() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
var dirSvc = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var file = dirSvc.get("XpcomLib", Components.interfaces.nsILocalFile);
|
||||
isnot(file, null, "Must have file here");
|
||||
|
@ -36,15 +37,13 @@ function initVals() {
|
|||
}
|
||||
|
||||
function initControl1() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i1").value = fullPath;
|
||||
is($("i1").value, fullPath, "Should have set full path 1");
|
||||
SpecialPowers.wrap($("i1")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i1")).value, fullPath, "Should have set full path 1");
|
||||
}
|
||||
|
||||
function initControl2() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i2").value = fullPath;
|
||||
is($("i2").value, fullPath, "Should have set full path 2");
|
||||
SpecialPowers.wrap($("i2")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i2")).value, fullPath, "Should have set full path 2");
|
||||
}
|
||||
|
||||
initVals();
|
||||
|
|
|
@ -159,10 +159,9 @@ function fileUriToSrc(path, mustExist) {
|
|||
if (navigator.appVersion.indexOf("Android") != -1)
|
||||
return path;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
|
||||
|
@ -444,8 +443,7 @@ function MediaTestManager() {
|
|||
// Force a GC after every completed testcase. This ensures that any decoders
|
||||
// with live threads waiting for the GC are killed promptly, to free up the
|
||||
// thread stacks' address space.
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
SpecialPowers.forceGC();
|
||||
|
||||
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
||||
var test = this.tests[this.testNum];
|
||||
|
@ -497,14 +495,13 @@ function mediaTestCleanup() {
|
|||
A[i].parentNode.removeChild(A[i]);
|
||||
A[i] = null;
|
||||
}
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
SpecialPowers.forceGC();
|
||||
}
|
||||
|
||||
(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
// Ensure that preload preferences are comsistent
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
var prefService = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
var oldDefault = 2;
|
||||
|
@ -522,7 +519,6 @@ function mediaTestCleanup() {
|
|||
branch.setBoolPref("opus.enabled", true);
|
||||
|
||||
window.addEventListener("unload", function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
branch.setIntPref("preload.default", oldDefault);
|
||||
branch.setIntPref("preload.auto", oldAuto);
|
||||
if (oldOpus !== undefined)
|
||||
|
|
|
@ -98,9 +98,10 @@ function isInaccessible(wnd, message) {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function xpcEnumerateContentWindows(callback) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var Ci = Components.interfaces;
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
var ww = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
var enumerator = ww.getWindowEnumerator();
|
||||
|
||||
|
@ -108,7 +109,7 @@ function xpcEnumerateContentWindows(callback) {
|
|||
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var win = enumerator.getNext();
|
||||
if (typeof ChromeWindow != "undefined" && win instanceof ChromeWindow) {
|
||||
if (typeof ChromeWindow != "undefined" && SpecialPowers.call_Instanceof(win, ChromeWindow)) {
|
||||
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode);
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
|
||||
function testDone() {
|
||||
document.body.removeChild(document.body.firstChild);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var isOK = false;
|
||||
try {
|
||||
isOK = history.previous != location;
|
||||
|
|
|
@ -60,7 +60,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
|||
}
|
||||
|
||||
function beginTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
gTest.window.document.body.focus();
|
||||
|
||||
// WARNING: If the following test fails, give the setTimeout() in the onload()
|
||||
|
@ -74,7 +73,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
|||
}
|
||||
|
||||
function goBack() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
gTest.window.history.back();
|
||||
setTimeout(function() {
|
||||
SimpleTest.waitForFocus(checkStillEditable, gTest.window);
|
||||
|
@ -82,7 +80,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=386782
|
|||
}
|
||||
|
||||
function checkStillEditable() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
// Check that the contents are correct.
|
||||
is(gTest.window.document.body.innerHTML, gTest.expectedBodyAfterEdit, "Edited contents still correct?");
|
||||
|
|
|
@ -186,9 +186,9 @@ var gNextTest = 0;
|
|||
|
||||
function runNextTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (gNextTest < gTests.length) {
|
||||
gCurrentTest = gTests[gNextTest++];
|
||||
|
@ -214,9 +214,9 @@ function runNextTest()
|
|||
|
||||
function finishTest()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
prefs.setBoolPref("network.jar.open-unsafe-types", false);
|
||||
|
||||
if (gNumPokes == 0) {
|
||||
|
@ -228,9 +228,9 @@ function finishTest()
|
|||
|
||||
function startTests()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gPrefValue = prefs.getBoolPref("network.jar.open-unsafe-types");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,6 @@ function onChildLoad(e) {
|
|||
}
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var popup = window.open("file_bug509055.html", "popup 0",
|
||||
"height=200,width=200,location=yes," +
|
||||
"menubar=yes,status=yes,toolbar=yes,dependent=yes");
|
||||
|
@ -72,7 +70,8 @@ function runTest() {
|
|||
dump('Got second hashchange. Spinning event loop.\n');
|
||||
yield;
|
||||
|
||||
var sh = popup.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
var sh = SpecialPowers.wrap(popup)
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.sessionHistory;
|
||||
|
||||
|
|
|
@ -43,7 +43,6 @@ function pollForPage(f, w)
|
|||
|
||||
function windowLoaded()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
switch (phase)
|
||||
{
|
||||
case 0:
|
||||
|
@ -57,18 +56,16 @@ function windowLoaded()
|
|||
pollForPage(function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 3. now, while we are on the error page, try to reload it, actually
|
||||
click the "Try Again" button */
|
||||
w.location.reload();
|
||||
SpecialPowers.wrap(w).location.reload();
|
||||
|
||||
pollForPage(function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 4-finish, check we are still on the error page */
|
||||
is(w.location.href, faultyURL, "Is on an error page");
|
||||
isnot(w.location.href, workingURL, "Is not on the previous page");
|
||||
is(SpecialPowers.wrap(w).location.href, faultyURL, "Is on an error page");
|
||||
isnot(SpecialPowers.wrap(w).location.href, workingURL, "Is not on the previous page");
|
||||
is(gotWrongPageOnTryAgainClick, false,
|
||||
"Must not get www.example.com page on reload of an error page");
|
||||
w.close();
|
||||
|
|
|
@ -42,8 +42,6 @@ function pollForPage(expectErrorPage, f, w)
|
|||
|
||||
function windowLoaded()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
/* 2. We have successfully loaded a page, now go to a faulty URL */
|
||||
// XXX The test fails when we change the location synchronously
|
||||
window.setTimeout(function() {
|
||||
|
@ -52,11 +50,9 @@ function windowLoaded()
|
|||
|
||||
pollForPage(true, function(succeeded) {
|
||||
ok(succeeded, "Waiting for error page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 3. now, while we are on the error page, navigate back */
|
||||
try {
|
||||
w.back();
|
||||
SpecialPowers.wrap(w).back();
|
||||
}
|
||||
catch(ex) {
|
||||
ok(false, "w.back() threw " + ex);
|
||||
|
@ -64,11 +60,9 @@ function windowLoaded()
|
|||
|
||||
pollForPage(false, function(succeeded) {
|
||||
ok(succeeded, "Waiting for original page succeeded");
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
/* 4-finish, check we are back at the original page */
|
||||
isnot(w.location.href, faultyURL, "Is on an error page");
|
||||
is(w.location.href, workingURL, "Is not on the previous page");
|
||||
isnot(SpecialPowers.wrap(w).location.href, faultyURL, "Is on an error page");
|
||||
is(SpecialPowers.wrap(w).location.href, workingURL, "Is not on the previous page");
|
||||
w.close();
|
||||
SimpleTest.finish();
|
||||
}, w);
|
||||
|
|
|
@ -21,16 +21,16 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=317448
|
|||
var x = new XMLHttpRequest();
|
||||
x.open("GET", document.location.href);
|
||||
x.send("");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
is(SpecialPowers.call_Instanceof(x, Components.interfaces.nsIInterfaceRequestor),
|
||||
is(x instanceof Components.interfaces.nsIInterfaceRequestor,
|
||||
true, "Must be interface requestor");
|
||||
|
||||
var count = {};
|
||||
var interfaces = x.
|
||||
var interfaces = SpecialPowers.wrap(x).
|
||||
QueryInterface(Components.interfaces.nsIClassInfo).
|
||||
getInterfaces(count).
|
||||
map(function(id) {
|
||||
return Components.interfacesByID[id].toString();
|
||||
id = SpecialPowers.wrap(id);
|
||||
return SpecialPowers.wrap(Components).interfacesByID[id].toString();
|
||||
});
|
||||
isnot(interfaces.indexOf("nsIInterfaceRequestor"), "-1",
|
||||
"Must have interface requestor classinfo");
|
||||
|
|
|
@ -550,7 +550,8 @@ function doNextTest() {
|
|||
|
||||
function getLoadContext() {
|
||||
const Ci = Components.interfaces;
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
return SpecialPowers.wrap(window)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
}
|
||||
|
|
|
@ -20,11 +20,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=627498
|
|||
// Make sure that acceleration is enabled/disabled the way we expect it to be
|
||||
// based on platform.
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var importObj = {};
|
||||
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Services.jsm",
|
||||
importObj);
|
||||
var Services = SpecialPowers.wrap(importObj).Services;
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Cc = SpecialPowers.wrap(Components).classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
||||
|
|
|
@ -126,26 +126,21 @@ function runTest1() {
|
|||
function runTest2(frameID, containerID) {
|
||||
// test reporting of painting in subdocuments
|
||||
var fired = 0;
|
||||
var gotSubdocPrivileged = false;
|
||||
var gotSubdocNonprivileged = false;
|
||||
var gotSubdoc = false;
|
||||
var iframe = document.getElementById(frameID);
|
||||
var container = document.getElementById(containerID);
|
||||
|
||||
function listener(event) {
|
||||
if (checkGotSubdoc(event.clientRects, container))
|
||||
gotSubdocNonprivileged = true;
|
||||
gotSubdoc = true;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (checkGotSubdoc(event.clientRects, container))
|
||||
gotSubdocPrivileged = true;
|
||||
if (++fired == 1)
|
||||
setTimeout(check, 100);
|
||||
}
|
||||
|
||||
function check() {
|
||||
is(fired, 1, "Wrong event count (" + frameID + ")");
|
||||
ok(gotSubdocPrivileged, "Didn't get subdoc invalidation while we were privileged (" + frameID + ")");
|
||||
ok(!gotSubdocNonprivileged, "Got subdoc invalidation while we were not privileged (" + frameID + ")");
|
||||
ok(!gotSubdoc, "Got subdoc invalidation (" + frameID + ")");
|
||||
window.removeEventListener("MozAfterPaint", listener, false);
|
||||
runNext();
|
||||
}
|
||||
|
@ -168,7 +163,6 @@ function runTest3() {
|
|||
var iframe = document.getElementById("iframe");
|
||||
|
||||
function listener(event) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (checkGotSubdoc(event.clientRects, iframe))
|
||||
gotScrolledOutInMainDoc = true;
|
||||
}
|
||||
|
|
|
@ -159,13 +159,11 @@ function todoSecurityState(expectedState, message)
|
|||
|
||||
function isSecurityState(expectedState, message, test)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
if (!test)
|
||||
test = ok;
|
||||
|
||||
// Quit nasty but working :)
|
||||
var ui = window
|
||||
var ui = SpecialPowers.wrap(window)
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
|
|
Загрузка…
Ссылка в новой задаче