mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 02:14:43 +00:00
Bug 580128. Fix various mochi chrome tests to work with the new wrappers. r=mrbkap@gmail.com
This commit is contained in:
parent
21cdd79153
commit
c6b8f8093f
@ -39,11 +39,11 @@ function doTest() {
|
||||
offScreenBrowser.contentWindow.focus();
|
||||
ok(offScreenBrowser.contentDocument.hasFocus(),"offscreen browser is not visible");
|
||||
|
||||
offScreenSubBrowser.wrappedJSObject.contentWindow.focus();
|
||||
todo(offScreenSubBrowser.wrappedJSObject.contentDocument.hasFocus(),"visible browser in offscreen browser is not visible");
|
||||
offScreenSubBrowser.contentWindow.focus();
|
||||
todo(offScreenSubBrowser.contentDocument.hasFocus(),"visible browser in offscreen browser is not visible");
|
||||
|
||||
offScreenBurriedBrowser.wrappedJSObject.contentWindow.focus();
|
||||
ok(!offScreenBurriedBrowser.wrappedJSObject.contentDocument.hasFocus(),"hidden browser in offscreen browser is visible");
|
||||
offScreenBurriedBrowser.contentWindow.focus();
|
||||
ok(!offScreenBurriedBrowser.contentDocument.hasFocus(),"hidden browser in offscreen browser is visible");
|
||||
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
@ -26,9 +26,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
|
||||
function go() {
|
||||
var ifr = document.getElementById("ifr");
|
||||
var doc = ifr.contentDocument;
|
||||
ok(doc.toString().indexOf("XPCNativeWrapper") >= 0, "doc is an XPCNativeWrapper");
|
||||
ok(doc.toString().indexOf("XrayWrapper") >= 0, "doc is an XrayWrapper");
|
||||
var weak = Components.utils.getWeakReference(doc);
|
||||
ok(weak.get().toString().indexOf("XPCNativeWrapper") >= 0, "weak reference returns a wrapper");
|
||||
ok(weak.get().toString().indexOf("XrayWrapper") >= 0, "weak reference returns a wrapper");
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -34,11 +34,11 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
var win = $('ifr').contentWindow;
|
||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
is(utils.getClassName(win), "XPCNativeWrapper", "win is an XPCNW");
|
||||
is(utils.getClassName(win), "Proxy", "win is a Proxy");
|
||||
ok("x" in XPCNativeWrapper.unwrap(win), "actually unwrapped");
|
||||
is(utils.getClassName(XPCNativeWrapper.unwrap(win)), "XPCSafeJSObjectWrapper",
|
||||
"unwrap on an NW returns the same object");
|
||||
is(utils.getClassName(XPCNativeWrapper.unwrap(new XPCNativeWrapper(win))), "XPCSafeJSObjectWrapper",
|
||||
is(utils.getClassName(XPCNativeWrapper.unwrap(win)), "Proxy",
|
||||
"unwrap on an Proxy returns the same object");
|
||||
is(utils.getClassName(XPCNativeWrapper.unwrap(new XPCNativeWrapper(win))), "Proxy",
|
||||
"unwrap on an explicit NW works too");
|
||||
|
||||
ok(utils.getClassName(window) !== "XPCNativeWrapper", "window is not a native wrapper");
|
||||
|
@ -37,7 +37,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
is(typeof readystatechange.QueryInterface, 'function', 'double wrapped');
|
||||
|
||||
ok(unwrapped.testme(readystatechange),
|
||||
'content didn't get a proxy, but another double wrapped object');
|
||||
'content didn\'t get a proxy, but another double wrapped object');
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
|
@ -33,14 +33,14 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
var win = $('ifr').contentWindow;
|
||||
var sandbox = new Cu.Sandbox(win);
|
||||
is(utils.getClassName(sandbox),
|
||||
"XPCSafeJSObjectWrapper",
|
||||
"Proxy",
|
||||
"sandbox was wrapped correctly");
|
||||
sandbox.__proto__ = new XPCNativeWrapper(win);
|
||||
|
||||
is(utils.getClassName(Cu.evalInSandbox("this.document", sandbox)),
|
||||
"XPCSafeJSObjectWrapper",
|
||||
"Proxy",
|
||||
"return value was rewrapped correctly");
|
||||
ok(Cu.evalInSandbox("(this.document + '').indexOf('XPCNativeWrapper') >= 0", sandbox),
|
||||
ok(Cu.evalInSandbox("('wrappedJSObject' in this.document);", sandbox),
|
||||
"wrappers inside eIS are XPCNativeWrappers");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
@ -22,7 +22,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
function checkWrapped(obj) {
|
||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
is(utils.getClassName(obj), "XPCSafeJSObjectWrapper", "right type of wrapper");
|
||||
is(utils.getClassName(obj), "Proxy", "right type of wrapper");
|
||||
}
|
||||
|
||||
var sandbox = new Components.utils.Sandbox("about:blank");
|
||||
|
@ -27,28 +27,28 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
|
||||
var win = $('ifr').contentWindow;
|
||||
var utils = window.QueryInterface(Components.interfaces.nsIInterfaceRequestor)
|
||||
.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
todo_is(utils.getClassName(window), "XPCSafeJSObjectWrapper", "our window is wrapped correctly")
|
||||
todo_is(utils.getClassName(location), "XPCSafeJSObjectWrapper", "our location is wrapped correctly")
|
||||
is(utils.getClassName(win), "XPCNativeWrapper", "win is an XPCNW");
|
||||
is(utils.getClassName(win.location), "XPCNativeWrapper", "deep wrapping works");
|
||||
is(utils.getClassName(window), "Proxy", "our window is wrapped correctly")
|
||||
is(utils.getClassName(location), "Proxy", "our location is wrapped correctly")
|
||||
is(utils.getClassName(win), "Proxy", "win is an Proxy");
|
||||
is(utils.getClassName(win.location), "Proxy", "deep wrapping works");
|
||||
is(win.location.href, "http://example.org/tests/js/src/xpconnect/tests/mochitest/chrome_wrappers_helper.html",
|
||||
"can still get strings out");
|
||||
|
||||
var unsafeWin = win.wrappedJSObject;
|
||||
is(utils.getClassName(unsafeWin), "XPCSafeJSObjectWrapper", "can get a SJOW");
|
||||
is(utils.getClassName(unsafeWin.location), "XPCSafeJSObjectWrapper", "deep wrapping works");
|
||||
is(utils.getClassName(unsafeWin), "Proxy", "can get a Proxy");
|
||||
is(utils.getClassName(unsafeWin.location), "Proxy", "deep wrapping works");
|
||||
|
||||
Object.defineProperty(unsafeWin, "defprop1", { value: 1, writable: true, enumerable: true });
|
||||
/* TODO (bug 552854): the getter isn't visible in content.
|
||||
function checkWrapper(val) {
|
||||
ok(utils.getClassName(val) == "XPCSafeJSObjectWrapper", "wrapped properly");
|
||||
ok(utils.getClassName(val) == "Proxy", "wrapped properly");
|
||||
}
|
||||
Object.defineProperty(unsafeWin, "defprop2", { set: checkWrapper, enumerable: true });
|
||||
*/
|
||||
unsafeWin.run_test(ok, win, unsafeWin);
|
||||
|
||||
win.setTimeout(function() {
|
||||
is(utils.getClassName(this), "XPCNativeWrapper",
|
||||
is(utils.getClassName(this), "Proxy",
|
||||
"this is wrapped correctly");
|
||||
SimpleTest.finish();
|
||||
}, 0)
|
||||
|
@ -15,10 +15,10 @@
|
||||
}
|
||||
function run_test(ok, xpcnw, sjow) {
|
||||
// both wrappers should point to our window: XOW
|
||||
check_wrapper(ok, ok, "Function", "functions are wrapped properly")
|
||||
check_wrapper(ok, ok, "Proxy", "functions are wrapped properly")
|
||||
check_parent(ok, ok, window, "ok is parented correctly");
|
||||
check_wrapper(ok, xpcnw, "XPCCrossOriginWrapper", "XPCNWs are transformed correctly");
|
||||
check_wrapper(ok, sjow, "XPCCrossOriginWrapper", "SJOWs are transformed correctly");
|
||||
check_wrapper(ok, xpcnw, "Proxy", "XPCNWs are transformed correctly");
|
||||
check_wrapper(ok, sjow, "Proxy", "SJOWs are transformed correctly");
|
||||
|
||||
ok(defprop1 === 1, "defprop1 exists");
|
||||
window.defprop1 = 2;
|
||||
|
@ -52,14 +52,14 @@ function runTest()
|
||||
});
|
||||
|
||||
// stopPropagation should not prevent the browser link handling from occuring
|
||||
frames[1].stopMode = true;
|
||||
frames[1].wrappedJSObject.stopMode = true;
|
||||
var body = document.getElementById("contentchild").contentDocument.body;
|
||||
expectLink(body, "http://www.mozilla.org", "http://www.mozilla.org",
|
||||
[ [ { type: "text/uri-list", data: "http://www.mozilla.org" } ] ],
|
||||
"text/x-moz-url drop on browser with stopPropagation drop event");
|
||||
|
||||
// canceling the event, however, should prevent the link from being handled
|
||||
frames[1].cancelMode = true;
|
||||
frames[1].wrappedJSObject.cancelMode = true;
|
||||
expectLink(body, "", "",
|
||||
[ [ { type: "text/uri-list", data: "http://www.example.org" } ] ],
|
||||
"text/x-moz-url drop on browser with cancelled drop event");
|
||||
|
Loading…
Reference in New Issue
Block a user