Bug 1589002 - Remove overzealous assertion in JS_CopyStringCharsZ. r=jonco
authorJan de Mooij <jdemooij@mozilla.com>
Thu, 17 Oct 2019 13:14:02 +0000
changeset 497993 add4a5be7b9311965496e8b79bc26ac096083e98
parent 497992 ae97896004707ce6cdcba5827056e620247fee9b
child 497994 210a032a7f17b77efcf1d488cc408dc413544049
push id36703
push userccoroiu@mozilla.com
push dateThu, 17 Oct 2019 21:54:25 +0000
treeherdermozilla-central@c260b3893967 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjonco
bugs1589002
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1589002 - Remove overzealous assertion in JS_CopyStringCharsZ. r=jonco I added this API to copy a string's character to a new buffer, but we can call this on strings from a different Zone. This should be fine because ensureLinear doesn't use the context's Zone. Differential Revision: https://phabricator.services.mozilla.com/D49579
js/src/jit-test/tests/basic/bug1589002.js
js/src/jsapi.cpp
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/basic/bug1589002.js
@@ -0,0 +1,7 @@
+var g = newGlobal({newCompartment: true});
+g.parent = this;
+g.eval(`
+  x = "12";
+  x += "3";
+  parent.evaluate("", {global: this, sourceMapURL: x});
+`);
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -4386,17 +4386,16 @@ JS_PUBLIC_API bool JS_CopyStringChars(JS
   CopyChars(dest.begin().get(), *linear);
   return true;
 }
 
 extern JS_PUBLIC_API JS::UniqueTwoByteChars JS_CopyStringCharsZ(JSContext* cx,
                                                                 JSString* str) {
   AssertHeapIsIdle();
   CHECK_THREAD(cx);
-  cx->check(str);
 
   JSLinearString* linear = str->ensureLinear(cx);
   if (!linear) {
     return nullptr;
   }
 
   size_t len = linear->length();