зеркало из https://github.com/mozilla/pjs.git
Bug 375801: Using (void 0) instead of "undefined" in toSource and uneval(), r=mrbkap
This commit is contained in:
Родитель
8f7a84d374
Коммит
72d77a0731
|
@ -338,6 +338,7 @@ js_InitPinnedAtoms(JSContext *cx, JSAtomState *state)
|
|||
FROB(toStringAtom, js_toString_str);
|
||||
FROB(toLocaleStringAtom, js_toLocaleString_str);
|
||||
FROB(valueOfAtom, js_valueOf_str);
|
||||
FROB(void0Atom, "(void 0)");
|
||||
|
||||
#if JS_HAS_XML_SUPPORT
|
||||
FROB(etagoAtom, js_etago_str);
|
||||
|
|
|
@ -203,6 +203,7 @@ struct JSAtomState {
|
|||
JSAtom *toSourceAtom;
|
||||
JSAtom *toStringAtom;
|
||||
JSAtom *valueOfAtom;
|
||||
JSAtom *void0Atom;
|
||||
JSAtom *xmlAtom;
|
||||
|
||||
/* Less frequently used atoms, pinned lazily by JS_ResolveStandardClass. */
|
||||
|
|
|
@ -2688,6 +2688,8 @@ js_ValueToSource(JSContext *cx, jsval v)
|
|||
JSTempValueRooter tvr;
|
||||
JSString *str;
|
||||
|
||||
if (JSVAL_IS_VOID(v))
|
||||
return ATOM_TO_STRING(cx->runtime->atomState.void0Atom);
|
||||
if (JSVAL_IS_STRING(v))
|
||||
return js_QuoteString(cx, JSVAL_TO_STRING(v), '"');
|
||||
if (JSVAL_IS_PRIMITIVE(v)) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче