Bug 775868 - fix more tests. r=bholley

This commit is contained in:
Andrew McCreight 2012-09-10 12:44:29 -07:00
parent 63490c62d3
commit ad40555109
2 changed files with 6 additions and 14 deletions

View File

@ -19,13 +19,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=534149
/** Test for Bug 534149 **/
function getIDs(iframe) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var win = iframe.contentWindow;
// Force inner creation
win.document;
var util = win.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
.getInterface(Components.interfaces.nsIDOMWindowUtils);
var util = SpecialPowers.getDOMWindowUtils(win);
return [util.outerWindowID, util.currentInnerWindowID];
}
@ -46,19 +44,16 @@ var innerWindowDestroyID;
var outerWindowDestroyID;
function outerObserver(id) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
outerWindowDestroyID =
id.QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
SpecialPowers.wrap(id).QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
}
function innerObserver(id) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
innerWindowDestroyID =
id.QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
SpecialPowers.wrap(id).QueryInterface(Components.interfaces.nsISupportsPRUint64).data;
}
function removeFrame(iframe) {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obsSvc = Components.classes["@mozilla.org/observer-service;1"]
var obsSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
obsSvc.addObserver(outerObserver, "outer-window-destroyed", false);
obsSvc.addObserver(innerObserver, "inner-window-destroyed", false);
@ -71,8 +66,7 @@ SimpleTest.waitForExplicitFinish();
SimpleTest.executeSoon(function() {
is(innerWindowDestroyID, i1inner, "inner window of frame 1 should be destroyed");
is(outerWindowDestroyID, i1outer, "outer window of frame 1 should be destroyed");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var obsSvc = Components.classes["@mozilla.org/observer-service;1"]
var obsSvc = SpecialPowers.wrap(Components).classes["@mozilla.org/observer-service;1"]
.getService(Components.interfaces.nsIObserverService);
obsSvc.removeObserver(outerObserver, "outer-window-destroyed");
obsSvc.removeObserver(innerObserver, "inner-window-destroyed");

View File

@ -89,9 +89,7 @@ function onLoadIFrame()
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsISelectionDisplay).
QueryInterface(Components.interfaces.nsISelectionController);
var utils = window.
QueryInterface(Components.interfaces.nsIInterfaceRequestor).
getInterface(Components.interfaces.nsIDOMWindowUtils);
var utils = SpecialPowers.getDOMWindowUtils(window);
const nsIDOMNode = Components.interfaces.nsIDOMNode;
// move focus to the HTML editor