Closed Bug 1240675 Opened 8 years ago Closed 8 years ago

Add tests for Bug 1208641

Categories

(Core :: General, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla47
Tracking Status
firefox46 --- affected
firefox47 --- fixed

People

(Reporter: wcpan, Unassigned)

Details

Attachments

(1 file)

Add a test to ensure bug 1208641 do not fail.
An uncaught exception will cause the test fail, but unfortunately it's what I need to test.

Maybe we need something like "except_exception = MyException" in mochitest.
I could help writing devtools test against that. Also I already wrote more low level test in xpconnect.
We already assert for valid stacks for common web exception.
In what precise scenarios should we see new stack appear on exceptions?

If I follow correctly, last patch from bug 1208641 is going to focus on window-related exceptions,
so it won't show JSM stacks yet?
(In reply to Alexandre Poirot [:ochameau] from comment #2)
> I could help writing devtools test against that. Also I already wrote more
> low level test in xpconnect.
> We already assert for valid stacks for common web exception.
> In what precise scenarios should we see new stack appear on exceptions?
>
> If I follow correctly, last patch from bug 1208641 is going to focus on
> window-related exceptions,
> so it won't show JSM stacks yet?

Yes, if a JSM throws an exception which created by Components.Exception, then the stack won't show in console.

I've tried to throw exception in the mochitest, but I can't seem to reproduce the problem.

Here is how I reproduce bug 1208641 on B2G:
1. modify some frequently used js module, e.g. BrowserElementParent.js
2. throw Components.Exception in every method
3. use adb logcat to observe B2G logs, some exceptions won't print the stack
> An uncaught exception will cause the test fail, but unfortunately it's what I need to test.

SimpleTest.expectUncaughtException() will solve this problem for you.  But from inside a mochitest it may not be trivial to tell what the console sees, so a devtools test is likely better.

> In what precise scenarios should we see new stack appear on exceptions?

  <script>
  function f() {
    throw new DOMException("Hello");
  }
  f();
  </script>
Attached patch patch v1Splinter Review
Here is a patch varifying that stacks now appear on following code:
  document.querySelector("broken;selector");
  throw new DOMException("plop"); // <= may be this one is redundant?
Attachment #8721980 - Flags: review?(vporof)
Attachment #8721980 - Flags: review?(vporof) → review+
https://hg.mozilla.org/mozilla-central/rev/138f7c7856b6
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla47
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: