Repository navigation
Fix for document salvageable state - #20837
Conversation
|
Heads up! This PR modifies the following files:
|
|
Opened new PR for upstreamable changes. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
534965b to
7f36eb8
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
7f36eb8 to
d2109ef
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
cbrewster
left a comment
There was a problem hiding this comment.
Ah, woops! This change looks correct.
Is there a way to avoid all of the setTimeouts in the test? Sometimes it can lead to intermittent tests with timing issues.
Also, please mention people in a comment rather than the PR body otherwise the mentioned people will get a notification when bors creates a merge commit.
| }), 1000); | ||
| } | ||
|
|
||
| onload = function() {setTimeout(function() { |
There was a problem hiding this comment.
Why do we need a setTimeout here?
d2109ef to
2e55ad3
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
2e55ad3 to
25819b1
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
25819b1 to
6e73f24
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
6e73f24 to
2cda5fc
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Ok, I was able to remove a few unnecessary timeouts. I also added an empty iframe to make sure the fact that the iframe is salvageable doesn't overwrite the unsalvageable state of the parent... I noticed, as you mentioned, that the timeouts can be somewhat unreliable, so I've set the one timeout that makes the test pass or fail to a wide margin so that even if the server is slowed down and it takes longer to discard the unsalvageable document, this would not result in an intermittent failure. |
2cda5fc to
32cf8ef
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
cbrewster
left a comment
There was a problem hiding this comment.
Tidy:
Checking files for tidiness...
./components/script/dom/document.rs:1668: trailing whitespace
| onload = function() { | ||
| var iframe = document.getElementsByTagName("iframe")[0] | ||
| onload = null; | ||
| iframe.src="004-1.html?" + Math.random(); |
There was a problem hiding this comment.
Is there any reason for Math.random()?
| onload = function() { | ||
| if (!parent.loaded) { | ||
| parent.loaded = true; | ||
| location="004-2.html?" + Math.random(); |
There was a problem hiding this comment.
Is there any reason for Math.random()?
There was a problem hiding this comment.
I think it is to prevent caching.
| onbeforeunload = function() { | ||
| onbeforeunload = null; | ||
| parent.beforeunload_fired = true; | ||
| setTimeout(function() { |
There was a problem hiding this comment.
Can we just call a function on parent here that then calls t.done()?
There was a problem hiding this comment.
yes, that is done there https://github.com/servo/servo/pull/20837/files#diff-98df125a78b53a9905ea2e52eb1362d5R4
because here the idea is that the timeout never fires because the document is not salvageable hence will be discarded, and the timeout along with it.
(by the way, I didn't quite "invent" this structure myself, I basically copied the same test applied to unload from https://github.com/servo/servo/blob/affcf81ce6156f0796b5e3a4332780135bbd51dd/tests/wpt/web-platform-tests/html/browsers/browsing-the-web/unloading-documents/unload/007.html. Actually I started with the test, then realized it was impossible to make it pass...)
32cf8ef to
42590a2
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
42590a2 to
67c0575
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
67c0575 to
255eb13
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
| if !document.salvageable() { | ||
| self.salvageable.set(false); | ||
| } | ||
| if !can_unload { |
There was a problem hiding this comment.
ended up changing this, because previously I would check document.salvageable() before calling document.prompt_to_unload(true). Who thought checking booleans could be so hard...
2663889 to
a00051a
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
a00051a to
6385fae
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
6385fae to
42bbe73
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
42bbe73 to
fb0639d
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
@cbrewster made a change to the tests, which doesn't change the logic, but hopefully takes care of two flies in one hit in the light of whatwg/html#3646 (comment) |
fb0639d to
29087f4
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
29087f4 to
57c0d82
Compare
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Thanks! |
|
📌 Commit 57c0d82 has been approved by |
…ster Fix for document salvageable state I noticed a bug where if the document was un-salavageable due to the presence of `beforeunload` listeners, this could be overwritten if there were no listeners for `unload`. This could also have happened if an iframe of the document had no listeners while the parent did. <!-- Please describe your changes on the following line: --> --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [ ] `./mach build -d` does not report any errors - [ ] `./mach test-tidy` does not report any errors - [ ] These changes fix #__ (github issue number if applicable). <!-- Either: --> - [ ] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.--> <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/20837) <!-- Reviewable:end -->
|
☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel-css, linux-rel-wpt, mac-dev-unit, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, windows-msvc-dev |
Upstreamed from servo/servo#20837 [ci skip]
I noticed a bug where if the document was un-salavageable due to the presence of
beforeunloadlisteners, this could be overwritten if there were no listeners forunload. This could also have happened if an iframe of the document had no listeners while the parent did../mach build -ddoes not report any errors./mach test-tidydoes not report any errorsThis change is