mirror of
https://github.com/netsurf-browser/netsurf
synced 2024-12-18 02:02:36 +03:00
fix global handling
This commit is contained in:
parent
d763e57d30
commit
c0aaf31f5a
@ -79,7 +79,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
|
||||
if (global == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
JS_SetGlobalObject(cx, global);
|
||||
return global;
|
||||
}
|
||||
|
||||
|
@ -92,8 +92,10 @@ JSObject *jsapi_new_document(JSContext *cx, JSObject *parent, void *doc_priv)
|
||||
|
||||
LOG(("setting content to %p",doc_priv));
|
||||
/* private pointer to browsing context */
|
||||
if (!JS_SetPrivate(cx, doc, doc_priv))
|
||||
if (JS_SetPrivate(cx, doc, doc_priv) != JS_TRUE) {
|
||||
LOG(("failed to set content"));
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
@ -299,8 +299,18 @@ JSObject * jsapi_new_window(JSContext *cx, JSObject *parent, void *win_priv)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/** @todo reconsider global object handling. future
|
||||
* editions of spidermonkey appear to be removing the
|
||||
* idea of a global so we probably need to handle
|
||||
* global object references internally
|
||||
*/
|
||||
|
||||
/* set the contexts global */
|
||||
JS_SetGlobalObject(cx, window);
|
||||
|
||||
/* Populate the global object with the standard globals, like
|
||||
Object and Array. */
|
||||
* Object and Array.
|
||||
*/
|
||||
if (!JS_InitStandardClasses(cx, window)) {
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user