summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/browserElement_CookiesNotThirdParty.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_CookiesNotThirdParty.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_CookiesNotThirdParty.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_CookiesNotThirdParty.js51
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_CookiesNotThirdParty.js b/dom/browser-element/mochitest/browserElement_CookiesNotThirdParty.js
new file mode 100644
index 000000000..32f877786
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_CookiesNotThirdParty.js
@@ -0,0 +1,51 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 806127 - Test that cookies set by <iframe mozbrowser> are not considered
+// third-party.
+"use strict";
+
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+
+function runTest() {
+ const innerPage = 'http://example.com/tests/dom/browser-element/mochitest/file_browserElement_CookiesNotThirdParty.html';
+
+ var iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', 'true');
+
+ iframe.addEventListener('mozbrowsershowmodalprompt', function(e) {
+ if (e.detail.message == 'next') {
+ iframe.src = innerPage + '?step=2';
+ return;
+ }
+
+ if (e.detail.message.startsWith('success:')) {
+ ok(true, e.detail.message);
+ return;
+ }
+
+ if (e.detail.message.startsWith('failure:')) {
+ ok(false, e.detail.message);
+ return;
+ }
+
+ if (e.detail.message == 'finish') {
+ SimpleTest.finish();
+ }
+ });
+
+ // innerPage will set a cookie and then alert('next'). We'll load
+ // innerPage?step=2. That page will check that the cooke exists (despite the
+ // fact that we've disabled third-party cookies) and alert('success:') or
+ // alert('failure:'), as appropriate. Finally, the page will
+ // alert('finish');
+ iframe.src = innerPage;
+ document.body.appendChild(iframe);
+}
+
+// Disable third-party cookies for this test.
+addEventListener('testready', function() {
+ SpecialPowers.pushPrefEnv({'set': [['network.cookie.cookieBehavior', 1]]}, runTest);
+});