Bug 593559 - JSFUN_CONSTRUCTOR should not use the same bit as JSPROP_READONLY (r=brendan)
authorLuke Wagner <lw@mozilla.com>
Tue, 02 Nov 2010 17:40:46 -0700
changeset 57688 279e8fdbc3468f060c0575a0fc8bfd9bced7ebdf
parent 57687 04272020d87327ee9bd250a97bcf31f0fe23b41a
child 57690 7ec0a71652a6f0314eb49852ef93e71d0a0649f0
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
reviewersbrendan
bugs593559
milestone2.0b8pre
Bug 593559 - JSFUN_CONSTRUCTOR should not use the same bit as JSPROP_READONLY (r=brendan)
js/src/jit-test/tests/basic/testBug593559.js
js/src/jsapi.h
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/testBug593559.js
@@ -0,0 +1,10 @@
+var gen = (function () {yield})();
+var t = gen.throw;
+
+try {
+    new t;
+} catch (e) {
+    actual = "" + e;
+}
+assertEq(actual, "TypeError: Generator.prototype.throw called on incompatible Object");
+
--- a/js/src/jsapi.h
+++ b/js/src/jsapi.h
@@ -480,26 +480,26 @@ extern JS_PUBLIC_DATA(jsid) JSID_EMPTY;
                                            set of the same-named property in an
                                            object that delegates to a prototype
                                            containing this property */
 #define JSPROP_INDEX            0x80    /* name is actually (jsint) index */
 #define JSPROP_SHORTID          0x100   /* set in JSPropertyDescriptor.attrs
                                            if getters/setters use a shortid */
 
 /* Function flags, set in JSFunctionSpec and passed to JS_NewFunction etc. */
-#define JSFUN_CONSTRUCTOR       0x02    /* native that can be called as a ctor
-                                           without creating a this object */
 #define JSFUN_LAMBDA            0x08    /* expressed, not declared, function */
 #define JSFUN_HEAVYWEIGHT       0x80    /* activation requires a Call object */
 
 #define JSFUN_HEAVYWEIGHT_TEST(f)  ((f) & JSFUN_HEAVYWEIGHT)
 
 #define JSFUN_PRIMITIVE_THIS  0x0100    /* |this| may be a primitive value */
-
-#define JSFUN_FLAGS_MASK      0x07fa    /* overlay JSFUN_* attributes --
+#define JSFUN_CONSTRUCTOR     0x0200    /* native that can be called as a ctor
+                                           without creating a this object */
+
+#define JSFUN_FLAGS_MASK      0x07f8    /* overlay JSFUN_* attributes --
                                            bits 12-15 are used internally to
                                            flag interpreted functions */
 
 #define JSFUN_STUB_GSOPS      0x1000    /* use JS_PropertyStub getter/setter
                                            instead of defaulting to class gsops
                                            for property holding function */
 
 /*