Mercurial > pymonkey
diff context.c @ 89:e77bc7c799e8
JS runtime mismatches are now checked for and enforced so they won't cause segfaults.
author | Atul Varma <varmaa@toolness.com> |
---|---|
date | Sun, 09 Aug 2009 22:54:15 -0700 |
parents | 345d4c0e3dd3 |
children | 97d1faf02460 |
line wrap: on
line diff
--- a/context.c Sun Aug 09 22:26:45 2009 -0700 +++ b/context.c Sun Aug 09 22:54:15 2009 -0700 @@ -119,6 +119,8 @@ if (!PyArg_ParseTuple(args, "O!", &PYM_JSObjectType, &object)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); + JSObject *obj = object->obj; if (JS_ObjectIsFunction(self->cx, obj)) { @@ -159,6 +161,8 @@ if (!PyArg_ParseTuple(args, "O!", &PYM_JSObjectType, &object)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); + JSObject *obj = object->obj; if (JS_ObjectIsFunction(self->cx, obj)) { @@ -216,6 +220,8 @@ &string)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); + JSString *jsString = JS_NewUCStringCopyZ(self->cx, (const jschar *) string); if (jsString == NULL) { @@ -262,6 +268,8 @@ if (!PyArg_ParseTuple(args, "O!", &PYM_JSObjectType, &object)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); + if (!JS_InitStandardClasses(self->cx, object->obj)) { PyErr_SetString(PYM_error, "JS_InitStandardClasses() failed"); return NULL; @@ -284,6 +292,8 @@ &source, &sourceLen, &filename, &lineNo)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); + jsval rval; JSBool result; Py_BEGIN_ALLOW_THREADS; @@ -312,6 +322,7 @@ &name, &value)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, object->runtime); jsval jsValue; if (PYM_pyObjectToJsval(self, value, &jsValue) == -1) @@ -342,6 +353,9 @@ &PyTuple_Type, &funcArgs)) return NULL; + PYM_ENSURE_RUNTIME_MATCH(self->runtime, obj->runtime); + PYM_ENSURE_RUNTIME_MATCH(self->runtime, fun->base.runtime); + uintN argc = PyTuple_Size(funcArgs); jsval argv[argc]; jsval *currArg = argv;