Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / http / tests / htmlimports / redirect.html
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <script src="../../../resources/testharness.js"></script>
5 <script src="../../../resources/testharnessreport.js"></script>
6 <link rel="help" "https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/imports/index.html#imported-document" />
7
8 <link id="same" rel="import"      href="http://127.0.0.1:8000/htmlimports/resources/hello.html">
9 <link id="cors" rel="import"      href="http://localhost:8000/htmlimports/resources/cors-basic.cgi">
10 <link id="xs"   rel="import"      href="http://localhost:8000/htmlimports/resources/hello.html">
11
12 <link id="same-same" rel="import" href="/security/resources/redir.php?url=http://127.0.0.1:8000/htmlimports/resources/hello.html">
13 <link id="same-cors" rel="import" href="/security/resources/redir.php?url=http://localhost:8000/htmlimports/resources/cors-basic.cgi">
14 <link id="same-xs"   rel="import" href="/security/resources/redir.php?url=http://localhost:8000/htmlimports/resources/hello.html">
15
16 </head>
17 <body>
18 <script>
19 function assert_loaded(id)
20 {
21     var target = document.getElementById(id);
22     assert_true(target.import instanceof Document)
23     assert_true(0 <= target.import.querySelector("h1").innerHTML.indexOf("Hello"));
24 }
25
26 function assert_not_loaded(id)
27 {
28     var target = document.getElementById(id);
29     assert_equals(target.import, null);
30 }
31
32 test(function() { assert_loaded("same"); }, "Accessing to a same origin import");
33 test(function() { assert_loaded("cors"); }, "Accessing to CORS-enabled origin import");
34 test(function() { assert_not_loaded("xs"); }, "Blocking access to a cross origin import");
35
36 test(function() { assert_loaded("same-same"); }, "Accessing to a same origin import including same domain redirect");
37 test(function() { assert_loaded("same-cors"); }, "Accessing to a CORS origin import including same domain redirect");
38 test(function() { assert_not_loaded("same-xs"); }, "Blocking access to a cross origin iamport including same domain redirect");
39
40 </script>
41 </body>
42 </html>