Bug 1016875 - Part5: Redirection test for Imports. r=mrbkap
authorGabor Krizsanits <gkrizsanits@mozilla.com>
Wed, 16 Jul 2014 14:31:59 +0200
changeset 216291 06a6bfac90ae73a2fe7c4d2bada2eb9060138c7a
parent 216290 bbc3281764727eef8307b7f3efde9d457e95f096
child 216292 c1a411690bdb284a0760036108d5ee82bdc9fa6d
push id515
push userraliiev@mozilla.com
push dateMon, 06 Oct 2014 12:51:51 +0000
treeherdermozilla-release@267c7a481bef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmrbkap
bugs1016875
milestone33.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1016875 - Part5: Redirection test for Imports. r=mrbkap
content/html/content/test/file_imports_redirect.html
content/html/content/test/file_imports_redirect.html^headers^
content/html/content/test/file_imports_redirected.html
content/html/content/test/mochitest.ini
content/html/content/test/test_imports_redirect.html
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/file_imports_redirect.html
@@ -0,0 +1,5 @@
+<!DOCTYPE html>
+<html>
+<body>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/file_imports_redirect.html^headers^
@@ -0,0 +1,2 @@
+HTTP 301 Moved Permanently
+Location: http://mochi.test:8888/tests/content/html/content/test/file_imports_redirected.html
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/file_imports_redirected.html
@@ -0,0 +1,6 @@
+<!DOCTYPE html>
+<html>
+<body>
+<script> var redirected = true; </script>
+</body>
+</html>
--- a/content/html/content/test/mochitest.ini
+++ b/content/html/content/test/mochitest.ini
@@ -143,16 +143,19 @@ support-files =
   file_iframe_sandbox_window_form_fail.html
   file_iframe_sandbox_window_form_pass.html
   file_iframe_sandbox_window_navigation_fail.html
   file_iframe_sandbox_window_navigation_pass.html
   file_iframe_sandbox_window_top_navigation_pass.html
   file_iframe_sandbox_window_top_navigation_fail.html
   file_iframe_sandbox_worker.js
   file_imports_basics.html
+  file_imports_redirect.html
+  file_imports_redirect.html^headers^
+  file_imports_redirected.html
   file_srcdoc-2.html
   file_srcdoc.html
   form_submit_server.sjs
   image.png
   image-allow-credentials.png
   image-allow-credentials.png^headers^
   nnc_lockup.gif
   reflect.js
@@ -449,16 +452,17 @@ skip-if = buildapp == 'b2g' # b2g(multip
 [test_iframe_sandbox_popups_inheritance.html]
 skip-if = buildapp == 'b2g' || e10s # b2g(multiple concurrent window.open()s fail on B2G) b2g-debug(multiple concurrent window.open()s fail on B2G) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
 [test_iframe_sandbox_redirect.html]
 [test_iframe_sandbox_same_origin.html]
 [test_iframe_sandbox_workers.html]
 [test_img_attributes_reflection.html]
 [test_imageSrcSet.html]
 [test_imports_basics.html]
+[test_imports_redirect.html]
 [test_li_attributes_reflection.html]
 [test_link_attributes_reflection.html]
 [test_link_sizes.html]
 [test_map_attributes_reflection.html]
 [test_meta_attributes_reflection.html]
 [test_mod_attributes_reflection.html]
 [test_mozaudiochannel.html]
 skip-if = (buildapp == 'b2g' && (toolkit != 'gonk' || debug)) # b2g-debug(Perma-orange on debug emulator) b2g-desktop(Bug 931116, b2g desktop specific, initial triage)
new file mode 100644
--- /dev/null
+++ b/content/html/content/test/test_imports_redirect.html
@@ -0,0 +1,39 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=1016875
+-->
+<head>
+  <title>Test for Bug 1016875</title>
+  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+  <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
+</head>
+<body>
+  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1016875">Mozilla Bug 1016875</a>
+
+  <script type="text/javascript">
+    SimpleTest.waitForExplicitFinish();
+    var loadEventFired = false;
+    var errorEventFired = false;
+    var counter = 0;
+    function loaded() {
+      loadEventFired = true;
+    }
+    function failed() {
+      errorEventFired = true;
+    }
+  </script>
+
+  <link rel="import" href="http://mochi.test:8888/tests/content/html/content/test/file_imports_redirect.html" id="import" onload="loaded()" onerror="failed()"></link>
+
+  <script type="text/javascript">
+    ok(loadEventFired, "Load event was fired");
+    ok(!errorEventFired, "Error event was not fired, redirection worked");
+    ok(redirected, "Script of the target of redirection was executed");
+
+    SimpleTest.finish();
+  </script>
+
+</body>
+</html>