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 MutationObserver.disconnect() #20740

Merged
merged 1 commit into from May 19, 2018

Conversation

@fabricedesre
Copy link
Contributor

fabricedesre commented May 2, 2018

This implements https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
I added a node_list to the MutationObserver struct to keep track of the nodes involved in an observer because otherwise I could not find a way to unregister the observers on the node themselves without traversing the whole document tree. Let me know if there's something I missed.


  • ./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 May 2, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/node.rs, components/script/dom/webidls/MutationObserver.webidl, components/script/dom/mutationobserver.rs
  • @fitzgen: components/script/dom/node.rs, components/script/dom/webidls/MutationObserver.webidl, components/script/dom/mutationobserver.rs
  • @KiChjang: components/script/dom/node.rs, components/script/dom/webidls/MutationObserver.webidl, components/script/dom/mutationobserver.rs
@fabricedesre fabricedesre assigned fabricedesre and unassigned glennw May 2, 2018
@fabricedesre fabricedesre requested a review from jdm May 2, 2018
@jdm jdm assigned jdm and unassigned fabricedesre May 2, 2018
@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 5, 2018

@jdm did you assign it to you to work on it? (I don't mind at all)

@KiChjang
Copy link
Member

KiChjang commented May 5, 2018

@fabricedesre No, that's just @jdm assigning himself for review.

@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 5, 2018

That's confusing, as there's a distinct "reviewer" role.

@jdm
jdm approved these changes May 9, 2018
@jdm
Copy link
Member

jdm commented May 9, 2018

I like this change. Is there a reason it's still marked [wip]?

@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 9, 2018

No other reason than I was not sure this would be the correct approach.

@fabricedesre fabricedesre changed the title [wip] Implement MutationObserver.disconnect() Implement MutationObserver.disconnect() May 9, 2018
@jdm
Copy link
Member

jdm commented May 9, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 9, 2018

📌 Commit 65711c4 has been approved by jdm

@bors-servo
Copy link
Contributor

bors-servo commented May 9, 2018

Testing commit 65711c4 with merge 0dec2a5...

bors-servo added a commit that referenced this pull request May 9, 2018
Implement MutationObserver.disconnect()

<!-- Please describe your changes on the following line: -->
This implements https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
I added a `node_list` to the `MutationObserver` struct to keep track of the nodes involved in an observer because otherwise I could not find a way to unregister the observers on the node themselves without traversing the whole document tree. Let me know if there's something I missed.

---
<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

bors-servo commented May 9, 2018

💔 Test failed - linux-rel-wpt

@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 9, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented May 9, 2018

@fabricedesre: 🔑 Insufficient privileges: and not in try users

@jdm
Copy link
Member

jdm commented May 9, 2018

@fabricedesre The test expectation will need to be updated; the test probably uses MutationObserver in a way that doesn't break now.

@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 9, 2018

Oh, yes, pretty obvious looking at it...

@jdm
Copy link
Member

jdm commented May 18, 2018

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2018

Testing commit 5bfa819 with merge 6235b64...

bors-servo added a commit that referenced this pull request May 18, 2018
Implement MutationObserver.disconnect()

<!-- Please describe your changes on the following line: -->
This implements https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
I added a `node_list` to the `MutationObserver` struct to keep track of the nodes involved in an observer because otherwise I could not find a way to unregister the observers on the node themselves without traversing the whole document tree. Let me know if there's something I missed.

---
<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

bors-servo commented May 18, 2018

💔 Test failed - linux-rel-wpt

@jdm
Copy link
Member

jdm commented May 18, 2018

  ▶ OK [expected TIMEOUT] /css/cssom-view/matchMedia.xht

  ▶ Unexpected subtest result in /css/cssom-view/matchMedia.xht:
  └ PASS [expected NOTRUN] Listeners are called in the order which they have been added

  ▶ Unexpected subtest result in /css/cssom-view/matchMedia.xht:
  └ PASS [expected NOTRUN] Listener added twice is only called once.

  ▶ Unexpected subtest result in /css/cssom-view/matchMedia.xht:
  │ FAIL [expected NOTRUN] Resize iframe from 200x100 to 200x50, then to 100x50
  │   → assert_equals: Check that the MediaQueryList passed to the handler is the same that addListener was invoked on. expected object "[object MediaQueryList]" but got object "[object MediaQueryListEvent]"
  │ 
  │ window.onload/</<@http://web-platform.test:8000/css/cssom-view/matchMedia.xht:132:25
  │ Test.prototype.step@http://web-platform.test:8000/resources/testharness.js:1490:20
  └ window.onload/<@http://web-platform.test:8000/css/cssom-view/matchMedia.xht:131:21
@fabricedesre
Copy link
Contributor Author

fabricedesre commented May 18, 2018

I'm not sure what's failing here, things look fine locally:

mutation-observer-disconnect fabrice@xps13:~/dev/servo$ ./mach test ./tests/wpt/web-platform-tests/css/cssom-view/matchMedia.xht
Running 1 tests in web-platform-tests

Ran 1 tests finished in 14.0 seconds.
  • 1 ran as expected. 0 tests skipped.

Tests completed in 19.34s

And I double checked that the displayed results matched the .ini expectations.

@jdm
Copy link
Member

jdm commented May 18, 2018

You're right. Those result changes are unrelated to this PR.
@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2018

Testing commit 5bfa819 with merge b9bf3b9...

bors-servo added a commit that referenced this pull request May 18, 2018
Implement MutationObserver.disconnect()

<!-- Please describe your changes on the following line: -->
This implements https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
I added a `node_list` to the `MutationObserver` struct to keep track of the nodes involved in an observer because otherwise I could not find a way to unregister the observers on the node themselves without traversing the whole document tree. Let me know if there's something I missed.

---
<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

bors-servo commented May 18, 2018

💔 Test failed - mac-dev-unit

@jdm
Copy link
Member

jdm commented May 18, 2018

@bors-servo retry

@bors-servo
Copy link
Contributor

bors-servo commented May 18, 2018

Testing commit 5bfa819 with merge fe1a057...

bors-servo added a commit that referenced this pull request May 18, 2018
Implement MutationObserver.disconnect()

<!-- Please describe your changes on the following line: -->
This implements https://dom.spec.whatwg.org/#dom-mutationobserver-disconnect
I added a `node_list` to the `MutationObserver` struct to keep track of the nodes involved in an observer because otherwise I could not find a way to unregister the observers on the node themselves without traversing the whole document tree. Let me know if there's something I missed.

---
<!-- 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 _____

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

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

bors-servo commented May 19, 2018

@bors-servo bors-servo merged commit 5bfa819 into servo:master May 19, 2018
3 of 4 checks passed
3 of 4 checks passed
Taskcluster (pull_request) TaskGroup: failure
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
homu Test successful
Details
@fabricedesre fabricedesre moved this from In progress to Done in Hubs support May 22, 2018
@jdm jdm moved this from In progress to Done in A-Frame support May 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Hubs support
  
Done
Linked issues

Successfully merging this pull request may close these issues.

None yet

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