diff options
author | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-19 15:18:37 +0100 |
---|---|---|
committer | janekptacijarabaci <janekptacijarabaci@seznam.cz> | 2018-03-19 15:18:37 +0100 |
commit | 6822460d3b0d4609ee5d4e1ab4b093799ed06580 (patch) | |
tree | 9bc036539687d788ab61e2f5aabc6729a4e6a3d3 /js/src/jsatom.cpp | |
parent | 213f9ea384c71eac84667d65a21dc96e422798db (diff) | |
download | UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.gz UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.lz UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.tar.xz UXP-6822460d3b0d4609ee5d4e1ab4b093799ed06580.zip |
Bug 1317309: Throw a TypeError when passing a Symbol value to ToAtom
Issue #78
[Depends on] Bug 883377: Implement ES6 function "name" property
semantics
Diffstat (limited to 'js/src/jsatom.cpp')
-rw-r--r-- | js/src/jsatom.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/js/src/jsatom.cpp b/js/src/jsatom.cpp index 3f8e8d8f8..2a3c58638 100644 --- a/js/src/jsatom.cpp +++ b/js/src/jsatom.cpp @@ -510,6 +510,14 @@ ToAtomSlow(ExclusiveContext* cx, typename MaybeRooted<Value, allowGC>::HandleTyp return v.toBoolean() ? cx->names().true_ : cx->names().false_; if (v.isNull()) return cx->names().null; + if (v.isSymbol()) { + if (cx->shouldBeJSContext() && allowGC) { + JS_ReportErrorNumberASCII(cx->asJSContext(), GetErrorMessage, nullptr, + JSMSG_SYMBOL_TO_STRING); + } + return nullptr; + } + MOZ_ASSERT(v.isUndefined()); return cx->names().undefined; } |