summaryrefslogtreecommitdiffstats
path: root/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-09-07 16:06:44 +0100
committerSteve Block <steveblock@google.com>2010-09-07 16:36:45 +0100
commiteff69b907ef2cd3a9af0351287a929c66f58e3f6 (patch)
treec0d8835711b71631a15c3fb20d93c195ee3d5064 /LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js
parent66945f3db6c497fb182ef8a187b8c69e683dbb26 (diff)
downloadexternal_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.zip
external_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.tar.gz
external_webkit-eff69b907ef2cd3a9af0351287a929c66f58e3f6.tar.bz2
Adds a number of fast/ LayoutTest directories to the triaged set
Tests are added at r66079. All tests pass fast/constructors/ fast/cookies/ fast/dom/Attr/ fast/dom/CSSStyleDeclaration/ fast/dom/DOMImplementation/ fast/dom/DeviceMotion/ fast/dom/EntityReference/ fast/dom/HTMLAnchorElement/ fast/dom/HTMLButtonElement/ fast/dom/HTMLFontElement/ fast/dom/HTMLFormElement/ fast/dom/HTMLHtmlElement/ fast/dom/HTMLKeygenElement/ fast/dom/HTMLLabelElement/ fast/dom/HTMLMetaElement/ fast/dom/HTMLTableRowElement/ fast/dom/HTMLTableSectionElement/ fast/dom/Node/ fast/dom/NodeList/ fast/dom/Selection/ fast/dom/StyleSheet/ fast/dom/Text/ fast/dom/TreeWalker/ fast/dom/beforeload/ fast/dom/getElementsByClassName/ fast/leaks/ Change-Id: I9a2c401151f7abf5bb22b764b1327022ab651e04
Diffstat (limited to 'LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js')
-rw-r--r--LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js71
1 files changed, 71 insertions, 0 deletions
diff --git a/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js b/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js
new file mode 100644
index 0000000..cc6a8e7
--- /dev/null
+++ b/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js
@@ -0,0 +1,71 @@
+description('Test setting the pathname attribute of the URL in HTMLAnchorElement.');
+
+var a = document.createElement('a');
+
+debug("Set pathname that starts with slash");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "/path name";
+shouldBe("a.href", "'https://www.mydomain.com/path%20name?key=value'");
+
+// IE8 throws an "Invalid URL" exception.
+try {
+debug("Set pathname that does not start with slash and contains '?'");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "pa?th";
+shouldBe("a.href", "'https://www.mydomain.com/pa%3Fth?key=value'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 throws an "Invalid URL" exception.
+try {
+debug("Set pathname that starts with double slash and contains '#'");
+a.href = "https://www.mydomain.com/path?key=value";
+a.pathname = "//path#name";
+shouldBe("a.href", "'https://www.mydomain.com//path%23name?key=value'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+debug("Set a pathname containing .. in it");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = "/it/../path";
+shouldBe("a.href", "'https://www.mydomain.com/path?key=value'");
+
+// IE8 converts null to "null", which is not the right thing to do.
+debug("Set pathname to null");
+a.href = "https://www.mydomain.com/path/testurl.html?key=value";
+a.pathname = null;
+shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
+
+debug("Set pathname to empty string");
+a.href = "https://www.mydomain.com/?key=value";
+a.pathname = "";
+shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
+
+// The expected behavior should change when the character table is updated.
+// IE8 considers this URL as valid.
+debug("Set pathname that includes illegal characters to URL that contains illegal characters.");
+a.href = "https://www.my|d[]()omain.com/path/testurl.html?key=value";
+a.pathname = "p$a|th";
+shouldBe("a.href", "'https://www.my|d[]()omain.com/path/testurl.html?key=value'");
+
+// IE8 throws a security exception.
+try {
+debug("Set pathname to URL that contains '@' in host");
+a.href = "http://w@#ww";
+a.pathname = "path";
+shouldBe("a.href", "'http://w@/path#ww'");
+} catch(e) {
+debug("Exception: " + e.description);
+}
+
+// IE8 allows setting the pathname, for non-hierarchial URL.
+// It is not supposed to allow that per
+// http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attributes .
+debug("Set pathname to a URL with non-hierarchical protocol");
+a.href = "tel:+1800-555-1212";
+a.pathname = "the-path";
+shouldBe("a.href", "'tel:+1800-555-1212'");
+
+var successfullyParsed = true;