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

Implement history.length #12685

Merged
merged 1 commit into from Aug 4, 2016
Merged

Implement history.length #12685

merged 1 commit into from Aug 4, 2016

Conversation

@cbrewster
Copy link
Member

cbrewster commented Aug 1, 2016


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

Heads up! This PR modifies the following files:

  • @asajeffrey: components/constellation/constellation.rs
  • @KiChjang: components/script/dom/history.rs, components/script/dom/webidls/History.webidl, components/script_traits/script_msg.rs, components/script_traits/script_msg.rs
@highfive
Copy link

highfive commented Aug 1, 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 Aug 1, 2016

@bors-servo
Copy link
Contributor

bors-servo commented Aug 1, 2016

Trying commit affe472 with merge 926e9df...

bors-servo added a commit that referenced this pull request Aug 1, 2016
Implement history.length

<!-- 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
- [ ] 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. -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 1, 2016

💔 Test failed - linux-rel

@cbrewster
Copy link
Member Author

cbrewster commented Aug 2, 2016

  ▶ Unexpected subtest result in /html/browsers/history/the-location-interface/location_assign_about_blank.html:
  │ FAIL [expected PASS] location.assign with initial about:blank browsing context
  │   → assert_equals: expected 1 but got 2
  │ 
  │ onload</</iframe.onload</<@http://web-platform.test:8000/html/browsers/history/the-location-interface/location_assign_about_blank.html:8:11
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1402:20
  └ Test.prototype.step_func/<@http://web-platform.test:8000/resources/testharness.js:1426:20

I am going to mark this as failing, since about:blank is not replaced after navigating. I will investigate that issue later.

@cbrewster cbrewster force-pushed the cbrewster:history_length branch from affe472 to d76302c Aug 2, 2016
@highfive highfive removed the S-tests-failed label Aug 2, 2016
@Manishearth
Copy link
Member

Manishearth commented Aug 2, 2016

@highfive highfive assigned asajeffrey and unassigned cbrewster Aug 2, 2016
@cbrewster cbrewster mentioned this pull request Aug 2, 2016
18 of 24 tasks complete
@asajeffrey
Copy link
Member

asajeffrey commented Aug 2, 2016

Yay, another property implemented! A question about code reuse, but apart from that LGTM.


Reviewed 4 of 4 files at r1, 4 of 4 files at r2.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/constellation/constellation.rs, line 1499 [r2] (raw file):

    }

    fn handle_joint_session_history_length(&self, pipeline_id: PipelineId, sender: IpcSender<u32>) {

Can we not reuse some code from joint_session_future and joint_session_past? Something like have functions joint_session_future_iterator, which iterates over the unsorted joint session future, and ditto past. Then the joint session future would be something like let mut result = joint_session_future_iterator().collect(); result.sort(); result, and this function could be joint_session_past_iterator().length() + joint_session_future_iterator().length().


Comments from Reviewable

@cbrewster
Copy link
Member Author

cbrewster commented Aug 2, 2016

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/constellation/constellation.rs, line 1499 [r2] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

Can we not reuse some code from joint_session_future and joint_session_past? Something like have functions joint_session_future_iterator, which iterates over the unsorted joint session future, and ditto past. Then the joint session future would be something like let mut result = joint_session_future_iterator().collect(); result.sort(); result, and this function could be joint_session_past_iterator().length() + joint_session_future_iterator().length().

Creating an iterator would be a little too complicated for this scenario. Since it would be a massive chain of `Chain`s. The only other option would to create a new struct that impls Iterator, which I think ends up being too complicated for this.

Comments from Reviewable

@asajeffrey
Copy link
Member

asajeffrey commented Aug 2, 2016

Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/constellation/constellation.rs, line 1499 [r2] (raw file):

Previously, ConnorGBrewster (Connor Brewster) wrote…

Creating an iterator would be a little too complicated for this scenario. Since it would be a massive chain of Chains. The only other option would to create a new struct that impls Iterator, which I think ends up being too complicated for this.

OK, if you reckon it would be more complicated. It looks to me like you've done most of the work. Perhaps a version of `FrameTreeIterator` that iterated over every frame, not just the fully active ones?

Comments from Reviewable

@cbrewster
Copy link
Member Author

cbrewster commented Aug 3, 2016

Review status: 7 of 8 files reviewed at latest revision, 1 unresolved discussion.


components/constellation/constellation.rs, line 1499 [r2] (raw file):

Previously, asajeffrey (Alan Jeffrey) wrote…

OK, if you reckon it would be more complicated. It looks to me like you've done most of the work. Perhaps a version of FrameTreeIterator that iterated over every frame, not just the fully active ones?

I like that idea, I have done that and it does reduce code duplication quite a bit. I would like to use it in `clear_joint_session_future` but that requires a mutable iterator. I don't want to make a separate mutable iterator just for use in one place, nor do I want to make it always mutable. Any thoughts?

Comments from Reviewable

@asajeffrey
Copy link
Member

asajeffrey commented Aug 3, 2016

LGTM, squash and r=me.


Reviewed 1 of 1 files at r3.
Review status: all files reviewed at latest revision, 1 unresolved discussion.


components/constellation/constellation.rs, line 1499 [r2] (raw file):

Previously, ConnorGBrewster (Connor Brewster) wrote…

I like that idea, I have done that and it does reduce code duplication quite a bit. I would like to use it in clear_joint_session_future but that requires a mutable iterator. I don't want to make a separate mutable iterator just for use in one place, nor do I want to make it always mutable. Any thoughts?

This is much nicer now. I'm afraid I can't see an easy way to share code between the mutable and immutable iterators, Rust doesn't have polymorphism over mutability.

Comments from Reviewable

Add full frame tree iter to reduce code duplication
Add FrameId field to the Frame struct.
@cbrewster cbrewster force-pushed the cbrewster:history_length branch from 43065c2 to 611de2a Aug 3, 2016
@cbrewster
Copy link
Member Author

cbrewster commented Aug 3, 2016

@bors-servo r=asajeffrey

@bors-servo
Copy link
Contributor

bors-servo commented Aug 3, 2016

📌 Commit 611de2a has been approved by asajeffrey

bors-servo added a commit that referenced this pull request Aug 4, 2016
Implement history.length

<!-- 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
- [ ] These changes fix #__ (github issue number if applicable).

<!-- Either: -->
- [x] 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/12685)
<!-- Reviewable:end -->
@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2016

Testing commit 611de2a with merge 7aafc0d...

@bors-servo
Copy link
Contributor

bors-servo commented Aug 4, 2016

@bors-servo bors-servo merged commit 611de2a into servo:master Aug 4, 2016
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.

None yet

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