Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make document url mutable and implement location.replace() #13418

Merged
merged 5 commits into from Nov 20, 2016
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file
Failed to load files.

Always

Just for now

Implement Location.replace

  • Loading branch information
stshine committed Nov 18, 2016
commit fb6cc15208690acb4c66445b71f2ff8d1dcfcf73
@@ -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)

This comment has been minimized.

@jdm

jdm Oct 14, 2016

Member

I think this change will make us fail tests? The spec has text specifically about how Location.hash's setter is supposed to behave when passed an empty string, and it's supposed to have # appended to it afterwards.

This comment has been minimized.

@stshine

stshine Nov 3, 2016

Author Contributor

Oh, This is for passing tests when the result url is returned to the wptrunner. Not relevant anymore, will remove.

}

This comment has been minimized.

@KiChjang

KiChjang Sep 28, 2016

Member

This code is still not throwing any exceptions.

}

// https://html.spec.whatwg.org/multipage/#dom-location-hash
@@ -16,7 +16,8 @@

[Throws]
void assign(USVString url);
//void replace(USVString url);
[Throws]
void replace(USVString url);
void reload();

//[SameObject] readonly attribute USVString[] ancestorOrigins;
@@ -1589,7 +1589,6 @@ impl Window {
js_runtime: DOMRefCell::new(Some(runtime.clone())),
bluetooth_thread: bluetooth_thread,
page_clip_rect: Cell::new(max_rect()),
fragment_name: DOMRefCell::new(None),
resize_event: Cell::new(None),
layout_chan: layout_chan,
layout_rpc: layout_rpc,
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.