#[repr(C)]pub(crate) struct Location {
reflector_: Reflector,
window: Dom<Window>,
}Fields§
§reflector_: Reflector§window: Dom<Window>Implementations§
Source§impl Location
impl Location
fn __assert_parent_type(&self)
Source§impl Location
impl Location
fn new_inherited(window: &Window) -> Location
pub(crate) fn new(window: &Window, can_gc: CanGc) -> DomRoot<Location>
Navigate the relevant Document’s browsing context.
This is ostensibly an implementation of https://html.spec.whatwg.org/multipage/#navigate, but the specification has greatly deviated from our code.
Sourcefn has_document(&self) -> bool
fn has_document(&self) -> bool
Get if this Location’s relevant Document is non-null.
Sourcefn document_if_same_origin(&self) -> Fallible<Option<DomRoot<Document>>>
fn document_if_same_origin(&self) -> Fallible<Option<DomRoot<Document>>>
Get this Location object’s relevant Document, or
Err(Error::Security) if it’s non-null and its origin is not same
origin-domain with the entry setting object’s origin.
In the specification’s terms:
-
If this
Locationobject’s relevantDocumentis null, then return null. -
If this
Locationobject’s relevantDocument’s origin is not same origin-domain with the entry settings object’s origin, then throw a “SecurityError”DOMException. -
Return this
Locationobject’s relevantDocument.
Sourcefn get_url_if_same_origin(&self) -> Fallible<ServoUrl>
fn get_url_if_same_origin(&self) -> Fallible<ServoUrl>
Get this Location object’s relevant url or
Err(Error::Security) if the relevant Document if it’s non-null
and its origin is not same origin-domain with the entry setting object’s
origin.
fn entry_settings_object(&self) -> DomRoot<GlobalScope>
Sourcefn setter_common(
&self,
f: impl FnOnce(ServoUrl) -> Fallible<Option<ServoUrl>>,
can_gc: CanGc,
) -> ErrorResult
fn setter_common( &self, f: impl FnOnce(ServoUrl) -> Fallible<Option<ServoUrl>>, can_gc: CanGc, ) -> ErrorResult
The common algorithm for Location’s setters and Location::Assign.
Sourcepub(crate) fn reload_without_origin_check(&self, can_gc: CanGc)
pub(crate) fn reload_without_origin_check(&self, can_gc: CanGc)
Perform a user-requested reload (the unlabeled paragraph after
reload()).
pub(crate) fn origin(&self) -> &MutableOrigin
Trait Implementations§
Source§impl DomObjectWrap<DomTypeHolder> for Location
impl DomObjectWrap<DomTypeHolder> for Location
Source§const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::LocationBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::location::Location>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::location::Location>>}
const WRAP: unsafe fn(SafeJSContext, &GlobalScope, Option<HandleObject<'_>>, Box<Self>, CanGc) -> Root<Dom<Self>> = {script_bindings::codegen::GenericBindings::LocationBinding::Wrap::<dom::bindings::codegen::DomTypeHolder::DomTypeHolder> as for<'a, 'b> unsafe fn(script_bindings::script_runtime::JSContext, &'a dom::globalscope::GlobalScope, std::option::Option<js::rust::Handle<'b, *mut js::jsapi::JSObject>>, std::boxed::Box<dom::location::Location>, script_bindings::script_runtime::CanGc) -> script_bindings::root::Root<script_bindings::root::Dom<dom::location::Location>>}
Source§impl IDLInterface for Location
impl IDLInterface for Location
Source§impl LocationMethods<DomTypeHolder> for Location
impl LocationMethods<DomTypeHolder> for Location
Source§fn Reload(&self, can_gc: CanGc) -> ErrorResult
fn Reload(&self, can_gc: CanGc) -> ErrorResult
Source§fn GetHostname(&self) -> Fallible<USVString>
fn GetHostname(&self) -> Fallible<USVString>
Source§fn SetHostname(&self, value: USVString, can_gc: CanGc) -> ErrorResult
fn SetHostname(&self, value: USVString, can_gc: CanGc) -> ErrorResult
Source§fn GetPathname(&self) -> Fallible<USVString>
fn GetPathname(&self) -> Fallible<USVString>
Source§fn SetPathname(&self, value: USVString, can_gc: CanGc) -> ErrorResult
fn SetPathname(&self, value: USVString, can_gc: CanGc) -> ErrorResult
Source§fn GetProtocol(&self) -> Fallible<USVString>
fn GetProtocol(&self) -> Fallible<USVString>
Source§fn SetProtocol(&self, value: USVString, can_gc: CanGc) -> ErrorResult
fn SetProtocol(&self, value: USVString, can_gc: CanGc) -> ErrorResult
Source§impl MallocSizeOf for Location
impl MallocSizeOf for Location
Source§fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
fn size_of(&self, ops: &mut MallocSizeOfOps) -> usize
Source§impl MutDomObject for Location
impl MutDomObject for Location
Source§impl ToJSValConvertible for Location
impl ToJSValConvertible for Location
impl Eq for Location
Auto Trait Implementations§
impl !Freeze for Location
impl !RefUnwindSafe for Location
impl !Send for Location
impl !Sync for Location
impl Unpin for Location
impl !UnwindSafe for Location
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<D, T> DomGlobalGeneric<D> for T
impl<D, T> DomGlobalGeneric<D> for T
Source§fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
fn global_(&self, realm: InRealm<'_>) -> Root<Dom<<D as DomTypes>::GlobalScope>>where
Self: Sized,
GlobalScope] of the realm that the DomObject was created in. If this
object is a Node, this will be different from it’s owning Document if adopted by. For
Nodes it’s almost always better to use NodeTraits::owning_global.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Filterable for T
impl<T> Filterable for T
Source§fn filterable(
self,
filter_name: &'static str,
) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
fn filterable( self, filter_name: &'static str, ) -> RequestFilterDataProvider<T, fn(DataRequest<'_>) -> bool>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more