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 | |
michael@0 | 5 | 'use strict' |
michael@0 | 6 | |
michael@0 | 7 | const { defer: async } = require('sdk/lang/functional'); |
michael@0 | 8 | const { before, after } = require('sdk/test/utils'); |
michael@0 | 9 | |
michael@0 | 10 | let AFTER_RUN = 0; |
michael@0 | 11 | let BEFORE_RUN = 0; |
michael@0 | 12 | |
michael@0 | 13 | /* |
michael@0 | 14 | * Tests are dependent on ordering, as the before and after functions |
michael@0 | 15 | * are called outside of each test, and sometimes checked in the next test |
michael@0 | 16 | * (like in the `after` tests) |
michael@0 | 17 | */ |
michael@0 | 18 | exports.testABeforeAsync = function (assert, done) { |
michael@0 | 19 | assert.equal(BEFORE_RUN, 1, 'before function was called'); |
michael@0 | 20 | BEFORE_RUN = 0; |
michael@0 | 21 | AFTER_RUN = 0; |
michael@0 | 22 | async(done)(); |
michael@0 | 23 | }; |
michael@0 | 24 | |
michael@0 | 25 | exports.testABeforeNameAsync = function (assert, done) { |
michael@0 | 26 | assert.equal(BEFORE_RUN, 2, 'before function was called with name'); |
michael@0 | 27 | BEFORE_RUN = 0; |
michael@0 | 28 | AFTER_RUN = 0; |
michael@0 | 29 | async(done)(); |
michael@0 | 30 | }; |
michael@0 | 31 | |
michael@0 | 32 | exports.testAfterAsync = function (assert, done) { |
michael@0 | 33 | assert.equal(AFTER_RUN, 1, 'after function was called previously'); |
michael@0 | 34 | BEFORE_RUN = 0; |
michael@0 | 35 | AFTER_RUN = 0; |
michael@0 | 36 | async(done)(); |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | exports.testAfterNameAsync = function (assert, done) { |
michael@0 | 40 | assert.equal(AFTER_RUN, 2, 'after function was called with name'); |
michael@0 | 41 | BEFORE_RUN = 0; |
michael@0 | 42 | AFTER_RUN = 0; |
michael@0 | 43 | async(done)(); |
michael@0 | 44 | }; |
michael@0 | 45 | |
michael@0 | 46 | exports.testSyncABefore = function (assert) { |
michael@0 | 47 | assert.equal(BEFORE_RUN, 1, 'before function was called for sync test'); |
michael@0 | 48 | BEFORE_RUN = 0; |
michael@0 | 49 | AFTER_RUN = 0; |
michael@0 | 50 | }; |
michael@0 | 51 | |
michael@0 | 52 | exports.testSyncAfter = function (assert) { |
michael@0 | 53 | assert.equal(AFTER_RUN, 1, 'after function was called for sync test'); |
michael@0 | 54 | BEFORE_RUN = 0; |
michael@0 | 55 | AFTER_RUN = 0; |
michael@0 | 56 | }; |
michael@0 | 57 | |
michael@0 | 58 | before(exports, (name, assert) => { |
michael@0 | 59 | if (name === 'testABeforeNameAsync') |
michael@0 | 60 | BEFORE_RUN = 2; |
michael@0 | 61 | else |
michael@0 | 62 | BEFORE_RUN = 1; |
michael@0 | 63 | assert.pass('assert passed into before function'); |
michael@0 | 64 | }); |
michael@0 | 65 | |
michael@0 | 66 | after(exports, (name, assert) => { |
michael@0 | 67 | // testAfterName runs after testAfter, which is where this |
michael@0 | 68 | // check occurs in the assertation |
michael@0 | 69 | if (name === 'testAfterAsync') |
michael@0 | 70 | AFTER_RUN = 2; |
michael@0 | 71 | else |
michael@0 | 72 | AFTER_RUN = 1; |
michael@0 | 73 | assert.pass('assert passed into after function'); |
michael@0 | 74 | }); |
michael@0 | 75 | |
michael@0 | 76 | require('sdk/test').run(exports); |