Closed Bug 995198 Opened 10 years ago Closed 10 years ago

Uncaught async Promise errors should appear as soon as possible during xpcshell tests

Categories

(Testing :: XPCShell Harness, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla31

People

(Reporter: Yoric, Assigned: Yoric)

References

Details

Attachments

(2 files, 2 obsolete files)

Subset of bug 976205 that can land without blockers.
Summary: Uncaught async Promise errors should appear as soon as possible → Uncaught async Promise errors should appear as soon as possible during xpcshell tests
This patch has been reviewed by Paolo as part of bug 976205.
Assignee: nobody → dteller
Attachment #8405622 - Flags: review+
Patch reviewed by ted as part of bug 976205 + trivial string change.
Attachment #8405623 - Flags: review+
I have tweaked xpcshell's head.js a little bit more.
Summary of changes:
* since we always use Promise, we now import it eagerly as global _Promise;
* instead of a TEST-UNEXPECTED-FAIL, we now display a TEST-KNOWN-FAIL and a scary warning.
Attachment #8405623 - Attachment is obsolete: true
Attachment #8405758 - Flags: review?(ted)
Comment on attachment 8405758 [details] [diff] [review]
2. Print uncaught async errors at each run_next_test / add_task., v2

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

::: testing/xpcshell/head.js
@@ +18,5 @@
>  var _cleanupFunctions = [];
>  var _pendingTimers = [];
>  var _profileInitialized = false;
>  
> +let _Promise = Components.utils.import("resource://gre/modules/Promise.jsm", this).Promise;

We should really scope everything in this file to avoid it leaking out to tests. (But you don't have to fix that.)

@@ +1438,5 @@
>      throw new Error("run_next_test() called from an add_task() test function. " +
>                      "run_next_test() should not be called from inside add_task() " +
>                      "under any circumstances!");
>    }
> +    

nit: whitespace

::: testing/xpcshell/xpcshell_b2g.ini
@@ +6,5 @@
>  [include:dom/mobilemessage/tests/xpcshell.ini]
>  [include:dom/network/tests/unit_stats/xpcshell.ini]
>  [include:dom/system/gonk/tests/xpcshell.ini]
>  [include:dom/wappush/tests/xpcshell.ini]
> +[include:toolkit/components/osfile/tests/xpcshell/xpcshell.ini]

This seems unrelated?
Attachment #8405758 - Flags: review?(ted) → review+
(In reply to Ted Mielczarek [:ted.mielczarek] from comment #5)
> Comment on attachment 8405758 [details] [diff] [review]
> 2. Print uncaught async errors at each run_next_test / add_task., v2
> 
> Review of attachment 8405758 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: testing/xpcshell/head.js
> @@ +18,5 @@
> >  var _cleanupFunctions = [];
> >  var _pendingTimers = [];
> >  var _profileInitialized = false;
> >  
> > +let _Promise = Components.utils.import("resource://gre/modules/Promise.jsm", this).Promise;
> 
> We should really scope everything in this file to avoid it leaking out to
> tests. (But you don't have to fix that.)

That's what I was thinking. Filed as bug 996652.
https://hg.mozilla.org/mozilla-central/rev/963eaafdb70f
https://hg.mozilla.org/mozilla-central/rev/1dbade92ce0a
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla31
Depends on: 1003168
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: