-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
LibWeb: Correct initiator origin logic for new top level traversables #8908
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| initial popup.location.href: about:blank | ||
| initial popup.document.body.textContent: Hello Shannon! | ||
| reloaded popup.document.body.textContent: |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| <!DOCTYPE html> | ||
| <script src="../include.js"></script> | ||
| <script> | ||
| asyncTest(async done => { | ||
| const popup = window.open(); | ||
| const initialDocument = popup.document; | ||
| const initialTextContent = "Hello Shannon!"; | ||
|
|
||
| println(`initial popup.location.href: ${popup.location.href}`); | ||
|
|
||
| try { | ||
| popup.document.body.innerHTML = `<p>${initialTextContent}</p>`; | ||
| println(`initial popup.document.body.textContent: ${popup.document.body.textContent}`); | ||
| } catch (error) { | ||
| println(`initial popup document access threw: ${error.name}: ${error.message}`); | ||
| } | ||
|
|
||
| popup.location.reload(); | ||
|
|
||
| for (let attempt = 0; attempt < 300; ++attempt) { | ||
| try { | ||
| const currentDocument = popup.document; | ||
| const currentTextContent = currentDocument.body ? currentDocument.body.textContent : ""; | ||
|
|
||
| if (currentDocument !== initialDocument || currentTextContent !== initialTextContent) | ||
| break; | ||
| } catch (error) { | ||
| } | ||
|
|
||
| await timeout(10); | ||
| } | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe WPT's standard way of dealing with these types of updates should work immediately; i.e. two nested
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For my understanding (I was wondering how we could do this) what is the magic which makes that timing okay? (specifically 2 animation frames)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As I understand, the first rAF triggers within the current frame (nothing updated yet), the second one actually enforces executing on the next rendering opportunity (layout/style updated) but might not yet have triggered the painting logic to the point where compositing is done, so the inner setTimeout() makes sure we schedule a task to let painting do its thing and taking a screenshot will reliably work. For different test cases different combinations of these three might work equally well, but rAF+rAF+setTimeout has been easy to remember as something that "just works" for me. For screenshot tests I can confirm that leaving out any of the three has caused tests to be flaky in the past.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I could try it, but we're waiting on the popup reload to replace the Document, which likely takes longer than waiting for renders to settle. |
||
|
|
||
| try { | ||
| println(`reloaded popup.document.body.textContent: ${popup.document.body.textContent}`); | ||
| } catch (error) { | ||
| println(`reloaded popup document access threw: ${error.name}: ${error.message}`); | ||
| } | ||
|
|
||
| popup.close(); | ||
| done(); | ||
| }); | ||
| </script> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof nice spot, any possbility of adding a test for this?