mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Rename Root<T> to DomRoot<T>
In a later PR, DomRoot<T> will become a type alias of Root<Dom<T>>, where Root<T> will be able to handle all the things that need to be rooted that have a stable traceable address that doesn't move for the whole lifetime of the root. Stay tuned.
This commit is contained in:
parent
577370746e
commit
f87c2a8d76
291 changed files with 1774 additions and 1770 deletions
|
@ -5,7 +5,7 @@
|
|||
use dom::bindings::codegen::Bindings::ServiceWorkerBinding::ServiceWorkerState;
|
||||
use dom::bindings::codegen::Bindings::ServiceWorkerRegistrationBinding::{ServiceWorkerRegistrationMethods, Wrap};
|
||||
use dom::bindings::reflector::reflect_dom_object;
|
||||
use dom::bindings::root::{Dom, Root};
|
||||
use dom::bindings::root::{Dom, DomRoot};
|
||||
use dom::bindings::str::USVString;
|
||||
use dom::eventtarget::EventTarget;
|
||||
use dom::globalscope::GlobalScope;
|
||||
|
@ -41,7 +41,7 @@ impl ServiceWorkerRegistration {
|
|||
#[allow(unrooted_must_root)]
|
||||
pub fn new(global: &GlobalScope,
|
||||
script_url: &ServoUrl,
|
||||
scope: ServoUrl) -> Root<ServiceWorkerRegistration> {
|
||||
scope: ServoUrl) -> DomRoot<ServiceWorkerRegistration> {
|
||||
let active_worker = ServiceWorker::install_serviceworker(global, script_url.clone(), scope.clone(), true);
|
||||
active_worker.set_transition_state(ServiceWorkerState::Installed);
|
||||
reflect_dom_object(box ServiceWorkerRegistration::new_inherited(&*active_worker, scope), global, Wrap)
|
||||
|
@ -79,13 +79,13 @@ impl ServiceWorkerRegistration {
|
|||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#get-newest-worker-algorithm
|
||||
pub fn get_newest_worker(&self) -> Option<Root<ServiceWorker>> {
|
||||
pub fn get_newest_worker(&self) -> Option<DomRoot<ServiceWorker>> {
|
||||
if self.installing.as_ref().is_some() {
|
||||
self.installing.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
self.installing.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
} else if self.waiting.as_ref().is_some() {
|
||||
self.waiting.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
self.waiting.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
} else {
|
||||
self.active.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
self.active.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -105,18 +105,18 @@ pub fn longest_prefix_match(stored_scope: &ServoUrl, potential_match: &ServoUrl)
|
|||
|
||||
impl ServiceWorkerRegistrationMethods for ServiceWorkerRegistration {
|
||||
// https://w3c.github.io/ServiceWorker/#service-worker-registration-installing-attribute
|
||||
fn GetInstalling(&self) -> Option<Root<ServiceWorker>> {
|
||||
self.installing.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
fn GetInstalling(&self) -> Option<DomRoot<ServiceWorker>> {
|
||||
self.installing.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#service-worker-registration-active-attribute
|
||||
fn GetActive(&self) -> Option<Root<ServiceWorker>> {
|
||||
self.active.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
fn GetActive(&self) -> Option<DomRoot<ServiceWorker>> {
|
||||
self.active.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#service-worker-registration-waiting-attribute
|
||||
fn GetWaiting(&self) -> Option<Root<ServiceWorker>> {
|
||||
self.waiting.as_ref().map(|sw| Root::from_ref(&**sw))
|
||||
fn GetWaiting(&self) -> Option<DomRoot<ServiceWorker>> {
|
||||
self.waiting.as_ref().map(|sw| DomRoot::from_ref(&**sw))
|
||||
}
|
||||
|
||||
// https://w3c.github.io/ServiceWorker/#service-worker-registration-scope-attribute
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue