Bug 784560 - Fix more tests. r=mccr8

This commit is contained in:
Bobby Holley 2012-08-23 11:45:28 -07:00
Родитель db063f3c32
Коммит f978d43865
17 изменённых файлов: 54 добавлений и 149 удалений

Просмотреть файл

@ -52,13 +52,13 @@ function executeCopyCommand(command, expectedValue)
{
// Just execute the command directly rather than simulating a context menu
// press to avoid having to deal with its asynchronous nature
subwindow.controllers.getControllerForCommand(command).doCommand(command);
SpecialPowers.wrap(subwindow).controllers.getControllerForCommand(command).doCommand(command);
// The easiest way to check the clipboard is to paste the contents into a
// textbox
input.focus();
input.value = "";
input.controllers.getControllerForCommand("cmd_paste").doCommand("cmd_paste");
SpecialPowers.wrap(input).controllers.getControllerForCommand("cmd_paste").doCommand("cmd_paste");
is(input.value, expectedValue, "paste for command " + command);
}
@ -250,7 +250,6 @@ function checkMenu(menu, expectedItems, data) {
*/
function runTest(testNum) {
// Seems we need to enable this again, or sendKeyEvent() complaints.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
ok(true, "Starting test #" + testNum);
var inspectItems = [];

Просмотреть файл

@ -30,22 +30,15 @@ function clickHandler() {
}
function suppressEvents(suppress) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils)
.suppressEventHandling(suppress);
SpecialPowers.DOMWindowUtils.suppressEventHandling(suppress);
}
function sendEvents() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
windowUtils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
windowUtils = SpecialPowers.getDOMWindowUtils(window);
windowUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
windowUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
iframeUtils = document.getElementById("ifr").contentWindow
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
iframeUtils = SpecialPowers.getDOMWindowUtils(document.getElementById("ifr").contentWindow);
iframeUtils.sendMouseEvent("mousedown", 1, 1, 0, 1, 0);
iframeUtils.sendMouseEvent("mouseup", 1, 1, 0, 1, 0);
}

Просмотреть файл

@ -48,9 +48,7 @@ function setOrRestoreTabFocus(newValue) {
var doc = document;
function tab_to(id) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var wu = doc.defaultView.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var wu = SpecialPowers.DOMWindowUtils;
wu.sendKeyEvent('keypress', 9, 0, 0);
is(doc.activeElement.id, id, "element with id=" + id + " should have focus");
}

Просмотреть файл

@ -31,17 +31,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493251
var keyUp = 0;
function suppressEventHandling(aSuppress) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
ok(true, "suppressEventHandling: aSuppress=" + aSuppress);
utils.suppressEventHandling(aSuppress);
}
function dispatchKeyEvent(type) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
ok(true, "Dipatching key event: type=" + type);
utils.sendKeyEvent(type,
Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
@ -49,9 +45,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493251
}
function dispatchMouseEvent(aType, aX, aY, aButton, aClickCount, aModifiers) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
ok(true, "Dipatching mouse event: aType=" + aType + ", aX=" + aX + ", aY" +
aY + ", aButton=" + aButton + ", aClickCount=" + aClickCount +
", aModifiers=" + aModifiers);
@ -88,8 +82,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=493251
}
ok(true, aEvent.type + " event is handled: " + detail);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var fm = Components.classes["@mozilla.org/focus-manager;1"].
var fm = SpecialPowers.wrap(Components).classes["@mozilla.org/focus-manager;1"].
getService(Components.interfaces.nsIFocusManager);
ok(true, "focused element is \"" + fm.focusedElement +
"\" and focused window is \"" + fm.focusedWindow +

Просмотреть файл

@ -34,18 +34,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
var keyUp = 0;
function dispatchKeyEvent(type) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = subwin.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(subwin);
utils.sendKeyEvent(type,
Components.interfaces.nsIDOMKeyEvent.DOM_VK_A,
0, 0);
}
function doTest() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
var f = win.document.getElementById("f");
subwin = f.contentWindow;
subwin.document.getElementsByTagName("input")[0].focus();
@ -81,9 +77,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
}
function continueTest1() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
dispatchKeyEvent("keydown");
utils.suppressEventHandling(true);
dispatchKeyEvent("keypress");
@ -96,9 +90,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
}
function continueTest2() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
is(keyDown, 2, "Wrong number events (13)");
is(keyPress, 2, "Wrong number events (14)");
is(keyUp, 2, "Wrong number events (15)");
@ -121,9 +113,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=545268
}
function continueTest3() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
utils.sendMouseEvent("mousedown", 5, 5, 0, 1, 0);
utils.suppressEventHandling(true);
utils.sendMouseEvent("mouseup", 5, 5, 0, 1, 0);

Просмотреть файл

@ -44,9 +44,7 @@ function runTest() {
'</div>', '_blank', 'width=300,height=300');
SimpleTest.waitForFocus(function () {
var scrollbox = win.document.getElementById("scrollbox");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
let winUtils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
let winUtils = SpecialPowers.getDOMWindowUtils(win);
let outstandingTests = [
[false, false],
[false, true],

Просмотреть файл

@ -26,9 +26,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=593959
/** Test for Bug 593959 **/
function doTest() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(window);
var e = document.createEvent("MouseEvent");
e.initEvent("mousedown", false, false, window, 0, 1, 1, 1, 1,
false, false, false, false, 0, null);
@ -38,8 +36,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=593959
var ifrwindow = document.getElementById("ifr").contentWindow;
var utils2 = ifrwindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils2 = SpecialPowers.getDOMWindowUtils(ifrwindow);
var e2 = ifrwindow.document.createEvent("MouseEvent");
e2.initEvent("mouseup", false, false, ifrwindow, 0, 1, 1, 1, 1,

Просмотреть файл

@ -58,7 +58,7 @@ function navigateByHyperlink(name) {
function isNavigated(wnd, message) {
var result = null;
try {
result = wnd.document.body.innerHTML;
result = SpecialPowers.wrap(wnd).document.body.innerHTML;
} catch(ex) {
result = ex;
}
@ -109,7 +109,7 @@ function xpcEnumerateContentWindows(callback) {
while (enumerator.hasMoreElements()) {
var win = enumerator.getNext();
if (typeof ChromeWindow != "undefined" && SpecialPowers.call_Instanceof(win, ChromeWindow)) {
if (/ChromeWindow/.exec(win)) {
var docshellTreeNode = win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeNode);
@ -118,7 +118,7 @@ function xpcEnumerateContentWindows(callback) {
var childTreeNode = docshellTreeNode.getChildAt(i);
// we're only interested in content docshells
if (childTreeNode.itemType != Ci.nsIDocShellTreeItem.typeContent)
if (SpecialPowers.unwrap(childTreeNode.itemType) != Ci.nsIDocShellTreeItem.typeContent)
continue;
var webNav = childTreeNode.QueryInterface(Ci.nsIWebNavigation);

Просмотреть файл

@ -38,9 +38,7 @@ function runNextTest() {
win.onunload = function() {
didClose = true;
}
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
utils.sendNativeKeyEvent(0, MAC_VK_ANSI_W, 0x4000 /* cmd */, "w", "w");
setTimeout(function () {

Просмотреть файл

@ -19,15 +19,12 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=391747
<script class="testbody" type="text/javascript">
function ctrlclick_391747(doc,x,y){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var wu = doc.defaultView.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var wu = SpecialPowers.getDOMWindowUtils(doc.defaultView);
wu.sendMouseEvent('mousedown', x, y, 0, 1, 2);
wu.sendMouseEvent('mouseup', x, y, 0, 1, 2);
}
function select_391747(doc){
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var range = doc.createRange();
range.setStart(doc, 0);
range.setEnd(doc, 0);

Просмотреть файл

@ -17,15 +17,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=461710
/** Test for Bug 461710 **/
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
SimpleTest.waitForExplicitFinish();
const Ci = Components.interfaces;
const Cc = Components.classes;
const Cr = Components.results;
const Cc = SpecialPowers.wrap(Components).classes;
const Cr = SpecialPowers.wrap(Components).results;
Components.utils.import("resource://gre/modules/NetUtil.jsm");
Components.utils.import("resource://gre/modules/Services.jsm");
SpecialPowers.wrap(Components).utils.import("resource://gre/modules/NetUtil.jsm", window);
var Services = SpecialPowers.Services;
var gIframe = document.getElementById("iframe");
@ -73,8 +72,6 @@ var subtests = [
var testNum = 0;
function loadNextTest() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// run the initialization code for each test
switch (++testNum) {
case 1:
@ -115,9 +112,7 @@ function loadNextTest() {
function getColor(doc, win, id) {
var elem = doc.getElementById(id);
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var utils = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(win);
return utils.getVisitedDependentComputedStyle(elem, "", "color");
}
@ -159,7 +154,6 @@ function get_PBSvc() {
if (_PBSvc)
return _PBSvc;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
try {
_PBSvc = Cc["@mozilla.org/privatebrowsing;1"].
getService(Ci.nsIPrivateBrowsingService);
@ -170,8 +164,6 @@ function get_PBSvc() {
function handleLoad() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
checkTest();
if (testNum < subtests.length) {
@ -189,9 +181,8 @@ var observer = {
uri: null,
resolved: true,
observe: function (aSubject, aTopic, aData) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (this.uri.equals(aSubject.QueryInterface(Ci.nsIURI))) {
if (this.uri.equals(SpecialPowers.wrap(aSubject).QueryInterface(Ci.nsIURI))) {
this.resolved = true;
Services.obs.removeObserver(this, aTopic);
@ -201,9 +192,7 @@ var observer = {
ok(this.resolved, "Can't set the expected URL when another is yet to be resolved");
this.resolved = false;
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
this.uri = NetUtil.newURI(url);
this.uri = SpecialPowers.wrap(NetUtil).newURI(url);
var topic = aOverrideTopic || URI_VISITED_RESOLUTION_TOPIC;
Services.obs.addObserver(this, topic, false);
}

Просмотреть файл

@ -65,11 +65,11 @@ function getTabModalPromptBox(domWin) {
// Given a content DOM window, returns the chrome window it's in.
function getChromeWindow(aWindow) {
var chromeWin = aWindow.QueryInterface(Ci.nsIInterfaceRequestor)
var chromeWin = SpecialPowers.wrap(aWindow).QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShell)
.chromeEventHandler.ownerDocument.defaultView;
return XPCNativeWrapper.unwrap(chromeWin);
return chromeWin;
}
try {
@ -77,7 +77,6 @@ function getTabModalPromptBox(domWin) {
var promptWin = domWin.top;
// Get the chrome window for the content window we're using.
// (Unwrap because we need a non-IDL property below.)
var chromeWin = getChromeWindow(promptWin);
if (chromeWin.getTabModalPromptBox)
@ -86,7 +85,8 @@ function getTabModalPromptBox(domWin) {
// If any errors happen, just assume no tabmodal prompter.
}
return promptBox;
// Callers get confused by a wrapped promptBox here.
return SpecialPowers.unwrap(promptBox);
}
function getDialogDoc() {

Просмотреть файл

@ -27,9 +27,7 @@ SimpleTest.waitForExplicitFinish();
var selectionTest = false;
var testNum = 0;
var utils = SpecialPowers.wrap(window)
.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.DOMWindowUtils;
function hasTabModalPrompts() {
var prefName = "prompts.tab_modal.enabled";

Просмотреть файл

@ -1,11 +1,8 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
Components.utils.import("resource://gre/modules/Services.jsm");
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
var Services = SpecialPowers.Services;
/*
* $_
@ -40,9 +37,6 @@ function $_(formNum, name) {
// Mochitest gives us a sendKey(), but it's targeted to a specific element.
// This basically sends an untargeted key event, to whatever's focused.
function doKey(aKey, modifier) {
// Seems we need to enable this again, or sendKeyEvent() complaints.
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var keyName = "DOM_VK_" + aKey.toUpperCase();
var key = Components.interfaces.nsIDOMKeyEvent[keyName];
@ -51,8 +45,7 @@ function doKey(aKey, modifier) {
modifier = null;
// Window utils for sending fake sey events.
var wutils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var wutils = SpecialPowers.getDOMWindowUtils(window);
wutils.sendKeyEvent("keydown", key, 0, modifier);
wutils.sendKeyEvent("keypress", key, 0, modifier);
@ -62,7 +55,7 @@ function doKey(aKey, modifier) {
function getAutocompletePopup() {
var Ci = Components.interfaces;
chromeWin = window
chromeWin = SpecialPowers.wrap(window)
.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
@ -78,8 +71,7 @@ function getAutocompletePopup() {
function cleanUpFormHist() {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var formhist = Components.classes["@mozilla.org/satchel/form-history;1"].
var formhist = SpecialPowers.wrap(Components).classes["@mozilla.org/satchel/form-history;1"].
getService(Components.interfaces.nsIFormHistory2);
formhist.removeAllEntries();
}
@ -98,8 +90,6 @@ var checkObserver = {
},
observe: function(subject, topic, data) {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
if (data != "addEntry" && data != "modifyEntry")
return;
ok(this.verifyStack.length > 0, "checking if saved form data was expected");

Просмотреть файл

@ -29,7 +29,6 @@ Form History test: form field autocomplete
<script class="testbody" type="text/javascript">
/** Test for Form History autocomplete **/
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
var autocompletePopup = getAutocompletePopup();
autocompletePopup.style.direction = "ltr";
@ -37,7 +36,7 @@ autocompletePopup.style.direction = "ltr";
var input = $_(1, "field1");
// Get the form history service
var fh = Components.classes["@mozilla.org/satchel/form-history;1"].
var fh = SpecialPowers.wrap(Components).classes["@mozilla.org/satchel/form-history;1"].
getService(Components.interfaces.nsIFormHistory2);
ok(fh != null, "got form history service");
@ -126,16 +125,9 @@ function doClickUnprivileged() {
* setTimeout() calls. The case statements are executed in order, one per
* timeout.
*/
var nextTestPrivledged = true;
function runTest(testNum) {
ok(true, "Starting test #" + testNum);
if (nextTestPrivledged) {
ok(true, "This test is privileged.");
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
nextTestPrivledged = false;
}
switch(testNum) {
//
// Check initial state
@ -152,7 +144,6 @@ function runTest(testNum) {
// try a focus()
case 2:
input.focus();
nextTestPrivledged = true;
break;
case 3:
checkPopupOpen(false);
@ -161,7 +152,6 @@ function runTest(testNum) {
// try a click()
case 4:
input.click();
nextTestPrivledged = true;
break;
case 5:
checkPopupOpen(false);
@ -170,7 +160,6 @@ function runTest(testNum) {
// try a mouseclick event
case 6:
doClickUnprivileged();
nextTestPrivledged = true;
break;
case 7:
checkPopupOpen(false);
@ -179,7 +168,6 @@ function runTest(testNum) {
// try a down-arrow
case 8:
doKeyUnprivileged("down");
nextTestPrivledged = true;
break;
case 9:
checkPopupOpen(false);
@ -188,7 +176,6 @@ function runTest(testNum) {
// try a page-down
case 10:
doKeyUnprivileged("page_down");
nextTestPrivledged = true;
break;
case 11:
checkPopupOpen(false);
@ -198,7 +185,6 @@ function runTest(testNum) {
case 12:
// XXX this causes later tests to fail for some reason.
// doKeyUnprivileged("return"); // not "enter"!
nextTestPrivledged = true;
break;
case 13:
checkPopupOpen(false);
@ -207,7 +193,6 @@ function runTest(testNum) {
// try a keypress
case 14:
doKeyUnprivileged('v');
nextTestPrivledged = true;
break;
case 15:
checkPopupOpen(false);
@ -216,7 +201,6 @@ function runTest(testNum) {
// try a space
case 16:
doKeyUnprivileged(" ");
nextTestPrivledged = true;
break;
case 17:
checkPopupOpen(false);
@ -225,19 +209,16 @@ function runTest(testNum) {
// backspace
case 18:
doKeyUnprivileged("back_space");
nextTestPrivledged = true;
break;
case 19:
checkPopupOpen(false);
checkForm("");
nextTestPrivledged = true;
break;
case 20:
// We're privileged for this test, so open the popup.
checkPopupOpen(false);
checkForm("");
doKey("down");
nextTestPrivledged = true;
break;
case 21:
checkPopupOpen(true, -1);
@ -252,7 +233,6 @@ function runTest(testNum) {
// try a down-arrow
case 100:
doKeyUnprivileged("down");
nextTestPrivledged = true;
break;
case 101:
checkPopupOpen(true, -1);
@ -261,18 +241,15 @@ function runTest(testNum) {
// try a page-down
case 102:
doKeyUnprivileged("page_down");
nextTestPrivledged = true;
break;
case 103:
checkPopupOpen(true, -1);
checkForm("");
nextTestPrivledged = true;
break;
// really adjust the index
case 104:
// (We're privileged for this test.) Try a privileged down-arrow.
doKey("down");
nextTestPrivledged = true;
break;
case 105:
checkPopupOpen(true, 0);
@ -281,7 +258,6 @@ function runTest(testNum) {
// try a down-arrow
case 106:
doKeyUnprivileged("down");
nextTestPrivledged = true;
break;
case 107:
checkPopupOpen(true, 0);
@ -290,7 +266,6 @@ function runTest(testNum) {
// try a page-down
case 108:
doKeyUnprivileged("page_down");
nextTestPrivledged = true;
break;
case 109:
checkPopupOpen(true, 0);
@ -299,7 +274,6 @@ function runTest(testNum) {
case 110:
// XXX this causes the popup to close, and makes the value "vaa" (sic)
//doKeyUnprivileged('a');
nextTestPrivledged = true;
break;
case 111:
checkPopupOpen(true, 0);
@ -313,7 +287,6 @@ function runTest(testNum) {
// try a right-arrow
case 200:
doKeyUnprivileged("right");
nextTestPrivledged = true;
break;
case 201:
checkPopupOpen(true, 0);
@ -322,7 +295,6 @@ function runTest(testNum) {
// try a space
case 202:
doKeyUnprivileged(" ");
nextTestPrivledged = true;
break;
case 203:
// XXX we should ignore this input while popup is open?
@ -332,17 +304,14 @@ function runTest(testNum) {
// backspace
case 204:
doKeyUnprivileged("back_space");
nextTestPrivledged = true;
break;
case 205:
// XXX we should ignore this input while popup is open?
checkPopupOpen(true, 0);
checkForm("");
nextTestPrivledged = true;
break;
case 206:
// (this space intentionally left blank)
nextTestPrivledged = true;
break;
case 207:
checkPopupOpen(true, 0);
@ -352,7 +321,6 @@ function runTest(testNum) {
case 208:
// XXX this seems to cause problems with reliably closing the popup
// doKeyUnprivileged("return"); // not "enter"!
nextTestPrivledged = true;
break;
case 209:
checkPopupOpen(true, 0);
@ -362,7 +330,6 @@ function runTest(testNum) {
case 210:
// Need to use doKey(), even though this test is not privileged.
doKey("escape");
nextTestPrivledged = true;
break;
case 211:
checkPopupOpen(false);

Просмотреть файл

@ -5,13 +5,12 @@
// handlerApp.xhtml grabs this for verification purposes via window.opener
var testURI = "webcal://127.0.0.1/rheeeeet.html";
const Cc = SpecialPowers.wrap(Components).classes;
function test() {
netscape.security.PrivilegeManager.enablePrivilege('UniversalXPConnect');
// set up the web handler object
var webHandler =
Components.classes["@mozilla.org/uriloader/web-handler-app;1"].
var webHandler = Cc["@mozilla.org/uriloader/web-handler-app;1"].
createInstance(Components.interfaces.nsIWebHandlerApp);
webHandler.name = "Test Web Handler App";
webHandler.uriTemplate =
@ -19,14 +18,14 @@ function test() {
"handlerApp.xhtml?uri=%s";
// set up the uri to test with
var ioService = Components.classes["@mozilla.org/network/io-service;1"].
var ioService = Cc["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
var uri = ioService.newURI(testURI, null, null);
// create a window, and launch the handler in it
var newWindow = window.open("", "handlerWindow", "height=300,width=300");
var windowContext =
newWindow.QueryInterface(Components.interfaces.nsIInterfaceRequestor).
SpecialPowers.wrap(newWindow).QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIWebNavigation).
QueryInterface(Components.interfaces.nsIDocShell);
@ -43,16 +42,15 @@ function test() {
ok(true, "webHandler launchWithURI (new window/tab) test started");
// set up the local handler object
var localHandler =
Components.classes["@mozilla.org/uriloader/local-handler-app;1"].
var localHandler = Cc["@mozilla.org/uriloader/local-handler-app;1"].
createInstance(Components.interfaces.nsILocalHandlerApp);
localHandler.name = "Test Local Handler App";
// get a local app that we know will be there and do something sane
var osString = Components.classes["@mozilla.org/xre/app-info;1"].
var osString = Cc["@mozilla.org/xre/app-info;1"].
getService(Components.interfaces.nsIXULRuntime).OS;
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"].
var dirSvc = Cc["@mozilla.org/file/directory_service;1"].
getService(Components.interfaces.nsIDirectoryServiceProvider);
if (osString == "WINNT") {
var windowsDir = dirSvc.getFile("WinD", {});
@ -73,13 +71,13 @@ function test() {
todo(false, "On SeaMonkey, testing OS X as generic Unix. (Bug 749872)");
// assume a generic UNIX variant
exe = Components.classes["@mozilla.org/file/local;1"].
exe = Cc["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("/bin/echo");
}
} else {
// assume a generic UNIX variant
exe = Components.classes["@mozilla.org/file/local;1"].
exe = Cc["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
exe.initWithPath("/bin/echo");
}
@ -94,11 +92,11 @@ function test() {
// the if statement below from "NOTDarwin" to "Darwin"
if (osString == "NOTDarwin") {
var killall = Components.classes["@mozilla.org/file/local;1"].
var killall = Cc["@mozilla.org/file/local;1"].
createInstance(Components.interfaces.nsILocalFile);
killall.initWithPath("/usr/bin/killall");
var process = Components.classes["@mozilla.org/process/util;1"].
var process = Cc["@mozilla.org/process/util;1"].
createInstance(Components.interfaces.nsIProcess);
process.init(killall);

Просмотреть файл

@ -25,7 +25,7 @@ const Cc = Components.classes;
const Ci = Components.interfaces;
function getBaseWindowInterface(win) {
return win.QueryInterface(Ci.nsIInterfaceRequestor)
return SpecialPowers.wrap(win).QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation)
.QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner
@ -74,7 +74,7 @@ var iWin = window.document.getElementById("iframe_not_editable").contentWindow;
is(getBaseWindowInterface(iWin).nativeHandle, nativeHandle,
"the nativeHandle of an iframe should be its parent's nativeHandle");
var dialog = window.openDialog("data:text/plain,this is an active window.", "_blank",
var dialog = SpecialPowers.wrap(window).openDialog("data:text/plain,this is an active window.", "_blank",
"chrome,dialog=yes,width=100,height=100");
isnot(getBaseWindowInterface(dialog).nativeHandle, "",