Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Unified Diff: third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js

Issue 2341333002: Import wpt@1f2080f9ffa00ad27eb764b83fbc10960a95d6aa (Closed)
Patch Set: update win expectations Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
diff --git a/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js b/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
index 2f31db921859f38e7845faefbb1ef6baace3b4c4..72ed01ef7bfa45288127f5844df29653dce95156 100644
--- a/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
+++ b/third_party/WebKit/LayoutTests/imported/wpt/html/dom/reflection.js
@@ -10,9 +10,8 @@ ReflectionTests.start = new Date().getTime();
* algorithm here, because we're not concerned with its correctness -- we're
* only testing HTML reflection, not Web Addresses.
*
- * Return "" if the URL couldn't be resolved, since this is really for
- * reflected URL attributes, and those are supposed to return "" if the URL
- * couldn't be resolved.
+ * Return the input if the URL couldn't be resolved, per the spec for
+ * reflected URL attributes.
*
* It seems like IE9 doesn't implement URL decomposition attributes correctly
* for <a>, which causes all these tests to fail. Ideally I'd do this in some
@@ -25,42 +24,18 @@ ReflectionTests.start = new Date().getTime();
* special cases for all the values we test.
*/
ReflectionTests.resolveUrl = function(url) {
+ url = String(url);
var el = document.createElement("a");
- el.href = String(url);
+ el.href = url;
var ret = el.protocol + "//" + el.host + el.pathname + el.search + el.hash;
if (ret == "//") {
- return "";
+ return url;
} else {
return ret;
}
};
/**
- * Given some input, convert to a multi-URL value for IDL get per the spec.
- */
-ReflectionTests.urlsExpected = function(urls) {
- var expected = "";
- // TODO: Test other whitespace?
- urls = urls + "";
- var split = urls.split(" ");
- for (var j = 0; j < split.length; j++) {
- if (split[j] == "") {
- continue;
- }
- var append = ReflectionTests.resolveUrl(split[j]);
- if (append == "") {
- continue;
- }
- if (expected == "") {
- expected = append;
- } else {
- expected += " " + append;
- }
- }
- return expected;
-};
-
-/**
* The "rules for parsing non-negative integers" from the HTML spec. They're
* mostly used for reflection, so here seems like as good a place to test them
* as any. Returns false on error.
@@ -177,14 +152,17 @@ ReflectionTests.typeMap = {
]
},
/**
- * "If a reflecting IDL attribute is a DOMString attribute whose content
- * attribute is defined to contain a URL, then on getting, the IDL
- * attribute must resolve the value of the content attribute relative to
- * the element and return the resulting absolute URL if that was
- * successful, or the empty string otherwise; and on setting, must set the
- * content attribute to the specified literal value. If the content
- * attribute is absent, the IDL attribute must return the default value, if
- * the content attribute has one, or else the empty string."
+ * "If a reflecting IDL attribute is a USVString attribute whose content
+ * attribute is defined to contain a URL, then on getting, if the content
+ * attribute is absent, the IDL attribute must return the empty string.
+ * Otherwise, the IDL attribute must parse the value of the content
+ * attribute relative to the element's node document and if that is
+ * successful, return the resulting URL string. If parsing fails, then the
+ * value of the content attribute must be returned instead, converted to a
+ * USVString. On setting, the content attribute must be set to the specified
+ * new value."
+ *
+ * Also HTMLHyperLinkElementUtils href, used by a.href and area.href
*/
"url": {
"jsType": "string",
@@ -198,31 +176,6 @@ ReflectionTests.typeMap = {
"idlIdlExpected": ReflectionTests.resolveUrl
},
/**
- * "If a reflecting IDL attribute is a DOMString attribute whose content
- * attribute is defined to contain one or more URLs, then on getting, the
- * IDL attribute must split the content attribute on spaces and return the
- * concatenation of resolving each token URL to an absolute URL relative to
- * the element, with a single U+0020 SPACE character between each URL,
- * ignoring any tokens that did not resolve successfully. If the content
- * attribute is absent, the IDL attribute must return the default value, if
- * the content attribute has one, or else the empty string. On setting, the
- * IDL attribute must set the content attribute to the specified literal
- * value."
- *
- * Seems to only be used for ping.
- */
- "urls": {
- "jsType": "string",
- "defaultVal": "",
- "domTests": ["", " foo ", "http://site.example/ foo bar baz",
- "//site.example/path???@#l", binaryString, undefined, 7, 1.5, true,
- false, {"test": 6}, NaN, +Infinity, -Infinity, "\0", null,
- {"toString":function(){return "test-toString";}},
- {"valueOf":function(){return "test-valueOf";}, toString:null}],
- "domExpected": ReflectionTests.urlsExpected,
- "idlIdlExpected": ReflectionTests.urlsExpected
- },
- /**
* "If a reflecting IDL attribute is a DOMString whose content attribute is
* an enumerated attribute, and the IDL attribute is limited to only known
* values, then, on getting, the IDL attribute must return the conforming

Powered by Google App Engine
This is Rietveld 408576698