Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Add a cheesey firefox extension that can send/receive events via jsbr…

…idge

We'll use this to start/stop video capture as needed
  • Loading branch information...
commit bb0076ff50386e780e29b105e962dae8a0d8dc7b 1 parent 526face
@wlach wlach authored
View
4 .gitignore
@@ -7,6 +7,10 @@ bin/decklink-convert.sh
bin/easy_install
bin/easy_install-2.7
bin/eideticker-server
+bin/manifestparser
+bin/mozinfo
+bin/mozprofile
+bin/mozrunner
bin/pip
bin/python
downloads/mobile_tp4.zip
View
3  .gitmodules
@@ -1,3 +1,6 @@
[submodule "src/talos"]
path = src/talos
url = git://github.com/wlach/talos.git
+[submodule "src/mozmill"]
+ path = src/mozmill
+ url = git://github.com/ctalbert/mozmill.git
View
2  bootstrap.sh
@@ -51,6 +51,8 @@ virtualenv .
# Install videocapture and jsbridge python eggs (and their deps)
./bin/easy_install src/videocapture
+./bin/easy_install src/mozmill/mozrunner
+./bin/easy_install src/mozmill/jsbridge
# Install extensions required by mobile talos
TALOS_EXTENSION_DIR=src/talos/mobile_profile/extensions
View
4 src/ffx-extension/chrome.manifest
@@ -0,0 +1,4 @@
+content eideticker-controller chrome/eideticker-controller/content/
+component {67a4936d-ce4c-4090-86f5-8a52ea173c5f} chromescript.js
+contract @mozilla.org/eideticker-controller-observer;1 {67a4936d-ce4c-4090-86f5-8a52ea173c5f}
+category profile-after-change @mozilla.org/eideticker-controller-observer;1 @mozilla.org/eideticker-controller-observer;1
View
35 src/ffx-extension/chrome/eideticker-controller/content/contentscript.js
@@ -0,0 +1,35 @@
+function EController() {
+}
+
+EController.prototype = {
+ toString: function() { return "[EController]"; },
+ pageLoaded: function() {
+ sendAsyncMessage('EController.PageLoaded', { });
+ },
+ animationFinished: function() {
+ sendAsyncMessage('EController.AnimationFinished', { });
+ },
+ __exposedProps__: {
+ 'toString': 'r',
+ 'pageLoaded': 'r',
+ 'animationFinished': 'r'
+ }
+};
+
+// This is a frame script, so it may be running in a content process.
+// In any event, it is targeted at a specific "tab", so we listen for
+// the DOMWindowCreated event to be notified about content windows
+// being created in this context.
+
+function EControllerManager() {
+ addEventListener("DOMWindowCreated", this, false);
+}
+
+EControllerManager.prototype = {
+ handleEvent: function handleEvent(aEvent) {
+ var window = aEvent.target.defaultView;
+ window.wrappedJSObject.EController = new EController(window);
+ }
+};
+
+var eidetickerControllerManager = new EControllerManager();
View
60 src/ffx-extension/chromescript.js
@@ -0,0 +1,60 @@
+const Cu = Components.utils;
+const Cc = Components.classes;
+const Ci = Components.interfaces;
+
+Cu.import("resource://gre/modules/XPCOMUtils.jsm");
+Cu.import("resource://gre/modules/Services.jsm");
+
+var jsbridge = {}; Cu.import('resource://jsbridge/modules/events.js', jsbridge);
+
+/* XPCOM gunk */
+function EControllerObserver() {}
+
+function myDump(aMessage) {
+ var consoleService = Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService);
+ consoleService.logStringMessage("EController: " + aMessage);
+}
+
+EControllerObserver.prototype = {
+ classDescription: "Eideticker Controller Observer for use in testing.",
+ classID: Components.ID("{67a4936d-ce4c-4090-86f5-8a52ea173c5f}"),
+ contractID: "@mozilla.org/eideticker-controller-observer;1",
+ QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
+ _xpcom_categories: [{category: "profile-after-change", service: true }],
+ isFrameScriptLoaded: false,
+
+ observe: function(aSubject, aTopic, aData)
+ {
+ if (aTopic == "profile-after-change") {
+ this.init();
+ } else if (!this.isFrameScriptLoaded &&
+ aTopic == "chrome-document-global-created") {
+ var messageManager = Cc["@mozilla.org/globalmessagemanager;1"].getService(Ci.nsIChromeFrameMessageManager);
+ // Register for any messages our API needs us to handle
+ messageManager.addMessageListener("EController.PageLoaded", this);
+ messageManager.addMessageListener("EController.AnimationFinished", this);
+
+ messageManager.loadFrameScript("chrome://eideticker-controller/content/contentscript.js", true);
+ this.isFrameScriptLoaded = true;
+ } else if (aTopic == "xpcom-shutdown") {
+ this.uninit();
+ }
+ },
+
+ init: function () {
+ var obs = Services.obs;
+ obs.addObserver(this, "xpcom-shutdown", false);
+ obs.addObserver(this, "chrome-document-global-created", false);
+ },
+
+ uninit: function () {
+ var obs = Services.obs;
+ obs.removeObserver(this, "chrome-document-global-created", false);
+ },
+
+ receiveMessage: function(aMessage) {
+ jsbridge.fireEvent(aMessage.name, {});
+ }
+};
+
+const NSGetFactory = XPCOMUtils.generateNSGetFactory([EControllerObserver]);
View
67 src/ffx-extension/install.rdf
@@ -0,0 +1,67 @@
+<?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>eideticker-controller@mozilla.org</em:id>
+ <em:version>1.0</em:version>
+ <em:type>2</em:type>
+
+ <!-- Target Application this extension can install into,
+ with minimum and maximum supported versions. -->
+ <em:targetApplication>
+ <!-- Firefox -->
+ <Description>
+ <em:id>{ec8030f7-c20a-464f-9b0e-13a3a9e97384}</em:id>
+ <em:minVersion>3.5</em:minVersion>
+ <em:maxVersion>10.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:targetApplication>
+ <!-- Thunderbird -->
+ <Description>
+ <em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
+ <em:minVersion>3.0a1pre</em:minVersion>
+ <em:maxVersion>10.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:targetApplication>
+ <!-- Sunbird -->
+ <Description>
+ <em:id>{718e30fb-e89b-41dd-9da7-e25a45638b28}</em:id>
+ <em:minVersion>1.0b1pre</em:minVersion>
+ <em:maxVersion>1.0pre</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:targetApplication>
+ <!-- SeaMonkey -->
+ <Description>
+ <em:id>{92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}</em:id>
+ <em:minVersion>2.0a1</em:minVersion>
+ <em:maxVersion>10.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:targetApplication>
+ <!-- Songbird -->
+ <Description>
+ <em:id>songbird@songbirdnest.com</em:id>
+ <em:minVersion>0.3pre</em:minVersion>
+ <em:maxVersion>1.0.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+ <em:targetApplication>
+ <Description>
+ <em:id>toolkit@mozilla.org</em:id>
+ <em:minVersion>1.9.1</em:minVersion>
+ <em:maxVersion>10.*</em:maxVersion>
+ </Description>
+ </em:targetApplication>
+
+ <!-- Front End MetaData -->
+ <em:name>Eideticker Controller</em:name>
+ <em:description>A very basic extension for controlling the browser remotely</em:description>
+ <em:creator>William Lachance</em:creator>
+ <em:homepageURL>http://www.mozilla.org</em:homepageURL>
+ </Description>
+</RDF>
1  src/mozmill
@@ -0,0 +1 @@
+Subproject commit 7ebe942e6c67517aa4c73331faafa551275b574d
Please sign in to comment.
Something went wrong with that request. Please try again.