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 { List, addListItem, removeListItem } = require('sdk/util/list'); |
michael@0 | 7 | const { Class } = require('sdk/core/heritage'); |
michael@0 | 8 | |
michael@0 | 9 | exports.testList = function(assert) { |
michael@0 | 10 | let list = List(); |
michael@0 | 11 | addListItem(list, 1); |
michael@0 | 12 | |
michael@0 | 13 | for (let key in list) { |
michael@0 | 14 | assert.equal(key, 0, 'key is correct'); |
michael@0 | 15 | assert.equal(list[key], 1, 'value is correct'); |
michael@0 | 16 | } |
michael@0 | 17 | |
michael@0 | 18 | let count = 0; |
michael@0 | 19 | for each (let ele in list) { |
michael@0 | 20 | assert.equal(ele, 1, 'ele is correct'); |
michael@0 | 21 | assert.equal(++count, 1, 'count is correct'); |
michael@0 | 22 | } |
michael@0 | 23 | |
michael@0 | 24 | count = 0; |
michael@0 | 25 | for (let ele of list) { |
michael@0 | 26 | assert.equal(ele, 1, 'ele is correct'); |
michael@0 | 27 | assert.equal(++count, 1, 'count is correct'); |
michael@0 | 28 | } |
michael@0 | 29 | |
michael@0 | 30 | removeListItem(list, 1); |
michael@0 | 31 | assert.equal(list.length, 0, 'remove worked'); |
michael@0 | 32 | }; |
michael@0 | 33 | |
michael@0 | 34 | exports.testImplementsList = function(assert) { |
michael@0 | 35 | let List2 = Class({ |
michael@0 | 36 | implements: [List], |
michael@0 | 37 | initialize: function() { |
michael@0 | 38 | List.prototype.initialize.apply(this, [0, 1, 2]); |
michael@0 | 39 | } |
michael@0 | 40 | }); |
michael@0 | 41 | let list2 = List2(); |
michael@0 | 42 | let count = 0; |
michael@0 | 43 | |
michael@0 | 44 | for each (let ele in list2) { |
michael@0 | 45 | assert.equal(ele, count++, 'ele is correct'); |
michael@0 | 46 | } |
michael@0 | 47 | |
michael@0 | 48 | count = 0; |
michael@0 | 49 | for (let ele of list2) { |
michael@0 | 50 | assert.equal(ele, count++, 'ele is correct'); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | addListItem(list2, 3); |
michael@0 | 54 | assert.equal(list2.length, 4, '3 was added'); |
michael@0 | 55 | assert.equal(list2[list2.length-1], 3, '3 was added'); |
michael@0 | 56 | } |
michael@0 | 57 | |
michael@0 | 58 | require('sdk/test').run(exports); |