mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Implement Location.replace
This commit is contained in:
parent
9863149043
commit
fb6cc15208
3 changed files with 14 additions and 2 deletions
|
@ -62,6 +62,18 @@ impl LocationMethods for Location {
|
|||
fn Reload(&self) {
|
||||
self.window.load_url(self.get_url(), true, true, None);
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-replace
|
||||
fn Replace(&self, url: USVString) -> ErrorResult {
|
||||
// TODO: per spec, we should use the _API base URL_ specified by the
|
||||
// _entry settings object_.
|
||||
let base_url = self.window.get_url();
|
||||
if let Ok(url) = base_url.join(&url.0) {
|
||||
self.window.load_url(url, true, false, None);
|
||||
Ok(())
|
||||
} else {
|
||||
Err(Error::Syntax)
|
||||
}
|
||||
}
|
||||
|
||||
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue