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