Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upFix for document salvageable state #20837
Conversation
highfive
commented
May 20, 2018
|
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
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
7f36eb8
to
d2109ef
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Ah, woops! This change looks correct. 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() { |
This comment has been minimized.
This comment has been minimized.
d2109ef
to
2e55ad3
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
2e55ad3
to
25819b1
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
25819b1
to
6e73f24
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
6e73f24
to
2cda5fc
|
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
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Tidy:
|
| onload = function() { | ||
| var iframe = document.getElementsByTagName("iframe")[0] | ||
| onload = null; | ||
| iframe.src="004-1.html?" + Math.random(); |
This comment has been minimized.
This comment has been minimized.
| onload = function() { | ||
| if (!parent.loaded) { | ||
| parent.loaded = true; | ||
| location="004-2.html?" + Math.random(); |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| onbeforeunload = function() { | ||
| onbeforeunload = null; | ||
| parent.beforeunload_fired = true; | ||
| setTimeout(function() { |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
gterzian
May 21, 2018
•
Author
Member
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
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
42590a2
to
67c0575
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
67c0575
to
255eb13
|
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 { |
This comment has been minimized.
This comment has been minimized.
gterzian
May 21, 2018
Author
Member
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
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
a00051a
to
6385fae
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
6385fae
to
42bbe73
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
42bbe73
to
fb0639d
|
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
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
29087f4
to
57c0d82
|
Transplanted upstreamable changes to existing PR. Completed upstream sync of web-platform-test changes at jdm/web-platform-tests#60. |
|
Thanks! |
|
|
…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 -->
|
|
Upstreamed from servo/servo#20837 [ci skip]
gterzian commentedMay 20, 2018
•
edited by cbrewster
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