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

Side by Side Diff: LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-pathname.js

Issue 26248003: Do not special case null for URLUtils attributes (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fix linux specific exceptions again Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 description('Test setting the pathname attribute of the URL in HTMLAnchorElement .'); 1 description('Test setting the pathname attribute of the URL in HTMLAnchorElement .');
2 2
3 var a = document.createElement('a'); 3 var a = document.createElement('a');
4 4
5 debug("Set pathname that starts with slash"); 5 debug("Set pathname that starts with slash");
6 a.href = "https://www.mydomain.com/path/testurl.html?key=value"; 6 a.href = "https://www.mydomain.com/path/testurl.html?key=value";
7 a.pathname = "/path name"; 7 a.pathname = "/path name";
8 shouldBe("a.href", "'https://www.mydomain.com/path%20name?key=value'"); 8 shouldBe("a.href", "'https://www.mydomain.com/path%20name?key=value'");
9 9
10 // IE8 throws an "Invalid URL" exception. 10 // IE8 throws an "Invalid URL" exception.
(...skipping 14 matching lines...) Expand all
25 shouldBe("a.href", "'https://www.mydomain.com//path%23name?key=value'"); 25 shouldBe("a.href", "'https://www.mydomain.com//path%23name?key=value'");
26 } catch(e) { 26 } catch(e) {
27 debug("Exception: " + e.description); 27 debug("Exception: " + e.description);
28 } 28 }
29 29
30 debug("Set a pathname containing .. in it"); 30 debug("Set a pathname containing .. in it");
31 a.href = "https://www.mydomain.com/path/testurl.html?key=value"; 31 a.href = "https://www.mydomain.com/path/testurl.html?key=value";
32 a.pathname = "/it/../path"; 32 a.pathname = "/it/../path";
33 shouldBe("a.href", "'https://www.mydomain.com/path?key=value'"); 33 shouldBe("a.href", "'https://www.mydomain.com/path?key=value'");
34 34
35 // IE8 converts null to "null", which is not the right thing to do.
36 debug("Set pathname to null"); 35 debug("Set pathname to null");
37 a.href = "https://www.mydomain.com/path/testurl.html?key=value"; 36 a.href = "https://www.mydomain.com/path/testurl.html?key=value";
38 a.pathname = null; 37 a.pathname = null;
39 shouldBe("a.href", "'https://www.mydomain.com/?key=value'"); 38 shouldBe("a.href", "'https://www.mydomain.com/null?key=value'");
40 39
41 debug("Set pathname to empty string"); 40 debug("Set pathname to empty string");
42 a.href = "https://www.mydomain.com/?key=value"; 41 a.href = "https://www.mydomain.com/?key=value";
43 a.pathname = ""; 42 a.pathname = "";
44 shouldBe("a.href", "'https://www.mydomain.com/?key=value'"); 43 shouldBe("a.href", "'https://www.mydomain.com/?key=value'");
45 44
46 // The expected behavior should change when the character table is updated. 45 // The expected behavior should change when the character table is updated.
47 // IE8 considers this URL as valid. 46 // IE8 considers this URL as valid.
48 debug("Set pathname that includes illegal characters to URL that contains illega l characters."); 47 debug("Set pathname that includes illegal characters to URL that contains illega l characters.");
49 a.href = "https://www.my|d[]()omain.com/path/testurl.html?key=value"; 48 a.href = "https://www.my|d[]()omain.com/path/testurl.html?key=value";
(...skipping 10 matching lines...) Expand all
60 debug("Exception: " + e.description); 59 debug("Exception: " + e.description);
61 } 60 }
62 61
63 // IE8 allows setting the pathname, for non-hierarchial URL. 62 // IE8 allows setting the pathname, for non-hierarchial URL.
64 // It is not supposed to allow that per 63 // It is not supposed to allow that per
65 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes . 64 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes .
66 debug("Set pathname to a URL with non-hierarchical protocol"); 65 debug("Set pathname to a URL with non-hierarchical protocol");
67 a.href = "tel:+1800-555-1212"; 66 a.href = "tel:+1800-555-1212";
68 a.pathname = "the-path"; 67 a.pathname = "the-path";
69 shouldBe("a.href", "'tel:+1800-555-1212'"); 68 shouldBe("a.href", "'tel:+1800-555-1212'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698