Skip to content
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

Avoid a constellation roundtrip when a same-origin iframe finishes loading #16109

Closed
wants to merge 1 commit into from

Conversation

@jdm
Copy link
Member

jdm commented Mar 23, 2017

  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #16108
  • There are tests for these changes

This change is Reviewable

@highfive
Copy link

highfive commented Mar 23, 2017

Heads up! This PR modifies the following files:

  • @asajeffrey: components/constellation/constellation.rs
  • @fitzgen: components/script/script_thread.rs, components/script/dom/document.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs
  • @KiChjang: components/script/script_thread.rs, components/script/dom/document.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs
@highfive
Copy link

highfive commented Mar 23, 2017

warning Warning warning

  • These commits modify unsafe code. Please review it carefully!
  • These commits modify script code, but no tests are modified. Please consider adding a test!
@jdm
Copy link
Member Author

jdm commented Mar 23, 2017

r? @asajeffrey

I'm not totally convinced about these changes, but they should make some of our tests that use multiple iframes run better when under load.

@highfive highfive assigned asajeffrey and unassigned Manishearth Mar 23, 2017
@jdm
Copy link
Member Author

jdm commented Mar 23, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Mar 23, 2017

Trying commit ee33dbf with merge f37f032...

bors-servo added a commit that referenced this pull request Mar 23, 2017
Avoid a constellation roundtrip when a same-origin iframe finishes loading

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16108
- [X] There are tests for these changes

<!-- 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/16109)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Mar 23, 2017

💔 Test failed - mac-rel-wpt1

LoadComplete(PipelineId),
/// has been dispatched. The boolean indicates whether the parent document
/// has been notified already.
LoadComplete(PipelineId, bool),

This comment has been minimized.

Copy link
@nox

nox Mar 25, 2017

Member

Booleans are the devil, could you please use a struct variant?

@asajeffrey
Copy link
Member

asajeffrey commented Mar 31, 2017

Would we be better off keeping track of the state of whether the notification to the parent has already been sent or not? Then the script thread being notified of loading would be idempotent, and we could simplify the constellation code. We would still be sending a pointless notification message from the constellation to script, so there's an efficiency vs code simplicity trade-off here.

Apart from that, and the bool vs enumerated type that @nox raised, lgtm, and yay for less round-tripping!

@bors-servo
Copy link
Contributor

bors-servo commented Apr 5, 2017

The latest upstream changes (presumably #16268) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm jdm force-pushed the jdm:same-origin-load branch from 7e39da3 to 673f003 Apr 17, 2017
@jdm jdm removed the S-needs-rebase label Apr 17, 2017
@jdm
Copy link
Member Author

jdm commented Apr 17, 2017

It took me a lot of investigation to finally figure out the issue, and it's made me a bit nervous! Previously I was retrieving the frame element from the browsing context, then calling global() on that to get a global that would give me the pipeline for the page containing the iframe. Turns out this is broken when the iframe is adopted into a different global, since the result of global() remains the creator, not the window for the document that it is now a part of. I fear that we may have a lot of these subtle bugs lurking :(

@jdm
Copy link
Member Author

jdm commented Apr 17, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Apr 17, 2017

Trying commit 673f003 with merge 9daba03...

bors-servo added a commit that referenced this pull request Apr 17, 2017
Avoid a constellation roundtrip when a same-origin iframe finishes loading

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16108
- [X] There are tests for these changes

<!-- 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/16109)
<!-- Reviewable:end -->
@asajeffrey
Copy link
Member

asajeffrey commented Apr 17, 2017

Yes, I saw that, I didn't realize that node.global() gives the originating global, not the global of the current window. I also suspect this is a good source of bugs.

@bors-servo
Copy link
Contributor

bors-servo commented Apr 17, 2017

💔 Test failed - linux-rel-wpt

@jdm jdm force-pushed the jdm:same-origin-load branch from 673f003 to 8d0ea85 May 10, 2017
@jdm jdm removed the S-needs-rebase label May 10, 2017
@asajeffrey
Copy link
Member

asajeffrey commented May 15, 2017

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

📌 Commit 8d0ea85 has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

Testing commit 8d0ea85 with merge de28278...

bors-servo added a commit that referenced this pull request May 15, 2017
Avoid a constellation roundtrip when a same-origin iframe finishes loading

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16108
- [X] There are tests for these changes

<!-- 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/16109)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

💔 Test failed - linux-rel-css

@jdm jdm force-pushed the jdm:same-origin-load branch from 8d0ea85 to 51edb49 May 15, 2017
@jdm
Copy link
Member Author

jdm commented May 15, 2017

@bors-servo: r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

📌 Commit 51edb49 has been approved by asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

Testing commit 51edb49 with merge 895cd76...

bors-servo added a commit that referenced this pull request May 15, 2017
Avoid a constellation roundtrip when a same-origin iframe finishes loading

- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #16108
- [X] There are tests for these changes

<!-- 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/16109)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented May 15, 2017

💔 Test failed - linux-rel-wpt

@bors-servo
Copy link
Contributor

bors-servo commented May 17, 2017

The latest upstream changes (presumably #16883) made this pull request unmergeable. Please resolve the merge conflicts.

@jdm
Copy link
Member Author

jdm commented May 18, 2017

The failures here come from a timing issue - if the script thread decides that a document is loaded before the constellation's document activity level notification is received, attempts to interact with the iframe's content will use the pre-navigation frame contents. I'm going to give up on this attempted optimization; I think it's going to be too difficult to maintain as part of the ever-more-complex navigation infrastructure.

@jdm jdm closed this May 18, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

6 participants
You can’t perform that action at this time.