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
use return value of invoking event handlers to cancel the event #8707
Conversation
We don't implement OnBeforeUnloadEventHandler or BeforeUnloadEvent yet; adding the new event interface is straightforward, but adding support for the special event handler will require work similar to #8430. I think doing that in a separate PR would make sense (or a separate commit in this one, if you'd like!), so it could just be a TODO in this one. As for checking whether it's null, there's an |
ok thanks, updated! Yeah i agree on a new PR so that this one can be closed first, what do you think? |
That works for me! |
It may be the case that the return value is never Also, there's the problem of
which I assume means we need to add it to the list in the string-cache repo. |
Already done, and landed in Servo; this PR just needs to be rebased. |
229a083
to
d9ecade
Compare
ok, updated to |
Whoops, we need to update the code to account for #8710 now. |
ok, updated! |
Sorry for the delay! Reviewed 1 of 1 files at r1. components/script/dom/eventtarget.rs, line 130 [r1] (raw file): components/script/dom/eventtarget.rs, line 131 [r1] (raw file): components/script/dom/eventtarget.rs, line 137 [r1] (raw file): components/script/dom/eventtarget.rs, line 148 [r1] (raw file): components/script/dom/eventtarget.rs, line 149 [r1] (raw file): components/script/dom/eventtarget.rs, line 151 [r1] (raw file): components/script/dom/eventtarget.rs, line 152 [r1] (raw file): components/script/dom/eventtarget.rs, line 156 [r1] (raw file): components/script/dom/eventtarget.rs, line 161 [r1] (raw file): components/script/dom/eventtarget.rs, line 171 [r1] (raw file): Comments from the review on Reviewable.io |
Don't forget to run Reviewed 1 of 1 files at r2. components/script/dom/eventtarget.rs, line 130 [r1] (raw file): let return_value = handler.Call_(object, ...);
if let Some(return_value) = return_value {
let return_value = RootedValue::new(cx, return_value);
...
} components/script/dom/eventtarget.rs, line 156 [r1] (raw file): components/script/dom/eventtarget.rs, line 139 [r2] (raw file): if let Ok(return_value) = return_value {
...
if return_value.is_boolean() && return_value.to_boolean() == true {
...
}
} components/script/dom/eventtarget.rs, line 149 [r2] (raw file): Comments from the review on Reviewable.io |
-S-awaiting-review +S-needs-code-changes Reviewed 1 of 1 files at r6. tests/wpt/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html, line 15 [r5] (raw file): tests/wpt/web-platform-tests/html/webappapis/scripting/events/event-handler-processing-algorithm.html, line 25 [r5] (raw file): Comments from the review on Reviewable.io |
☔ The latest upstream changes (presumably #8903) made this pull request unmergeable. Please resolve the merge conflicts. |
The changes here appear to have reverted to an earlier revision that didn't build. Review status: 0 of 3 files reviewed at latest revision, 2 unresolved discussions, some commit checks failed. Comments from the review on Reviewable.io |
☔ The latest upstream changes (presumably #9062) made this pull request unmergeable. Please resolve the merge conflicts. |
@jxs Are you still working on this? |
This is totally waiting on me. The spec issue I filed doesn't really have resolution yet. |
Rebased in #9755. |
use return value of invoking event handlers to cancel the event Rebased from #8707. Fixes #8490. We can modify the code and test as necessary whenever we make a decision about whatwg/html#423 in the future. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9755) <!-- Reviewable:end -->
use return value of invoking event handlers to cancel the event Rebased from #8707. Fixes #8490. We can modify the code and test as necessary whenever we make a decision about whatwg/html#423 in the future. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9755) <!-- Reviewable:end -->
use return value of invoking event handlers to cancel the event Rebased from #8707. Fixes #8490. We can modify the code and test as necessary whenever we make a decision about whatwg/html#423 in the future. <!-- Reviewable:start --> [<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9755) <!-- Reviewable:end -->
Fixes #8490.
@jdm having some questions on the beforeunload event: how can i check if return_value is null?
shoud i also check if "If the Event object E is a BeforeUnloadEvent object, and the Event object E's returnValue attribute's value is the empty string, then set the returnValue attribute's value to return value." ?
thanks!