зеркало из https://github.com/mozilla/gecko-dev.git
Backout b4a63a0b90c2 (bug 778420), b849f1b3859a (bug 778420), d522b5a13b27 (bug 72964), 3a12c64bf53a (bug 778420), c07148142675 (bug 726053) for failures in test_bug435425.html on a CLOSED TREE
This commit is contained in:
Родитель
086c58eec5
Коммит
5162e724a0
|
@ -18,7 +18,9 @@ Browser context menu tests.
|
|||
|
||||
/** Test for Login Manager: multiple login autocomplete. **/
|
||||
|
||||
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/InlineSpellChecker.jsm", window);
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.import("resource://gre/modules/InlineSpellChecker.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
@ -727,7 +729,7 @@ function runTest(testNum) {
|
|||
|
||||
case 24:
|
||||
// Context menu for selected text
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-copy", true,
|
||||
"context-selectall", true,
|
||||
|
@ -743,7 +745,7 @@ function runTest(testNum) {
|
|||
|
||||
case 25:
|
||||
// Context menu for selected text which matches valid URL pattern
|
||||
if (SpecialPowers.Services.appinfo.OS == "Darwin") {
|
||||
if (Services.appinfo.OS == "Darwin") {
|
||||
// This test is only enabled on Mac due to bug 736399.
|
||||
checkContextMenu(["context-openlinkincurrent", true,
|
||||
"context-openlinkintab", true,
|
||||
|
@ -788,7 +790,8 @@ var text, link, mailto, input, img, canvas, video_ok, video_bad, video_bad2,
|
|||
inputspell, pagemenu, dom_full_screen, plainTextItems, audio_in_video;
|
||||
|
||||
function startTest() {
|
||||
chromeWin = SpecialPowers.wrap(subwindow)
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
chromeWin = subwindow
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeItem)
|
||||
|
|
|
@ -26,7 +26,6 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=462856
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
|
||||
var numFinished = 0;
|
||||
|
||||
|
@ -35,17 +34,18 @@ window.addEventListener("message", function(event) {
|
|||
|
||||
if (++numFinished == 3) {
|
||||
// Clean up after ourself
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
||||
getService(Components.interfaces.nsIPermissionManager);
|
||||
var ioService = Cc["@mozilla.org/network/io-service;1"]
|
||||
var ioService = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService);
|
||||
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
|
||||
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
|
||||
|
||||
var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal1 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri1);
|
||||
var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal2 = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri2);
|
||||
|
||||
|
@ -108,7 +108,8 @@ function loaded() {
|
|||
// Click the notification bar's "Allow" button. This should kick
|
||||
// off updates, which will eventually lead to getting messages from
|
||||
// the children.
|
||||
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
var notificationBox = win.gBrowser.getNotificationBox();
|
||||
|
@ -116,7 +117,7 @@ function loaded() {
|
|||
var notification = notificationBox.getNotificationWithValue("offline-app-requested-mochi.test");
|
||||
notification.childNodes[0].click();
|
||||
|
||||
notification = SpecialPowers.wrap(notificationBox).getNotificationWithValue("offline-app-requested-example.com");
|
||||
notification = notificationBox.getNotificationWithValue("offline-app-requested-example.com");
|
||||
notification.childNodes[0].click();
|
||||
}
|
||||
|
||||
|
|
|
@ -32,13 +32,15 @@ SimpleTest.waitForExplicitFinish();
|
|||
|
||||
function finishTest() {
|
||||
// Clean up after ourselves.
|
||||
var Cc = SpecialPowers.wrap(Components).classes;
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].
|
||||
netscape.security.PrivilegeManager
|
||||
.enablePrivilege("UniversalXPConnect");
|
||||
var pm = Components.classes["@mozilla.org/permissionmanager;1"].
|
||||
getService(Components.interfaces.nsIPermissionManager);
|
||||
|
||||
var uri = Cc["@mozilla.org/network/io-service;1"].getService(Components.interfaces.nsIIOService)
|
||||
var uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(window.frames[0].location, null, null);
|
||||
var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
|
||||
|
@ -68,6 +70,8 @@ function handleMessageEvents(event) {
|
|||
// successfully reloaded), or the string "error" appears
|
||||
// in the iframe, as in the case of bug 501422.
|
||||
intervalID = setInterval(function() {
|
||||
netscape.security.PrivilegeManager
|
||||
.enablePrivilege("UniversalXPConnect");
|
||||
// Sometimes document.body may not exist, and trying to access
|
||||
// it will throw an exception, so handle this case.
|
||||
try {
|
||||
|
@ -99,7 +103,8 @@ function loaded() {
|
|||
// Click the notification bar's "Allow" button. This should kick
|
||||
// off updates, which will eventually lead to getting messages from
|
||||
// the iframe.
|
||||
var wm = SpecialPowers.wrap(Components).classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"].
|
||||
getService(Components.interfaces.nsIWindowMediator);
|
||||
var win = wm.getMostRecentWindow("navigator:browser");
|
||||
var notificationBox = win.gBrowser.getNotificationBox();
|
||||
|
|
|
@ -20,7 +20,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=589543
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
addLoadEvent(function() {
|
||||
var doc = SpecialPowers.wrap($("testFrame").contentDocument);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var doc = $("testFrame").contentDocument;
|
||||
var daddy = doc.getElementById("feedSubscribeLine");
|
||||
var popup = doc.getAnonymousElementByAttribute(daddy, "anonid", "handlersMenuPopup");
|
||||
isnot(popup, null, "Feed preview should have a handlers popup");
|
||||
|
|
|
@ -32,14 +32,15 @@ function afterLoad() {
|
|||
iframeDoc.getElementById("password").value = "123456";
|
||||
iframeDoc.getElementById("hidden").value = "gecko";
|
||||
|
||||
var file = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var file = 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;
|
||||
|
||||
SpecialPowers.wrap(iframeDoc).getElementById("file").value = filePath;
|
||||
iframeDoc.getElementById("file").value = filePath;
|
||||
|
||||
/* Reload the page */
|
||||
$("testframe").setAttribute("onload", "afterReload()");
|
||||
|
@ -61,7 +62,8 @@ function afterReload() {
|
|||
"password field value forgotten");
|
||||
is(iframeDoc.getElementById("hidden").value, "gecko",
|
||||
"hidden field value preserved");
|
||||
is(SpecialPowers.wrap(iframeDoc).getElementById("file").value, filePath,
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
is(iframeDoc.getElementById("file").value, filePath,
|
||||
"file field value preserved");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -29,7 +29,7 @@ function checkTypes(aNode, aNodeType, aTypeArray)
|
|||
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
|
||||
{
|
||||
for (var i = 0; i < aInterfaceArray.length; ++i) {
|
||||
ok(SpecialPowers.call_Instanceof(aNode, Components.interfaces[aInterfaceArray[i]]),
|
||||
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
|
||||
aNodeType + " interface test " + i,
|
||||
aNodeType + " should be a " + aInterfaceArray[i]);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ function checkTypes(aNode, aNodeType, aTypeArray)
|
|||
function checkInterfaces(aNode, aNodeType, aInterfaceArray)
|
||||
{
|
||||
for (var i = 0; i < aInterfaceArray.length; ++i) {
|
||||
ok(SpecialPowers.call_Instanceof(aNode, Components.interfaces[aInterfaceArray[i]]),
|
||||
ok(aNode instanceof Components.interfaces[aInterfaceArray[i]],
|
||||
aNodeType + " interface test " + i,
|
||||
aNodeType + " should be a " + aInterfaceArray[i]);
|
||||
}
|
||||
|
|
|
@ -45,8 +45,7 @@ function doContentTest(id) {
|
|||
}
|
||||
|
||||
function checkPrincipal() {
|
||||
is(SpecialPowers.call_Instanceof(SpecialPowers.getNodePrincipal(document),
|
||||
Components.interfaces.nsIPrincipal),
|
||||
is(SpecialPowers.getNodePrincipal(document) instanceof Components.interfaces.nsIPrincipal,
|
||||
true,
|
||||
"Should be a principal");
|
||||
}
|
||||
|
|
|
@ -31,10 +31,9 @@ function eventHandler(evt) {
|
|||
|
||||
function test(trusted, type, removeAddedListener, removeSetListener, allowUntrusted) {
|
||||
if (trusted) {
|
||||
var x1 = SpecialPowers.wrap(new XMLHttpRequest());
|
||||
} else {
|
||||
x1 = new XMLHttpRequest();
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
}
|
||||
var x1 = new XMLHttpRequest();
|
||||
|
||||
var handlerCount = 0;
|
||||
if (trusted || allowUntrusted || allowUntrusted == undefined) {
|
||||
|
|
|
@ -22,13 +22,14 @@
|
|||
request.send(null);
|
||||
|
||||
// Try reading headers in privileged context
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
||||
is(SpecialPowers.wrap(request).getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
is(request.getResponseHeader("Set-Cookie"), "test", "Reading Set-Cookie response header in privileged context");
|
||||
is(request.getResponseHeader("Set-Cookie2"), "test2", "Reading Set-Cookie2 response header in privileged context");
|
||||
is(request.getResponseHeader("X-Dummy"), "test", "Reading X-Dummy response header in privileged context");
|
||||
|
||||
ok(/\bSet-Cookie:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie2:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
||||
ok(/\bX-Dummy:/i.test(SpecialPowers.wrap(request).getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie in all response headers in privileged context");
|
||||
ok(/\bSet-Cookie2:/i.test(request.getAllResponseHeaders()), "Looking for Set-Cookie2 in all response headers in privileged context");
|
||||
ok(/\bX-Dummy:/i.test(request.getAllResponseHeaders()), "Looking for X-Dummy in all response headers in privileged context");
|
||||
|
||||
// Try reading headers in unprivileged context
|
||||
setTimeout(function() {
|
||||
|
|
|
@ -19,8 +19,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=422537
|
|||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 422537 **/
|
||||
var isupports_string = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/supports-string;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var isupports_string = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
isupports_string.data = "foo";
|
||||
|
||||
|
@ -34,15 +35,12 @@ 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.wrap(xhr).channel;
|
||||
if (!SpecialPowers.call_Instanceof(chan, Components.interfaces.nsIUploadChannel))
|
||||
var chan = SpecialPowers.unwrap(SpecialPowers.wrap(xhr).channel);
|
||||
if (!(chan instanceof Components.interfaces.nsIUploadChannel))
|
||||
throw "Must be an upload channel";
|
||||
var stream = chan.uploadStream;
|
||||
if (!stream || !SpecialPowers.call_Instanceof(stream, Components.interfaces.nsISeekableStream))
|
||||
if (!stream || !(stream instanceof 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);
|
||||
|
|
|
@ -29,12 +29,12 @@ function logEvent(evt) {
|
|||
while ((currentEvents.length != i) &&
|
||||
currentEvents[i].optional &&
|
||||
((currentEvents[i].type != evt.type) ||
|
||||
!(SpecialPowers.call_Instanceof(evt.target, currentEvents[i].target)))) {
|
||||
!(evt.target instanceof currentEvents[i].target))) {
|
||||
++i;
|
||||
}
|
||||
ok(i != currentEvents.length, "Extra or wrong event?");
|
||||
is(evt.type, currentEvents[i].type, "Wrong event!")
|
||||
ok(SpecialPowers.call_Instanceof(evt.target, currentEvents[i].target),
|
||||
ok(evt.target instanceof currentEvents[i].target,
|
||||
"Wrong event target [" + evt.target + "," + evt.type + "]!");
|
||||
// If we handled non-optional event, remove all optional events before the
|
||||
// handled event and then the non-optional event from the list.
|
||||
|
|
|
@ -32,9 +32,9 @@ function testHTMLDocuments(ids, isXHTML) {
|
|||
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
|
||||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
is(doc1.body, null, "Shouldn't have .body!");
|
||||
ok(SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMHTMLDocument),
|
||||
ok(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument,
|
||||
"Document should be an HTML document!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMSVGDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var docType2 =
|
||||
|
@ -68,9 +68,9 @@ function testSVGDocument() {
|
|||
var doc1 = document.implementation.createDocument(null, null, docType1);
|
||||
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
|
||||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMHTMLDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMSVGDocument),
|
||||
ok(doc1 instanceof Components.interfaces.nsIDOMSVGDocument,
|
||||
"Document should be an SVG document!");
|
||||
|
||||
// SVG documents have .rootElement.
|
||||
|
@ -95,9 +95,9 @@ function testFooBarDocument() {
|
|||
var doc1 = document.implementation.createDocument(null, null, docType1);
|
||||
is(docType1.ownerDocument, doc1, "docType should have ownerDocument!");
|
||||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMHTMLDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMSVGDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var docType2 =
|
||||
|
@ -112,9 +112,9 @@ function testFooBarDocument() {
|
|||
function testNullDocTypeDocument() {
|
||||
var doc1 = document.implementation.createDocument(null, null, null);
|
||||
ok(!doc1.documentElement, "Document shouldn't have document element!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMHTMLDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMHTMLDocument),
|
||||
"Document shouldn't be an HTML document!");
|
||||
ok(!SpecialPowers.call_Instanceof(doc1, Components.interfaces.nsIDOMSVGDocument),
|
||||
ok(!(doc1 instanceof Components.interfaces.nsIDOMSVGDocument),
|
||||
"Document shouldn't be an SVG document!");
|
||||
|
||||
var doc2 = document.implementation.createDocument("FooBarNS",
|
||||
|
|
|
@ -6,14 +6,13 @@
|
|||
<script>
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
|
||||
function IsD2DEnabled() {
|
||||
var enabled = false;
|
||||
|
||||
try {
|
||||
enabled = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
enabled = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).D2DEnabled;
|
||||
} catch(e) {}
|
||||
|
||||
return enabled;
|
||||
|
@ -27,7 +26,8 @@ function IsMacOSX10_5orOlder() {
|
|||
var is105orOlder = false;
|
||||
|
||||
if (navigator.platform.indexOf("Mac") == 0) {
|
||||
var version = Cc["@mozilla.org/system-info;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var version = Components.classes["@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,7 +43,8 @@ function IsAzureEnabled() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend != "none");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -54,7 +55,8 @@ function IsAzureSkia() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "skia");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -65,7 +67,8 @@ function IsAzureCairo() {
|
|||
var enabled = false;
|
||||
|
||||
try {
|
||||
var backend = Cc["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var backend = Components.classes["@mozilla.org/gfx/info;1"].getService(Components.interfaces.nsIGfxInfo).getInfo().AzureCanvasBackend;
|
||||
enabled = (backend == "cairo");
|
||||
} catch (e) { }
|
||||
|
||||
|
@ -123,8 +126,7 @@ 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 = SpecialPowers.unwrap(SpecialPowers.wrap(ctx)
|
||||
.getImageData(x, y, 1, 1));
|
||||
var pixel = ctx.getImageData(x, y, 1, 1);
|
||||
var pr = pixel.data[0],
|
||||
pg = pixel.data[1],
|
||||
pb = pixel.data[2],
|
||||
|
@ -19802,8 +19804,9 @@ function test_bug397524() {
|
|||
<script>
|
||||
function test_bug405982() {
|
||||
|
||||
var canvas = SpecialPowers.wrap(document.getElementById('c614'));
|
||||
var canvas = document.getElementById('c614');
|
||||
var ctx = canvas.getContext('2d');
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var _threw = false;
|
||||
try {
|
||||
|
@ -21120,6 +21123,7 @@ 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);
|
||||
|
@ -21246,6 +21250,7 @@ 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,10 +24,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=143220
|
|||
var leafName;
|
||||
var fullPath;
|
||||
|
||||
|
||||
function initVals() {
|
||||
var dirSvc = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/file/directory_service;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var dirSvc = 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");
|
||||
|
@ -37,13 +36,15 @@ function initVals() {
|
|||
}
|
||||
|
||||
function initControl1() {
|
||||
SpecialPowers.wrap($("i1")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i1")).value, fullPath, "Should have set full path 1");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i1").value = fullPath;
|
||||
is($("i1").value, fullPath, "Should have set full path 1");
|
||||
}
|
||||
|
||||
function initControl2() {
|
||||
SpecialPowers.wrap($("i2")).value = fullPath;
|
||||
is(SpecialPowers.wrap($("i2")).value, fullPath, "Should have set full path 2");
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
$("i2").value = fullPath;
|
||||
is($("i2").value, fullPath, "Should have set full path 2");
|
||||
}
|
||||
|
||||
initVals();
|
||||
|
|
|
@ -245,15 +245,14 @@ for each (var tag in allTags) {
|
|||
tagName(tag) + " not an instance of " + classInfos[tag]);
|
||||
is(node instanceof HTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of HTMLUnknownElement");
|
||||
is(SpecialPowers.call_Instanceof(node, Components.interfaces.nsIDOMHTMLUnknownElement),
|
||||
false,
|
||||
is(node instanceof Components.interfaces.nsIDOMHTMLUnknownElement, false,
|
||||
tagName(tag) + " is an instance of nsIDOMHTMLUnknownElement");
|
||||
|
||||
// Check that each node QIs to all the things we expect it to QI to
|
||||
for each (var iface in interfaces[tag].concat(interfacesNonClassinfo[tag])) {
|
||||
is(iface in Components.interfaces, true,
|
||||
iface + " not in Components.interfaces");
|
||||
is(SpecialPowers.call_Instanceof(node, Components.interfaces[iface]), true,
|
||||
is(node instanceof Components.interfaces[iface], true,
|
||||
tagName(tag) + " does not QI to " + iface);
|
||||
}
|
||||
|
||||
|
|
|
@ -32,23 +32,24 @@ var input2Files =
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
function setFileInputs () {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
f = createFileWithData(input1File.name, input1File.body);
|
||||
SpecialPowers.wrap(singleFileInput).mozSetFileNameArray([f.path], 1);
|
||||
singleFileInput.mozSetFileNameArray([f.path], 1);
|
||||
|
||||
var input2FileNames = [];
|
||||
for each (file in input2Files) {
|
||||
f = createFileWithData(file.name, file.body);
|
||||
input2FileNames.push(f.path);
|
||||
}
|
||||
SpecialPowers.wrap(multiFileInput).mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
||||
multiFileInput.mozSetFileNameArray(input2FileNames, input2FileNames.length);
|
||||
}
|
||||
|
||||
function createFileWithData(fileName, fileData) {
|
||||
var dirSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/file/directory_service;1"]
|
||||
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
|
||||
.getService(Components.interfaces.nsIProperties);
|
||||
var testFile = dirSvc.get("ProfD", Components.interfaces.nsIFile);
|
||||
testFile.append(fileName);
|
||||
var outStream = SpecialPowers.wrap(Components).
|
||||
var outStream = Components.
|
||||
classes["@mozilla.org/network/file-output-stream;1"].
|
||||
createInstance(Components.interfaces.nsIFileOutputStream);
|
||||
outStream.init(testFile, 0x02 | 0x08 | 0x20, // write, create, truncate
|
||||
|
|
|
@ -55,7 +55,9 @@ function checkURI(uri, name, type) {
|
|||
|
||||
function checkFrame(num) {
|
||||
// Just snarf our data
|
||||
var outer = SpecialPowers.wrap(window.frames[num]);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var outer = window.frames[num]
|
||||
name = outer.name;
|
||||
|
||||
is(outer.document.baseURI,
|
||||
|
|
|
@ -24,9 +24,10 @@ var frame = document.getElementById("i");
|
|||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
addLoadEvent(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var viewer =
|
||||
SpecialPowers.wrap(frame.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
|
||||
frame.contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.contentViewer
|
||||
|
@ -37,6 +38,7 @@ addLoadEvent(function() {
|
|||
setTimeout(function() {
|
||||
synthesizeMouse(frame, 30, 30, {});
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
is(viewer.fullZoom, 1.5, "Zoom in the image frame should not have been reset");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -159,9 +159,10 @@ function fileUriToSrc(path, mustExist) {
|
|||
if (navigator.appVersion.indexOf("Android") != -1)
|
||||
return path;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = SpecialPowers.wrap(Components).classes;
|
||||
const Cr = SpecialPowers.wrap(Components).results;
|
||||
const Cc = Components.classes;
|
||||
const Cr = Components.results;
|
||||
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var f = dirSvc.get("CurWorkD", Ci.nsILocalFile);
|
||||
|
@ -443,7 +444,8 @@ 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.
|
||||
SpecialPowers.forceGC();
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
|
||||
while (this.testNum < this.tests.length && this.tokens.length < PARALLEL_TESTS) {
|
||||
var test = this.tests[this.testNum];
|
||||
|
@ -495,13 +497,14 @@ function mediaTestCleanup() {
|
|||
A[i].parentNode.removeChild(A[i]);
|
||||
A[i] = null;
|
||||
}
|
||||
SpecialPowers.forceGC();
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
Components.utils.forceGC();
|
||||
}
|
||||
|
||||
(function() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
// Ensure that preload preferences are comsistent
|
||||
var prefService = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
var prefService = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefService);
|
||||
var branch = prefService.getBranch("media.");
|
||||
var oldDefault = 2;
|
||||
|
@ -519,6 +522,7 @@ 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,10 +98,9 @@ function isInaccessible(wnd, message) {
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
|
||||
function xpcEnumerateContentWindows(callback) {
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var Ci = Components.interfaces;
|
||||
var ww = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
var ww = Components.classes["@mozilla.org/embedcomp/window-watcher;1"]
|
||||
.getService(Ci.nsIWindowWatcher);
|
||||
var enumerator = ww.getWindowEnumerator();
|
||||
|
||||
|
@ -109,7 +108,7 @@ function xpcEnumerateContentWindows(callback) {
|
|||
|
||||
while (enumerator.hasMoreElements()) {
|
||||
var win = enumerator.getNext();
|
||||
if (typeof ChromeWindow != "undefined" && SpecialPowers.call_Instanceof(win, ChromeWindow)) {
|
||||
if (typeof ChromeWindow != "undefined" && win instanceof ChromeWindow) {
|
||||
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIDocShellTreeNode);
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
function testDone() {
|
||||
document.body.removeChild(document.body.firstChild);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var isOK = false;
|
||||
try {
|
||||
isOK = history.previous != location;
|
||||
|
|
|
@ -60,6 +60,7 @@ 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()
|
||||
|
@ -73,6 +74,7 @@ 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);
|
||||
|
@ -80,6 +82,7 @@ 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()
|
||||
{
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = 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()
|
||||
{
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = 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()
|
||||
{
|
||||
var prefs = SpecialPowers.wrap(Components)
|
||||
.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"].
|
||||
getService(Components.interfaces.nsIPrefBranch);
|
||||
gPrefValue = prefs.getBoolPref("network.jar.open-unsafe-types");
|
||||
}
|
||||
|
||||
|
|
|
@ -41,6 +41,8 @@ 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");
|
||||
|
@ -70,8 +72,7 @@ function runTest() {
|
|||
dump('Got second hashchange. Spinning event loop.\n');
|
||||
yield;
|
||||
|
||||
var sh = SpecialPowers.wrap(popup)
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
var sh = popup.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.sessionHistory;
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ function pollForPage(f, w)
|
|||
|
||||
function windowLoaded()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
switch (phase)
|
||||
{
|
||||
case 0:
|
||||
|
@ -56,16 +57,18 @@ 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 */
|
||||
SpecialPowers.wrap(w).location.reload();
|
||||
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(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(w.location.href, faultyURL, "Is on an error page");
|
||||
isnot(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,6 +42,8 @@ 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() {
|
||||
|
@ -50,9 +52,11 @@ 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 {
|
||||
SpecialPowers.wrap(w).back();
|
||||
w.back();
|
||||
}
|
||||
catch(ex) {
|
||||
ok(false, "w.back() threw " + ex);
|
||||
|
@ -60,9 +64,11 @@ 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(SpecialPowers.wrap(w).location.href, faultyURL, "Is on an error page");
|
||||
is(SpecialPowers.wrap(w).location.href, workingURL, "Is not on the previous page");
|
||||
isnot(w.location.href, faultyURL, "Is on an error page");
|
||||
is(w.location.href, workingURL, "Is not on the previous page");
|
||||
w.close();
|
||||
SimpleTest.finish();
|
||||
}, w);
|
||||
|
|
|
@ -82,14 +82,14 @@ function verifyBuffers(buffer1, buffer2)
|
|||
|
||||
function verifyBlob(blob1, blob2, fileId, blobReadHandler)
|
||||
{
|
||||
is(SpecialPowers.call_Instanceof(blob1, Components.interfaces.nsIDOMBlob), true,
|
||||
is(blob1 instanceof Components.interfaces.nsIDOMBlob, true,
|
||||
"Instance of nsIDOMBlob");
|
||||
is(SpecialPowers.call_Instanceof(blob1, Components.interfaces.nsIDOMFile),
|
||||
SpecialPowers.call_Instanceof(blob2, Components.interfaces.nsIDOMFile),
|
||||
is(blob1 instanceof Components.interfaces.nsIDOMFile,
|
||||
blob2 instanceof Components.interfaces.nsIDOMFile,
|
||||
"Instance of nsIDOMFile");
|
||||
is(blob1.size, blob2.size, "Correct size");
|
||||
is(blob1.type, blob2.type, "Correct type");
|
||||
if (SpecialPowers.call_Instanceof(blob2, Components.interfaces.nsIDOMFile)) {
|
||||
if (blob2 instanceof Components.interfaces.nsIDOMFile) {
|
||||
is(blob1.name, blob2.name, "Correct name");
|
||||
}
|
||||
is(utils.getFileId(blob1), fileId, "Correct file id");
|
||||
|
|
|
@ -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(x instanceof Components.interfaces.nsIInterfaceRequestor,
|
||||
true, "Must be interface requestor");
|
||||
|
||||
var count = {};
|
||||
var interfaces = SpecialPowers.wrap(x).
|
||||
var interfaces = x.
|
||||
QueryInterface(Components.interfaces.nsIClassInfo).
|
||||
getInterfaces(count).
|
||||
map(function(id) {
|
||||
id = SpecialPowers.wrap(id);
|
||||
return SpecialPowers.wrap(Components).interfacesByID[id].toString();
|
||||
return Components.interfacesByID[id].toString();
|
||||
});
|
||||
isnot(interfaces.indexOf("nsIInterfaceRequestor"), "-1",
|
||||
"Must have interface requestor classinfo");
|
||||
|
|
|
@ -116,8 +116,9 @@ function test5()
|
|||
SimpleTest.executeSoon(function() {
|
||||
// We have to focus back the originating window but we can't do that with
|
||||
// .focus() or .blur() anymore.
|
||||
var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"]
|
||||
.getService(Components.interfaces.nsIFocusManager);
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var fm = Components.classes["@mozilla.org/focus-manager;1"].
|
||||
getService(Components.interfaces.nsIFocusManager);
|
||||
fm.focusedWindow = window;
|
||||
});
|
||||
}, w, true);
|
||||
|
@ -125,7 +126,8 @@ function test5()
|
|||
|
||||
function finished()
|
||||
{
|
||||
SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch)
|
||||
.setBoolPref("dom.disable_window_flip", gOldPrefValue);
|
||||
SimpleTest.finish();
|
||||
|
@ -135,7 +137,8 @@ SimpleTest.waitForExplicitFinish();
|
|||
|
||||
|
||||
// dom.disable_window_flip has to be set to true for this test.
|
||||
var prefs = SpecialPowers.wrap(Components).classes["@mozilla.org/preferences-service;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var prefs = Components.classes["@mozilla.org/preferences-service;1"]
|
||||
.getService(Components.interfaces.nsIPrefBranch);
|
||||
gOldPrefValue = prefs.getBoolPref("dom.disable_window_flip");
|
||||
prefs.setBoolPref("dom.disable_window_flip", true);
|
||||
|
|
|
@ -153,7 +153,8 @@ function popstateExpected(msg) {
|
|||
}
|
||||
|
||||
function getColor(elem) {
|
||||
var utils = SpecialPowers.wrap(document).defaultView.
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var utils = document.defaultView.
|
||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
return utils.getVisitedDependentComputedStyle(elem, "", "color");
|
||||
|
@ -161,8 +162,10 @@ function getColor(elem) {
|
|||
|
||||
function getSHistory(theWindow)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
var sh = SpecialPowers.wrap(theWindow.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
var sh = theWindow.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.sessionHistory;
|
||||
if (!sh || sh == null)
|
||||
|
@ -173,6 +176,8 @@ function getSHistory(theWindow)
|
|||
|
||||
function getSHTitle(sh, offset)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
if (!offset)
|
||||
offset = 0;
|
||||
|
||||
|
|
|
@ -22,7 +22,8 @@ var iframe = document.getElementById("load-frame");
|
|||
function enableJS() allowJS(true, iframe);
|
||||
function disableJS() allowJS(false, iframe);
|
||||
function allowJS(allow, frame) {
|
||||
SpecialPowers.wrap(frame.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor))
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
frame.contentWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
.allowJavascript = allow;
|
||||
|
|
|
@ -67,7 +67,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=502673
|
|||
function doTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var input = document.getElementById("ip");
|
||||
if (SpecialPowers.call_Instanceof(input, Components.interfaces.nsIDOMNSEditableElement)) {
|
||||
if (input instanceof Components.interfaces.nsIDOMNSEditableElement) {
|
||||
// Add multiple listeners to the same editor
|
||||
var editor = input.editor;
|
||||
var listener1 = new listener();
|
||||
|
|
|
@ -36,7 +36,7 @@ function editDoc() {
|
|||
function getSpellCheckSelection() {
|
||||
var Ci = Components.interfaces;
|
||||
var win = editDoc().defaultView;
|
||||
var editingSession = SpecialPowers.wrap(win.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
var editingSession = win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession);
|
||||
|
@ -51,6 +51,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
function addWords(aLimit) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (aLimit == 0) {
|
||||
is(isSpellingCheckOk(), true, "All misspellings accounted for.");
|
||||
SimpleTest.finish();
|
||||
|
|
|
@ -20,6 +20,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=468353
|
|||
var styleSheets = null;
|
||||
|
||||
function checkStylesheets() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
// Evidently RemoveStyleSheet is the only method in nsIEditorStyleSheets
|
||||
// that would throw. RemoveOverrideStyleSheet returns NS_OK even if the
|
||||
// sheet is not there
|
||||
|
@ -41,6 +43,8 @@ function checkStylesheets() {
|
|||
}
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
const Ci = Components.interfaces;
|
||||
const Cc = Components.classes;
|
||||
|
||||
|
@ -54,7 +58,7 @@ function runTest() {
|
|||
editdoc.designMode='on';
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
|
@ -73,7 +77,7 @@ function runTest() {
|
|||
editdoc.body.contentEditable = true;
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
|
@ -90,7 +94,7 @@ function runTest() {
|
|||
editdoc.designMode = "off";
|
||||
|
||||
// Hold the reference to the editor
|
||||
editor = SpecialPowers.wrap(editframe.QueryInterface(Ci.nsIInterfaceRequestor))
|
||||
editor = editframe.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIEditingSession)
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<script class="testbody" type="application/javascript">
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
function verifyContent(s) {
|
||||
var e = document.getElementById('i1');
|
||||
var doc = e.contentDocument;
|
||||
|
@ -25,7 +27,7 @@ function runTest() {
|
|||
selection.removeAllRanges();
|
||||
selection.selectAllChildren(e);
|
||||
selection.collapseToEnd();
|
||||
SpecialPowers.wrap(doc).execCommand("paste", false, null);
|
||||
doc.execCommand("paste", false, null);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@ -49,7 +51,7 @@ function runTest() {
|
|||
range.selectNode(doc.getElementById(target_id));
|
||||
selection.addRange(range);
|
||||
}
|
||||
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||
doc.execCommand("copy", false, null);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -8,6 +8,8 @@
|
|||
<script class="testbody" type="application/javascript">
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
function verifyContent(s) {
|
||||
var e = document.getElementById('i1');
|
||||
var doc = e.contentDocument;
|
||||
|
@ -28,7 +30,7 @@ function runTest() {
|
|||
selection.removeAllRanges();
|
||||
selection.selectAllChildren(e);
|
||||
selection.collapseToEnd();
|
||||
SpecialPowers.wrap(doc).execCommand("paste", false, null);
|
||||
doc.execCommand("paste", false, null);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
@ -52,7 +54,7 @@ function runTest() {
|
|||
range.selectNode(doc.getElementById(target_id));
|
||||
selection.addRange(range);
|
||||
}
|
||||
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||
doc.execCommand("copy", false, null);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -550,8 +550,7 @@ function doNextTest() {
|
|||
|
||||
function getLoadContext() {
|
||||
const Ci = Components.interfaces;
|
||||
return SpecialPowers.wrap(window)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
}
|
||||
|
@ -564,10 +563,12 @@ function runTest(test) {
|
|||
} else
|
||||
elem.focus();
|
||||
|
||||
var trans = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/transferable;1"]
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var trans = Components.classes["@mozilla.org/widget/transferable;1"]
|
||||
.createInstance(Components.interfaces.nsITransferable);
|
||||
trans.init(getLoadContext());
|
||||
var data = SpecialPowers.wrap(Components).classes["@mozilla.org/supports-string;1"]
|
||||
var data = Components.classes["@mozilla.org/supports-string;1"]
|
||||
.createInstance(Components.interfaces.nsISupportsString);
|
||||
data.data = test.payload;
|
||||
trans.addDataFlavor("text/html");
|
||||
|
@ -581,13 +582,13 @@ function runTest(test) {
|
|||
getSelection().collapse(elem, 0);
|
||||
win = window;
|
||||
}
|
||||
editor = SpecialPowers.wrap(win).QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
editor = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIEditorDocShell)
|
||||
.editor;
|
||||
editor.pasteTransferable(trans);
|
||||
} else {
|
||||
var clipboard = SpecialPowers.wrap(Components).classes["@mozilla.org/widget/clipboard;1"]
|
||||
var clipboard = Components.classes["@mozilla.org/widget/clipboard;1"]
|
||||
.getService(Components.interfaces.nsIClipboard);
|
||||
|
||||
clipboard.setData(trans, null, Components.interfaces.nsIClipboard.kGlobalClipboard);
|
||||
|
|
|
@ -7,14 +7,13 @@
|
|||
|
||||
<script class="testbody" type="application/javascript">
|
||||
|
||||
var utils = SpecialPowers.wrap(window)
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
var Cc = SpecialPowers.wrap(Components).classes;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
function getLoadContext() {
|
||||
return SpecialPowers.wrap(window)
|
||||
.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
return window.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||
.getInterface(Ci.nsIWebNavigation)
|
||||
.QueryInterface(Ci.nsILoadContext);
|
||||
}
|
||||
|
@ -30,6 +29,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
function pasteInto(trans, html, target_id) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var e = document.getElementById('i1');
|
||||
var doc = e.contentDocument;
|
||||
doc.designMode = "on";
|
||||
|
@ -53,6 +53,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
function getTransferableFromClipboard(asHTML) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var trans = Cc["@mozilla.org/widget/transferable;1"].createInstance(Ci.nsITransferable);
|
||||
trans.init(getLoadContext());
|
||||
if (asHTML) {
|
||||
|
@ -66,6 +67,8 @@ function runTest() {
|
|||
}
|
||||
|
||||
function makeTransferable(s,asHTML,target_id) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var e = document.getElementById('i2');
|
||||
var doc = e.contentDocument;
|
||||
if (asHTML) {
|
||||
|
@ -109,6 +112,7 @@ function runTest() {
|
|||
}
|
||||
|
||||
function copyToClipBoard(s,asHTML,target_id) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
var e = document.getElementById('i2');
|
||||
var doc = e.contentDocument;
|
||||
if (asHTML) {
|
||||
|
@ -128,7 +132,7 @@ function runTest() {
|
|||
range.selectNode(doc.getElementById(target_id));
|
||||
selection.addRange(range);
|
||||
}
|
||||
SpecialPowers.wrap(doc).execCommand("copy", false, null);
|
||||
doc.execCommand("copy", false, null);
|
||||
return e;
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.waitForFocus(runTest);
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
function runDesignModeTest(aDoc, aFocus, aNewSource)
|
||||
{
|
||||
aDoc.designMode = "on";
|
||||
|
@ -81,9 +83,11 @@ var gSetFocusToIFrame = false;
|
|||
|
||||
function onLoadIFrame()
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
|
||||
var frameDoc = gIFrame.contentWindow.document;
|
||||
|
||||
var selCon = SpecialPowers.wrap(gIFrame).contentWindow.
|
||||
var selCon = gIFrame.contentWindow.
|
||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
getInterface(Components.interfaces.nsIWebNavigation).
|
||||
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
|
||||
|
|
|
@ -32,7 +32,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=471722
|
|||
var editor = null;
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (SpecialPowers.call_Instanceof(t1, Components.interfaces.nsIDOMNSEditableElement))
|
||||
if (t1 instanceof Components.interfaces.nsIDOMNSEditableElement)
|
||||
editor = t1.editor;
|
||||
ok(editor, "able to get editor for the element");
|
||||
t1.focus();
|
||||
|
|
|
@ -35,7 +35,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=483651
|
|||
var t1 = $("t1");
|
||||
var editor = null;
|
||||
|
||||
if (SpecialPowers.call_Instanceof(t1, Components.interfaces.nsIDOMNSEditableElement))
|
||||
if (t1 instanceof Components.interfaces.nsIDOMNSEditableElement)
|
||||
editor = t1.editor;
|
||||
|
||||
ok(editor, "able to get editor for the element");
|
||||
|
|
|
@ -20,12 +20,11 @@ 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.
|
||||
|
||||
var importObj = {};
|
||||
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/Services.jsm",
|
||||
importObj);
|
||||
var Services = SpecialPowers.wrap(importObj).Services;
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var Cc = SpecialPowers.wrap(Components).classes;
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
var Cc = Components.classes;
|
||||
var Ci = Components.interfaces;
|
||||
|
||||
var sysInfo = Cc["@mozilla.org/system-info;1"].getService(Ci.nsIPropertyBag2);
|
||||
|
|
|
@ -36,8 +36,9 @@ addLoadEvent(function() {
|
|||
ok(equal, "Show/hide should have no effect",
|
||||
"got " + str1 + " but expected " + str2);
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
|
||||
var viewer =
|
||||
SpecialPowers.wrap($("ourFrame")).contentWindow
|
||||
$("ourFrame").contentWindow
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
|
|
|
@ -126,21 +126,26 @@ function runTest1() {
|
|||
function runTest2(frameID, containerID) {
|
||||
// test reporting of painting in subdocuments
|
||||
var fired = 0;
|
||||
var gotSubdoc = false;
|
||||
var gotSubdocPrivileged = false;
|
||||
var gotSubdocNonprivileged = false;
|
||||
var iframe = document.getElementById(frameID);
|
||||
var container = document.getElementById(containerID);
|
||||
|
||||
function listener(event) {
|
||||
if (checkGotSubdoc(event.clientRects, container))
|
||||
gotSubdoc = true;
|
||||
gotSubdocNonprivileged = 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(!gotSubdoc, "Got subdoc invalidation (" + frameID + ")");
|
||||
ok(gotSubdocPrivileged, "Didn't get subdoc invalidation while we were privileged (" + frameID + ")");
|
||||
ok(!gotSubdocNonprivileged, "Got subdoc invalidation while we were not privileged (" + frameID + ")");
|
||||
window.removeEventListener("MozAfterPaint", listener, false);
|
||||
runNext();
|
||||
}
|
||||
|
@ -163,6 +168,7 @@ function runTest3() {
|
|||
var iframe = document.getElementById("iframe");
|
||||
|
||||
function listener(event) {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
if (checkGotSubdoc(event.clientRects, iframe))
|
||||
gotScrolledOutInMainDoc = true;
|
||||
}
|
||||
|
|
|
@ -63,9 +63,7 @@ function do_test() {
|
|||
|
||||
try {
|
||||
var res = utils.getBindingURLs(docElement);
|
||||
is(SpecialPowers.call_Instanceof(res, Components.interfaces["nsIArray"]),
|
||||
true,
|
||||
"getBindingURLs result type");
|
||||
is(res instanceof Components.interfaces["nsIArray"], true, "getBindingURLs result type");
|
||||
is(res.length, 0, "getBindingURLs array length");
|
||||
}
|
||||
catch(e) { ok(false, "got an unexpected exception:" + e); }
|
||||
|
|
|
@ -159,11 +159,13 @@ function todoSecurityState(expectedState, message)
|
|||
|
||||
function isSecurityState(expectedState, message, test)
|
||||
{
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
if (!test)
|
||||
test = ok;
|
||||
|
||||
// Quit nasty but working :)
|
||||
var ui = SpecialPowers.wrap(window)
|
||||
var ui = window
|
||||
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIWebNavigation)
|
||||
.QueryInterface(Components.interfaces.nsIDocShell)
|
||||
|
|
|
@ -9,7 +9,6 @@ var Ci = Components.interfaces;
|
|||
var Cc = Components.classes;
|
||||
|
||||
Components.utils.import("resource://mochikit/MockFilePicker.jsm");
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
function SpecialPowersAPI() {
|
||||
this._consoleListeners = [];
|
||||
|
@ -410,10 +409,6 @@ SpecialPowersAPI.prototype = {
|
|||
return MockFilePicker
|
||||
},
|
||||
|
||||
get Services() {
|
||||
return wrapPrivileged(Services);
|
||||
},
|
||||
|
||||
getDOMWindowUtils: function(aWindow) {
|
||||
if (aWindow == this.window.get() && this.DOMWindowUtils != null)
|
||||
return this.DOMWindowUtils;
|
||||
|
@ -639,12 +634,6 @@ SpecialPowersAPI.prototype = {
|
|||
return obj.QueryInterface(Ci[iface]);
|
||||
},
|
||||
|
||||
call_Instanceof: function (obj1, obj2) {
|
||||
obj1=unwrapIfWrapped(obj1);
|
||||
obj2=unwrapIfWrapped(obj2);
|
||||
return obj1 instanceof obj2;
|
||||
},
|
||||
|
||||
// Mimic the get*Pref API
|
||||
getBoolPref: function(aPrefName) {
|
||||
return (this._getPref(aPrefName, 'BOOL'));
|
||||
|
|
Загрузка…
Ссылка в новой задаче