Assert.rejects in ContentTask.spawn: TypeError: can't access property "filename", stack is null
Categories
(Testing :: Mochitest, defect, P2)
Tracking
(firefox-esr115 wontfix, firefox118 wontfix, firefox119 wontfix, firefox120 wontfix, firefox121 fixed)
People
(Reporter: robwu, Assigned: robwu)
References
(Regression)
Details
(Keywords: regression, Whiteboard: [addons-jira])
Attachments
(2 files)
The original contentPage.spawn
(now contentPage.spawnLegacy
) method used to successfully log a message when Assert.rejects
is used. But the new contentPage.spawn
method prints an error instead. E.g. as seen in https://phabricator.services.mozilla.com/D174513?id=700812#inline-1051275 :
0:06.76 INFO "Register service worker from a content webpage (disallowed redirects)"
0:06.77 pid:1405152 JavaScript error: /home/rpl/my/mozlab/mc-trypush/testing/xpcshell/head.js, line 929: TypeError: can't access property "filename", stack is null
0:06.77 INFO "Register service worker from a content webpage (with import redirect)"
0:06.77 INFO "CONSOLE_MESSAGE: (error) [JavaScript Error: "TypeError: can't access property "filename", stack is null" {file: "/home/rpl/my/mozlab/mc-trypush/testing/xpcshell/head.js" line: 929}]
do_report_result@/home/rpl/my/mozlab/mc-trypush/testing/xpcshell/head.js:929:42
receiveMessage@resource://testing-common/SpecialPowersChild.sys.mjs:320:32
_do_main@/home/rpl/my/mozlab/mc-trypush/testing/xpcshell/head.js:245:6
_execute_test@/home/rpl/my/mozlab/mc-trypush/testing/xpcshell/head.js:592:5
@-e:1:1
"
Updated•2 years ago
|
Comment 1•2 years ago
|
||
Set release status flags based on info from the regressing bug 1648545
Assignee | ||
Comment 2•2 years ago
|
||
... and make sure that Assert.rejects(Promise.resolve())
resolves even
if the _reporter
override does not throw. This is needed for the test
to run to completion; otherwise the new Harness_sanity tests get stuck.
An extra test has been added to test_assert.js to verify that under
normal circumstances, Assert.rejects(Promise.resolve())
rejects.
Assignee | ||
Comment 3•2 years ago
|
||
Assert.rejects uses callbacks in a way that the stack no longer includes
the original caller in the stack when the stack is generated.
Consequently, when AssertionError tries to identify the caller, it is
unable to do so, resulting in a null
stack.
This null
stack is passed by the SpecialPowers glue to
do_report_result
in xpcshell/head.js, which doesn't expect a null
stack, and consequently the following error is reported:
"TypeError: can't access property "filename", stack is null"
To fix this issue, we save the stack (including the caller) upon
entering Assert.rejects
, and forward that to AssertionError
.
Assignee | ||
Comment 4•2 years ago
|
||
I have added some necessary test coverage. While doing so I noticed that there are more issues beyond the initial report.
In the test coverage, I intentionally added cases for rejection vs non-rejection, but not for rejection with incorrect error. Some work on that had started before in bug 1480075 and can be covered there.
Updated•2 years ago
|
Comment 5•2 years ago
|
||
The severity field is not set for this bug.
:jmaher, could you have a look please?
For more information, please visit BugBot documentation.
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Backed out 2 changesets (Bug 1856464) for causing failures in test_SpecialPowersSandbox.js
Log: https://treeherder.mozilla.org/logviewer?job_id=433744589&repo=autoland&lineNumber=3073
https://treeherder.mozilla.org/logviewer?job_id=433744581&repo=autoland&lineNumber=5223
Backout: https://hg.mozilla.org/integration/autoland/rev/fe1cfe8c93976cb8704f6a4aedcf6a127fdd336e
Assignee | ||
Updated•2 years ago
|
Comment 9•2 years ago
|
||
Backed out for causing failures on test_SpecialPowersSandbox.html
- backout: https://hg.mozilla.org/integration/autoland/rev/98934bd95a83d7a797c49dc2e015409bcf89db48
- push: https://treeherder.mozilla.org/jobs?repo=autoland&group_state=expanded&selectedTaskRun=XZ9PEJH9Sc-GZR_zxwmEkw.0&revision=4a8a737bf972f06efa9883f8af6c873c5e10d765
- failure log: https://treeherder.mozilla.org/logviewer?job_id=433804561&repo=autoland&lineNumber=9814
[task 2023-10-25T22:09:11.797Z] 22:09:11 INFO - TEST-PASS | testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html | Got stack for: Thing - 1 == 2
[task 2023-10-25T22:09:11.797Z] 22:09:11 INFO - Buffered messages finished
[task 2023-10-25T22:09:11.800Z] 22:09:11 INFO - TEST-UNEXPECTED-FAIL | testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html | Stack does not contain /test_SpecialPowersSandbox.html:: @http://mochi.test:8888/tests/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:68:16
[task 2023-10-25T22:09:11.800Z] 22:09:11 INFO - execute@resource://testing-common/SpecialPowersSandbox.sys.mjs:139:12
[task 2023-10-25T22:09:11.801Z] 22:09:11 INFO - _spawnTask@resource://testing-common/SpecialPowersChild.sys.mjs:1654:15
[task 2023-10-25T22:09:11.802Z] 22:09:11 INFO - receiveMessage@resource://testing-common/SpecialPowersChild.sys.mjs:257:21
[task 2023-10-25T22:09:11.802Z] 22:09:11 INFO - JSActor query*receiveMessage@resource://testing-common/SpecialPowersParent.sys.mjs:1385:14
[task 2023-10-25T22:09:11.802Z] 22:09:11 INFO - JSActor query*spawn@resource://testing-common/SpecialPowersChild.sys.mjs:1583:17
[task 2023-10-25T22:09:11.802Z] 22:09:11 INFO - doApply@resource://testing-common/WrapPrivileged.sys.mjs:117:18
[task 2023-10-25T22:09:11.803Z] 22:09:11 INFO - apply/<@resource://testing-common/WrapPrivileged.sys.mjs:252:30
[task 2023-10-25T22:09:11.804Z] 22:09:11 INFO - wrapExceptions@resource://testing-common/WrapPrivileged.sys.mjs:205:12
[task 2023-10-25T22:09:11.804Z] 22:09:11 INFO - apply@resource://testing-common/WrapPrivileged.sys.mjs:236:12
[task 2023-10-25T22:09:11.805Z] 22:09:11 INFO - SpecialPowers.spawn@http://mochi.test:8888/tests/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:66:28
[task 2023-10-25T22:09:11.805Z] 22:09:11 INFO - interceptDiagnostics@http://mochi.test:8888/tests/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:30:11
[task 2023-10-25T22:09:11.806Z] 22:09:11 INFO - @http://mochi.test:8888/tests/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:127:23
[task 2023-10-25T22:09:11.806Z] 22:09:11 INFO - async*add_task/nextTick/<@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:2189:34
[task 2023-10-25T22:09:11.807Z] 22:09:11 INFO - nextTick@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:2233:11
[task 2023-10-25T22:09:11.807Z] 22:09:11 INFO - setTimeout handler*SimpleTest_setTimeoutShim@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:922:41
[task 2023-10-25T22:09:11.807Z] 22:09:11 INFO - add_task@http://mochi.test:8888/tests/SimpleTest/SimpleTest.js:2137:17
[task 2023-10-25T22:09:11.808Z] 22:09:11 INFO - @http://mochi.test:8888/tests/testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:38:9
[task 2023-10-25T22:09:11.809Z] 22:09:11 INFO -
[task 2023-10-25T22:09:11.809Z] 22:09:11 INFO - SimpleTest.ok@SimpleTest/SimpleTest.js:426:16
[task 2023-10-25T22:09:11.811Z] 22:09:11 INFO - @testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:141:11
[task 2023-10-25T22:09:11.811Z] 22:09:11 INFO - async*add_task/nextTick/<@SimpleTest/SimpleTest.js:2189:34
[task 2023-10-25T22:09:11.812Z] 22:09:11 INFO - nextTick@SimpleTest/SimpleTest.js:2233:11
[task 2023-10-25T22:09:11.812Z] 22:09:11 INFO - setTimeout handler*SimpleTest_setTimeoutShim@SimpleTest/SimpleTest.js:922:41
[task 2023-10-25T22:09:11.812Z] 22:09:11 INFO - add_task@SimpleTest/SimpleTest.js:2137:17
[task 2023-10-25T22:09:11.813Z] 22:09:11 INFO - @testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html?currentTestURL=testing%2Fmochitest%2Ftests%2FHarness_sanity%2Ftest_SpecialPowersSandbox.html&closeWhenDone=1&showTestReport=false&expected=pass:38:9
[task 2023-10-25T22:09:11.813Z] 22:09:11 INFO - TEST-PASS | testing/mochitest/tests/Harness_sanity/test_SpecialPowersSandbox.html | Got stack for: Hmm - 1 == 1
Assignee | ||
Updated•2 years ago
|
Comment 10•2 years ago
|
||
Comment 11•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/99c934546f5a
https://hg.mozilla.org/mozilla-central/rev/99f5a11e1027
Comment 12•2 years ago
|
||
The patch landed in nightly and beta is affected.
:robwu, is this bug important enough to require an uplift?
- If yes, please nominate the patch for beta approval.
- If no, please set
status-firefox120
towontfix
.
For more information, please visit BugBot documentation.
Assignee | ||
Updated•2 years ago
|
Updated•2 years ago
|
Description
•