mirror of
https://github.com/servo/servo.git
synced 2025-07-24 15:50:21 +01:00
Pass around event types as Atoms instead of Strings
`Event` internally stores the `type` as an `Atom`, and we're `String`s everywhere, which can cause unnecessary allocations to occur since they'll end up as `Atom`s anyways.
This commit is contained in:
parent
996c0a60b8
commit
4accaf50b2
25 changed files with 156 additions and 135 deletions
|
@ -128,7 +128,7 @@ impl Worker {
|
|||
let worker = address.root();
|
||||
let global = worker.r().global.root();
|
||||
let event = Event::new(global.r(),
|
||||
DOMString::from("error"),
|
||||
atom!("error"),
|
||||
EventBubbles::DoesNotBubble,
|
||||
EventCancelable::NotCancelable);
|
||||
event.fire(worker.upcast());
|
||||
|
@ -139,7 +139,7 @@ impl Worker {
|
|||
let worker = address.root();
|
||||
let global = worker.r().global.root();
|
||||
let error = RootedValue::new(global.r().get_cx(), UndefinedValue());
|
||||
let errorevent = ErrorEvent::new(global.r(), DOMString::from("error"),
|
||||
let errorevent = ErrorEvent::new(global.r(), atom!("error"),
|
||||
EventBubbles::Bubbles, EventCancelable::Cancelable,
|
||||
message, filename, lineno, colno, error.handle());
|
||||
errorevent.upcast::<Event>().fire(worker.upcast());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue