mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #13912 - ddrmanxbxfr:remove-deprecated-url-methods, r=Ms2ger
Remove URL.domainToASCII and URL.domainToUnicode Modifications - Removed URL.domainToASCII method - Removed URL.domainToUnicode method - Added test in wpt to make sure both method are undefined. --- - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #13835 (github issue number if applicable). - [X] There are tests for these changes <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/13912) <!-- Reviewable:end -->
This commit is contained in:
commit
4b28750b9a
7 changed files with 20 additions and 48 deletions
|
@ -17,10 +17,8 @@ use ipc_channel::ipc;
|
||||||
use net_traits::{CoreResourceMsg, IpcSend};
|
use net_traits::{CoreResourceMsg, IpcSend};
|
||||||
use net_traits::blob_url_store::{get_blob_origin, parse_blob_url};
|
use net_traits::blob_url_store::{get_blob_origin, parse_blob_url};
|
||||||
use net_traits::filemanager_thread::FileManagerThreadMsg;
|
use net_traits::filemanager_thread::FileManagerThreadMsg;
|
||||||
use std::borrow::ToOwned;
|
|
||||||
use std::default::Default;
|
use std::default::Default;
|
||||||
use url::{Host, Url};
|
use url::Url;
|
||||||
use url::quirks::domain_to_unicode;
|
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#url
|
// https://url.spec.whatwg.org/#url
|
||||||
|
@ -96,23 +94,6 @@ impl URL {
|
||||||
Ok(result)
|
Ok(result)
|
||||||
}
|
}
|
||||||
|
|
||||||
// https://url.spec.whatwg.org/#dom-url-domaintoasciidomain
|
|
||||||
pub fn DomainToASCII(_: &GlobalScope, origin: USVString) -> USVString {
|
|
||||||
// Step 1.
|
|
||||||
let ascii_domain = Host::parse(&origin.0);
|
|
||||||
if let Ok(Host::Domain(string)) = ascii_domain {
|
|
||||||
// Step 3.
|
|
||||||
USVString(string.to_owned())
|
|
||||||
} else {
|
|
||||||
// Step 2.
|
|
||||||
USVString("".to_owned())
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn DomainToUnicode(_: &GlobalScope, origin: USVString) -> USVString {
|
|
||||||
USVString(domain_to_unicode(&origin.0))
|
|
||||||
}
|
|
||||||
|
|
||||||
// https://w3c.github.io/FileAPI/#dfn-createObjectURL
|
// https://w3c.github.io/FileAPI/#dfn-createObjectURL
|
||||||
pub fn CreateObjectURL(global: &GlobalScope, blob: &Blob) -> DOMString {
|
pub fn CreateObjectURL(global: &GlobalScope, blob: &Blob) -> DOMString {
|
||||||
/// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
|
/// XXX: Second field is an unicode-serialized Origin, it is a temporary workaround
|
||||||
|
|
|
@ -5,9 +5,6 @@
|
||||||
// https://url.spec.whatwg.org/#url
|
// https://url.spec.whatwg.org/#url
|
||||||
[Constructor(USVString url, optional USVString base), Exposed=(Window,Worker)]
|
[Constructor(USVString url, optional USVString base), Exposed=(Window,Worker)]
|
||||||
interface URL {
|
interface URL {
|
||||||
static USVString domainToASCII(USVString domain);
|
|
||||||
static USVString domainToUnicode(USVString domain);
|
|
||||||
|
|
||||||
[SetterThrows]
|
[SetterThrows]
|
||||||
/*stringifier*/ attribute USVString href;
|
/*stringifier*/ attribute USVString href;
|
||||||
readonly attribute USVString origin;
|
readonly attribute USVString origin;
|
||||||
|
|
|
@ -37715,7 +37715,9 @@
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"local_changes": {
|
"local_changes": {
|
||||||
"deleted": [],
|
"deleted": [
|
||||||
|
"url/url-domainToUnicode.html"
|
||||||
|
],
|
||||||
"deleted_reftests": {},
|
"deleted_reftests": {},
|
||||||
"items": {
|
"items": {
|
||||||
"reftest": {
|
"reftest": {
|
||||||
|
|
|
@ -26,4 +26,12 @@ test(function() {
|
||||||
url.href = "./bar";
|
url.href = "./bar";
|
||||||
});
|
});
|
||||||
}, "Setting URL's href attribute and base URLs");
|
}, "Setting URL's href attribute and base URLs");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(URL.domainToASCII, undefined);
|
||||||
|
}, "URL.domainToASCII should be undefined");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(URL.domainToUnicode, undefined);
|
||||||
|
}, "URL.domainToUnicode should be undefined");
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -13,4 +13,12 @@ test(function() {
|
||||||
});
|
});
|
||||||
}, "Setting URL's href attribute and base URLs");
|
}, "Setting URL's href attribute and base URLs");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(URL.domainToASCII, undefined);
|
||||||
|
}, "URL.domainToASCII should be undefined");
|
||||||
|
|
||||||
|
test(function() {
|
||||||
|
assert_equals(URL.domainToUnicode, undefined);
|
||||||
|
}, "URL.domainToUnicode should be undefined");
|
||||||
|
|
||||||
done();
|
done();
|
||||||
|
|
|
@ -12,9 +12,6 @@
|
||||||
[Constructor(USVString url, optional USVString base),
|
[Constructor(USVString url, optional USVString base),
|
||||||
Exposed=(Window,Worker)]
|
Exposed=(Window,Worker)]
|
||||||
interface URL {
|
interface URL {
|
||||||
static USVString domainToASCII(USVString domain);
|
|
||||||
static USVString domainToUnicode(USVString domain);
|
|
||||||
|
|
||||||
stringifier attribute USVString href;
|
stringifier attribute USVString href;
|
||||||
readonly attribute USVString origin;
|
readonly attribute USVString origin;
|
||||||
attribute USVString protocol;
|
attribute USVString protocol;
|
||||||
|
|
|
@ -1,21 +0,0 @@
|
||||||
<!doctype html>
|
|
||||||
<meta charset="utf-8">
|
|
||||||
<title></title>
|
|
||||||
<script src="/resources/testharness.js"></script>
|
|
||||||
<script src="/resources/testharnessreport.js"></script>
|
|
||||||
<script>
|
|
||||||
test(function() {
|
|
||||||
var domain = 'example.org'
|
|
||||||
assert_true(URL.domainToUnicode(domain) === domain, 'Ascii domain should be parsed correctly.')
|
|
||||||
}, 'URL.domainToUnicode valid input')
|
|
||||||
|
|
||||||
test(function() {
|
|
||||||
var domain = 'xn--maana-pta.com'
|
|
||||||
assert_true(URL.domainToUnicode(domain) === 'mañana.com', ' Ascii encoded domain should be parsed correctly.')
|
|
||||||
}, 'URL.domainToUnicode valid encoded input')
|
|
||||||
|
|
||||||
test(function() {
|
|
||||||
var domain = 'http://not.a.domain'
|
|
||||||
assert_true(URL.domainToUnicode(domain) === "", 'Invalid domain should be return an empty string.')
|
|
||||||
}, 'URL.domainToUnicode invalid input')
|
|
||||||
</script>
|
|
Loading…
Add table
Add a link
Reference in a new issue