summaryrefslogtreecommitdiff
path: root/js/src/jsfun.cpp
diff options
context:
space:
mode:
authorGaming4JC <g4jc@hyperbola.info>2019-07-13 23:12:12 -0400
committerGaming4JC <g4jc@hyperbola.info>2019-07-18 22:38:42 -0400
commit21d5d683b387d5b813b99d43456bd05fc8a7cc86 (patch)
treee5f2022cbd0841cec5d7d71b268c8c7dc3af5556 /js/src/jsfun.cpp
parent575c08d7f3e13d50204bd7067d5a89abb931130a (diff)
downloadaura-central-21d5d683b387d5b813b99d43456bd05fc8a7cc86.tar.gz
1359622 - Fix assert for calling Function.toString on class constructors when the compartment has had source discarded.
Diffstat (limited to 'js/src/jsfun.cpp')
-rw-r--r--js/src/jsfun.cpp6
1 files changed, 4 insertions, 2 deletions
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 "))