Closed Bug 1219057 Opened 4 years ago Closed 4 years ago

Don't show "Unable to print stack trace" for top-level syntax errors

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla44
Tracking Status
firefox44 --- fixed

People

(Reporter: jruderman, Assigned: arai)

References

Details

(Keywords: testcase)

Attachments

(1 file)

js> foo bar
typein:1:4 SyntaxError: missing ; before statement:
typein:1:4 foo bar
typein:1:4 ....^
(Unable to print stack trace)

In this case, the stack is just empty, rather than missing, so we don't need a warning.
Disabled the "Unable to print stack trace" message for |exnObj->as<ErrorObject>().stack() == nullptr| case, that seems to happen only while compiling top-level script.
https://dxr.mozilla.org/mozilla-central/rev/9a8f2342fb3116d23989087e026448d38a3768c5/js/src/jsexn.cpp#710
Assignee: nobody → arai.unmht
Attachment #8679747 - Flags: review?(jdemooij)
Comment on attachment 8679747 [details] [diff] [review]
Do not show "Unable to print stack trace" for exception thrown while compiling top-level script.

Review of attachment 8679747 [details] [diff] [review]:
-----------------------------------------------------------------

::: js/src/shell/js.cpp
@@ +5228,5 @@
>      // Ignore non-ErrorObject thrown by |throw| statement.
>      if (!exnObj->is<ErrorObject>())
>          return true;
>  
> +    // Exception thrown while compiling top-level script have no stack.

Nit: s/Exception/Exceptions/ to match (plural) "have"
Attachment #8679747 - Flags: review?(jdemooij) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/50c8bbe25d6866bf05c355b28cd27c98fc534453
Bug 1219057 - Do not show "Unable to print stack trace" for exception thrown while compiling top-level script. r=jandem
https://hg.mozilla.org/mozilla-central/rev/50c8bbe25d68
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla44
You need to log in before you can comment on or make changes to this bug.