summaryrefslogtreecommitdiffstats
path: root/js
diff options
context:
space:
mode:
Diffstat (limited to 'js')
-rw-r--r--js/src/jit-test/tests/class/bug1359622.js4
-rw-r--r--js/src/jsfun.cpp6
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 "))