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 AddEventListenerOptions: once #22100

Merged
merged 1 commit into from
Dec 22, 2018
Merged

Conversation

Eijebong
Copy link
Contributor

@Eijebong Eijebong commented Nov 3, 2018

Fixes #13242


This change is Reviewable

@highfive
Copy link

highfive commented Nov 3, 2018

Heads up! This PR modifies the following files:

  • @asajeffrey: components/script/dom/event.rs, components/script/dom/eventtarget.rs, components/script/dom/mediaquerylist.rs, components/script/dom/webidls/EventTarget.webidl
  • @KiChjang: components/script/dom/event.rs, components/script/dom/eventtarget.rs, components/script/dom/mediaquerylist.rs, components/script/dom/webidls/EventTarget.webidl

@highfive highfive added the S-awaiting-review There is new code that needs to be reviewed. label Nov 3, 2018
@Eijebong
Copy link
Contributor Author

Eijebong commented Nov 3, 2018

@bors-servo try=wpt

@bors-servo
Copy link
Contributor

⌛ Trying commit 7260c30 with merge 1051b37...

bors-servo pushed a commit that referenced this pull request Nov 3, 2018
Implement AddEventListenerOptions: once

Fixes #13242

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

☀️ Test successful - linux-rel-css, linux-rel-wpt
State: approved= try=True


impl std::cmp::PartialEq for EventListenerEntry {
fn eq(&self, other: &Self) -> bool {
self.phase == other.phase && self.listener == other.listener
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is once ignored?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because removing an eventlistener without specifying once: true still needs to find the ones that are once

components/script/dom/eventtarget.rs Outdated Show resolved Hide resolved
components/script/dom/eventtarget.rs Show resolved Hide resolved
@nox nox added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Nov 22, 2018
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Nov 28, 2018

let listener = EventListenerType::Additive(listener);
for entry in handlers.get_mut(ty) {
if let Some(position) = entry.iter().position(|e| e.listener == listener && e.once) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can probably use drain here, which will result in slightly more performant code.

});
}
},
}
}

pub fn remove_listener_if_once(&self, ty: &Atom, listener: Rc<EventListener>) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make listener be a &Rc<EventListener> and you will be able to avoid a cloning operation in the caller.

@jdm
Copy link
Member

jdm commented Dec 19, 2018

This should improve the behaviour of html/webappapis/dynamic-markup-insertion/opening-the-input-stream/bailout-exception-vs-return-xml.window.js; otherwise it ends up endlessly loading new iframes.

@jdm jdm added S-needs-code-changes Changes have not yet been made that were requested by a reviewer. and removed S-awaiting-review There is new code that needs to be reviewed. labels Dec 19, 2018
@highfive highfive added S-awaiting-review There is new code that needs to be reviewed. and removed S-needs-code-changes Changes have not yet been made that were requested by a reviewer. labels Dec 20, 2018
@Eijebong
Copy link
Contributor Author

There, anything else ? :p

@jdm
Copy link
Member

jdm commented Dec 22, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 4b45958 has been approved by jdm

@highfive highfive assigned jdm and unassigned nox Dec 22, 2018
@highfive highfive removed the S-awaiting-review There is new code that needs to be reviewed. label Dec 22, 2018
@highfive highfive added the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 22, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit 4b45958 with merge 46f5b8d...

bors-servo pushed a commit that referenced this pull request Dec 22, 2018
Implement AddEventListenerOptions: once

Fixes #13242

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

💔 Test failed - status-taskcluster

@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 Dec 22, 2018
@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 Dec 22, 2018
@Eijebong
Copy link
Contributor Author

Ran rustfmt

@jdm
Copy link
Member

jdm commented Dec 22, 2018

@bors-servo r+

@bors-servo
Copy link
Contributor

📌 Commit 50c8327 has been approved by jdm

@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 Dec 22, 2018
@bors-servo
Copy link
Contributor

⌛ Testing commit 50c8327 with merge cc0e7fd...

bors-servo pushed a commit that referenced this pull request Dec 22, 2018
Implement AddEventListenerOptions: once

Fixes #13242

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

☀️ Test successful - android-mac, arm32, arm64, linux-rel-css, linux-rel-wpt, mac-rel-css1, mac-rel-css2, mac-rel-wpt1, mac-rel-wpt2, mac-rel-wpt3, mac-rel-wpt4, magicleap, status-taskcluster
Approved by: jdm
Pushing cc0e7fd to master...

@bors-servo bors-servo merged commit 50c8327 into servo:master Dec 22, 2018
@highfive highfive removed the S-awaiting-merge The PR is in the process of compiling and running tests on the automated CI. label Dec 22, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants