diff --git a/js/src/jit-test/tests/basic/testBug1235874.js b/js/src/jit-test/tests/basic/testBug1235874.js new file mode 100644 index 000000000000..8e7841081482 --- /dev/null +++ b/js/src/jit-test/tests/basic/testBug1235874.js @@ -0,0 +1 @@ +evaluate('evalcx("1")', { fileName: null }); diff --git a/js/src/jsapi.cpp b/js/src/jsapi.cpp index 0f771237d3a5..76f3a2d756aa 100644 --- a/js/src/jsapi.cpp +++ b/js/src/jsapi.cpp @@ -5909,6 +5909,8 @@ JS_PUBLIC_API(bool) DescribeScriptedCaller(JSContext* cx, UniqueChars* filename, unsigned* lineno, unsigned* column) { + if (filename) + filename->reset(); if (lineno) *lineno = 0; if (column) @@ -5923,7 +5925,7 @@ DescribeScriptedCaller(JSContext* cx, UniqueChars* filename, unsigned* lineno, if (i.activation()->scriptedCallerIsHidden()) return false; - if (filename) { + if (filename && i.filename()) { UniqueChars copy = make_string_copy(i.filename()); if (!copy) return false;