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 | |
michael@0 | 2 | var Cc = Components.classes; |
michael@0 | 3 | var Ci = Components.interfaces; |
michael@0 | 4 | var Cu = Components.utils; |
michael@0 | 5 | |
michael@0 | 6 | Cu.import("resource://gre/modules/Services.jsm"); |
michael@0 | 7 | |
michael@0 | 8 | function loadIntoWindow(window) {} |
michael@0 | 9 | function unloadFromWindow(window) {} |
michael@0 | 10 | |
michael@0 | 11 | function _sendMessageToJava (aMsg) { |
michael@0 | 12 | return Services.androidBridge.handleGeckoMessage(aMsg); |
michael@0 | 13 | }; |
michael@0 | 14 | |
michael@0 | 15 | /* |
michael@0 | 16 | bootstrap.js API |
michael@0 | 17 | */ |
michael@0 | 18 | var windowListener = { |
michael@0 | 19 | onOpenWindow: function(aWindow) { |
michael@0 | 20 | // Wait for the window to finish loading |
michael@0 | 21 | let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || Ci.nsIDOMWindow); |
michael@0 | 22 | domWindow.addEventListener("load", function() { |
michael@0 | 23 | domWindow.removeEventListener("load", arguments.callee, false); |
michael@0 | 24 | if (domWindow) { |
michael@0 | 25 | domWindow.addEventListener("scroll", function(e) { |
michael@0 | 26 | let message = { |
michael@0 | 27 | type: 'robocop:scroll', |
michael@0 | 28 | y: XPCNativeWrapper.unwrap(e.target).documentElement.scrollTop, |
michael@0 | 29 | height: XPCNativeWrapper.unwrap(e.target).documentElement.scrollHeight, |
michael@0 | 30 | cheight: XPCNativeWrapper.unwrap(e.target).documentElement.clientHeight, |
michael@0 | 31 | }; |
michael@0 | 32 | let retVal = _sendMessageToJava(message); |
michael@0 | 33 | }); |
michael@0 | 34 | } |
michael@0 | 35 | }, false); |
michael@0 | 36 | }, |
michael@0 | 37 | onCloseWindow: function(aWindow) { }, |
michael@0 | 38 | onWindowTitleChange: function(aWindow, aTitle) { } |
michael@0 | 39 | }; |
michael@0 | 40 | |
michael@0 | 41 | function startup(aData, aReason) { |
michael@0 | 42 | let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); |
michael@0 | 43 | |
michael@0 | 44 | // Load into any new windows |
michael@0 | 45 | wm.addListener(windowListener); |
michael@0 | 46 | Services.obs.addObserver(function observe(aSubject, aTopic, aData) { |
michael@0 | 47 | dump("Robocop:Quit received -- requesting quit"); |
michael@0 | 48 | let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup); |
michael@0 | 49 | appStartup.quit(Ci.nsIAppStartup.eForceQuit); |
michael@0 | 50 | }, "Robocop:Quit", false); |
michael@0 | 51 | } |
michael@0 | 52 | |
michael@0 | 53 | function shutdown(aData, aReason) { |
michael@0 | 54 | // When the application is shutting down we normally don't have to clean up any UI changes |
michael@0 | 55 | if (aReason == APP_SHUTDOWN) return; |
michael@0 | 56 | |
michael@0 | 57 | let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); |
michael@0 | 58 | |
michael@0 | 59 | // Stop watching for new windows |
michael@0 | 60 | wm.removeListener(windowListener); |
michael@0 | 61 | } |
michael@0 | 62 | |
michael@0 | 63 | function install(aData, aReason) { } |
michael@0 | 64 | function uninstall(aData, aReason) { } |
michael@0 | 65 |