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

[WIP] Make subsequent about:blank loads async #14764

Closed
wants to merge 5 commits into from

Conversation

@cbrewster
Copy link
Member

cbrewster commented Dec 28, 2016


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14856 (github issue number if applicable).
  • There are tests for these changes OR
  • These changes do not require tests because _____

This change is Reviewable

@highfive
Copy link

highfive commented Dec 28, 2016

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/htmliframeelement.rs, components/script/script_thread.rs
  • @KiChjang: components/script/dom/htmliframeelement.rs, components/script/script_thread.rs
@highfive
Copy link

highfive commented Dec 28, 2016

warning Warning warning

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

cbrewster commented Dec 28, 2016

r? @jdm
cc @asajeffrey
Should a test for this be in wpt or mozilla?

@highfive highfive assigned jdm and unassigned nox Dec 28, 2016
@jdm
Copy link
Member

jdm commented Dec 28, 2016

Depends what it's testing, really :) If you can write a test that checks behaviour that the spec describes, then it belongs in wpt.

@bors-servo: try

@bors-servo
Copy link
Contributor

bors-servo commented Dec 28, 2016

Trying commit 6d42d53 with merge 265b72b...

bors-servo added a commit that referenced this pull request Dec 28, 2016
Only send ScriptLoadedAboutBlankInIFrame on initial BC creation

<!-- 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: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #13716 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

<!-- 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/14764)
<!-- Reviewable:end -->
@cbrewster
Copy link
Member Author

cbrewster commented Dec 28, 2016

@jdm an easy test is to create an iframe with some src (can be anything), then set src to about:blank and then use the History API to traverse backwards with the idea that this won't cause a crash.

@jdm
Copy link
Member

jdm commented Dec 28, 2016

Whenever possible, have the test verify expected outcomes beyond just "does this crash", since that will make the test more meaningful to both us and other browsers.

@bors-servo
Copy link
Contributor

bors-servo commented Dec 28, 2016

💔 Test failed - mac-rel-wpt2

@jdm
Copy link
Member

jdm commented Dec 28, 2016

  ▶ ERROR [expected OK] /webstorage/event_body_attribute.html
  └   → iframe.contentWindow is null

  ▶ Unexpected subtest result in /webstorage/event_body_attribute.html:
  │ FAIL [expected PASS] sessionStorage mutations fire StorageEvents that are caught by the event listener specified as an attribute on the body.
  │   → null has no properties
  │ FAIL [expected PASS] localStorage mutations fire StorageEvents that are caught by the event listener specified as an attribute on the body.
  │   → null has no properties
  │ 
  │ step0@http://web-platform.test:8000/webstorage/event_body_attribute.js:15:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1430:20

  ▶ ERROR [expected OK] /webstorage/event_basic.html
  └   → iframe.contentWindow is null

  ▶ ERROR [expected OK] /webstorage/event_setattribute.html
  └   → iframe.contentWindow is null

  ▶ Unexpected subtest result in /webstorage/event_setattribute.html:
  │ FAIL [expected PASS] sessionStorage mutations fire StorageEvents that are caught by the event listener attached via setattribute.
  │   → null has no properties
  │ FAIL [expected PASS] localStorage mutations fire StorageEvents that are caught by the event listener attached via setattribute.
  │   → null has no properties
  │ 
  │ step0@http://web-platform.test:8000/webstorage/event_setattribute.js:15:13
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1406:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1430:20

  ▶ ERROR [expected OK] /webstorage/event_case_sensitive.html
  └   → iframe.contentWindow is null
@cbrewster
Copy link
Member Author

cbrewster commented Dec 28, 2016

After some digging I found that the issue is that whenever src is set and then contentDocument is called right after, there is a race condition and contentDocument will return null because the Document hasn't been created in the script thread yet.

These tests were previously passing because they set src to about:blank. This was a special case because navigate_or_reload_child_browsing_context checked to see if the Url is about:blank in which case it believe that it is the initial about:blank load which will cause the load to be synchronous when really it should only do the synchronous load when the iframe is initially loaded.

I am not entirely sure the best way to fix the race condition but I think it would be ok to update the test expectations here and fix the race condition in a separate PR. Unless all about:blank loads should be synchronous (in which case we just need to fix a couple things on the constellation side of things).

Edit: The plan is to wait until we figure out how to fix the tests.

Copy link
Contributor

Ms2ger left a comment

Do squash.

@@ -75,6 +75,13 @@ enum ProcessingMode {
NotFirstTime,
}

#[derive(PartialEq)]
pub enum NavigationType {
SynchronousAboutBlank,

This comment has been minimized.

Copy link
@Ms2ger

Ms2ger Dec 29, 2016

Contributor

Maybe InitialAboutBlank.

This comment has been minimized.

Copy link
@cbrewster

cbrewster Dec 29, 2016

Author Member

Done.

@bors-servo
Copy link
Contributor

bors-servo commented Dec 29, 2016

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

@cbrewster cbrewster changed the title Only send ScriptLoadedAboutBlankInIFrame on initial BC creation Make subsequent about:blank loads async Dec 29, 2016
@cbrewster
Copy link
Member Author

cbrewster commented Dec 29, 2016

Checklist

  • Subsequent about:blank loads should be async; however, they should be treated as same-origin navigations (share the script thread).
  • Iframe's should not update their current PipelineId until the Document associated with the new Pipeline has matured.
@cbrewster cbrewster force-pushed the cbrewster:about_blank_fix branch from 9e34ef7 to bed1ef8 Dec 29, 2016
@cbrewster
Copy link
Member Author

cbrewster commented Dec 29, 2016

This should be ready for review
@bors-servo try

@jdm jdm removed the S-needs-rebase label Dec 29, 2016
@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.

@cbrewster cbrewster force-pushed the cbrewster:about_blank_fix branch from 708130c to 92cf190 Apr 13, 2017
@cbrewster cbrewster force-pushed the cbrewster:about_blank_fix branch from 92cf190 to 499843b Apr 13, 2017
@cbrewster
Copy link
Member Author

cbrewster commented Apr 13, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Apr 13, 2017

Trying commit 499843b with merge 21763ba...

bors-servo added a commit that referenced this pull request Apr 13, 2017
[WIP] Make subsequent about:blank loads async

<!-- 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: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14856 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Apr 13, 2017

💔 Test failed - linux-rel-wpt

@cbrewster cbrewster force-pushed the cbrewster:about_blank_fix branch from 499843b to ce918c0 Apr 13, 2017
@cbrewster
Copy link
Member Author

cbrewster commented Apr 13, 2017

@bors-servo
Copy link
Contributor

bors-servo commented Apr 13, 2017

Trying commit ce918c0 with merge dbe102d...

bors-servo added a commit that referenced this pull request Apr 13, 2017
[WIP] Make subsequent about:blank loads async

<!-- 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: -->
- [X] `./mach build -d` does not report any errors
- [X] `./mach test-tidy` does not report any errors
- [X] These changes fix #14856 (github issue number if applicable).

<!-- Either: -->
- [ ] There are tests for these changes OR
- [ ] These changes do not require tests because _____

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

bors-servo commented Apr 13, 2017

💔 Test failed - linux-rel-css

@cbrewster
Copy link
Member Author

cbrewster commented Apr 18, 2017

Superseded by #16506

@cbrewster cbrewster closed this Apr 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.

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