summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js
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/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js
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/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js60
1 files changed, 60 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js b/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js
new file mode 100644
index 000000000..3657d9732
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_XFrameOptionsAllowFrom.js
@@ -0,0 +1,60 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 690168 - Support Allow-From notation for X-Frame-Options header.
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+
+var initialScreenshotArrayBuffer = null;
+
+function arrayBuffersEqual(a, b) {
+ var x = new Int8Array(a);
+ var y = new Int8Array(b);
+ if (x.length != y.length) {
+ return false;
+ }
+
+ for (var i = 0; i < x.length; i++) {
+ if (x[i] != y[i]) {
+ return false;
+ }
+ }
+
+ return true;
+}
+
+function runTest() {
+ var count = 0;
+
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', 'true');
+ iframe.height = '1000px';
+
+ var step1, stepfinish;
+ // The innermost page we load will fire an alert when it successfully loads.
+ iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
+ switch (e.detail.message) {
+ case 'step 1':
+ step1 = SpecialPowers.snapshotWindow(iframe.contentWindow);
+ break;
+ case 'step 2':
+ ok(false, 'cross origin page loaded');
+ break;
+ case 'finish':
+ // The page has now attempted to load the X-Frame-Options page; take
+ // another screenshot.
+ stepfinish = SpecialPowers.snapshotWindow(iframe.contentWindow);
+ ok(step1.toDataURL() == stepfinish.toDataURL(), "Screenshots should be identical");
+ SimpleTest.finish();
+ }
+ });
+
+ document.body.appendChild(iframe);
+
+ iframe.src = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_XFrameOptionsAllowFrom.html';
+}
+
+addEventListener('testready', runTest);