зеркало из https://github.com/mozilla/gecko-dev.git
Outerize the results of nsIDOMWindowUtils.getParent and the jsshell's parent() methods. r=orange
--HG-- extra : rebase_source : 848ad247e5094b6eb8edce6198bfb1d368c31bc3
This commit is contained in:
Родитель
08d3d1fa5e
Коммит
b97410bfd2
|
@ -1313,7 +1313,17 @@ nsDOMWindowUtils::GetParent()
|
|||
if(JSVAL_IS_PRIMITIVE(argv[0]))
|
||||
return NS_ERROR_XPC_BAD_CONVERT_JS;
|
||||
|
||||
*rval = OBJECT_TO_JSVAL(JS_GetParent(cx, JSVAL_TO_OBJECT(argv[0])));
|
||||
JSObject *parent = JS_GetParent(cx, JSVAL_TO_OBJECT(argv[0]));
|
||||
*rval = OBJECT_TO_JSVAL(parent);
|
||||
|
||||
// Outerize if necessary. Embrace the ugliness!
|
||||
JSClass *clasp = JS_GetClass(cx, parent);
|
||||
if (clasp->flags & JSCLASS_IS_EXTENDED) {
|
||||
JSExtendedClass *xclasp = reinterpret_cast<JSExtendedClass *>(clasp);
|
||||
if (JSObjectOp outerize = xclasp->outerObject)
|
||||
*rval = OBJECT_TO_JSVAL(outerize(cx, parent));
|
||||
}
|
||||
|
||||
cc->SetReturnValueWasSet(PR_TRUE);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -3672,7 +3672,17 @@ Parent(JSContext *cx, uintN argc, jsval *vp)
|
|||
return JS_FALSE;
|
||||
}
|
||||
|
||||
*vp = OBJECT_TO_JSVAL(JS_GetParent(cx, JSVAL_TO_OBJECT(v)));
|
||||
JSObject *parent = JS_GetParent(cx, JSVAL_TO_OBJECT(v));
|
||||
*rval = OBJECT_TO_JSVAL(parent);
|
||||
|
||||
/* Outerize if necessary. Embrace the ugliness! */
|
||||
JSClass *clasp = JS_GetClass(cx, parent);
|
||||
if (clasp->flags & JSCLASS_IS_EXTENDED) {
|
||||
JSExtendedClass *xclasp = reinterpret_cast<JSExtendedClass *>(clasp);
|
||||
if (JSObjectOp outerize = xclasp->outerObject)
|
||||
*rval = OBJECT_TO_JSVAL(outerize(cx, parent));
|
||||
}
|
||||
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче