Commit graph

116 commits

Author SHA1 Message Date
Corey Farwell
f447040ea9 Migrate EventTarget event firing functions to use Atoms.
This allows us to utilize more `atom` macros.
2016-11-03 17:04:30 -04:00
Corey Farwell
c3b279a4c3 Remove "fire a simple event" concept, refactor event firing API.
"fire a simple event" concept was removed in
https://github.com/whatwg/html/pull/1933.
2016-11-03 15:01:07 -04:00
Simon Sapin
53b638c0e2 Update to string-cache 0.3 2016-11-03 16:23:05 +01:00
Jesse Kipp
4f0ffbd1f6 Issue 13363 - Step 1.2 of compiling event handler
When compiling event handlers, check whether scripting is enabled
and early return None/null if not.

https://html.spec.whatwg.org/multipage/
webappapis.html#getting-the-current-value-of-the-event-handler

Issue 13363 - Fix spec for disabled scripting

The original spec for this PR was bad because it depended on the
DOM without scripting enabled to use Javascript to signal the test's
failure, so it could never fail.

Use an onerror handler on `window` where scripting is enabled, and
use an invalid string of JavaScript for the handler, to detect
whether or not the event handler is *really* being compiled or not.

Condense tests into a single HTML file

Yup, didn't even realize I could do that at the time.

Remove an unnecessary test
2016-10-20 11:08:44 -04:00
Anthony Ramine
d8e92bb271 Rename Reflectable::global_scope to global 2016-10-06 21:36:41 +02:00
Anthony Ramine
907781eb75 Remove Reflectable::global 2016-10-06 21:35:58 +02:00
Anthony Ramine
ae6af5172b Introduce Reflectable::global_scope 2016-10-06 21:35:38 +02:00
Anthony Ramine
fcb59d3057 Make reflect_dom_object take a &GlobalScope 2016-10-06 20:59:09 +02:00
Stephen Lester
76e04e2acd Invert conditional and return early for AddEventListener/RemoveEventListener 2016-10-05 07:55:33 -07:00
Adolfo Ochagavía
6c8bfdb774 Return an enum instead of a boolean from dispatch_event
Fixes #13196
2016-09-26 17:52:38 +02:00
Ms2ger
ae38c53de7 Dispatch error events at the window object. 2016-09-02 11:44:44 +02:00
Ms2ger
5662f0d346 Remove the JSAutoCompartment from report_pending_exception.
It doesn't really belong there.
2016-08-26 17:59:31 +02:00
Eduard Burtescu
0db1faf876 Switch to using the new rooted!/RootedGuard API for rooting. 2016-07-04 20:59:01 +03:00
Anthony Ramine
27620320f3 Make report_pending_exception unsafe 2016-06-07 00:26:49 +02:00
Anthony Ramine
cdc7bca944 Move DOMString back to script
This entirely removes the 'non-geckolib' feature of the util crate.
2016-05-24 10:54:57 +02:00
Piotr Stankiewicz
d1af39c114 dom: Add missing event handlers
Adding:
* global event handlers,
* window event handlers,
* document and element handlers,
* and support for BeforeUnloadEvent.

Signed-off-by: Piotr Stankiewicz <bionicrift@gmail.com>
2016-05-20 18:25:13 +01:00
Anthony Ramine
60aaac5175 Remove the custom PartialEq implementations on TypeId enums
https://github.com/rust-lang/rust/pull/33593 made them useless.
2016-05-17 15:30:14 +02:00
Ms2ger
735480c184 Stop using JSAutoRequest. 2016-05-13 15:34:38 +02:00
Simon Sapin
7932ab6ac2 Upgrade to rust-url 1.0 and hyper 0.9 2016-04-23 20:27:58 +02:00
Arpad Borsos
c880c97b1b rename deprecated utf16_units to encode_utf16 2016-03-07 16:14:04 +01:00
Anthony Ramine
4d2587d6c3 Rename various bindings in event dispatching 2016-02-29 10:42:06 +01:00
Anthony Ramine
fc2cf31d5a Return a Vec from EventTarget::get_listeners_for 2016-02-29 10:42:02 +01:00
Anthony Ramine
590316a468 Merge EventTarget::{get_listeners, get_listeners_for} 2016-02-29 10:41:57 +01:00
João Oliveira
b60d668908 use return value of invoking event handlers to cancel the event 2016-02-26 10:17:57 -05:00
Anthony Ramine
0adfb08089 Implement From<DOMString> for Atom 2016-02-24 17:52:17 +01:00
Anthony Ramine
25ae4ed093 Use atom!("error") in EventTarget::get_compiled_event_handler 2016-02-24 17:52:14 +01:00
bors-servo
0209d42b7b Auto merge of #9701 - Ms2ger:listener-is-some, r=KiChjang
Use if-let in set_inline_event_listener.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9701)
<!-- Reviewable:end -->
2016-02-19 21:34:22 +05:30
Josh Matthews
2796a4dfa8 Compile raw inline event handlers lazily. Resolves #8489. 2016-02-11 15:44:52 +01:00
Ms2ger
1b50023a08 Use if-let in set_inline_event_listener. 2016-02-11 15:14:19 +01:00
Ms2ger
5317af1e19 Remove the global argument to EventTarget::{fire_event, fire_simple_event}. 2016-02-08 19:21:56 +01:00
Alexander Lopatin
2be49404be Fix #9508: Beautify our union enums constructors 2016-02-07 02:55:21 +03:00
bors-servo
87aaa5ffe0 Auto merge of #9523 - ruud-v-a:hasher, r=Wafflespeanut
Upgrade to new Hasher API

This fixes #9494.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9523)
<!-- Reviewable:end -->
2016-02-05 07:32:13 +05:30
Anthony Ramine
cb5cd8d881 Say farewell to in-tree HeapSizeOf 2016-02-04 22:03:32 +01:00
Ruud van Asseldonk
95be0b9a25 Upgrade to new Hasher API 2016-02-03 20:06:39 +01:00
Chad Kimes
ce6075825d Add global default method for Reflectable trait 2016-01-11 20:23:47 -05:00
Keith Yeung
c3f73b36e1 Fix documentation links for EventTarget 2016-01-09 06:33:36 -05:00
Brandon Fairchild
fb0304cfdb Rename fire_simple_event_params to fire_event
Fixes #9180.
2016-01-07 13:49:49 -05:00
Johannes Linke
6b215f38ee Fix a bunch of clippy lints 2016-01-02 23:27:15 +01:00
Arthur Skobara
d38771e270 Implement EventTarget::fire_simple_event and EventTarget::fire_simple_event_params 2015-12-22 13:47:57 +06:00
Alan Jeffrey
3dec6edd10 Update string_cache to 0.2.
Updated string_cache, html5ever, xml5ever and selectors in Cargo.toml files and Cargo.lock.
Removed references to string_cache_plugin.
Import atom! and ns! from string_cache.
Replaced ns!("") by ns!().
Replaced ns!(XML) and co by ns!(xml) and co.
Replaced atom!(foo) by atom!("foo").
Replaced Atom::from_slice by Atom::from.
Replaced atom.as_slice() by &*atom.
2015-11-25 10:13:21 -06:00
Josh Matthews
2340583e56 Differentiate between error and non-error event handlers per the spec. 2015-11-12 16:21:24 -05:00
rohan.prinja
6e774ea6eb merge from master 2015-11-03 19:01:23 +09:00
David Zbarsky
0070adb71f Use an Atom for Event.type 2015-11-01 09:42:11 -08:00
rohan.prinja
51df8e310b rearrange imports to be in alphabetical order 2015-10-30 20:28:59 +09:00
rohan.prinja
9fd823e449 replace InheritTypes imports with inheritance imports 2015-10-30 20:26:30 +09:00
rohan.prinja
45224028db more refactoring 2015-10-30 20:26:29 +09:00
Adam Szopa
88991013ab Remove explicit lifetimes which can be elided. 2015-10-21 01:27:48 +02:00
Michael Wu
e733a7c46a Support the updated spidermonkey bindings 2015-10-14 15:30:52 -04:00
Anthony Ramine
aab2c40389 Generate the TypeId enums in codegen 2015-10-14 18:45:35 +02:00
Anthony Urena
ba86131cd5 Refactor Error enum usage to consistently be qualified 2015-10-06 05:43:52 -04:00