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 | /* -*- Mode: javascript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2; js-indent-level: 2; -*- */ |
michael@0 | 2 | /* vim: set ft=javascript ts=2 et sw=2 tw=80: */ |
michael@0 | 3 | /* This Source Code Form is subject to the terms of the Mozilla Public |
michael@0 | 4 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
michael@0 | 5 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
michael@0 | 6 | |
michael@0 | 7 | /** |
michael@0 | 8 | * This file is meant to be loaded as a ChromeWorker. It accepts messages which |
michael@0 | 9 | * have data of the form: |
michael@0 | 10 | * |
michael@0 | 11 | * { id, url, indent, source } |
michael@0 | 12 | * |
michael@0 | 13 | * Where `id` is a unique ID to identify this request, `url` is the url of the |
michael@0 | 14 | * source being pretty printed, `indent` is the number of spaces to indent the |
michael@0 | 15 | * code by, and `source` is the source text. |
michael@0 | 16 | * |
michael@0 | 17 | * On success, the worker responds with a message of the form: |
michael@0 | 18 | * |
michael@0 | 19 | * { id, code, mappings } |
michael@0 | 20 | * |
michael@0 | 21 | * Where `id` is the same unique ID from the request, `code` is the pretty |
michael@0 | 22 | * printed source text, and `mappings` is an array or source mappings from the |
michael@0 | 23 | * pretty printed code back to the ugly source text. |
michael@0 | 24 | * |
michael@0 | 25 | * In the case of an error, the worker responds with a message of the form: |
michael@0 | 26 | * |
michael@0 | 27 | * { id, error } |
michael@0 | 28 | */ |
michael@0 | 29 | |
michael@0 | 30 | importScripts("resource://gre/modules/devtools/acorn/acorn.js"); |
michael@0 | 31 | importScripts("resource://gre/modules/devtools/source-map.js"); |
michael@0 | 32 | importScripts("resource://gre/modules/devtools/pretty-fast.js"); |
michael@0 | 33 | |
michael@0 | 34 | self.onmessage = (event) => { |
michael@0 | 35 | const { data: { id, url, indent, source } } = event; |
michael@0 | 36 | try { |
michael@0 | 37 | const prettified = prettyFast(source, { |
michael@0 | 38 | url: url, |
michael@0 | 39 | indent: " ".repeat(indent) |
michael@0 | 40 | }); |
michael@0 | 41 | |
michael@0 | 42 | self.postMessage({ |
michael@0 | 43 | id: id, |
michael@0 | 44 | code: prettified.code, |
michael@0 | 45 | mappings: prettified.map._mappings |
michael@0 | 46 | }); |
michael@0 | 47 | } catch (e) { |
michael@0 | 48 | self.postMessage({ |
michael@0 | 49 | id: id, |
michael@0 | 50 | error: e.message + "\n" + e.stack |
michael@0 | 51 | }); |
michael@0 | 52 | } |
michael@0 | 53 | }; |