[INFER] Set script for type of Function.prototype, bug 675889.
authorBrian Hackett <bhackett1024@gmail.com>
Tue, 02 Aug 2011 08:27:42 -0700
changeset 76089 91281c11a122752991030da2bd8ec7583628013f
parent 76088 674160662e80b4537796dec10668fb3117fd41db
child 76090 a82d5a5e070e069a9ffc53cd8868cb0ed38974c5
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
bugs675889
milestone8.0a1
[INFER] Set script for type of Function.prototype, bug 675889.
js/src/jit-test/tests/basic/bug675889.js
js/src/jsfun.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug675889.js
@@ -0,0 +1,8 @@
+function checkMethods(proto) {
+    var names = Object.getOwnPropertyNames(proto);
+    for (var i = 0; i < names.length; i++) {
+        var name = names[i];
+        var prop = proto[name];
+    }
+}
+checkMethods(Function.prototype);
--- a/js/src/jsfun.cpp
+++ b/js/src/jsfun.cpp
@@ -2426,16 +2426,17 @@ js_InitFunctionClass(JSContext *cx, JSOb
         return NULL;
     script->noScriptRval = true;
     script->code[0] = JSOP_STOP;
     script->code[1] = SRC_NULL;
 #ifdef CHECK_SCRIPT_OWNER
     script->owner = NULL;
 #endif
     fun->u.i.script = script;
+    fun->getType(cx)->functionScript = script;
     script->hasFunction = true;
     script->where.fun = fun;
     script->setOwnerObject(fun);
     js_CallNewScriptHook(cx, script, fun);
 
     if (obj->isGlobal()) {
         /* ES5 13.2.3: Construct the unique [[ThrowTypeError]] function object. */
         JSFunction *throwTypeError =