Bug 872871 - remove unused extensions from mobile talos jobs. r=jhammel
authorJoel Maher <jmaher@mozilla.com>
Mon, 20 May 2013 17:24:16 -0400
changeset 642 dfe08f329e2c10fbc86aeff2c202ae497863b075
parent 641 c69a5cabbbf65ec35b9eb975ed1127499cad0305
child 643 7d4ae29b7d1f142bd47c6779c406e274e636ba92
push id380
push userjmaher@mozilla.com
push dateMon, 20 May 2013 21:24:31 +0000
reviewersjhammel
bugs872871
Bug 872871 - remove unused extensions from mobile talos jobs. r=jhammel
talos/PerfConfigurator.py
talos/mobile_extensions/roboextender@mozilla.org/bootstrap.js
talos/mobile_extensions/roboextender@mozilla.org/install.rdf
--- a/talos/PerfConfigurator.py
+++ b/talos/PerfConfigurator.py
@@ -487,16 +487,17 @@ the highest value.
         activeTests = self.config.pop('activeTests', [])
         overrides = self.config.pop('test_overrides', {}) # test overrides from yaml file
         global_overrides = {}
         for key in self.global_overrides:
             # get global overrides for all tests
             value = self.config.pop(key, None)
             if value is not None:
                 global_overrides[key] = value
+
         # add noChrome to global overrides (HACK)
         noChrome = self.config.pop('noChrome', None)
         if noChrome:
             global_overrides['tpchrome'] = False
 
         # HACK: currently xperf tests post results to graph server and we want to ensure we don't publish shutdown numbers
         # This is also hacked because "--noShutdown -> shutdown:True"
         if self.config.get('xperf_path', ''):
@@ -505,16 +506,22 @@ the highest value.
         if isinstance(activeTests, basestring):
             activeTests = activeTests.strip()
             activeTests = activeTests.split(':')
 
         # add the tests to the configuration
         # XXX extending vs over-writing?
         self.config.setdefault('tests', []).extend(self.tests(activeTests, overrides, global_overrides, counters))
 
+        if self.config.get('fennecIDs', ''):
+            # robopan is the only robocop based extension which uses roboextender
+            for test in self.config.get('tests', []):
+                if test['name'] == 'trobopan':
+                    self.config['extensions'] = ['${talos}/mobile_extensions/roboextender@mozilla.org']
+
         if self.remote:
             # fix up logfile preference
             logfile = self.config['preferences'].get('talos.logfile')
             if logfile:
                 # use the last part of the browser_log overridden for the remote log
                 # from the global; see
                 # http://hg.mozilla.org/build/talos/file/c702ff8892be/talos/remotePerfConfigurator.py#l45
                 self.config['preferences']['talos.logfile'] = '%s/%s' % (self.deviceroot, os.path.basename(logfile))
new file mode 100644
--- /dev/null
+++ b/talos/mobile_extensions/roboextender@mozilla.org/bootstrap.js
@@ -0,0 +1,58 @@
+
+var Cc = Components.classes;
+var Ci = Components.interfaces;
+
+function loadIntoWindow(window) {}
+function unloadFromWindow(window) {}
+
+function _sendMessageToJava (aMsg) {
+  let bridge = Cc["@mozilla.org/android/bridge;1"].getService(Ci.nsIAndroidBridge);
+  return bridge.handleGeckoMessage(JSON.stringify(aMsg));
+};
+
+/*
+ bootstrap.js API
+*/
+var windowListener = {
+  onOpenWindow: function(aWindow) {
+    // Wait for the window to finish loading
+    let domWindow = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).getInterface(Ci.nsIDOMWindowInternal || 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,
+          };
+          let retVal = _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);
+}
+
+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);
+  let obs = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService);
+
+  // Stop watching for new windows
+  wm.removeListener(windowListener);
+}
+
+function install(aData, aReason) { }
+function uninstall(aData, aReason) { }
new file mode 100644
--- /dev/null
+++ b/talos/mobile_extensions/roboextender@mozilla.org/install.rdf
@@ -0,0 +1,19 @@
+<?xml version="1.0"?>
+<RDF xmlns="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:em="http://www.mozilla.org/2004/em-rdf#">
+    <Description about="urn:mozilla:install-manifest">
+        <em:id>roboextender@mozilla.org</em:id>
+        <em:type>2</em:type>
+        <em:name>Robocop Extender</em:name>
+        <em:version>1.0</em:version>
+        <em:bootstrap>true</em:bootstrap>
+        <em:creator>Joel Maher</em:creator>
+        <em:targetApplication>
+            <Description>
+               <em:id>toolkit@mozilla.org</em:id>
+               <em:minVersion>10.0</em:minVersion>
+               <em:maxVersion>*</em:maxVersion>
+            </Description>
+        </em:targetApplication>
+    </Description>
+</RDF>
+