Introduce Reflectable::global_scope

This commit is contained in:
Anthony Ramine 2016-10-01 18:15:15 +02:00
parent 27f100b1d4
commit ae6af5172b
30 changed files with 116 additions and 120 deletions

View file

@ -535,8 +535,6 @@ impl Runnable for CloseTask {
fn handler(self: Box<Self>) {
let ws = self.address.root();
let ws = ws.r();
let global = ws.global();
if ws.ready_state.get() == WebSocketRequestState::Closed {
// Do nothing if already closed.
@ -558,7 +556,7 @@ impl Runnable for CloseTask {
let clean_close = !self.failed;
let code = self.code.unwrap_or(close_code::NO_STATUS);
let reason = DOMString::from(self.reason.unwrap_or("".to_owned()));
let close_event = CloseEvent::new(global.r().as_global_scope(),
let close_event = CloseEvent::new(&ws.global_scope(),
atom!("close"),
EventBubbles::DoesNotBubble,
EventCancelable::NotCancelable,