mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-20 00:35:44 +00:00
Bug 1651732 - Part 8: Split ValueToId callers in js::Stringify. r=jandem
Only call `ValueToId` for primitive values in preparation for the next patch and instead call `ToAtom` for objects. Differential Revision: https://phabricator.services.mozilla.com/D83059
This commit is contained in:
parent
60f966c979
commit
616df230cc
@ -770,7 +770,12 @@ bool js::Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Step 4b(iii)(5)(c-g). */
|
/* Step 4b(iii)(5)(c-g). */
|
||||||
if (!item.isNumber() && !item.isString()) {
|
RootedId id(cx);
|
||||||
|
if (item.isNumber() || item.isString()) {
|
||||||
|
if (!ValueToId<CanGC>(cx, item, &id)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
ESClass cls;
|
ESClass cls;
|
||||||
if (!GetClassOfValue(cx, item, &cls)) {
|
if (!GetClassOfValue(cx, item, &cls)) {
|
||||||
return false;
|
return false;
|
||||||
@ -779,11 +784,13 @@ bool js::Stringify(JSContext* cx, MutableHandleValue vp, JSObject* replacer_,
|
|||||||
if (cls != ESClass::String && cls != ESClass::Number) {
|
if (cls != ESClass::String && cls != ESClass::Number) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
RootedId id(cx);
|
JSAtom* atom = ToAtom<CanGC>(cx, item);
|
||||||
if (!ValueToId<CanGC>(cx, item, &id)) {
|
if (!atom) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
id.set(AtomToId(atom));
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Step 4b(iii)(5)(g). */
|
/* Step 4b(iii)(5)(g). */
|
||||||
|
Loading…
Reference in New Issue
Block a user