#[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>
) -> Result<(), Error>
fn setter_common(
&self,
f: impl FnOnce(ServoUrl) -> Result<Option<ServoUrl>, Error>
) -> Result<(), Error>
The common algorithm for Location
’s setters and Location::Assign
.
sourcepub fn reload_without_origin_check(&self)
pub fn reload_without_origin_check(&self)
Perform a user-requested reload (the unlabeled paragraph after
reload()
).