Skip to content

History API - #11220

Closed
cbrewster wants to merge 10 commits into
servo:masterfrom
cbrewster:history_api
Closed

cbrewster wants to merge 10 commits into
servo:masterfrom
cbrewster:history_api

Conversation

@cbrewster

@cbrewster cbrewster commented May 17, 2016 •

Copy link
Copy Markdown
Contributor

Thank you for contributing to Servo! Please replace each [ ] by [X] when the step is complete, and replace __ with appropriate data:

  • ./mach build -d does not report any errors
  • ./mach test-tidy --faster does not report any errors
  • These changes fix #__ (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.

What this PR covers

  • Add the history object
  • Support navigation by a delta
  • Support interleaved session history
  • Implement HistoryTraversalTaskSource
  • Add onpopstate window event listener
  • Use BrowsingContext's session history to store history state

What needs to be done:

  • Cleanup (Clear out things marked with TODO and cleanup commits)
  • Enabling the history interface tests
  • Security Checks
  • Window onpopstate
  • Clear forward state on BrowsingContext when frames are evicted

This change is Reviewable

@highfive

Copy link
Copy Markdown

Heads up! This PR modifies the following files:

  • @jgraham: components/webdriver_server/lib.rs
  • @KiChjang: components/script/dom/htmliframeelement.rs, components/script/dom/bindings/global.rs, components/script/dom/history.rs, components/script/dom/webidls/History.webidl, components/script/dom/mod.rs, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs, components/script/dom/popstateevent.rs, components/script/dom/browsingcontext.rs, components/script/script_thread.rs, components/script/task_source/history_traversal.rs, components/script/dom/window.rs, components/script/dom/webidls/Window.webidl, 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 May 17, 2016
@cbrewster

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 697d759 with merge dda9dc8...

bors-servo pushed a commit that referenced this pull request May 17, 2016
History API

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 --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
 * Will enable these after making sure the current set of tests still pass.
- [ ] 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.

This is a work in progress. **Do not merge.**

What needs to be done:
 - [ ] Cleanup
 - [ ] Enabling the history interface tests
 - [ ] Security Checks
 - [ ] Changing `Url` on state change
@cbrewster cbrewster mentioned this pull request May 17, 2016
18 of 24 tasks
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - mac-rel-wpt

@highfive highfive added the S-tests-failed The changes caused existing tests to fail. label May 17, 2016
@highfive

Copy link
Copy Markdown
  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/PopStateEvent.html:
  └ PASS [expected FAIL] Dispatching a synthetic PopStateEvent

  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/browsing_context_name_cross_origin.html:
  └ PASS [expected FAIL] Restoring window.name on cross-origin history traversal

  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html:
  └ PASS [expected FAIL] Default value is "auto"

  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/persisted-user-state-restoration/scroll-restoration-basic.html:
  └ PASS [expected FAIL] Invalid values are ignored

  ▶ TIMEOUT [expected OK] /html/browsers/browsing-the-web/history-traversal/popstate_event.html

  ▶ Unexpected subtest result in /html/browsers/browsing-the-web/history-traversal/popstate_event.html:
  │ TIMEOUT [expected FAIL] Queue a task to fire popstate event
  └   → Test timed out

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: existence and properties of interface object

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface object length

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface object name

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: existence and properties of interface prototype object

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: existence and properties of interface prototype object's "constructor" property

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: attribute length

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: attribute scrollRestoration

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: attribute state

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: operation go(long)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: operation back()

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: operation forward()

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: operation pushState(any,DOMString,DOMString)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: operation replaceState(any,DOMString,DOMString)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History must be primary interface of window.history

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] Stringification of window.history

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "length" with the proper type (0)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "scrollRestoration" with the proper type (1)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "state" with the proper type (2)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "go" with the proper type (3)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: calling go(long) on window.history with too few arguments must throw TypeError

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "back" with the proper type (4)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property "forward" with the proper type (5)

  ▶ Unexpected subt</span><span class="stdout">est result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property &#34;pushState&#34; with the proper type (6)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: calling pushState(any,DOMString,DOMString) on window.history with too few arguments must throw TypeError

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: window.history must inherit property &#34;replaceState&#34; with the proper type (7)

  ▶ Unexpected subtest result in /html/dom/interfaces.html:
  └ PASS [expected FAIL] History interface: calling replaceState(any,DOMString,DOMString) on window.history with too few arguments must throw TypeError

  ▶ Unexpected subtest result in /_mozilla/mozilla/interfaces.html:
  │ FAIL [expected PASS] Interfaces exposed on the window
  │   → assert_true: If this is failing: DANGER, are you sure you want to expose the new interface History to all webpages as a property on the window? Do not make a change to this file without review from jdm or Ms2ger for that specific change! expected true got false
  │ 
  │ @http://web-platform.test:8000/_mozilla/mozilla/interfaces.html:254:5
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1397:20
  │ test@http://web-platform.test:8000/resources/testharness.js:495:9
  └ @http://web-platform.test:8000/_mozilla/mozilla/interfaces.html:248:1

@cbrewster

Copy link
Copy Markdown
Contributor Author

Looks like nothing broke at all! 😄

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@highfive highfive removed the S-tests-failed The changes caused existing tests to fail. label May 17, 2016
@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@cbrewster

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 59fc102 with merge ae03bdb...

bors-servo pushed a commit that referenced this pull request May 17, 2016
History API

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 --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
 * Will enable these after making sure the current set of tests still pass.
- [ ] 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.

This is a work in progress. **Do not merge.**

What needs to be done:
 - [ ] Cleanup (Clear out things marked with `TODO` and cleanup commits)
 - [ ] Enabling the history interface tests
 - [ ] Security Checks
 - [ ] Changing `Url` on state change
 - [ ] Scroll Restoration (I may save this for a different PR)
 - [ ] Window `onpopstate`
 - [x] Clear forward state on `BrowsingContext` when frames are evicted

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11220)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

☀️ Test successful - android, arm32, arm64, linux-dev, linux-rel, mac-dev-unit, mac-rel-css, mac-rel-wpt, windows

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@cbrewster

Copy link
Copy Markdown
Contributor Author

@bors-servo try

@bors-servo

Copy link
Copy Markdown
Contributor

⌛ Trying commit 122ad81 with merge c78029a...

bors-servo pushed a commit that referenced this pull request May 17, 2016
History API

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 --faster` does not report any errors
- [ ] These changes fix #__ (github issue number if applicable).

Either:
- [ ] There are tests for these changes OR
 * Will enable these after making sure the current set of tests still pass.
- [ ] 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.

This is a work in progress. **Do not merge.**

What needs to be done:
 - [ ] Cleanup (Clear out things marked with `TODO` and cleanup commits)
 - [ ] Enabling the history interface tests
 - [ ] Security Checks
 - [ ] Changing `Url` on state change
 - [ ] Scroll Restoration (I may save this for a different PR)
 - [ ] Window `onpopstate`
 - [x] Clear forward state on `BrowsingContext` when frames are evicted

<!-- Reviewable:start -->
---
This change is [<img src="https://reviewable.io/review_button.svg" height="35" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/11220)
<!-- Reviewable:end -->
@bors-servo

Copy link
Copy Markdown
Contributor

💔 Test failed - linux-rel

@cbrewster cbrewster added the S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged. label May 23, 2016
@cbrewster

Copy link
Copy Markdown
Contributor Author

Blocked by #11344

@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label May 24, 2016
@cbrewster cbrewster removed the S-needs-rebase There are merge conflict errors. label May 27, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label May 27, 2016
@cbrewster

cbrewster commented May 28, 2016 •

Copy link
Copy Markdown
Contributor Author

@asajeffrey the joint session history is now an iterator that lazily interleaves the frame tree history. Seems to work very well, plus if a Frame is removed from the tree, there should be no issue now.

Also, once we get this ready for actual reviewal, I will open a PR so reviewable isn't so slow

@cbrewster cbrewster removed the S-needs-rebase There are merge conflict errors. label May 28, 2016
@bors-servo

Copy link
Copy Markdown
Contributor

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

@highfive highfive added the S-needs-rebase There are merge conflict errors. label May 28, 2016
cbrewster added 9 commits May 27, 2016 18:40
window ref

push state

forward nav

more history api work

Added popstate event usage

more stuff

Added delta to NavigationDirection enum variants

Added history length and full delta nav

Added constellation - script communication for active history entry

Quick fixes to finish of proof of concept

Switched to use StructuredCloneData when possible

Use Heap<JS> instead of MutHeapJSVal

pushState and replaceState should be marked as Throw

Added FrameEntry

added interleaved session history

Cleanup

tidy fixes

cleaned up

clear forward browsing context session history

updated test expectations

enabled history interface tests

Added popstate event handler
fixed forward history not being cleared

Fix conditions on when popstate should be fired

push/replace state url handling

remove changing of hash as it causes a page reload

Updated test expectations

Added active document check
Address other comments

Remove duplicate popstate event binding
rebase and fix bhtml nav issue
added TODO for fully active document
@cbrewster cbrewster removed the S-needs-rebase There are merge conflict errors. label May 28, 2016
@highfive

Copy link
Copy Markdown

New code was committed to pull request.

@cbrewster cbrewster mentioned this pull request May 28, 2016
3 of 4 tasks
@cbrewster

Copy link
Copy Markdown
Contributor Author

New PR at #11481

@cbrewster cbrewster closed this May 28, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-awaiting-review There is new code that needs to be reviewed. S-blocked-on-external Something, somewhere else, needs to happen before this PR can be merged.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants