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