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

Constellation informs script about documents becoming inactive, active or fully active. #14971

Merged
merged 2 commits into from Jan 28, 2017

Conversation

@asajeffrey
Copy link
Member

asajeffrey commented Jan 11, 2017

This PR replaces the current freeze/thaw mechanism by messages from the constellation to script informing it about when documents become inactive, active or fully active.

This means we can now implement |Document::is_active()| which is used in |document.write|.

This PR also changes how timers work: previously they were initialized running, and were then frozen/thawed. This means there was a transitory period when timers were running even though the document was not fully active. With this PR, timers are initially suspended, and are only resumed when the document is made fully active.


  • ./mach build -d does not report any errors
  • ./mach test-tidy does not report any errors
  • These changes fix #14876
  • These changes do not require tests because it's an interal refactoring.

This change is Reviewable

@highfive
Copy link

highfive commented Jan 11, 2017

Heads up! This PR modifies the following files:

  • @fitzgen: components/script/dom/document.rs, components/script/timers.rs, components/script/dom/bindings/trace.rs, components/script/script_thread.rs, components/script/dom/window.rs, components/script_traits/lib.rs, components/script_traits/lib.rs
  • @KiChjang: components/script/dom/document.rs, components/script/timers.rs, components/script/dom/bindings/trace.rs, components/script/script_thread.rs, components/script/dom/window.rs, components/script_traits/lib.rs, components/script_traits/lib.rs
@highfive
Copy link

highfive commented Jan 11, 2017

warning Warning warning

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

asajeffrey commented Jan 11, 2017

@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 12, 2017

Hmm, there are wpt failures for this, I've still not quite got timers sorted out. I'll let you know once I've got something that passes wpt locally.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from 5852156 to 3e9bda1 Jan 12, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 12, 2017

I rewrote this PR to explicitly initialize the document activity, which means we can go back to timers initially running. This fixes the wpt failures locally.

This PR is now ready for review.

@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 12, 2017

Oh good, an intermittent:

./mach test-wpt --release --repeat-until-unexpected ~/_mozilla/mozilla/websocket_connection_fail.html
...
Running 1 tests in web-platform-tests

Ran 185 tests finished in 1.0 seconds.
  • 185 ran as expected. 0 tests skipped.

Running 1 tests in web-platform-tests
...
  ▶ Unexpected subtest result in /_mozilla/mozilla/websocket_connection_fail.html:
  │ TIMEOUT [expected PASS] Untitled
  └   → Test timed out
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 12, 2017

That intermittent is reproducable on master: #14985.

@bors-servo
Copy link
Contributor

bors-servo commented Jan 12, 2017

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

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from 3e9bda1 to ee2bf98 Jan 12, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 12, 2017

Rebased.

@bors-servo
Copy link
Contributor

bors-servo commented Jan 13, 2017

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

@jdm
Copy link
Member

jdm commented Jan 19, 2017

@Ms2ger Review ping.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from ee2bf98 to 6fc5b69 Jan 19, 2017
@Ms2ger
Copy link
Contributor

Ms2ger commented Jan 20, 2017

Can we add a test for the document.write() change?

r? @cbrewster

@highfive highfive assigned cbrewster and unassigned Ms2ger Jan 20, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 20, 2017

@Ms2ger OK, I'll give it a shot. The test might fail at the moment, because writing into iframe content documents isn't fully implemented IIRC. @nox?

@nox
Copy link
Member

nox commented Jan 21, 2017

@asajeffrey I have no idea what you mean by "fully implemented". Why would iframe content documents be different than any other document? As long is it's same origin I don't see what's not implemented.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from 6fc5b69 to 90fb8e3 Jan 23, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 23, 2017

@nox: I pushed a test to this PR (90fb8e3) which will show you what I mean. It passes in FF, but fails in servo with the error 'The object is in an invalid state'.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from 3a8fc25 to 3816799 Jan 23, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 27, 2017

Rebased.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from d7210ea to 631fefb Jan 27, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 27, 2017

@bors-servo r=cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 27, 2017

📌 Commit 631fefb has been approved by cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 27, 2017

Testing commit 631fefb with merge 7cdc265...

bors-servo added a commit that referenced this pull request Jan 27, 2017
…rewster

Constellation informs script about documents becoming inactive, active or fully active.

<!-- Please describe your changes on the following line: -->

This PR replaces the current freeze/thaw mechanism by messages from the constellation to script informing it about when documents become inactive, active or fully active.

This means we can now implement |Document::is_active()| which is used in |document.write|.

This PR also changes how timers work: previously they were initialized running, and were then frozen/thawed. This means there was a transitory period when timers were running even though the document was not fully active. With this PR, timers are initially suspended, and are only resumed when the document is made fully active.

---
<!-- 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 #14876
- [X] These changes do not require tests because it's an interal refactoring.

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

bors-servo commented Jan 27, 2017

💔 Test failed - linux-rel-wpt

@cbrewster
Copy link
Member

cbrewster commented Jan 27, 2017

  ▶ Unexpected subtest result in /html/dom/dynamic-markup-insertion/document-write/write-active-document.html:
  │ FAIL [expected PASS] document.write only writes to active documents
  └   → The object is in an invalid state.
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 27, 2017

Oops, forgot to check in the .ini file.

@asajeffrey asajeffrey force-pushed the asajeffrey:script-track-active-documents branch from 631fefb to ca9cee0 Jan 27, 2017
@asajeffrey
Copy link
Member Author

asajeffrey commented Jan 27, 2017

@bors-servo r=cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 27, 2017

📌 Commit ca9cee0 has been approved by cbrewster

@bors-servo
Copy link
Contributor

bors-servo commented Jan 28, 2017

Testing commit ca9cee0 with merge b5c94ba...

bors-servo added a commit that referenced this pull request Jan 28, 2017
…rewster

Constellation informs script about documents becoming inactive, active or fully active.

<!-- Please describe your changes on the following line: -->

This PR replaces the current freeze/thaw mechanism by messages from the constellation to script informing it about when documents become inactive, active or fully active.

This means we can now implement |Document::is_active()| which is used in |document.write|.

This PR also changes how timers work: previously they were initialized running, and were then frozen/thawed. This means there was a transitory period when timers were running even though the document was not fully active. With this PR, timers are initially suspended, and are only resumed when the document is made fully active.

---
<!-- 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 #14876
- [X] These changes do not require tests because it's an interal refactoring.

<!-- 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/14971)
<!-- Reviewable:end -->
@bors-servo bors-servo merged commit ca9cee0 into servo:master Jan 28, 2017
3 checks passed
3 checks passed
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
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.

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