mirror of
https://github.com/servo/servo.git
synced 2025-08-05 13:40:08 +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) {
|
fn Reload(&self) {
|
||||||
self.window.load_url(self.get_url(), true, true, None);
|
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
|
// https://html.spec.whatwg.org/multipage/#dom-location-hash
|
||||||
|
|
|
@ -16,7 +16,8 @@
|
||||||
|
|
||||||
[Throws]
|
[Throws]
|
||||||
void assign(USVString url);
|
void assign(USVString url);
|
||||||
//void replace(USVString url);
|
[Throws]
|
||||||
|
void replace(USVString url);
|
||||||
void reload();
|
void reload();
|
||||||
|
|
||||||
//[SameObject] readonly attribute USVString[] ancestorOrigins;
|
//[SameObject] readonly attribute USVString[] ancestorOrigins;
|
||||||
|
|
|
@ -1589,7 +1589,6 @@ impl Window {
|
||||||
js_runtime: DOMRefCell::new(Some(runtime.clone())),
|
js_runtime: DOMRefCell::new(Some(runtime.clone())),
|
||||||
bluetooth_thread: bluetooth_thread,
|
bluetooth_thread: bluetooth_thread,
|
||||||
page_clip_rect: Cell::new(max_rect()),
|
page_clip_rect: Cell::new(max_rect()),
|
||||||
fragment_name: DOMRefCell::new(None),
|
|
||||||
resize_event: Cell::new(None),
|
resize_event: Cell::new(None),
|
||||||
layout_chan: layout_chan,
|
layout_chan: layout_chan,
|
||||||
layout_rpc: layout_rpc,
|
layout_rpc: layout_rpc,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue