diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /mobile/android/tests/browser/robocop/roboextender/bootstrap.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip |
Add m-esr52 at 52.6.0
Diffstat (limited to 'mobile/android/tests/browser/robocop/roboextender/bootstrap.js')
-rw-r--r-- | mobile/android/tests/browser/robocop/roboextender/bootstrap.js | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/mobile/android/tests/browser/robocop/roboextender/bootstrap.js b/mobile/android/tests/browser/robocop/roboextender/bootstrap.js new file mode 100644 index 000000000..e903aa3f6 --- /dev/null +++ b/mobile/android/tests/browser/robocop/roboextender/bootstrap.js @@ -0,0 +1,65 @@ + +var Cc = Components.classes; +var Ci = Components.interfaces; +var Cu = Components.utils; + +Cu.import("resource://gre/modules/Services.jsm"); + +function loadIntoWindow(window) {} +function unloadFromWindow(window) {} + +function _sendMessageToJava (aMsg) { + return Services.androidBridge.handleGeckoMessage(aMsg); +}; + +/* + bootstrap.js API +*/ +var windowListener = { + onOpenWindow: function(aWindow) { + // Wait for the window to finish loading + let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindow); + domWindow.addEventListener("load", function() { + domWindow.removeEventListener("load", arguments.callee, false); + if (domWindow) { + domWindow.addEventListener("scroll", function(e) { + let message = { + type: 'robocop:scroll', + y: XPCNativeWrapper.unwrap(e.target).documentElement.scrollTop, + height: XPCNativeWrapper.unwrap(e.target).documentElement.scrollHeight, + cheight: XPCNativeWrapper.unwrap(e.target).documentElement.clientHeight, + }; + _sendMessageToJava(message); + }); + } + }, false); + }, + onCloseWindow: function(aWindow) { }, + onWindowTitleChange: function(aWindow, aTitle) { } +}; + +function startup(aData, aReason) { + let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); + + // Load into any new windows + wm.addListener(windowListener); + Services.obs.addObserver(function observe(aSubject, aTopic, aData) { + dump("Robocop:Quit received -- requesting quit"); + let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"].getService(Ci.nsIAppStartup); + appStartup.quit(Ci.nsIAppStartup.eForceQuit); + }, "Robocop:Quit", false); +} + +function shutdown(aData, aReason) { + // When the application is shutting down we normally don't have to clean up any UI changes + if (aReason == APP_SHUTDOWN) return; + + let wm = Cc["@mozilla.org/appshell/window-mediator;1"].getService(Ci.nsIWindowMediator); + + // Stop watching for new windows + wm.removeListener(windowListener); +} + +function install(aData, aReason) { } +function uninstall(aData, aReason) { } + |