diff --git a/js/src/jsapi-tests/Makefile.in b/js/src/jsapi-tests/Makefile.in index 48ff8baa141..d63a7f1ea6e 100644 --- a/js/src/jsapi-tests/Makefile.in +++ b/js/src/jsapi-tests/Makefile.in @@ -57,6 +57,7 @@ CPPSRCS = \ testPropCache.cpp \ testTrap.cpp \ testSameValue.cpp \ + testSeal.cpp \ testXDR.cpp \ $(NULL) diff --git a/js/src/jsapi-tests/testSeal.cpp b/js/src/jsapi-tests/testSeal.cpp new file mode 100644 index 00000000000..55ecd9bdd6b --- /dev/null +++ b/js/src/jsapi-tests/testSeal.cpp @@ -0,0 +1,10 @@ +#include "tests.h" + +BEGIN_TEST(testSeal_bug535703) +{ + JSObject *obj = JS_NewObject(cx, NULL, NULL, NULL); + CHECK(obj); + JS_SealObject(cx, obj, JS_TRUE); // don't crash + return true; +} +END_TEST(testSeal_bug535703) diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index faeee86e646..eb08f7fb917 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -2947,6 +2947,8 @@ JS_SealObject(JSContext *cx, JSObject *obj, JSBool deep) nslots = scope->freeslot; for (i = 0; i != nslots; ++i) { v = STOBJ_GET_SLOT(obj, i); + if (i == JSSLOT_PRIVATE && (obj->getClass()->flags & JSCLASS_HAS_PRIVATE)) + continue; if (JSVAL_IS_PRIMITIVE(v)) continue; if (!JS_SealObject(cx, JSVAL_TO_OBJECT(v), deep))