summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--javascript/jsapi.h1
-rw-r--r--javascript/jsapi/document.c4
-rw-r--r--javascript/jsapi/window.c12
3 files changed, 14 insertions, 3 deletions
diff --git a/javascript/jsapi.h b/javascript/jsapi.h
index cf099ccf0..a44323f77 100644
--- a/javascript/jsapi.h
+++ b/javascript/jsapi.h
@@ -79,7 +79,6 @@ JS_NewCompartmentAndGlobalObject(JSContext *cx,
if (global == NULL) {
return NULL;
}
- JS_SetGlobalObject(cx, global);
return global;
}
diff --git a/javascript/jsapi/document.c b/javascript/jsapi/document.c
index dfad551d6..bb5019c4b 100644
--- a/javascript/jsapi/document.c
+++ b/javascript/jsapi/document.c
@@ -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;
}
diff --git a/javascript/jsapi/window.c b/javascript/jsapi/window.c
index 06e6cdfe8..0b7673be3 100644
--- a/javascript/jsapi/window.c
+++ b/javascript/jsapi/window.c
@@ -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;
}