Permalink
Browse files

Merge branch 'next'

  • Loading branch information...
2 parents f4c8300 + 144eccf commit 0476727949c70523dfc7288b5d930ba26b3e5e61 @gtanner gtanner committed Jul 19, 2012
Showing with 3,224 additions and 476 deletions.
  1. +1 −0 .gitignore
  2. +2 −1 .jshintrc
  3. +21 −2 Jakefile
  4. +13 −0 README.md
  5. +13 −19 build/btest.js
  6. +2 −1 build/build/chromestore.js
  7. +2 −1 build/build/chromium.js
  8. +22 −2 build/deploy.js
  9. +1 −1 build/lint.js
  10. +5 −0 build/scripts/runTestsInNode
  11. +4 −9 build/test.js
  12. +23 −0 doc/CHANGELOG.md
  13. +1 −0 ext/assets/index.html
  14. +2 −2 ext/chromestore/controllers/Background.js
  15. +23 −0 ext/chromestore/views/background.html
  16. +34 −8 ext/chromium/controllers/Background.js
  17. +8 −4 ext/chromium/controllers/Insertion.js
  18. +16 −1 ext/chromium/controllers/frame.js
  19. +0 −9 ext/chromium/controllers/injector.js
  20. +5 −1 ext/chromium/manifest.json
  21. +1 −0 ext/chromium/views/background.html
  22. +19 −0 lib/ripple.js
  23. +1 −1 lib/ripple/bootstrap.js
  24. +2 −1 lib/ripple/devices/Colt.js
  25. +1 −1 lib/ripple/devices/NexusS.js
  26. +1 −1 lib/ripple/devices/iPad.js
  27. +1 −1 lib/ripple/devices/iPhone3.js
  28. +4 −1 lib/ripple/emulatorBridge.js
  29. +31 −18 lib/ripple/platform.js
  30. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/JavaPluginManager.js
  31. +27 −0 lib/ripple/platform/cordova/2.0.0/MediaError.js
  32. +14 −7 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge.js
  33. +20 −17 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/accelerometer.js
  34. +23 −0 lib/ripple/platform/cordova/2.0.0/bridge/app.js
  35. +29 −0 lib/ripple/platform/cordova/2.0.0/bridge/camera.js
  36. +28 −0 lib/ripple/platform/cordova/2.0.0/bridge/capture.js
  37. +10 −10 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/compass.js
  38. +21 −0 lib/ripple/platform/cordova/2.0.0/bridge/console.js
  39. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/contacts.js
  40. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/device.js
  41. +349 −0 lib/ripple/platform/cordova/2.0.0/bridge/file.js
  42. +81 −0 lib/ripple/platform/cordova/2.0.0/bridge/geolocation.js
  43. +205 −0 lib/ripple/platform/cordova/2.0.0/bridge/media.js
  44. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/network.js
  45. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/bridge/notification.js
  46. 0 lib/ripple/platform/cordova/{1.6 → 2.0.0}/logger.js
  47. +33 −11 lib/ripple/platform/cordova/{1.6 → 2.0.0}/spec.js
  48. 0 lib/ripple/platform/{phonegap/1.0 → cordova/2.0.0}/spec/config.js
  49. 0 lib/ripple/platform/{phonegap/1.0 → cordova/2.0.0}/spec/device.js
  50. +47 −0 lib/ripple/platform/cordova/2.0.0/spec/events.js
  51. 0 lib/ripple/platform/{phonegap/1.0 → cordova/2.0.0}/spec/ui.js
  52. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/AVCodecsAttributes.js
  53. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/Acceleration.js
  54. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/AudioCodecAttributes.js
  55. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/AudioDeviceAttributes.js
  56. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/BrailleDeviceAttributes.js
  57. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/CPUAttributes.js
  58. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/CameraAttributes.js
  59. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/Connection.js
  60. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ConnectionAttributes.js
  61. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/Contact.js
  62. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactAccount.js
  63. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactAddress.js
  64. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactError.js
  65. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactField.js
  66. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactFindOptions.js
  67. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactName.js
  68. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ContactOrganization.js
  69. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/DisplayDeviceAttributes.js
  70. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/InputDevicesAttributes.js
  71. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/KeyboardAttributes.js
  72. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/MicrophoneAttributes.js
  73. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/NetworkAttributes.js
  74. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/NetworkStatus.js
  75. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/OutputDevicesAttributes.js
  76. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/PhoneGap.js
  77. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/PointerAttributes.js
  78. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/PowerAttributes.js
  79. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/PrintingDeviceAttributes.js
  80. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/SensorAttributes.js
  81. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/StorageUnitAttributes.js
  82. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/SystemInfoOptions.js
  83. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/ThermalAttributes.js
  84. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/VideoCodecAttributes.js
  85. +1 −1 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/accelerometer.js
  86. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/camera.js
  87. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/compass.js
  88. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/contacts.js
  89. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/device.js
  90. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/map.js
  91. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/navigator.js
  92. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/network.js
  93. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/notification.js
  94. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/orientation.js
  95. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/service.js
  96. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/sms.js
  97. +171 −0 lib/ripple/platform/phonegap/1.0.0/spec.js
  98. +263 −0 lib/ripple/platform/phonegap/1.0.0/spec/config.js
  99. +51 −0 lib/ripple/platform/phonegap/1.0.0/spec/device.js
  100. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/spec/events.js
  101. +24 −0 lib/ripple/platform/phonegap/1.0.0/spec/ui.js
  102. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/system.js
  103. 0 lib/ripple/platform/phonegap/{1.0 → 1.0.0}/telephony.js
  104. +0 −171 lib/ripple/platform/phonegap/1.0/spec.js
  105. +7 −3 lib/ripple/platform/spec.js
  106. +0 −21 lib/ripple/platform/webworks.bb10/1.0.0/BrowserArguments.js
  107. +8 −1 lib/ripple/platform/webworks.bb10/1.0.0/app.js
  108. +5 −1 lib/ripple/platform/webworks.bb10/1.0.0/device.js
  109. +50 −2 lib/ripple/platform/webworks.bb10/1.0.0/event.js
  110. +27 −42 lib/ripple/platform/webworks.bb10/1.0.0/invoke.js
  111. +2 −11 lib/ripple/platform/webworks.bb10/1.0.0/spec.js
  112. +516 −0 lib/ripple/platform/webworks.bb10/1.0.0/spec/config.js
  113. +13 −0 lib/ripple/platform/webworks.bb10/1.0.0/spec/device.js
  114. +7 −2 lib/ripple/platform/webworks.bb10/1.0.0/spec/events.js
  115. +2 −1 lib/ripple/platform/webworks.bb10/1.0.0/spec/ui.js
  116. +8 −0 lib/ripple/platform/webworks.bb10/1.0.0/system.js
  117. +1 −1 lib/ripple/platform/webworks.core/2.0.0/select.js
  118. +3 −3 lib/ripple/platform/webworks.handset/2.0.0/client/Contact.js
  119. +2 −0 lib/ripple/platform/webworks.handset/2.0.0/server/appEvent.js
  120. +8 −0 lib/ripple/platform/webworks.tablet/2.0.0/server/appEvent.js
  121. +36 −3 lib/ripple/ui/plugins/build.js
  122. +3 −0 lib/ripple/ui/plugins/build/panel.html
  123. +32 −10 lib/ripple/ui/plugins/camera.js
  124. +14 −4 lib/ripple/ui/plugins/camera/overlay.html
  125. +4 −2 lib/ripple/ui/plugins/geoView.js
  126. +43 −0 lib/ripple/ui/plugins/invoke.js
  127. +71 −0 lib/ripple/ui/plugins/invoke/panel.html
  128. +13 −0 lib/ripple/utils.js
  129. +31 −0 lib/ripple/widgetConfig.js
  130. +3 −3 package.json
  131. +8 −7 test/integration/webworks.tablet/systemEvent.js
  132. +0 −1 test/unit/accelerometer.js
  133. +76 −0 test/unit/cordova/accelerometer.js
  134. +42 −0 test/unit/cordova/compass.js
  135. +426 −0 test/unit/cordova/media.js
  136. +15 −6 test/unit/emulatorBridge.js
  137. +5 −6 test/unit/fs.js
  138. +1 −1 test/unit/phonegap/accelerometer.js
  139. +1 −1 test/unit/phonegap/camera.js
  140. +1 −1 test/unit/phonegap/compass.js
  141. +15 −15 test/unit/phonegap/contacts.js
  142. +1 −1 test/unit/phonegap/device.js
  143. +1 −1 test/unit/phonegap/events.js
  144. +1 −1 test/unit/phonegap/navigator.js
  145. +1 −1 test/unit/phonegap/network.js
  146. +1 −1 test/unit/phonegap/notification.js
  147. +5 −3 test/unit/platform.js
  148. +0 −1 test/unit/resizer.js
  149. +36 −0 test/unit/utils.js
  150. +9 −9 test/unit/webworks.bb10/event.js
  151. +6 −7 test/unit/webworks/fsCache.js
  152. +7 −0 test/unit/webworks/select.js
  153. +1 −1 test/unit/widgetConfig.js
View
@@ -11,3 +11,4 @@ tags
www/*
build_output/
pkg
+plugins
View
@@ -64,7 +64,8 @@
"sinon",
"setInterval", "clearInterval", "setTimeout", "clearTimeout",
"require", "Contact", "Position", "Coordinates", "Node",
- "OpenLayers"
+ "OpenLayers",
+ "cordova"
],
"node" : true,
View
@@ -22,10 +22,29 @@ task('build', [], require('./build/build'));
desc("test and lint before building (with js compression)");
task('deploy', [], require('./build/deploy'));
+// TODO: put this functionality into its own module (same with code in build/deploy).
desc("run all tests in node with an emulated dom - jake test [path,path2]");
task('test', [], function () {
- require('./build/test')(null, process.argv.length >= 4 ? process.argv[3] : null);
-});
+ var childProcess = require('child_process'),
+ env = process.env,
+ lib = process.cwd() + '/lib',
+ script = process.cwd() + '/build/scripts/runTestsInNode',
+ child;
+
+ env.NODE_PATH = lib;
+ child = childProcess.spawn(process.execPath, [script], {'env': env});
+
+ function log(data) {
+ process.stdout.write(new Buffer(data).toString('utf-8'));
+ }
+
+ child.stdout.on('data', log);
+ child.stderr.on('data', log);
+ child.on('exit', function (code) {
+ complete();
+ process.exit(code);
+ });
+}, true);
desc("boot test server for running all tests in the browser");
task('btest', [], require('./build/btest'));
View
@@ -35,6 +35,17 @@ To test ripple as an extension in chrome/chromium just load the chromium folder
This will describe all the available commands for building and running the tests
+## Running as a Chrome Extension
+
+- go to the extension management page (chrome://chrome/extensions/) in chrome.
+- Ensure that you have selected the developer mode checkbox
+- click the Load Unpacked extension button
+- select the chromestore folders in the pkg/ folder.
+
+NOTE: for development you should be fine to just build with jake and refresh your browser. If
+you end up editing anything in the ext folder you will need to refresh the extension from
+the extension management page.
+
## Running Inside Other Web Browsers
Ripple is (by-design) browser agnostic, and is able to run inside any web browser (with disabled web security).
@@ -45,6 +56,8 @@ To get it running inside Chrome you should start it with these [command line](ht
--disable-web-security
--user-data-dir=/path/to/dummy/profile
+This has only really be tested in chrome.
+
## Code Guidelines
* 4 spaces per editor tab
View
@@ -24,27 +24,21 @@ module.exports = function () {
doc,
modules,
specs,
- openlayers,
- app = connect(
- connect.static(__dirname + "/../lib/"),
- connect.static(__dirname + "/../"),
- connect.router(function (app) {
- app.get('/', function (req, res) {
- res.writeHead(200, {
- "Cache-Control": "no-cache",
- "Content-Type": "text/html"
- });
- res.end(doc);
+ app = connect()
+ .use(connect.static(__dirname + "/../lib/"))
+ .use(connect.static(__dirname + "/../"))
+ .use('/', function (req, res) {
+ res.writeHead(200, {
+ "Cache-Control": "max-age=0",
+ "Content-Type": "text/html"
});
- })
- );
+ res.end(doc);
+ });
- //HACK: Openlayers causes weird stuff with the browser runner, so lets pop it off the list until we fix it
- openlayers = conf.thirdpartyIncludes.pop();
- if (openlayers !== "OpenLayers.js") {
- //HACK: just a safe check to make sure our hack is still valid
- console.log("HACK: we wanted to pop OpenLayers off but it looks like it wasn't the last one anymore");
- }
+ //HACK: Openlayers causes weird stuff with the browser runner, so lets remove it from the list until we fix it
+ conf.thirdpartyIncludes = conf.thirdpartyIncludes.filter(function (filename) {
+ return !filename.match(/openlayers\.js/i);
+ });
modules = pack();
@@ -24,7 +24,8 @@ module.exports = function (src, baton) {
'cp -r ' + _c.ASSETS + "images " + _c.DEPLOY + "chromestore/ &&" +
'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromestore/ &&" +
'cp ' + _c.EXT + "chromestore/manifest.json " + _c.DEPLOY + "chromestore/manifest.json &&" +
- 'cp ' + _c.EXT + "chromestore/controllers/Background.js " + _c.DEPLOY + "chromestore/controllers/Background.js";
+ 'cp ' + _c.EXT + "chromestore/controllers/Background.js " + _c.DEPLOY + "chromestore/controllers/Background.js" +
+ 'cp ' + _c.EXT + "chromestore/views/background.html " + _c.DEPLOY + "chromestore/views/background.html";
childProcess.exec(copy, function () {
var css = _c.ASSETS + "ripple.css",
View
@@ -22,7 +22,8 @@ module.exports = function (src, baton) {
var copy = 'cp -r ' + _c.EXT + "chromium " + _c.DEPLOY + " && " +
'cp -r ' + _c.ASSETS + "images " + _c.DEPLOY + "chromium/ &&" +
- 'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromium/";
+ 'cp -r ' + _c.ASSETS + "themes " + _c.DEPLOY + "chromium/" +
+ 'cp -r ' + _c.ROOT + "plugins " + _c.DEPLOY + "chromium/";
childProcess.exec(copy, function () {
var css = _c.ASSETS + "ripple.css",
View
@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-var test = require('./test'),
- lint = require('./lint'),
+var lint = require('./lint'),
build = require('./build'),
+ childProcess = require('child_process'),
fs = require('fs'),
fail = fs.readFileSync(__dirname + "/../thirdparty/fail.txt", "utf-8");
@@ -26,6 +26,26 @@ function ok(code) {
}
}
+function test(callback) {
+ var env = process.env,
+ lib = process.cwd() + '/lib',
+ script = process.cwd() + '/build/scripts/runTestsInNode',
+ child;
+
+ env.NODE_PATH = lib;
+ child = childProcess.spawn(process.execPath, [script], {'env': env});
+
+ function log(data) {
+ process.stdout.write(new Buffer(data).toString('utf-8'));
+ }
+
+ child.stdout.on('data', log);
+ child.stderr.on('data', log);
+ child.on('exit', function (code) {
+ callback(code);
+ });
+}
+
module.exports = function () {
test(function (code) {
ok(code, "red tests");
View
@@ -38,7 +38,7 @@ function _lintJS(files, done) {
function _lintCSS(files, done) {
var rules = JSON.parse(fs.readFileSync(__dirname + "/../.csslintrc", "utf-8")),
- options = ["--rules=" + rules, "--format=compact"];
+ options = ["--errors=" + rules, "--format=compact", "--quiet"];
_spawn('csslint', files.concat(options), done);
}
@@ -0,0 +1,5 @@
+// This is here for a reason.
+// This is so you can do things like `NODE_PATH=/path/to/ripple/lib node external_script`.
+// This gets around that pesky forcing of relative requires in Node (these days).
+// See the `jakefile` for how this is used in this project.
+require('./../test')();
View
@@ -66,13 +66,11 @@ function _setupEnv(ready) {
_extraMocks();
- childProcess.exec('rm -rf node_modules/ripple* && ' +
- 'cp -rf lib/ripple node_modules/ripple && ' +
- 'cp -f lib/ripple.js node_modules/ripple.js', ready);
+ ready();
});
}
-module.exports = function (done, custom) {
+module.exports = function (done) {
//HACK: this should be taken out if our pull request in jasmine is accepted.
jasmine.core.Matchers.prototype.toThrow = function (expected) {
var result = false,
@@ -108,14 +106,11 @@ module.exports = function (done, custom) {
};
_setupEnv(function () {
- var targets = __dirname + "/../" + (custom ? custom : "test");
+ var targets = __dirname + "/../test";
jasmine.run(targets.split(' '), function (runner) {
var failed = runner.results().failedCount === 0 ? 0 : 1;
- //Nuke everything out of node_modules since it was just in there to run the tests
- childProcess.exec('rm -rf node_modules/ripple*', function () {
- (typeof done !== "function" ? process.exit : done)(failed);
- });
+ (typeof done !== "function" ? process.exit : done)(failed);
});
});
};
View
@@ -1,3 +1,26 @@
+## v0.9.7 - July 19, 2012
+
+* Fixed an issue with Ripple booting on Chrome 21 dev channel
+* Webworks BB10 support: (https://github.com/blackberry/Ripple-UI/issues?milestone=11&page=1&state=closed)
+ * blackberry.app.exit
+ * device settings for software version and hardware ID
+ * support for consumer and enterprise parameters
+ * support for the swipe down event
+ * support for invoke
+* Fixed a caching issue.
+* Cleaned up browser test failures
+* updated build tooling to work in latest node
+* updated README docs for running as a plugin
+* added support for selecting the platform and version when launching from the querystring
+* Updated Cordova support for 2.0.0 (https://github.com/blackberry/Ripple-UI/issues?milestone=13&page=1&state=closed)
+ * updated the version numbers for phonegap and cordova
+ * navigator camera
+ * Media
+ * File API
+ * cordova specific event support
+ * updated and fixed support for navigator.contacts
+ * added partial support for navigator.device.capture
+
## v0.9.6.1 (HOTFIX) - June 21, 2012
* Fixed bug with Chrome Version 21.0.1180.0 dev where Ripple will not boot
View
@@ -16,6 +16,7 @@
<!DOCTYPE html>
<html manifest="cache.manifest">
<head>
+ <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
<link href="#URL_PREFIX#ripple.css" type="text/css" rel="stylesheet" />
</head>
<body>
@@ -173,7 +173,7 @@ tinyHippos.Background = (function () {
chrome.tabs.getSelected(null, function (tab) {
console.log("enable ==> " + tab.url);
_persistEnabled(tab.url);
- chrome.tabs.sendRequest(tab.id, {"action": "enable", "mode": "widget", "tabURL": tab.url }, function (response) {});
+ chrome.tabs.sendRequest(tab.id, {"action": "enable", "mode": "widget", "tabURL": tab.url });
});
},
@@ -194,7 +194,7 @@ tinyHippos.Background = (function () {
localStorage["tinyhippos-enabled-uri"] = JSON.stringify(jsonObject);
- chrome.tabs.sendRequest(tab.id, {"action": "disable", "tabURL": tab.url }, function (response) {});
+ chrome.tabs.sendRequest(tab.id, {"action": "disable", "tabURL": tab.url });
});
},
@@ -0,0 +1,23 @@
+<!--
+ * Copyright 2011 Research In Motion Limited.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+-->
+<html>
+ <head>
+ <script type="text/javascript" src="../controllers/jquery.js"></script>
+ <script type="text/javascript" src="../controllers/Background.js"></script>
+ </head>
+ <body>
+ </body>
+</html>
@@ -56,6 +56,8 @@ tinyHippos.Background = (function () {
xhr.send();
chrome.extension.onRequest.addListener(function (request, sender, sendResponse) {
+ var xhr, postData, data, plugin;
+console.log(request);
switch (request.action) {
case "isEnabled":
console.log("isEnabled? ==> " + request.tabURL);
@@ -67,16 +69,16 @@ tinyHippos.Background = (function () {
sendResponse();
break;
case "userAgent":
- console.log("user agent ==> " + userAgent);
+ console.log("user agent ==> " + request.data);
userAgent = request.data;
break;
case "version":
sendResponse(version);
break;
case "xhr":
- var xhr = new XMLHttpRequest(),
- postData = new FormData(),
- data = JSON.parse(request.data);
+ xhr = new XMLHttpRequest();
+ postData = new FormData();
+ data = JSON.parse(request.data);
console.log("xhr ==> " + data.url);
@@ -99,8 +101,32 @@ tinyHippos.Background = (function () {
}
});
break;
+ case "services":
+ console.log("services", request.data);
+ if (request.data === '"start"') {
+ plugin = document.getElementById("pluginRippleBD");
+ if (plugin) {
+ console.log("return from startBD", plugin.startBD(9910));
+ sendResponse();
+ }
+ }
+ else if (request.data === '"stop"') {
+ xhr = new XMLHTTPRequest();
+ try {
+ xhr.open("GET", "http://127.0.0.1:9910/ripple/shutdown", false);
+ xhr.send();
+ }
+ catch (e) {
+ console.log(e);
+ }
+ }
+ break;
+ case "lag":
+ case "network":
+ // methods to be implemented at a later date
+ break;
default:
- throw {name: "MethodNotImplemented", message: "Requested action is not supported!"};
+ throw {name: "MethodNotImplemented", message: "Requested action is not supported! "};
break;
};
});
@@ -186,7 +212,7 @@ tinyHippos.Background = (function () {
chrome.tabs.getSelected(null, function (tab) {
console.log("enable ==> " + tab.url);
_persistEnabled(tab.url);
- chrome.tabs.sendRequest(tab.id, {"action": "enable", "mode": "widget", "tabURL": tab.url }, function (response) {});
+ chrome.tabs.sendRequest(tab.id, {"action": "enable", "mode": "widget", "tabURL": tab.url});
});
},
@@ -207,12 +233,12 @@ tinyHippos.Background = (function () {
localStorage["tinyhippos-enabled-uri"] = JSON.stringify(jsonObject);
- chrome.tabs.sendRequest(tab.id, {"action": "disable", "tabURL": tab.url }, function (response) {});
+ chrome.tabs.sendRequest(tab.id, {"action": "disable", "tabURL": tab.url });
});
},
isEnabled: function (url, enabledURIs) {
- if (url.match(/enableripple=true/i)) {
+ if (url.match(/enableripple=/i)) {
_persistEnabled(url);
return true;
}
Oops, something went wrong.

0 comments on commit 0476727

Please sign in to comment.