Sat, 03 Jan 2015 20:18:00 +0100
Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.
michael@0 | 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 4 | 'use strict'; |
michael@0 | 5 | |
michael@0 | 6 | const { create } = require('sdk/frame/utils'); |
michael@0 | 7 | const { open, close } = require('sdk/window/helpers'); |
michael@0 | 8 | |
michael@0 | 9 | exports['test frame creation'] = function(assert, done) { |
michael@0 | 10 | open('data:text/html;charset=utf-8,Window').then(function (window) { |
michael@0 | 11 | let frame = create(window.document); |
michael@0 | 12 | |
michael@0 | 13 | assert.equal(frame.getAttribute('type'), 'content', |
michael@0 | 14 | 'frame type is content'); |
michael@0 | 15 | assert.ok(frame.contentWindow, 'frame has contentWindow'); |
michael@0 | 16 | assert.equal(frame.contentWindow.location.href, 'about:blank', |
michael@0 | 17 | 'by default "about:blank" is loaded'); |
michael@0 | 18 | assert.equal(frame.docShell.allowAuth, false, 'auth disabled by default'); |
michael@0 | 19 | assert.equal(frame.docShell.allowJavascript, false, 'js disabled by default'); |
michael@0 | 20 | assert.equal(frame.docShell.allowPlugins, false, |
michael@0 | 21 | 'plugins disabled by default'); |
michael@0 | 22 | close(window).then(done); |
michael@0 | 23 | }); |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | exports['test fram has js disabled by default'] = function(assert, done) { |
michael@0 | 27 | open('data:text/html;charset=utf-8,window').then(function (window) { |
michael@0 | 28 | let frame = create(window.document, { |
michael@0 | 29 | uri: 'data:text/html;charset=utf-8,<script>document.documentElement.innerHTML' + |
michael@0 | 30 | '= "J" + "S"</script>', |
michael@0 | 31 | }); |
michael@0 | 32 | frame.contentWindow.addEventListener('DOMContentLoaded', function ready() { |
michael@0 | 33 | frame.contentWindow.removeEventListener('DOMContentLoaded', ready, false); |
michael@0 | 34 | assert.ok(!~frame.contentDocument.documentElement.innerHTML.indexOf('JS'), |
michael@0 | 35 | 'JS was executed'); |
michael@0 | 36 | |
michael@0 | 37 | close(window).then(done); |
michael@0 | 38 | }, false); |
michael@0 | 39 | }); |
michael@0 | 40 | }; |
michael@0 | 41 | |
michael@0 | 42 | exports['test frame with js enabled'] = function(assert, done) { |
michael@0 | 43 | open('data:text/html;charset=utf-8,window').then(function (window) { |
michael@0 | 44 | let frame = create(window.document, { |
michael@0 | 45 | uri: 'data:text/html;charset=utf-8,<script>document.documentElement.innerHTML' + |
michael@0 | 46 | '= "J" + "S"</script>', |
michael@0 | 47 | allowJavascript: true |
michael@0 | 48 | }); |
michael@0 | 49 | frame.contentWindow.addEventListener('DOMContentLoaded', function ready() { |
michael@0 | 50 | frame.contentWindow.removeEventListener('DOMContentLoaded', ready, false); |
michael@0 | 51 | assert.ok(~frame.contentDocument.documentElement.innerHTML.indexOf('JS'), |
michael@0 | 52 | 'JS was executed'); |
michael@0 | 53 | |
michael@0 | 54 | close(window).then(done); |
michael@0 | 55 | }, false); |
michael@0 | 56 | }); |
michael@0 | 57 | }; |
michael@0 | 58 | |
michael@0 | 59 | require('test').run(exports); |