Bug 821850 - Properly propagate |strict| in JSObject::deleteByValue. r=jorendorff
authorBobby Holley <bobbyholley@gmail.com>
Fri, 08 Feb 2013 14:24:19 +0000
changeset 131178 60c531ee1fbed09e53b197f914fa9d75642cb639
parent 131177 a286986efccf8123dc73c0a3eb6cceb9259a2e2b
child 131179 7e7bd18931c180fbb2f3faedc45bf389587dbc9a
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs821850
milestone21.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 821850 - Properly propagate |strict| in JSObject::deleteByValue. r=jorendorff
js/src/jit-test/tests/basic/bug821850.js
js/src/jsobj.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug821850.js
@@ -0,0 +1,9 @@
+load(libdir + "asserts.js");
+
+m={}
+Object.defineProperty(m, 'p', {value: 3});
+assertThrowsInstanceOf(function() {"use strict"; delete m.p;}, TypeError);
+
+x = new Proxy(m, {})
+assertEq(x.p, 3);
+assertEq((function fun() {"use strict"; return delete x.p; })(), false);
--- a/js/src/jsobj.cpp
+++ b/js/src/jsobj.cpp
@@ -1618,20 +1618,20 @@ JSObject::deleteByValue(JSContext *cx, H
     if (ValueIsSpecial(obj, &propval, &sid, cx))
         return deleteSpecial(cx, obj, sid, rval, strict);
 
     JSAtom *name = ToAtom<CanGC>(cx, propval);
     if (!name)
         return false;
 
     if (name->isIndex(&index))
-        return deleteElement(cx, obj, index, rval, false);
+        return deleteElement(cx, obj, index, rval, strict);
 
     Rooted<PropertyName*> propname(cx, name->asPropertyName());
-    return deleteProperty(cx, obj, propname, rval, false);
+    return deleteProperty(cx, obj, propname, rval, strict);
 }
 
 JS_FRIEND_API(bool)
 JS_CopyPropertiesFrom(JSContext *cx, JSObject *targetArg, JSObject *objArg)
 {
     RootedObject target(cx, targetArg);
     RootedObject obj(cx, objArg);