mirror of
https://github.com/servo/servo.git
synced 2025-07-23 15:23:42 +01:00
Auto merge of #5423 - yodalee:issue5397-location-pathname, r=jdm
issue #5397
This commit is contained in:
commit
d0acc33bf2
8 changed files with 22 additions and 23 deletions
|
@ -46,6 +46,10 @@ impl<'a> LocationMethods for JSRef<'a, Location> {
|
||||||
UrlHelper::Href(&self.get_url())
|
UrlHelper::Href(&self.get_url())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn Pathname(self) -> USVString {
|
||||||
|
UrlHelper::Pathname(&self.get_url())
|
||||||
|
}
|
||||||
|
|
||||||
fn Stringify(self) -> DOMString {
|
fn Stringify(self) -> DOMString {
|
||||||
self.Href().0
|
self.Href().0
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
use dom::bindings::str::USVString;
|
use dom::bindings::str::USVString;
|
||||||
|
|
||||||
use url::Url;
|
use url::{Url, SchemeData};
|
||||||
|
|
||||||
use std::borrow::ToOwned;
|
use std::borrow::ToOwned;
|
||||||
|
|
||||||
|
@ -31,6 +31,15 @@ impl UrlHelper {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub fn Pathname(url: &Url) -> USVString {
|
||||||
|
// https://url.spec.whatwg.org/#dom-urlutils-pathname
|
||||||
|
// FIXME: Url null check is skipped for now
|
||||||
|
USVString(match url.scheme_data {
|
||||||
|
SchemeData::NonRelative(ref scheme_data) => scheme_data.clone(),
|
||||||
|
SchemeData::Relative(..) => url.serialize_path().unwrap()
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
/// https://html.spec.whatwg.org/multipage/browsers.html#same-origin
|
/// https://html.spec.whatwg.org/multipage/browsers.html#same-origin
|
||||||
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
|
pub fn SameOrigin(urlA: &Url, urlB: &Url) -> bool {
|
||||||
if urlA.host() != urlB.host() {
|
if urlA.host() != urlB.host() {
|
||||||
|
|
|
@ -16,6 +16,7 @@ interface URLUtils {
|
||||||
// attribute USVString hostname;
|
// attribute USVString hostname;
|
||||||
// attribute USVString port;
|
// attribute USVString port;
|
||||||
// attribute USVString pathname;
|
// attribute USVString pathname;
|
||||||
|
readonly attribute USVString pathname;
|
||||||
// attribute USVString search;
|
// attribute USVString search;
|
||||||
readonly attribute USVString search;
|
readonly attribute USVString search;
|
||||||
// attribute URLSearchParams searchParams;
|
// attribute URLSearchParams searchParams;
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
[getresponseheader-error-state.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: getResponseHeader() in error state (failing cross-origin test)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,14 +0,0 @@
|
||||||
[send-redirect-to-non-cors.htm]
|
|
||||||
type: testharness
|
|
||||||
[XMLHttpRequest: send() - Redirect to cross-origin resource, not CORS-enabled (301)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirect to cross-origin resource, not CORS-enabled (302)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirect to cross-origin resource, not CORS-enabled (303)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
||||||
[XMLHttpRequest: send() - Redirect to cross-origin resource, not CORS-enabled (307)]
|
|
||||||
expected: FAIL
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[timeout-cors-async.htm]
|
[timeout-cors-async.htm]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: TIMEOUT
|
expected: OK
|
||||||
[XMLHttpRequest: timeout event and cross-origin request]
|
[XMLHttpRequest: timeout event and cross-origin request]
|
||||||
expected: NOTRUN
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[frameElement.sub.html]
|
[frameElement.sub.html]
|
||||||
type: testharness
|
type: testharness
|
||||||
expected: ERROR
|
expected: OK
|
||||||
[The window\'s frameElement attribute must return its container element if it is a nested browsing context]
|
[The window\'s frameElement attribute must return its container element if it is a nested browsing context]
|
||||||
expected: FAIL
|
expected: FAIL
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
[members.html]
|
||||||
|
type: testharness
|
||||||
|
[members of WorkerLocation]
|
||||||
|
expected: FAIL
|
Loading…
Add table
Add a link
Reference in a new issue