Skip to content

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

Merged
bors-servo merged 2 commits intoservo:masterfrom
asajeffrey:script-track-active-documents
Jan 28, 2017
Merged

Constellation informs script about documents becoming inactive, active or fully active.#14971
bors-servo merged 2 commits intoservo:masterfrom
asajeffrey:script-track-active-documents

Conversation

@asajeffrey
Copy link
Copy Markdown
Contributor

@asajeffrey 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 Determine if a Document is active #14876
  • These changes do not require tests because it's an interal refactoring.

This change is Reviewable

@highfive
Copy link
Copy Markdown

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
Copy Markdown

warning Warning warning

  • These commits modify script code, but no tests are modified. Please consider adding a test!

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Jan 11, 2017
@asajeffrey asajeffrey added A-content/script Related to the script thread A-constellation Involves the constellation labels Jan 11, 2017
@asajeffrey
Copy link
Copy Markdown
Contributor Author

cc @jdm @cbrewster

@asajeffrey
Copy link
Copy Markdown
Contributor Author

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 script-track-active-documents branch from 5852156 to 3e9bda1 Compare January 12, 2017 03:08
@asajeffrey
Copy link
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

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
Copy Markdown
Contributor Author

That intermittent is reproducable on master: #14985.

@bors-servo
Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jan 12, 2017
@asajeffrey asajeffrey force-pushed the script-track-active-documents branch from 3e9bda1 to ee2bf98 Compare January 12, 2017 23:09
@asajeffrey
Copy link
Copy Markdown
Contributor Author

Rebased.

@bors-servo
Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label Jan 13, 2017
@jdm
Copy link
Copy Markdown
Member

jdm commented Jan 19, 2017

@Ms2ger Review ping.

@asajeffrey asajeffrey force-pushed the script-track-active-documents branch from ee2bf98 to 6fc5b69 Compare January 19, 2017 23:04
@asajeffrey asajeffrey removed the S-needs-rebase There are merge conflict errors. label Jan 19, 2017
@Ms2ger
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

@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
Copy Markdown
Contributor

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 script-track-active-documents branch from 6fc5b69 to 90fb8e3 Compare January 23, 2017 15:04
@asajeffrey
Copy link
Copy Markdown
Contributor Author

@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 script-track-active-documents branch from 3a8fc25 to 3816799 Compare January 23, 2017 18:58
@asajeffrey
Copy link
Copy Markdown
Contributor Author

Rebased.

@asajeffrey asajeffrey force-pushed the script-track-active-documents branch from d7210ea to 631fefb Compare January 27, 2017 21:20
@asajeffrey asajeffrey removed the S-needs-squash Some (or all) of the commits in the PR should be combined. label Jan 27, 2017
@asajeffrey
Copy link
Copy Markdown
Contributor Author

@bors-servo r=cbrewster

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit 631fefb has been approved by cbrewster

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 27, 2017
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit 631fefb with merge 7cdc265...

bors-servo pushed 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
Copy Markdown
Contributor

💔 Test failed - linux-rel-wpt

@highfive highfive added S-tests-failed The changes caused existing tests to fail. and removed S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. labels Jan 27, 2017
@cbrewster
Copy link
Copy Markdown
Contributor

  ▶ 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
Copy Markdown
Contributor Author

Oops, forgot to check in the .ini file.

@asajeffrey asajeffrey force-pushed the script-track-active-documents branch from 631fefb to ca9cee0 Compare January 27, 2017 23:25
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-tests-failed The changes caused existing tests to fail. labels Jan 27, 2017
@asajeffrey
Copy link
Copy Markdown
Contributor Author

@bors-servo r=cbrewster

@bors-servo
Copy link
Copy Markdown
Contributor

📌 Commit ca9cee0 has been approved by cbrewster

@highfive highfive added S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. and removed S-awaiting-review There is new code that needs to be reviewed. labels Jan 27, 2017
@bors-servo
Copy link
Copy Markdown
Contributor

⌛ Testing commit ca9cee0 with merge b5c94ba...

bors-servo pushed 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
Copy link
Copy Markdown
Contributor

@bors-servo bors-servo merged commit ca9cee0 into servo:master Jan 28, 2017
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Jan 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-constellation Involves the constellation A-content/script Related to the script thread

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Determine if a Document is active

7 participants