Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
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 | |
michael@0 | 5 | "use strict"; |
michael@0 | 6 | |
michael@0 | 7 | const Cc = Components.classes; |
michael@0 | 8 | const Ci = Components.interfaces; |
michael@0 | 9 | const Cu = Components.utils; |
michael@0 | 10 | const Cr = Components.results; |
michael@0 | 11 | |
michael@0 | 12 | Components.utils.import("resource://gre/modules/Services.jsm"); |
michael@0 | 13 | |
michael@0 | 14 | const DEBUG = false; |
michael@0 | 15 | |
michael@0 | 16 | let log = DEBUG ? dump : function (){}; |
michael@0 | 17 | |
michael@0 | 18 | |
michael@0 | 19 | function startup(data, reason) { |
michael@0 | 20 | // This code allow to make all stdIO work |
michael@0 | 21 | try { |
michael@0 | 22 | Components.utils.import("resource://gre/modules/ctypes.jsm"); |
michael@0 | 23 | let libdvm = ctypes.open("libdvm.so"); |
michael@0 | 24 | let dvmStdioConverterStartup; |
michael@0 | 25 | // Starting with Android ICS, dalvik uses C++. |
michael@0 | 26 | // So that the symbol isn't a simple C one |
michael@0 | 27 | try { |
michael@0 | 28 | dvmStdioConverterStartup = libdvm.declare("_Z24dvmStdioConverterStartupv", ctypes.default_abi, ctypes.bool); |
michael@0 | 29 | } |
michael@0 | 30 | catch(e) { |
michael@0 | 31 | // Otherwise, before ICS, it was a pure C library |
michael@0 | 32 | dvmStdioConverterStartup = libdvm.declare("dvmStdioConverterStartup", ctypes.default_abi, ctypes.void_t); |
michael@0 | 33 | } |
michael@0 | 34 | dvmStdioConverterStartup(); |
michael@0 | 35 | log("MU: console redirected to adb logcat.\n"); |
michael@0 | 36 | } catch(e) { |
michael@0 | 37 | Cu.reportError("MU: unable to execute jsctype hack: "+e); |
michael@0 | 38 | } |
michael@0 | 39 | |
michael@0 | 40 | try { |
michael@0 | 41 | let QuitObserver = { |
michael@0 | 42 | observe: function (aSubject, aTopic, aData) { |
michael@0 | 43 | Services.obs.removeObserver(QuitObserver, "quit-application"); |
michael@0 | 44 | dump("MU: APPLICATION-QUIT\n"); |
michael@0 | 45 | } |
michael@0 | 46 | }; |
michael@0 | 47 | Services.obs.addObserver(QuitObserver, "quit-application", false); |
michael@0 | 48 | log("MU: ready to watch firefox exit.\n"); |
michael@0 | 49 | } catch(e) { |
michael@0 | 50 | log("MU: unable to register quit-application observer: " + e + "\n"); |
michael@0 | 51 | } |
michael@0 | 52 | } |
michael@0 | 53 | |
michael@0 | 54 | function install() {} |
michael@0 | 55 | function shutdown() {} |