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

Side by Side Diff: third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/script-tests/set-href-attribute-protocol.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 protocol 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/path/";
7 a.protocol = "http-foo";
8 shouldBe("a.href", "'http-foo://www.mydomain.com/path/'");
9
10 // IE8 throws "Invalid argument" exception.
11 debug("Set a protocol that contains ':'");
12 try {
13 a.href = "https://www.mydomain.com/path/";
14 a.protocol = "http:foo";
15 shouldBe("a.href", "'http://www.mydomain.com/path/'");
16 } catch(e) {
17 debug("Exception: " + e.description);
18 }
19
20 // IE8 throws "Invalid argument" exception.
21 debug("Set a protocol that contains invalid characters");
22 try {
23 a.href = "https://www.mydomain.com/path/";
24 a.protocol = "http^foo";
25 shouldBe("a.href", "'https://www.mydomain.com/path/'");
26 } catch(e) {
27 debug("Exception: " + e.description);
28 }
29
30 // The expected behavior should change when the character table is updated.
31 // IE8 encodes '^' in the host.
32 debug("Set a protocol to a URL with invalid host name");
33 a.href = "h:^^";
34 a.protocol = "foo";
35 shouldBe("a.href", "'foo:^^'");
36
37 // IE8 throws "Invalid argument" exception.
38 try {
39 debug("Set a protocol that starts with ':'");
40 a.href = "https://www.mydomain.com/path/";
41 a.protocol = ":http";
42 shouldBe("a.href", "'https://www.mydomain.com/path/'");
43 } catch(e) {
44 debug("Exception: " + e.description);
45 }
46
47 debug("Set protocol to null");
48 a.href = "https://www.mydomain.com/path/";
49 a.protocol = null;
50 shouldBe("a.href", "'null://www.mydomain.com/path/'");
51
52 // IE8 throws "Invalid argument" exception.
53 try {
54 debug("Set protocol to empty string");
55 a.href = "https://www.mydomain.com/path/";
56 a.protocol = "";
57 shouldBe("a.href", "'https://www.mydomain.com/path/'");
58 } catch(e) {
59 debug("Exception: " + e.description);
60 }
61
62 // Firefox 4 adds three slashes, unlike Safari and Chrome
63 debug("Set protocol to http on malformed URL");
64 a.href = "foo:??bar";
65 a.protocol = "http";
66 shouldBe("a.href", "'http:/??bar'");
67
68 // IE8 keeps the protocol if it is 'c:'.
69 debug("Set protocol to a URL which points to a local file");
70 a.href = "c:\path";
71 a.protocol = "f-oo";
72 shouldBe("a.href", "'f-oo:path'");
73
74 debug("Set protocol to undefined");
75 a.href = "https://www.mydomain.com/path/";
76 a.protocol = undefined;
77 shouldBe("a.href", "'undefined://www.mydomain.com/path/'");
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698