Closed Bug 1414136 Opened 2 years ago Closed 2 years ago

Fix failures in docshell/test/navigation/ depends on non-comformant Promise handling

Categories

(Core :: DOM: Core & HTML, defect, P3)

defect

Tracking

()

RESOLVED FIXED
mozilla59
Tracking Status
firefox59 --- fixed

People

(Reporter: bevis, Assigned: bevis)

References

Details

Attachments

(1 file)

This is a follow-up of the try result in bug 1193394 comment 48:
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_bug1364364.html | check history.length - got 2, expected 6
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 1, expected 5
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | shistory.index - got +0, expected 4
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 2, expected 6
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | shistory.index - got 1, expected 5
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 2, expected 6
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | docShell.previousTransIndex - got 1, expected 3
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | docShell.loadedTransIndex - got +0, expected 2
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | shistory.index - got +0, expected 2
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 2, expected 4
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | shistory.index - got 1, expected 5
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 2, expected 6
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | shistory.index - got +0, expected 4
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | history.length - got 2, expected 6
TEST-UNEXPECTED-FAIL | docshell/test/navigation/test_sessionhistory.html | Test timed out.
Priority: -- → P3
Take this bug to follow up.
Assignee: nobody → btseng
Promise callbacks resolved/rejected in an event listener shall be performed earlier at the return of that listener instead of the end of current task as explained in bug 1193394 comment 48.

To prevent the session history entry be replaced immediately [1] by next change of the "src" in the resolved callback before the entire "onload" process is complete internally, I'd like to use setTimeout() to postpone the resolved callback to next task to run the test correctly.

Try result of with/without fix of bug 1193394 looks good, btw.
(See test_bug1364364.html, test_sessionhistory.html in M1 of "Linux x64 opt" in both try results:
1. (with) https://treeherder.mozilla.org/#/jobs?repo=try&revision=afeeb22cd302ddb089ffa008e82a754eca570444
2. (without) https://treeherder.mozilla.org/#/jobs?repo=try&revision=443d58bbccbf330940f59c3566c79a336577eda7)

[1] https://searchfox.org/mozilla-central/source/docshell/base/nsDocShell.cpp#4437-4446
Attachment #8928123 - Flags: review?(sawang)
Comment on attachment 8928123 [details] [diff] [review]
Fix test failures in session history relying on non-comformant Promise handling.

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

::: docshell/test/navigation/file_bug1326251.html
@@ +154,4 @@
>          frame.addEventListener('load', function listener(e) {
>            if (++count == occurances) {
>              frame.removeEventListener('load', listener);
> +            setTimeout(() => resolve(), 0);

Or `setTimeout(resolve, 0)` ?
Attachment #8928123 - Flags: review?(sawang) → review+
Pushed by btseng@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/16f8037fb5f0
Fix test failures in session history relying on non-comformant Promise handling. r=sawang
https://hg.mozilla.org/mozilla-central/rev/16f8037fb5f0
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla59
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.