diff options
author | Gaming4JC <g4jc@hyperbola.info> | 2019-07-13 23:12:12 -0400 |
---|---|---|
committer | Gaming4JC <g4jc@hyperbola.info> | 2019-07-18 22:38:42 -0400 |
commit | 7e510ee9b4dee7c2d15005baac89a2017f5673ef (patch) | |
tree | e5f2022cbd0841cec5d7d71b268c8c7dc3af5556 /js/src | |
parent | 7b1c6a022c4c0606b1b75e492a256ae7f4af305d (diff) | |
download | UXP-7e510ee9b4dee7c2d15005baac89a2017f5673ef.tar UXP-7e510ee9b4dee7c2d15005baac89a2017f5673ef.tar.gz UXP-7e510ee9b4dee7c2d15005baac89a2017f5673ef.tar.lz UXP-7e510ee9b4dee7c2d15005baac89a2017f5673ef.tar.xz UXP-7e510ee9b4dee7c2d15005baac89a2017f5673ef.zip |
1359622 - Fix assert for calling Function.toString on class constructors when the compartment has had source discarded.
Diffstat (limited to 'js/src')
-rw-r--r-- | js/src/jit-test/tests/class/bug1359622.js | 4 | ||||
-rw-r--r-- | js/src/jsfun.cpp | 6 |
2 files changed, 8 insertions, 2 deletions
diff --git a/js/src/jit-test/tests/class/bug1359622.js b/js/src/jit-test/tests/class/bug1359622.js new file mode 100644 index 000000000..b4a0df749 --- /dev/null +++ b/js/src/jit-test/tests/class/bug1359622.js @@ -0,0 +1,4 @@ +setDiscardSource(true) +evaluate(` + unescape(class get { static staticMethod() {} }); +`); diff --git a/js/src/jsfun.cpp b/js/src/jsfun.cpp index 0886923fd..06dc40162 100644 --- a/js/src/jsfun.cpp +++ b/js/src/jsfun.cpp @@ -1022,8 +1022,10 @@ js::FunctionToString(JSContext* cx, HandleFunction fun, bool prettyPrint) return nullptr; } } else { - // Default class constructors should always haveSource. - MOZ_ASSERT(!fun->infallibleIsDefaultClassConstructor(cx)); + // Default class constructors should always haveSource unless source + // has been discarded for the whole compartment. + MOZ_ASSERT(!fun->infallibleIsDefaultClassConstructor(cx) || + fun->compartment()->behaviors().discardSource()); if (!AppendPrelude() || !out.append("() {\n ")) |