summaryrefslogtreecommitdiffstats
path: root/dom/tests/mochitest/bugs/test_bug593174.html
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/tests/mochitest/bugs/test_bug593174.html
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/tests/mochitest/bugs/test_bug593174.html')
-rw-r--r--dom/tests/mochitest/bugs/test_bug593174.html85
1 files changed, 85 insertions, 0 deletions
diff --git a/dom/tests/mochitest/bugs/test_bug593174.html b/dom/tests/mochitest/bugs/test_bug593174.html
new file mode 100644
index 000000000..370d40b79
--- /dev/null
+++ b/dom/tests/mochitest/bugs/test_bug593174.html
@@ -0,0 +1,85 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=593174
+-->
+<head>
+ <title>Test for Bug 593174</title>
+ <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+ <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=593174">Mozilla Bug 593174</a>
+
+<script>
+
+SimpleTest.waitForExplicitFinish();
+
+var loadCount = 0;
+var popup = null;
+
+const kOriginalLocation = location.href;
+
+function iframeLoaded(identifier) {
+ loadCount++;
+ dump("iframeLoaded. loadCount=" + loadCount +
+ " identifier='" + identifier + "'\n");
+
+ var iframe = document.getElementById('iframe');
+ var iframeCw = iframe.contentWindow;
+
+ if (loadCount == 1) {
+ // Test 1: Navigate iframe1. This page should be the referer.
+ // We'll get a callback from the inner page when its iframe finishes
+ // loading, so get rid of the onload listener on our iframe.
+
+ // Change this page's URI using replaceState; the referrer should be this
+ // new value, not our original location.
+ history.replaceState('', '', Math.random());
+
+ iframe.onload = null;
+ iframeCw.location = 'file_bug593174_2.html';
+ }
+ else if (loadCount == 2) {
+ // Test 1: Check that this page is the referer.
+ is(iframeCw.document.referrer, String(document.location), 'outer iframe referrer');
+
+ // Test 2: file_bug593174_2.html itself contains an iframe, whose src is a
+ // data: uri. Call into that inner iframe and have it set its
+ // document.location. The new document's referrer should be
+ // file_bug593174_2.html.
+
+ // We'll get a call to iframeLoaded when this finishes.
+ iframeCw.navigateInnerIframe();
+ }
+ else if (loadCount == 3) {
+ is(iframeCw.getInnerIframeReferrer(), String(iframeCw.location), 'inner iframe referrer');
+
+ // Now do the test again, this time with a popup.
+ popup = window.open('file_bug593174_1.html');
+ popup.onload = iframeLoaded('popup/outer');
+ }
+ else if (loadCount == 4) {
+ history.replaceState('', '', Math.random());
+
+ popup.onload = null;
+ popup.location = 'file_bug593174_2.html';
+ }
+ else if (loadCount == 5) {
+ is(popup.document.referrer, String(document.location), 'popup referrer after replaceState');
+ popup.navigateInnerIframe();
+ }
+ else if (loadCount == 6) {
+ is(popup.getInnerIframeReferrer(), String(popup.location), 'popup/inner iframe referrer');
+ popup.close();
+ history.replaceState('', '', kOriginalLocation);
+ SimpleTest.finish();
+ }
+}
+
+</script>
+
+<iframe onload='iframeLoaded("outer")' id='iframe' src='file_bug593174_1.html'></iframe>
+
+</body>
+</html>