Closed Bug 1819134 Opened 2 years ago Closed 2 years ago

X-window Error objects lost logging information when tests fail

Categories

(Testing :: Mochitest, defect)

Default
Desktop
All
defect

Tracking

(firefox112 fixed)

RESOLVED FIXED
112 Branch
Tracking Status
firefox112 --- fixed

People

(Reporter: Gijs, Assigned: Gijs)

References

Details

Attachments

(1 file)

bug 1815682 and bug 1767042 tried to make the logging better for non-Error objects.

Unfortunately, they used instanceof Error, which only works for error objects from the same scope. When the errors are generated elsewhere, they hit the "object" case, which means we try to JSON.stringify them, which doesn't work well because the stack/message properties are on the prototype, so the JSON stringification just shows {} which is... not very useful.

DOM errors have DOMException.isInstance (which works cross-global), but Error objects appear not to have this, probably because they're not DOM interfaces? This is annoying though, because it means that AFAICT the best option we have is duck-typing it in some way.

Assignee: nobody → gijskruitbosch+bugs
Status: NEW → ASSIGNED
Pushed by gijskruitbosch@gmail.com: https://hg.mozilla.org/integration/autoland/rev/f561c50bdbd0 fix 'Error' object dection in x-window errors in mochitests and associated logging, r=willdurand
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 112 Branch
Regressions: 1819445

On a (not yet landed) test, I've started getting intermittent errors: [task 2023-03-03T10:29:45.773Z] 10:29:45 INFO - GECKO(1279) | JavaScript error: chrome://mochikit/content/browser-test.js, line 1361: NS_ERROR_XPC_BAD_CONVERT_JS: Component returned failure code: 0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS) [nsIXPCComponents_Utils.getGlobalForObject] https://treeherder.mozilla.org/logviewer?job_id=407694387&repo=try&lineNumber=1606

Flags: needinfo?(gijskruitbosch+bugs)

(In reply to Alexandre LISSY :gerard-majax from comment #5)

On a (not yet landed) test, I've started getting intermittent errors: [task 2023-03-03T10:29:45.773Z] 10:29:45 INFO - GECKO(1279) | JavaScript error: chrome://mochikit/content/browser-test.js, line 1361: NS_ERROR_XPC_BAD_CONVERT_JS: Component returned failure code: 0x80570009 (NS_ERROR_XPC_BAD_CONVERT_JS) [nsIXPCComponents_Utils.getGlobalForObject] https://treeherder.mozilla.org/logviewer?job_id=407694387&repo=try&lineNumber=1606

It does looks like the fix for bug 1819445 would avoid that.

Flags: needinfo?(gijskruitbosch+bugs)
Regressions: 1820298
No longer regressions: 1820298
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: