| Index: third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html
|
| diff --git a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html
|
| index 16185c45acdf201c0a5893d2dd34a066d14b03ab..c5ab9547038d162bb8acf11e0a0a526955a4b8b9 100644
|
| --- a/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html
|
| +++ b/third_party/WebKit/LayoutTests/fast/dom/HTMLAnchorElement/set-href-attribute-protocol.html
|
| @@ -4,6 +4,84 @@
|
| <script src="../../../resources/js-test.js"></script>
|
| </head>
|
| <body>
|
| -<script src="script-tests/set-href-attribute-protocol.js"></script>
|
| +<script>
|
| +description('Test setting the protocol attribute of the URL in HTMLAnchorElement .');
|
| +
|
| +var a = document.createElement('a');
|
| +
|
| +debug("Basic test");
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = "http-foo";
|
| +shouldBe("a.href", "'http-foo://www.mydomain.com/path/'");
|
| +
|
| +// IE8 throws "Invalid argument" exception.
|
| +debug("Set a protocol that contains ':'");
|
| +try {
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = "http:foo";
|
| +shouldBe("a.href", "'http://www.mydomain.com/path/'");
|
| +} catch(e) {
|
| +debug("Exception: " + e.description);
|
| +}
|
| +
|
| +// IE8 throws "Invalid argument" exception.
|
| +debug("Set a protocol that contains invalid characters");
|
| +try {
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = "http^foo";
|
| +shouldBe("a.href", "'https://www.mydomain.com/path/'");
|
| +} catch(e) {
|
| +debug("Exception: " + e.description);
|
| +}
|
| +
|
| +// The expected behavior should change when the character table is updated.
|
| +// IE8 encodes '^' in the host.
|
| +debug("Set a protocol to a URL with invalid host name");
|
| +a.href = "h:^^";
|
| +a.protocol = "foo";
|
| +shouldBe("a.href", "'foo:^^'");
|
| +
|
| +// IE8 throws "Invalid argument" exception.
|
| +try {
|
| +debug("Set a protocol that starts with ':'");
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = ":http";
|
| +shouldBe("a.href", "'https://www.mydomain.com/path/'");
|
| +} catch(e) {
|
| +debug("Exception: " + e.description);
|
| +}
|
| +
|
| +debug("Set protocol to null");
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = null;
|
| +shouldBe("a.href", "'null://www.mydomain.com/path/'");
|
| +
|
| +// IE8 throws "Invalid argument" exception.
|
| +try {
|
| +debug("Set protocol to empty string");
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = "";
|
| +shouldBe("a.href", "'https://www.mydomain.com/path/'");
|
| +} catch(e) {
|
| +debug("Exception: " + e.description);
|
| +}
|
| +
|
| +// Firefox 4 adds three slashes, unlike Safari and Chrome
|
| +debug("Set protocol to http on malformed URL");
|
| +a.href = "foo:??bar";
|
| +a.protocol = "http";
|
| +shouldBe("a.href", "'http:/??bar'");
|
| +
|
| +// IE8 keeps the protocol if it is 'c:'.
|
| +debug("Set protocol to a URL which points to a local file");
|
| +a.href = "c:\path";
|
| +a.protocol = "f-oo";
|
| +shouldBe("a.href", "'f-oo:path'");
|
| +
|
| +debug("Set protocol to undefined");
|
| +a.href = "https://www.mydomain.com/path/";
|
| +a.protocol = undefined;
|
| +shouldBe("a.href", "'undefined://www.mydomain.com/path/'");
|
| +</script>
|
| </body>
|
| </html>
|
|
|