diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-10-02 17:11:29 +0200 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-10-06 21:35:46 +0200 |
commit | d4fccbace431b003abbc49f2fbc5e8b2de6b3f2a (patch) | |
tree | 988014f7e9b0331a65796f806fedaecdff593b43 /components/script/dom/bluetooth.rs | |
parent | 918352519293cbf3ac86df7cfbe5f3cb9d07f0bc (diff) | |
download | servo-d4fccbace431b003abbc49f2fbc5e8b2de6b3f2a.tar.gz servo-d4fccbace431b003abbc49f2fbc5e8b2de6b3f2a.zip |
Make bluetooth::result_to_promise take a &GlobalScope
Diffstat (limited to 'components/script/dom/bluetooth.rs')
-rw-r--r-- | components/script/dom/bluetooth.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/components/script/dom/bluetooth.rs b/components/script/dom/bluetooth.rs index 143bc04855a..a0e5484abd3 100644 --- a/components/script/dom/bluetooth.rs +++ b/components/script/dom/bluetooth.rs @@ -8,7 +8,6 @@ use dom::bindings::codegen::Bindings::BluetoothBinding::{self, BluetoothMethods, use dom::bindings::codegen::Bindings::BluetoothBinding::RequestDeviceOptions; use dom::bindings::error::Error::{self, Security, Type}; use dom::bindings::error::Fallible; -use dom::bindings::global::GlobalRef; use dom::bindings::js::Root; use dom::bindings::reflector::{Reflectable, Reflector, reflect_dom_object}; use dom::bindings::str::DOMString; @@ -271,10 +270,10 @@ fn canonicalize_filter(filter: &BluetoothRequestDeviceFilter) -> Fallible<Blueto } #[allow(unrooted_must_root)] -pub fn result_to_promise<T: ToJSValConvertible>(global_ref: GlobalRef, +pub fn result_to_promise<T: ToJSValConvertible>(global: &GlobalScope, bluetooth_result: Fallible<T>) -> Rc<Promise> { - let p = Promise::new(global_ref.as_global_scope()); + let p = Promise::new(global); match bluetooth_result { Ok(v) => p.resolve_native(p.global().r().get_cx(), &v), Err(e) => p.reject_error(p.global().r().get_cx(), e), @@ -298,6 +297,6 @@ impl BluetoothMethods for Bluetooth { #[allow(unrooted_must_root)] // https://webbluetoothcg.github.io/web-bluetooth/#dom-bluetooth-requestdevice fn RequestDevice(&self, option: &RequestDeviceOptions) -> Rc<Promise> { - result_to_promise(self.global().r(), self.request_device(option)) + result_to_promise(&self.global_scope(), self.request_device(option)) } } |