| Index: LayoutTests/manifest/link-manifest-url.html
|
| diff --git a/LayoutTests/manifest/link-manifest-url.html b/LayoutTests/manifest/link-manifest-url.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..5a038ec2998769b976fff6517265ab99b162992d
|
| --- /dev/null
|
| +++ b/LayoutTests/manifest/link-manifest-url.html
|
| @@ -0,0 +1,93 @@
|
| +<!DOCTYPE html>
|
| +<html>
|
| +<head>
|
| + <link rel='manifest' href='foo.json'>
|
| +</head>
|
| +<body>
|
| +<script src="../resources/testharness.js"></script>
|
| +<script src="../resources/testharnessreport.js"></script>
|
| +<script>
|
| + var links = document.getElementsByTagName('link');
|
| +
|
| + test(function() {
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that the parser correctly find the manifest");
|
| +
|
| + test(function() {
|
| + links[0].href = 'foobar.json';
|
| + assert_equals(links[0].href, window.internals.linkManifest(document).href);
|
| + }, "Test that changing the href will change the known URL");
|
| +
|
| + test(function() {
|
| + links[0].href = 'htp:/blah';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that invalid URL are accepted");
|
| +
|
| + test(function() {
|
| + links[0].href = '';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that empty URL are accepted");
|
| +
|
| + test(function() {
|
| + links[0].href = 'http://example.com/manifest.json';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that cross-origin URL are accepted");
|
| +
|
| + test(function() {
|
| + links[0].rel = "foo bar manifest";
|
| + links[0].href = 'http://example.com/manifest.json';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that having multiple tokens in @rel will keep thi link as a manifest");
|
| +
|
| + test(function() {
|
| + var link = document.createElement('link');
|
| + link.rel = 'manifest';
|
| + link.href = 'foobar.json';
|
| + document.head.appendChild(link);
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| +
|
| + link = document.createElement('link');
|
| + link.rel = 'manifest';
|
| + link.href = 'manifest.json';
|
| + document.head.insertBefore(link, links[0]);
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that the first manifest is always being used");
|
| +
|
| + test(function() {
|
| + // Remove all current links.
|
| + while (document.head.firstChild)
|
| + document.head.removeChild(document.head.firstChild);
|
| +
|
| + // Add link to the body.
|
| + var link = document.createElement('link');
|
| + link.rel = 'manifest';
|
| + link.href = 'manifest.json';
|
| + document.body.appendChild(link);
|
| +
|
| + assert_not_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that links outside of the head are ignored");
|
| +
|
| + test(function() {
|
| + // Add a clean <link rel='manifest'>.
|
| + var link = document.createElement('link');
|
| + link.rel = 'manifest';
|
| + link.href = 'foobar.json';
|
| + link.type = 'application/manifest+json';
|
| + document.head.appendChild(link);
|
| +
|
| + links[0].crossOrigin = 'use-credentials';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| +
|
| + links[0].setAttribute('hreflang', 'klingon');
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| +
|
| + links[0].type = 'image/gif';
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| +
|
| + links[0].setAttribute('sizes', '16x16');
|
| + assert_equals(links[0], window.internals.linkManifest(document));
|
| + }, "Test that attributes on the element do not affect which one is used.");
|
| +
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|