зеркало из https://github.com/mozilla/gecko-dev.git
Bug 478433 - Use a better method to create this function. r+sr=jst
This commit is contained in:
Родитель
2936afe95f
Коммит
69aa2d6536
|
@ -645,8 +645,20 @@ XPC_NW_NewResolve(JSContext *cx, JSObject *obj, jsval id, uintN flags,
|
|||
|
||||
if (id == GetRTStringByIndex(cx, XPCJSRuntime::IDX_TO_STRING)) {
|
||||
*objp = obj;
|
||||
return JS_DefineFunction(cx, obj, "toString",
|
||||
XPC_NW_toString, 0, 0) != nsnull;
|
||||
|
||||
// See the comment in XPC_NW_WrapFunction for why we create this function
|
||||
// like this.
|
||||
JSFunction *fun = JS_NewFunction(cx, XPC_NW_toString, 0, 0, nsnull,
|
||||
"toString");
|
||||
if (!fun) {
|
||||
return JS_FALSE;
|
||||
}
|
||||
|
||||
JSObject *funobj = JS_GetFunctionObject(fun);
|
||||
STOBJ_SET_PARENT(funobj, obj);
|
||||
|
||||
return JS_DefineProperty(cx, obj, "toString", OBJECT_TO_JSVAL(funobj),
|
||||
nsnull, nsnull, 0);
|
||||
}
|
||||
|
||||
if (!EnsureLegalActivity(cx, obj)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче