#[repr(C)]pub struct Location {
reflector_: Reflector,
window: Dom<Window>,
}
Fields§
§reflector_: Reflector
§window: Dom<Window>
Implementations§
source§impl Location
impl Location
fn new_inherited(window: &Window) -> Location
pub fn new(window: &Window) -> Root<Dom<Location>>
Navigate the relevant Document
’s browsing context.
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) -> Result<Option<Root<Dom<Document>>>, Error>
fn document_if_same_origin(&self) -> Result<Option<Root<Dom<Document>>>, Error>
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
Location
object’s relevantDocument
is null, then return null. -
If this
Location
object’s relevantDocument
’s origin is not same origin-domain with the entry settings object’s origin, then throw a “SecurityError
”DOMException
. -
Return this
Location
object’s relevantDocument
.
sourcefn get_url_if_same_origin(&self) -> Result<ServoUrl, Error>
fn get_url_if_same_origin(&self) -> Result<ServoUrl, Error>
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) -> Root<Dom<GlobalScope>>
sourcefn setter_common(
&self,
f: impl FnOnce(ServoUrl) -> Result<Option<ServoUrl>, Error>,
can_gc: CanGc,
) -> Result<(), Error>
fn setter_common( &self, f: impl FnOnce(ServoUrl) -> Result<Option<ServoUrl>, Error>, can_gc: CanGc, ) -> Result<(), Error>
The common algorithm for Location
’s setters and Location::Assign
.
sourcepub fn reload_without_origin_check(&self, can_gc: CanGc)
pub fn reload_without_origin_check(&self, can_gc: CanGc)
Perform a user-requested reload (the unlabeled paragraph after
reload()
).
pub fn origin(&self) -> &MutableOrigin
Trait Implementations§
source§impl DomObjectWrap for Location
impl DomObjectWrap for Location
source§const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::LocationBinding::Location_Binding::Wrap as for<'a, 'b> unsafe fn(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_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::location::Location>>}
const WRAP: unsafe fn(_: SafeJSContext, _: &GlobalScope, _: Option<HandleObject<'_>>, _: Box<Self>, _: CanGc) -> Root<Dom<Self>> = {dom::bindings::codegen::Bindings::LocationBinding::Location_Binding::Wrap as for<'a, 'b> unsafe fn(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_runtime::CanGc) -> dom::bindings::root::Root<dom::bindings::root::Dom<dom::location::Location>>}
source§impl IDLInterface for Location
impl IDLInterface for Location
source§impl LocationMethods for Location
impl LocationMethods for Location
fn Assign(&self, url: USVString, can_gc: CanGc) -> Result<(), Error>
fn Reload(&self, can_gc: CanGc) -> Result<(), Error>
fn Replace(&self, url: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetHash(&self) -> Result<USVString, Error>
fn SetHash(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetHost(&self) -> Result<USVString, Error>
fn SetHost(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetOrigin(&self) -> Result<USVString, Error>
fn GetHostname(&self) -> Result<USVString, Error>
fn SetHostname(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetHref(&self) -> Result<USVString, Error>
fn SetHref(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetPathname(&self) -> Result<USVString, Error>
fn SetPathname(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetPort(&self) -> Result<USVString, Error>
fn SetPort(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetProtocol(&self) -> Result<USVString, Error>
fn SetProtocol(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
fn GetSearch(&self) -> Result<USVString, Error>
fn SetSearch(&self, value: USVString, can_gc: CanGc) -> Result<(), Error>
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 PartialEq for Location
impl PartialEq 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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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