addon-sdk/source/python-lib/cuddlefish/mobile-utils/bootstrap.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

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 /* This Source Code Form is subject to the terms of the Mozilla Public
     2  * License, v. 2.0. If a copy of the MPL was not distributed with this
     3  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
     5 "use strict";
     7 const Cc = Components.classes;
     8 const Ci = Components.interfaces;
     9 const Cu = Components.utils;
    10 const Cr = Components.results;
    12 Components.utils.import("resource://gre/modules/Services.jsm");
    14 const DEBUG = false;
    16 let log = DEBUG ? dump : function (){};
    19 function startup(data, reason) {
    20   // This code allow to make all stdIO work
    21   try {
    22     Components.utils.import("resource://gre/modules/ctypes.jsm");
    23     let libdvm = ctypes.open("libdvm.so");
    24     let dvmStdioConverterStartup;
    25     // Starting with Android ICS, dalvik uses C++.
    26     // So that the symbol isn't a simple C one
    27     try {
    28       dvmStdioConverterStartup = libdvm.declare("_Z24dvmStdioConverterStartupv", ctypes.default_abi, ctypes.bool);
    29     }
    30     catch(e) {
    31       // Otherwise, before ICS, it was a pure C library
    32       dvmStdioConverterStartup = libdvm.declare("dvmStdioConverterStartup", ctypes.default_abi, ctypes.void_t);
    33     }
    34     dvmStdioConverterStartup();
    35     log("MU: console redirected to adb logcat.\n");
    36   } catch(e) {
    37     Cu.reportError("MU: unable to execute jsctype hack: "+e);
    38   }
    40   try {
    41     let QuitObserver = {
    42       observe: function (aSubject, aTopic, aData) {
    43         Services.obs.removeObserver(QuitObserver, "quit-application");
    44         dump("MU: APPLICATION-QUIT\n");
    45       }
    46     };
    47     Services.obs.addObserver(QuitObserver, "quit-application", false);
    48     log("MU: ready to watch firefox exit.\n");
    49   } catch(e) {
    50     log("MU: unable to register quit-application observer: " + e + "\n");
    51   }
    52 }
    54 function install() {}
    55 function shutdown() {}

mercurial