diff options
author | Ms2ger <ms2ger@gmail.com> | 2014-07-15 22:28:43 +0200 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2014-07-15 22:28:43 +0200 |
commit | d97ec6995773ee79fbde053520bc580e7b33d15d (patch) | |
tree | e5a00cefa1309b80bc8a44287c3cc9059ed4a257 /src/components/script/dom/testbinding.rs | |
parent | f816a92c72e2eb60f733b2cd7072c8542710d5ae (diff) | |
parent | df9d063b36aca184a336b9e67da3ce30bb46cb79 (diff) | |
download | servo-d97ec6995773ee79fbde053520bc580e7b33d15d.tar.gz servo-d97ec6995773ee79fbde053520bc580e7b33d15d.zip |
Merge pull request #2839 from Ms2ger/globals
Introduce abstractions for global scopes; r=Manishearth,larsberg
Diffstat (limited to 'src/components/script/dom/testbinding.rs')
-rw-r--r-- | src/components/script/dom/testbinding.rs | 26 |
1 files changed, 12 insertions, 14 deletions
diff --git a/src/components/script/dom/testbinding.rs b/src/components/script/dom/testbinding.rs index 72d2f68dd88..bf3e5f2d232 100644 --- a/src/components/script/dom/testbinding.rs +++ b/src/components/script/dom/testbinding.rs @@ -2,27 +2,25 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -use dom::bindings::js::{JS, JSRef, Temporary}; use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnum; use dom::bindings::codegen::Bindings::TestBindingBinding::TestEnumValues::_empty; use dom::bindings::codegen::UnionTypes::BlobOrString::BlobOrString; use dom::bindings::codegen::UnionTypes::EventOrString::{EventOrString, eString}; use dom::bindings::codegen::UnionTypes::HTMLElementOrLong::{HTMLElementOrLong, eLong}; +use dom::bindings::global::GlobalField; +use dom::bindings::js::{JSRef, Temporary}; use dom::bindings::str::ByteString; use dom::bindings::utils::{Reflector, Reflectable}; use dom::blob::Blob; -use dom::window::Window; use servo_util::str::DOMString; use js::jsapi::JSContext; use js::jsval::{JSVal, NullValue}; -use std::cell::Cell; - #[deriving(Encodable)] pub struct TestBinding { - pub reflector: Reflector, - pub window: Cell<JS<Window>>, + reflector: Reflector, + global: GlobalField, } pub trait TestBindingMethods { @@ -279,20 +277,20 @@ pub trait TestBindingMethods { impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn InterfaceAttribute(&self) -> Temporary<Blob> { - let window = self.window.get().root(); - Blob::new(&*window) + let global = self.global.root(); + Blob::new(&global.root_ref()) } fn GetInterfaceAttributeNullable(&self) -> Option<Temporary<Blob>> { - let window = self.window.get().root(); - Some(Blob::new(&*window)) + let global = self.global.root(); + Some(Blob::new(&global.root_ref())) } fn ReceiveInterface(&self) -> Temporary<Blob> { - let window = self.window.get().root(); - Blob::new(&*window) + let global = self.global.root(); + Blob::new(&global.root_ref()) } fn ReceiveNullableInterface(&self) -> Option<Temporary<Blob>> { - let window = self.window.get().root(); - Some(Blob::new(&*window)) + let global = self.global.root(); + Some(Blob::new(&global.root_ref())) } } |