Bug 541742 - Make XPCNativeWrapper.unwrap work. r=bzbarsky
This commit is contained in:
Родитель
be34fc16fc
Коммит
a4c692a569
|
@ -1180,7 +1180,17 @@ UnwrapNW(JSContext *cx, uintN argc, jsval *vp)
|
|||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return GetwrappedJSObject(cx, JSVAL_TO_OBJECT(v), vp);
|
||||
XPCWrappedNative *wn;
|
||||
if (!XPCNativeWrapper::GetWrappedNative(cx, JSVAL_TO_OBJECT(v), &wn)) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
if (!wn) {
|
||||
JS_SET_RVAL(cx, vp, JSVAL_NULL);
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
return GetwrappedJSObject(cx, wn->GetFlatJSObject(), vp);
|
||||
}
|
||||
|
||||
static JSFunctionSpec static_functions[] = {
|
||||
|
|
|
@ -3,9 +3,9 @@
|
|||
<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
|
||||
type="text/css"?>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=500931
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=533596
|
||||
-->
|
||||
<window title="Mozilla Bug 500931"
|
||||
<window title="Mozilla Bug 533596"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||
|
@ -34,6 +34,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=500931
|
|||
var win = $('ifr').contentWindow;
|
||||
var utils = window.getInterface(Components.interfaces.nsIDOMWindowUtils);
|
||||
is(utils.getClassName(win), "XPCNativeWrapper", "win is an XPCNW");
|
||||
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",
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>Inner frame for bug 500931 mochitest</title>
|
||||
<script>x = 42;</script>
|
||||
</head>
|
||||
<body>
|
||||
</body>
|
||||
|
|
Загрузка…
Ссылка в новой задаче