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

Side by Side Diff: LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-host.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 host attribute of the URL in HTMLAnchorElement.'); 1 description('Test setting the host attribute of the URL in HTMLAnchorElement.');
2 2
3 var a = document.createElement('a'); 3 var a = document.createElement('a');
4 4
5 debug("Basic test"); 5 debug("Basic test");
6 a.href = "https://www.mydomain.com:8080/path/"; 6 a.href = "https://www.mydomain.com:8080/path/";
7 a.host = "www.otherdomain.com:0"; 7 a.host = "www.otherdomain.com:0";
8 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'"); 8 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
9 9
10 // IE8 throws "The URL is invalid" exception. 10 // IE8 throws "The URL is invalid" exception.
(...skipping 27 matching lines...) Expand all
38 a.href = "https://www.mydomain.com:8080/path/"; 38 a.href = "https://www.mydomain.com:8080/path/";
39 a.host = "www.otherdomain.com: 443"; 39 a.host = "www.otherdomain.com: 443";
40 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'"); 40 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
41 41
42 // Firefox 3.5.2 removed the port, clearly against the spec . 42 // Firefox 3.5.2 removed the port, clearly against the spec .
43 debug("Colon without port number"); 43 debug("Colon without port number");
44 a.href = "https://www.mydomain.com:8080/path/"; 44 a.href = "https://www.mydomain.com:8080/path/";
45 a.host = "www.otherdomain.com:"; 45 a.host = "www.otherdomain.com:";
46 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'"); 46 shouldBe("a.href", "'https://www.otherdomain.com:0/path/'");
47 47
48 // IE8 converts null to "null", which is not the right thing to do.
49 // Firefox 3.5.2 allows setting the host to null, which it shouldn't per
50 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes .
51 debug("Set host to null"); 48 debug("Set host to null");
52 a.href = "https://www.mydomain.com:8080/path/"; 49 a.href = "https://www.mydomain.com:8080/path/";
53 a.host = null; 50 a.host = null;
54 shouldBe("a.href", "'https://www.mydomain.com:8080/path/'"); 51 shouldBe("a.href", "'https://null:8080/path/'");
55 52
56 // Both IE8 and Firefox 3.5.2 allow setting the host to empty string, which they shouldn't, per 53 // Both IE8 and Firefox 3.5.2 allow setting the host to empty string, which they shouldn't, per
57 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes . 54 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes .
58 // Since both do that in a buggy way, WebKit does not follow either one of them. 55 // Since both do that in a buggy way, WebKit does not follow either one of them.
59 debug("Set host to empty string"); 56 debug("Set host to empty string");
60 a.href = "https://www.mydomain.com:8080/path/"; 57 a.href = "https://www.mydomain.com:8080/path/";
61 a.host = ""; 58 a.host = "";
62 shouldBe("a.href", "'https://www.mydomain.com:8080/path/'"); 59 shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
63 60
64 // Firefox 3.5.2 does not `set the host for file: . 61 // Firefox 3.5.2 does not `set the host for file: .
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 } catch(e) { 102 } catch(e) {
106 debug("Exception: " + e.description); 103 debug("Exception: " + e.description);
107 } 104 }
108 105
109 // Both IE8 and Firefox append the hosts, instead of rejecting, per 106 // Both IE8 and Firefox append the hosts, instead of rejecting, per
110 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes . 107 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes .
111 debug("Set host to a URL with tel: protocol"); 108 debug("Set host to a URL with tel: protocol");
112 a.href = "tel:+1-816-555-1212"; 109 a.href = "tel:+1-816-555-1212";
113 a.host = "+1-800-555-1212"; 110 a.host = "+1-800-555-1212";
114 shouldBe("a.href", "'tel:+1-816-555-1212'"); 111 shouldBe("a.href", "'tel:+1-816-555-1212'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698