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 { on } = require("../system/events"); |
michael@0 | 7 | const core = require("./core"); |
michael@0 | 8 | const { id: jetpackId} = require('../self'); |
michael@0 | 9 | |
michael@0 | 10 | const OPTIONS_DISPLAYED = "addon-options-displayed"; |
michael@0 | 11 | |
michael@0 | 12 | function onOptionsDisplayed({ subject: document, data: addonId }) { |
michael@0 | 13 | if (addonId !== jetpackId) |
michael@0 | 14 | return; |
michael@0 | 15 | let query = 'setting[data-jetpack-id="' + jetpackId + '"][pref-name], ' + |
michael@0 | 16 | 'button[data-jetpack-id="' + jetpackId + '"][pref-name]'; |
michael@0 | 17 | let nodes = document.querySelectorAll(query); |
michael@0 | 18 | for (let node of nodes) { |
michael@0 | 19 | let name = node.getAttribute("pref-name"); |
michael@0 | 20 | if (node.tagName == "setting") { |
michael@0 | 21 | let desc = core.get(name + "_description"); |
michael@0 | 22 | if (desc) |
michael@0 | 23 | node.setAttribute("desc", desc); |
michael@0 | 24 | let title = core.get(name + "_title"); |
michael@0 | 25 | if (title) |
michael@0 | 26 | node.setAttribute("title", title); |
michael@0 | 27 | |
michael@0 | 28 | for (let item of node.querySelectorAll("menuitem, radio")) { |
michael@0 | 29 | let key = name + "_options." + item.getAttribute("label"); |
michael@0 | 30 | let label = core.get(key); |
michael@0 | 31 | if (label) |
michael@0 | 32 | item.setAttribute("label", label); |
michael@0 | 33 | } |
michael@0 | 34 | } |
michael@0 | 35 | else if (node.tagName == "button") { |
michael@0 | 36 | let label = core.get(name + "_label"); |
michael@0 | 37 | if (label) |
michael@0 | 38 | node.setAttribute("label", label); |
michael@0 | 39 | } |
michael@0 | 40 | } |
michael@0 | 41 | } |
michael@0 | 42 | on(OPTIONS_DISPLAYED, onOptionsDisplayed); |