Closed Bug 1261816 Opened 8 years ago Closed 8 years ago

JS error thrown after end of test can cause finish() to be called twice

Categories

(Testing :: Mochitest, defect)

48 Branch
defect
Not set
normal

Tracking

(firefox46 wontfix, firefox47 fixed, firefox48 fixed)

RESOLVED FIXED
mozilla48
Tracking Status
firefox46 --- wontfix
firefox47 --- fixed
firefox48 --- fixed

People

(Reporter: kats, Assigned: kats)

Details

Attachments

(1 file)

While working on bug 1261158 I ran into a situation where I was running |./mach mochitest --e10s -f plain image/test/mochitest/test_xultree_animation.xhtml|, the test ran and successfully completed, and then when I closed the browser window, the browser shutdown process would throw a JS error. The JS error was caught by the mochitest harness, handled in [1], but then [2] was invoked. This call to SimpleTest.finish() was in addition to the SimpleTest.finish() that the test already did, and so it caused a failure of the type "finish() already called" [3].

Now it may very well be that JS errors thrown during the shutdown process are intended to cause test failures, but if so, they should do so via handling in the code at [1], rather than the indirect "finish() already called" thing that was happening here. I think it makes sense to guard against this scenario, where the test harness is basically ignoring the actual error and then inducing some nonsensical error in its' place.

[1] http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/SimpleTest.js?rev=b78ed68af2fb#1543
[2] http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/SimpleTest.js?rev=b78ed68af2fb#1587
[3] http://mxr.mozilla.org/mozilla-central/source/testing/mochitest/tests/SimpleTest/SimpleTest.js?rev=b78ed68af2fb#1018
Assignee: nobody → bugmail.mozilla
Attachment #8737776 - Flags: review?(jmaher)
Comment on attachment 8737776 [details] [diff] [review]
Guard against finish() being called twice

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

thanks!
Attachment #8737776 - Flags: review?(jmaher) → review+
OS: Unspecified → All
Hardware: Unspecified → All
Version: Trunk → 48 Branch
https://hg.mozilla.org/mozilla-central/rev/126df4c0f1fb
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla48
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: