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

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

Issue 2667393002: Stop using script-tests in fast/dom/. (Closed)
Patch Set: . Created 3 years, 10 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
OLDNEW
(Empty)
1 description('Test setting the hostname attribute of the URL in HTMLAnchorElement .');
2
3 var a = document.createElement('a');
4
5 debug("Basic test");
6 a.href = "https://www.mydomain.com:8080/path/";
7 a.hostname = "www.otherdomain.com";
8 shouldBe("a.href", "'https://www.otherdomain.com:8080/path/'");
9
10 // IE8 throws an exception "The URL is invalid".
11 try {
12 debug("Extra slashes before hostname");
13 a.href = "https://www.mydomain.com:8080/path/";
14 a.hostname = "//www.otherdomain.com";
15 shouldBe("a.href", "'https://www.otherdomain.com:8080/path/'");
16 } catch(e) {
17 debug("Exception: " + e.description);
18 }
19
20 // Firefox 3.5.2 does not allow setting the host to foo: protocol
21 debug("Set hostname to URL with foo: protocol");
22 a.href = "foo://www.mydomain.com/path/";
23 a.hostname = "www.otherdomain.com";
24 shouldBe("a.href", "'foo://www.otherdomain.com/path/'");
25
26 debug("Set hostname to null");
27 a.href = "https://www.mydomain.com:8080/path/";
28 a.hostname = null;
29 shouldBe("a.href", "'https://null:8080/path/'");
30
31 // Both IE8 and Firefox 3.5.2 allow setting the host to empty string, against th e spec at
32 // http://dev.w3.org/html5/spec/infrastructure.html#url-decomposition-idl-attrib utes .
33 // Since both do that in a buggy way, WebKit should not follow either one of the m.
34 debug("Set hostname to empty string");
35 a.href = "https://www.mydomain.com:8080/path/";
36 a.hostname = "";
37 shouldBe("a.href", "'https://www.mydomain.com:8080/path/'");
38
39 // IE8 fails to process really: protocol.
40 debug("Set hostname to URL with 2 colons");
41 a.href = "really:bad:url";
42 a.hostname = "mydomain.com";
43 shouldBe("a.href", "'really:bad:url'");
44
45 // The expected behavior should change when the character table is updated.
46 // IE8 encodes the space in the hostname.
47 // Firefox3.5.2 and WebKit consider space as illegal character and would not set
48 // the new hostname.
49 debug("Set a hostname that contains space in it");
50 a.href = "http://www.my domain.com/path/";
51 a.hostname = "www.other domain.com";
52 shouldBe("a.href", "'http://www.my domain.com/path/'");
53
54 // IE8 throws an exception "The URL is invalid".
55 try {
56 debug("Set hostname on a local file");
57 a.href = "c:/path/testurl.html";
58 a.hostname= "a";
59 shouldBe("a.href", "'c:/path/testurl.html'");
60 } catch(e) {
61 debug("Exception: " + e.description);
62 }
63
64 debug("Set hostname to undefined");
65 a.href = "https://www.mydomain.com:8080/path/";
66 a.hostname = undefined;
67 shouldBe("a.href", "'https://undefined:8080/path/'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698