Skip to content

Commit

Permalink
Add more event names to atom list; use more atom macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
frewsxcv committed Nov 6, 2016
1 parent c62ce53 commit 54e490a
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
4 changes: 3 additions & 1 deletion components/atoms/static_atoms.txt
Expand Up @@ -74,4 +74,6 @@ invalid
change
open
toggle

statechange
controllerchange
fetch
3 changes: 1 addition & 2 deletions components/script/dom/serviceworker.rs
Expand Up @@ -18,7 +18,6 @@ use dom::globalscope::GlobalScope;
use js::jsapi::{HandleValue, JSContext};
use script_thread::Runnable;
use script_traits::{ScriptMsg, DOMMessage};
use servo_atoms::Atom;
use std::cell::Cell;
use url::Url;

Expand Down Expand Up @@ -62,7 +61,7 @@ impl ServiceWorker {

pub fn set_transition_state(&self, state: ServiceWorkerState) {
self.state.set(state);
self.upcast::<EventTarget>().fire_event(Atom::from("statechange"));
self.upcast::<EventTarget>().fire_event(atom!("statechange"));
}

pub fn get_script_url(&self) -> Url {
Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/serviceworkercontainer.rs
Expand Up @@ -15,7 +15,6 @@ use dom::promise::Promise;
use dom::serviceworker::ServiceWorker;
use dom::serviceworkerregistration::ServiceWorkerRegistration;
use script_thread::ScriptThread;
use servo_atoms::Atom;
use std::ascii::AsciiExt;
use std::default::Default;
use std::rc::Rc;
Expand Down Expand Up @@ -46,7 +45,7 @@ pub trait Controllable {
impl Controllable for ServiceWorkerContainer {
fn set_controller(&self, active_worker: &ServiceWorker) {
self.controller.set(Some(active_worker));
self.upcast::<EventTarget>().fire_event(Atom::from("controllerchange"));
self.upcast::<EventTarget>().fire_event(atom!("controllerchange"));
}
}

Expand Down
3 changes: 1 addition & 2 deletions components/script/dom/serviceworkerglobalscope.rs
Expand Up @@ -28,7 +28,6 @@ use net_traits::request::{CredentialsMode, Destination, RequestInit, Type as Req
use rand::random;
use script_runtime::{CommonScriptMsg, StackRootTLS, get_reports, new_rt_and_cx, ScriptChan};
use script_traits::{TimerEvent, WorkerGlobalScopeInit, ScopeThings, ServiceWorkerMsg, WorkerScriptLoadOrigin};
use servo_atoms::Atom;
use std::sync::mpsc::{Receiver, RecvError, Select, Sender, channel};
use std::thread;
use std::time::Duration;
Expand Down Expand Up @@ -269,7 +268,7 @@ impl ServiceWorkerGlobalScope {
// TODO XXXcreativcoder This will eventually use a FetchEvent interface to fire event
// when we have the Request and Response dom api's implemented
// https://slightlyoff.github.io/ServiceWorker/spec/service_worker_1/index.html#fetch-event-section
self.upcast::<EventTarget>().fire_event(Atom::from("fetch"));
self.upcast::<EventTarget>().fire_event(atom!("fetch"));
let _ = mediator.response_chan.send(None);
}
}
Expand Down

0 comments on commit 54e490a

Please sign in to comment.