diff options
author | Ms2ger <ms2ger@gmail.com> | 2015-01-01 12:21:47 +0100 |
---|---|---|
committer | Ms2ger <ms2ger@gmail.com> | 2015-01-01 20:38:04 +0100 |
commit | 6077ed0ce8eceff97284657d3ae90ec08c9da810 (patch) | |
tree | 5dcb662e3476550c9242b94e79bfb9becb340f78 /components/script | |
parent | d09d245ee1c0d6e095a29327555940f1256fc1e4 (diff) | |
download | servo-6077ed0ce8eceff97284657d3ae90ec08c9da810.tar.gz servo-6077ed0ce8eceff97284657d3ae90ec08c9da810.zip |
Rename GlobalRoot::root_ref() to GlobalRoot::r() for consistency.
Diffstat (limited to 'components/script')
-rw-r--r-- | components/script/dom/bindings/callback.rs | 2 | ||||
-rw-r--r-- | components/script/dom/bindings/codegen/CodegenRust.py | 4 | ||||
-rw-r--r-- | components/script/dom/bindings/global.rs | 2 | ||||
-rw-r--r-- | components/script/dom/blob.rs | 4 | ||||
-rw-r--r-- | components/script/dom/formdata.rs | 2 | ||||
-rw-r--r-- | components/script/dom/storage.rs | 4 | ||||
-rw-r--r-- | components/script/dom/testbinding.rs | 8 | ||||
-rw-r--r-- | components/script/dom/worker.rs | 6 | ||||
-rw-r--r-- | components/script/dom/xmlhttprequest.rs | 14 |
9 files changed, 23 insertions, 23 deletions
diff --git a/components/script/dom/bindings/callback.rs b/components/script/dom/bindings/callback.rs index 56690bcfd41..bd6cf907220 100644 --- a/components/script/dom/bindings/callback.rs +++ b/components/script/dom/bindings/callback.rs @@ -147,7 +147,7 @@ impl CallSetup { pub fn new<T: CallbackContainer>(callback: T, handling: ExceptionHandling) -> CallSetup { let global = global_object_for_js_object(callback.callback()); let global = global.root(); - let cx = global.root_ref().get_cx(); + let cx = global.r().get_cx(); CallSetup { cx: cx, _handling: handling diff --git a/components/script/dom/bindings/codegen/CodegenRust.py b/components/script/dom/bindings/codegen/CodegenRust.py index 127e8615b1d..5ade3e8b683 100644 --- a/components/script/dom/bindings/codegen/CodegenRust.py +++ b/components/script/dom/bindings/codegen/CodegenRust.py @@ -2222,7 +2222,7 @@ class CGCallGenerator(CGThing): " Ok(result) => result,\n" " Err(e) => {\n" "%s" - " throw_dom_exception(cx, global.root_ref(), e);\n" + " throw_dom_exception(cx, global.r(), e);\n" " return%s;\n" " },\n" "};" % (glob, errorResult))) @@ -4014,7 +4014,7 @@ let global = global_object_for_js_object(JS_CALLEE(cx, vp).to_object()); let global = global.root(); """) nativeName = MakeNativeName(self._ctor.identifier.name) - callGenerator = CGMethodCall(["&global.root_ref()"], nativeName, True, + callGenerator = CGMethodCall(["&global.r()"], nativeName, True, self.descriptor, self._ctor) return CGList([preamble, callGenerator]) diff --git a/components/script/dom/bindings/global.rs b/components/script/dom/bindings/global.rs index 7fa9ba6c05c..8079c796094 100644 --- a/components/script/dom/bindings/global.rs +++ b/components/script/dom/bindings/global.rs @@ -101,7 +101,7 @@ impl<'a> Reflectable for GlobalRef<'a> { impl GlobalRoot { /// Obtain a safe reference to the global object that cannot outlive the /// lifetime of this root. - pub fn root_ref<'c>(&'c self) -> GlobalRef<'c> { + pub fn r<'c>(&'c self) -> GlobalRef<'c> { match *self { GlobalRoot::Window(ref window) => GlobalRef::Window(window.r()), GlobalRoot::Worker(ref worker) => GlobalRef::Worker(worker.r()), diff --git a/components/script/dom/blob.rs b/components/script/dom/blob.rs index 8532f37751a..b5922705d11 100644 --- a/components/script/dom/blob.rs +++ b/components/script/dom/blob.rs @@ -121,13 +121,13 @@ impl<'a> BlobMethods for JSRef<'a, Blob> { let span: i64 = max(relativeEnd - relativeStart, 0); let global = self.global.root(); match self.bytes { - None => Blob::new(&global.root_ref(), None, relativeContentType.as_slice()), + None => Blob::new(&global.r(), None, relativeContentType.as_slice()), Some(ref vec) => { let start = relativeStart.to_uint().unwrap(); let end = (relativeStart + span).to_uint().unwrap(); let mut bytes: Vec<u8> = Vec::new(); bytes.push_all(vec.slice(start, end)); - Blob::new(&global.root_ref(), Some(bytes), relativeContentType.as_slice()) + Blob::new(&global.r(), Some(bytes), relativeContentType.as_slice()) } } } diff --git a/components/script/dom/formdata.rs b/components/script/dom/formdata.rs index 8bf4daf4f15..c75823e53ce 100644 --- a/components/script/dom/formdata.rs +++ b/components/script/dom/formdata.rs @@ -116,6 +116,6 @@ impl PrivateFormDataHelpers for FormData { let global = self.global.root(); let f: Option<JSRef<File>> = FileCast::to_ref(value); let name = filename.unwrap_or(f.map(|inner| inner.name().clone()).unwrap_or("blob".into_string())); - File::new(&global.root_ref(), value, name) + File::new(&global.r(), value, name) } } diff --git a/components/script/dom/storage.rs b/components/script/dom/storage.rs index acf2d43d1ca..cbbabb912a7 100644 --- a/components/script/dom/storage.rs +++ b/components/script/dom/storage.rs @@ -38,13 +38,13 @@ impl Storage { fn get_url(&self) -> Url { let global_root = self.global.root(); - let global_ref = global_root.root_ref(); + let global_ref = global_root.r(); global_ref.get_url() } fn get_storage_task(&self) -> StorageTask { let global_root = self.global.root(); - let global_ref = global_root.root_ref(); + let global_ref = global_root.r(); global_ref.as_window().storage_task() } diff --git a/components/script/dom/testbinding.rs b/components/script/dom/testbinding.rs index 9bf48116145..a9e0023c15a 100644 --- a/components/script/dom/testbinding.rs +++ b/components/script/dom/testbinding.rs @@ -59,7 +59,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn SetEnumAttribute(self, _: TestEnum) {} fn InterfaceAttribute(self) -> Temporary<Blob> { let global = self.global.root(); - Blob::new(&global.root_ref(), None, "") + Blob::new(&global.r(), None, "") } fn SetInterfaceAttribute(self, _: JSRef<Blob>) {} fn UnionAttribute(self) -> HTMLElementOrLong { eLong(0) } @@ -99,7 +99,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn GetEnumAttributeNullable(self) -> Option<TestEnum> { Some(_empty) } fn GetInterfaceAttributeNullable(self) -> Option<Temporary<Blob>> { let global = self.global.root(); - Some(Blob::new(&global.root_ref(), None, "")) + Some(Blob::new(&global.r(), None, "")) } fn SetInterfaceAttributeNullable(self, _: Option<JSRef<Blob>>) {} fn GetUnionAttributeNullable(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) } @@ -123,7 +123,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn ReceiveEnum(self) -> TestEnum { _empty } fn ReceiveInterface(self) -> Temporary<Blob> { let global = self.global.root(); - Blob::new(&global.root_ref(), None, "") + Blob::new(&global.r(), None, "") } fn ReceiveAny(self, _: *mut JSContext) -> JSVal { NullValue() } fn ReceiveUnion(self) -> HTMLElementOrLong { eLong(0) } @@ -145,7 +145,7 @@ impl<'a> TestBindingMethods for JSRef<'a, TestBinding> { fn ReceiveNullableEnum(self) -> Option<TestEnum> { Some(_empty) } fn ReceiveNullableInterface(self) -> Option<Temporary<Blob>> { let global = self.global.root(); - Some(Blob::new(&global.root_ref(), None, "")) + Some(Blob::new(&global.r(), None, "")) } fn ReceiveNullableUnion(self) -> Option<HTMLElementOrLong> { Some(eLong(0)) } fn ReceiveNullableUnion2(self) -> Option<EventOrString> { Some(eString("".into_string())) } diff --git a/components/script/dom/worker.rs b/components/script/dom/worker.rs index b222311c37a..51f9962ed6b 100644 --- a/components/script/dom/worker.rs +++ b/components/script/dom/worker.rs @@ -89,13 +89,13 @@ impl Worker { let mut message = UndefinedValue(); unsafe { assert!(JS_ReadStructuredClone( - global.root_ref().get_cx(), data as *const u64, nbytes, + global.r().get_cx(), data as *const u64, nbytes, JS_STRUCTURED_CLONE_VERSION, &mut message, ptr::null(), ptr::null_mut()) != 0); } let target: JSRef<EventTarget> = EventTargetCast::from_ref(worker.r()); - MessageEvent::dispatch_jsval(target, global.root_ref(), message); + MessageEvent::dispatch_jsval(target, global.r(), message); } } @@ -112,7 +112,7 @@ impl<'a> WorkerMethods for JSRef<'a, Worker> { return Err(DataClone); } - let address = Trusted::new(cx, self, self.global.root().root_ref().script_chan().clone()); + let address = Trusted::new(cx, self, self.global.root().r().script_chan().clone()); self.sender.send((address, ScriptMsg::DOMMessage(data, nbytes))); Ok(()) } diff --git a/components/script/dom/xmlhttprequest.rs b/components/script/dom/xmlhttprequest.rs index 05e3e4f097c..24cafc44e82 100644 --- a/components/script/dom/xmlhttprequest.rs +++ b/components/script/dom/xmlhttprequest.rs @@ -367,7 +367,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { *self.request_method.borrow_mut() = maybe_method.unwrap(); // Step 6 - let base = self.global.root().root_ref().get_url(); + let base = self.global.root().r().get_url(); let parsed_url = match UrlParser::new().base_url(&base).parse(url.as_slice()) { Ok(parsed) => parsed, Err(_) => return Err(Syntax) // Step 7 @@ -535,7 +535,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { } let global = self.global.root(); - let resource_task = global.root_ref().resource_task(); + let resource_task = global.r().resource_task(); let (start_chan, start_port) = channel(); let mut load_data = LoadData::new(self.request_url.borrow().clone().unwrap(), start_chan); load_data.data = extracted; @@ -579,7 +579,7 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { *self.terminate_sender.borrow_mut() = Some(terminate_sender); // CORS stuff - let referer_url = self.global.root().root_ref().get_url(); + let referer_url = self.global.root().r().get_url(); let mode = if self.upload_events.get() { RequestMode::ForcedPreflight } else { @@ -613,11 +613,11 @@ impl<'a> XMLHttpRequestMethods for JSRef<'a, XMLHttpRequest> { terminate_receiver, cors_request, gen_id, start_port); } else { self.fetch_time.set(time::now().to_timespec().sec); - let script_chan = global.root_ref().script_chan(); + let script_chan = global.r().script_chan(); // Pin the object before launching the fetch task. This is to ensure that // the object will stay alive as long as there are (possibly cancelled) // inflight events queued up in the script task's port. - let addr = Trusted::new(self.global.root().root_ref().get_cx(), self, + let addr = Trusted::new(self.global.root().r().get_cx(), self, script_chan.clone()); spawn_named("XHRTask", proc() { let _ = XMLHttpRequest::fetch(&mut SyncOrAsync::Async(addr, script_chan), @@ -764,7 +764,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { assert!(self.ready_state.get() != rs) self.ready_state.set(rs); let global = self.global.root(); - let event = Event::new(global.root_ref(), + let event = Event::new(global.r(), "readystatechange".into_string(), EventBubbles::DoesNotBubble, EventCancelable::Cancelable).root(); @@ -899,7 +899,7 @@ impl<'a> PrivateXMLHttpRequestHelpers for JSRef<'a, XMLHttpRequest> { fn dispatch_progress_event(self, upload: bool, type_: DOMString, loaded: u64, total: Option<u64>) { let global = self.global.root(); let upload_target = self.upload.root(); - let progressevent = ProgressEvent::new(global.root_ref(), + let progressevent = ProgressEvent::new(global.r(), type_, false, false, total.is_some(), loaded, total.unwrap_or(0)).root(); |