Skip to content

Commit

Permalink
Fix enumerability of Error and Function properties.
Browse files Browse the repository at this point in the history
The Error.message, Error.stackTrace, Function.prototype properties were
defined with the wrong attributes.

x
  • Loading branch information
ccxvii committed Jan 23, 2020
1 parent e082e6e commit 6f93cab
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions jserror.c
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,10 @@ static int jsB_ErrorX(js_State *J, js_Object *prototype)
js_pushobject(J, jsV_newobject(J, JS_CERROR, prototype));
if (top > 1) {
js_pushstring(J, js_tostring(J, 1));
js_setproperty(J, -2, "message");
js_defproperty(J, -2, "message", JS_DONTENUM);
}
if (jsB_stacktrace(J, 1))
js_setproperty(J, -2, "stackTrace");
js_defproperty(J, -2, "stackTrace", JS_DONTENUM);
return 1;
}

Expand Down
6 changes: 3 additions & 3 deletions jsvalue.c
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ void js_newfunction(js_State *J, js_Function *fun, js_Environment *scope)
js_copy(J, -2);
js_defproperty(J, -2, "constructor", JS_DONTENUM);
}
js_defproperty(J, -2, "prototype", JS_DONTCONF);
js_defproperty(J, -2, "prototype", JS_DONTENUM | JS_DONTCONF);
}
}

Expand Down Expand Up @@ -445,7 +445,7 @@ void js_newcfunction(js_State *J, js_CFunction cfun, const char *name, int lengt
js_copy(J, -2);
js_defproperty(J, -2, "constructor", JS_DONTENUM);
}
js_defproperty(J, -2, "prototype", JS_DONTCONF);
js_defproperty(J, -2, "prototype", JS_DONTENUM | JS_DONTCONF);
}
}

Expand All @@ -464,7 +464,7 @@ void js_newcconstructor(js_State *J, js_CFunction cfun, js_CFunction ccon, const
js_rot2(J); /* obj proto */
js_copy(J, -2); /* obj proto obj */
js_defproperty(J, -2, "constructor", JS_DONTENUM);
js_defproperty(J, -2, "prototype", JS_READONLY | JS_DONTENUM | JS_DONTCONF);
js_defproperty(J, -2, "prototype", JS_DONTENUM | JS_DONTCONF);
}
}

Expand Down

0 comments on commit 6f93cab

Please sign in to comment.