You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by st...@apache.org on 2013/09/12 01:30:42 UTC

[1/8] js commit: [android] Don't catch exceptions wihtin the bridge since the browser does better logging of them when uncaught.

Updated Branches:
  refs/heads/ffos 3be32a335 -> 062730881


[android] Don't catch exceptions wihtin the bridge since the browser does better logging of them when uncaught.


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/8937f29e
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/8937f29e
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/8937f29e

Branch: refs/heads/ffos
Commit: 8937f29ee8aa58568db94865860c86615acf23ca
Parents: 7d5f6f6
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri Aug 30 16:12:50 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri Aug 30 16:12:50 2013 -0400

----------------------------------------------------------------------
 lib/android/exec.js | 89 +++++++++++++++++++++++-------------------------
 1 file changed, 43 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/8937f29e/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index 0d35ff1..a68608f 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -169,50 +169,44 @@ androidExec.setNativeToJsBridgeMode = function(mode) {
 
 // Processes a single message, as encoded by NativeToJsMessageQueue.java.
 function processMessage(message) {
-    try {
-        var firstChar = message.charAt(0);
-        if (firstChar == 'J') {
-            eval(message.slice(1));
-        } else if (firstChar == 'S' || firstChar == 'F') {
-            var success = firstChar == 'S';
-            var keepCallback = message.charAt(1) == '1';
-            var spaceIdx = message.indexOf(' ', 2);
-            var status = +message.slice(2, spaceIdx);
-            var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
-            var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx);
-            var payloadKind = message.charAt(nextSpaceIdx + 1);
-            var payload;
-            if (payloadKind == 's') {
-                payload = message.slice(nextSpaceIdx + 2);
-            } else if (payloadKind == 't') {
-                payload = true;
-            } else if (payloadKind == 'f') {
-                payload = false;
-            } else if (payloadKind == 'N') {
-                payload = null;
-            } else if (payloadKind == 'n') {
-                payload = +message.slice(nextSpaceIdx + 2);
-            } else if (payloadKind == 'A') {
-                var data = message.slice(nextSpaceIdx + 2);
-                var bytes = window.atob(data);
-                var arraybuffer = new Uint8Array(bytes.length);
-                for (var i = 0; i < bytes.length; i++) {
-                    arraybuffer[i] = bytes.charCodeAt(i);
-                }
-                payload = arraybuffer.buffer;
-            } else if (payloadKind == 'S') {
-                payload = window.atob(message.slice(nextSpaceIdx + 2));
-            } else {
-                payload = JSON.parse(message.slice(nextSpaceIdx + 1));
+    var firstChar = message.charAt(0);
+    if (firstChar == 'J') {
+        eval(message.slice(1));
+    } else if (firstChar == 'S' || firstChar == 'F') {
+        var success = firstChar == 'S';
+        var keepCallback = message.charAt(1) == '1';
+        var spaceIdx = message.indexOf(' ', 2);
+        var status = +message.slice(2, spaceIdx);
+        var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
+        var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx);
+        var payloadKind = message.charAt(nextSpaceIdx + 1);
+        var payload;
+        if (payloadKind == 's') {
+            payload = message.slice(nextSpaceIdx + 2);
+        } else if (payloadKind == 't') {
+            payload = true;
+        } else if (payloadKind == 'f') {
+            payload = false;
+        } else if (payloadKind == 'N') {
+            payload = null;
+        } else if (payloadKind == 'n') {
+            payload = +message.slice(nextSpaceIdx + 2);
+        } else if (payloadKind == 'A') {
+            var data = message.slice(nextSpaceIdx + 2);
+            var bytes = window.atob(data);
+            var arraybuffer = new Uint8Array(bytes.length);
+            for (var i = 0; i < bytes.length; i++) {
+                arraybuffer[i] = bytes.charCodeAt(i);
             }
-            cordova.callbackFromNative(callbackId, success, status, [payload], keepCallback);
+            payload = arraybuffer.buffer;
+        } else if (payloadKind == 'S') {
+            payload = window.atob(message.slice(nextSpaceIdx + 2));
         } else {
-            console.log("processMessage failed: invalid message:" + message);
+            payload = JSON.parse(message.slice(nextSpaceIdx + 1));
         }
-    } catch (e) {
-        console.log("processMessage failed: Message: " + message);
-        console.log("processMessage failed: Error: " + e);
-        console.log("processMessage failed: Stack: " + e.stack);
+        cordova.callbackFromNative(callbackId, success, status, [payload], keepCallback);
+    } else {
+        console.log("processMessage failed: invalid message:" + message);
     }
 }
 
@@ -239,11 +233,14 @@ androidExec.processMessages = function(messages) {
             var msgLen = +messages.slice(0, spaceIdx);
             var message = messages.substr(spaceIdx + 1, msgLen);
             messages = messages.slice(spaceIdx + msgLen + 1);
-            processMessage(message);
-            if (messages) {
-                messagesFromNative[0] = messages;
-            } else {
-                messagesFromNative.shift();
+            try {
+                processMessage(message);
+            } finally {
+                if (messages) {
+                    messagesFromNative[0] = messages;
+                } else {
+                    messagesFromNative.shift();
+                }
             }
         }
     }


[7/8] js commit: override init.js in the firefoxos platform for navigator fix, other bugfixes

Posted by st...@apache.org.
override init.js in the firefoxos platform for navigator fix, other bugfixes


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/d6603c93
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/d6603c93
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/d6603c93

Branch: refs/heads/ffos
Commit: d6603c93aa913eb79366e063e84e03142802f84b
Parents: 6866193
Author: James Long <lo...@gmail.com>
Authored: Wed Aug 21 15:19:08 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:24 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/exec.js     |   3 +
 lib/firefoxos/init.js     | 142 +++++++++++++++++++++++++++++++++++++++++
 lib/firefoxos/platform.js |  12 +---
 3 files changed, 146 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
new file mode 100644
index 0000000..ab3311b
--- /dev/null
+++ b/lib/firefoxos/exec.js
@@ -0,0 +1,3 @@
+module.exports = function() {
+    console.log('exec not implemented yet');
+}

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/init.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/init.js b/lib/firefoxos/init.js
new file mode 100644
index 0000000..b25d4af
--- /dev/null
+++ b/lib/firefoxos/init.js
@@ -0,0 +1,142 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+/*
+ * This file has been copied into the firefoxos platform and patched
+ * to fix a problem with replacing the navigator object. We will have
+ * to keep this file up-to-date with the common init.js.
+ */
+
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
+var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
+
+var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
+
+function logUnfiredChannels(arr) {
+    for (var i = 0; i < arr.length; ++i) {
+        if (arr[i].state != 2) {
+            console.log('Channel not fired: ' + arr[i].type);
+        }
+    }
+}
+
+window.setTimeout(function() {
+    if (channel.onDeviceReady.state != 2) {
+        console.log('deviceready has not fired after 5 seconds.');
+        logUnfiredChannels(platformInitChannelsArray);
+        logUnfiredChannels(channel.deviceReadyChannelsArray);
+    }
+}, 5000);
+
+// Replace navigator before any modules are required(), to ensure it happens as soon as possible.
+// We replace it so that properties that can't be clobbered can instead be overridden.
+function replaceNavigator(origNavigator) {
+    var CordovaNavigator = function() {};
+    CordovaNavigator.prototype = origNavigator;
+    var newNavigator = new CordovaNavigator();
+    // This work-around really only applies to new APIs that are newer than Function.bind.
+    // Without it, APIs such as getGamepads() break.
+    if (CordovaNavigator.bind) {
+        for (var key in origNavigator) {
+            try {
+                if (typeof origNavigator[key] == 'function') {
+                    newNavigator[key] = origNavigator[key].bind(origNavigator);
+                }
+            } catch(e) {
+                // This try/catch was added for Firefox OS 1.0 and 1.1
+                // because it throws an security exception when trying
+                // to access a few properties of the navigator object.
+                // It has been fixed in 1.2.
+            }
+        }
+    }
+    return newNavigator;
+}
+if (window.navigator) {
+    window.navigator = replaceNavigator(window.navigator);
+}
+
+if (!window.console) {
+    window.console = {
+        log: function(){}
+    };
+}
+if (!window.console.warn) {
+    window.console.warn = function(msg) {
+        this.log("warn: " + msg);
+    };
+}
+
+// Register pause, resume and deviceready channels as events on document.
+channel.onPause = cordova.addDocumentEventHandler('pause');
+channel.onResume = cordova.addDocumentEventHandler('resume');
+channel.onDeviceReady = cordova.addStickyDocumentEventHandler('deviceready');
+
+// Listen for DOMContentLoaded and notify our channel subscribers.
+if (document.readyState == 'complete' || document.readyState == 'interactive') {
+    channel.onDOMContentLoaded.fire();
+} else {
+    document.addEventListener('DOMContentLoaded', function() {
+        channel.onDOMContentLoaded.fire();
+    }, false);
+}
+
+// _nativeReady is global variable that the native side can set
+// to signify that the native code is ready. It is a global since
+// it may be called before any cordova JS is ready.
+if (window._nativeReady) {
+    channel.onNativeReady.fire();
+}
+
+modulemapper.clobbers('cordova', 'cordova');
+modulemapper.clobbers('cordova/exec', 'cordova.exec');
+modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+
+// Call the platform-specific initialization.
+platform.bootstrap && platform.bootstrap();
+
+pluginloader.load(function() {
+    channel.onPluginsReady.fire();
+});
+
+/**
+ * Create all cordova objects once native side is ready.
+ */
+channel.join(function() {
+    modulemapper.mapModules(window);
+
+    platform.initialize && platform.initialize();
+
+    // Fire event to notify that all objects are created
+    channel.onCordovaReady.fire();
+
+    // Fire onDeviceReady event once page has fully loaded, all
+    // constructors have run and cordova info has been received from native
+    // side.
+    channel.join(function() {
+        require('cordova').fireDocumentEvent('deviceready');
+    }, channel.deviceReadyChannelsArray);
+
+}, platformInitChannelsArray);
+

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/d6603c93/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index a9829c6..4903014 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -22,16 +22,6 @@
 module.exports = {
     id: 'firefoxos',
     bootstrap: function() {
-        var channel = require('cordova/channel'),
-            cordova = require('cordova'),
-            exec = require('cordova/exec'),
-            modulemapper = require('cordova/modulemapper');
-
-        // Tell the JS that the native side is ready.
-        channel.onNativeReady.fire();
-
-        // TODO: Extract this as a proper plugin.
-        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
-
+        require('cordova/channel').onNativeReady.fire();
     }
 };


[8/8] js commit: fixed merge issues

Posted by st...@apache.org.
fixed merge issues


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/06273088
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/06273088
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/06273088

Branch: refs/heads/ffos
Commit: 06273088134dcad7058e7382c3482f904d38ac63
Parents: d6603c9 0bc7da8
Author: Steven Gill <st...@gmail.com>
Authored: Wed Sep 11 16:30:31 2013 -0700
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 16:30:31 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/exec.js     | 32 +++++++++++++++++++++++++++++---
 lib/firefoxos/platform.js | 13 +++++++++++++
 2 files changed, 42 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/06273088/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --cc lib/firefoxos/exec.js
index ab3311b,d9d958a..a41d5df
--- a/lib/firefoxos/exec.js
+++ b/lib/firefoxos/exec.js
@@@ -1,3 -1,8 +1,29 @@@
- module.exports = function() {
-     console.log('exec not implemented yet');
- }
++/*
++ *
++ * Licensed to the Apache Software Foundation (ASF) under one
++ * or more contributor license agreements.  See the NOTICE file
++ * distributed with this work for additional information
++ * regarding copyright ownership.  The ASF licenses this file
++ * to you 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.
++ *
++*/
++
+ var firefoxos = require('cordova/platform');
+ 
+ module.exports = function(success, fail, service, action, actionArgs) {
+     var plugin = firefoxos.getPlugin(service);
+     actionArgs.unshift(fail);
+     actionArgs.unshift(success);
+     plugin[action].apply(plugin, actionArgs);
+ };


[3/8] js commit: [all] [CB-4725] Export cordova version as "cordova.version"

Posted by st...@apache.org.
[all] [CB-4725] Export cordova version as "cordova.version"


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/e2942e16
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/e2942e16
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/e2942e16

Branch: refs/heads/ffos
Commit: e2942e162e1db06446d44d0b814ba450eb22a028
Parents: 0ab1d2b
Author: Andrew Grieve <ag...@chromium.org>
Authored: Tue Sep 3 09:42:54 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Tue Sep 3 09:43:13 2013 -0400

----------------------------------------------------------------------
 lib/cordova.js | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/e2942e16/lib/cordova.js
----------------------------------------------------------------------
diff --git a/lib/cordova.js b/lib/cordova.js
index 77a1d23..d2c2294 100644
--- a/lib/cordova.js
+++ b/lib/cordova.js
@@ -92,6 +92,7 @@ function createEvent(type, data) {
 var cordova = {
     define:define,
     require:require,
+    version:CORDOVA_JS_BUILD_LABEL,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.
      */


[2/8] js commit: Revert "[android] Don't catch exceptions wihtin the bridge since the browser does better logging of them when uncaught."

Posted by st...@apache.org.
Revert "[android] Don't catch exceptions wihtin the bridge since the browser does better logging of them when uncaught."

This reverts commit 8937f29ee8aa58568db94865860c86615acf23ca.

I checked it in too hastily. It doesn't actually work as I wanted. Needs
more thinking...


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0ab1d2bd
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0ab1d2bd
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0ab1d2bd

Branch: refs/heads/ffos
Commit: 0ab1d2bd2e44e0e42bcb12c3fbd8f461eb7e84f4
Parents: 8937f29
Author: Andrew Grieve <ag...@chromium.org>
Authored: Sat Aug 31 14:44:06 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Sat Aug 31 14:44:06 2013 -0400

----------------------------------------------------------------------
 lib/android/exec.js | 89 +++++++++++++++++++++++++-----------------------
 1 file changed, 46 insertions(+), 43 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0ab1d2bd/lib/android/exec.js
----------------------------------------------------------------------
diff --git a/lib/android/exec.js b/lib/android/exec.js
index a68608f..0d35ff1 100644
--- a/lib/android/exec.js
+++ b/lib/android/exec.js
@@ -169,44 +169,50 @@ androidExec.setNativeToJsBridgeMode = function(mode) {
 
 // Processes a single message, as encoded by NativeToJsMessageQueue.java.
 function processMessage(message) {
-    var firstChar = message.charAt(0);
-    if (firstChar == 'J') {
-        eval(message.slice(1));
-    } else if (firstChar == 'S' || firstChar == 'F') {
-        var success = firstChar == 'S';
-        var keepCallback = message.charAt(1) == '1';
-        var spaceIdx = message.indexOf(' ', 2);
-        var status = +message.slice(2, spaceIdx);
-        var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
-        var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx);
-        var payloadKind = message.charAt(nextSpaceIdx + 1);
-        var payload;
-        if (payloadKind == 's') {
-            payload = message.slice(nextSpaceIdx + 2);
-        } else if (payloadKind == 't') {
-            payload = true;
-        } else if (payloadKind == 'f') {
-            payload = false;
-        } else if (payloadKind == 'N') {
-            payload = null;
-        } else if (payloadKind == 'n') {
-            payload = +message.slice(nextSpaceIdx + 2);
-        } else if (payloadKind == 'A') {
-            var data = message.slice(nextSpaceIdx + 2);
-            var bytes = window.atob(data);
-            var arraybuffer = new Uint8Array(bytes.length);
-            for (var i = 0; i < bytes.length; i++) {
-                arraybuffer[i] = bytes.charCodeAt(i);
+    try {
+        var firstChar = message.charAt(0);
+        if (firstChar == 'J') {
+            eval(message.slice(1));
+        } else if (firstChar == 'S' || firstChar == 'F') {
+            var success = firstChar == 'S';
+            var keepCallback = message.charAt(1) == '1';
+            var spaceIdx = message.indexOf(' ', 2);
+            var status = +message.slice(2, spaceIdx);
+            var nextSpaceIdx = message.indexOf(' ', spaceIdx + 1);
+            var callbackId = message.slice(spaceIdx + 1, nextSpaceIdx);
+            var payloadKind = message.charAt(nextSpaceIdx + 1);
+            var payload;
+            if (payloadKind == 's') {
+                payload = message.slice(nextSpaceIdx + 2);
+            } else if (payloadKind == 't') {
+                payload = true;
+            } else if (payloadKind == 'f') {
+                payload = false;
+            } else if (payloadKind == 'N') {
+                payload = null;
+            } else if (payloadKind == 'n') {
+                payload = +message.slice(nextSpaceIdx + 2);
+            } else if (payloadKind == 'A') {
+                var data = message.slice(nextSpaceIdx + 2);
+                var bytes = window.atob(data);
+                var arraybuffer = new Uint8Array(bytes.length);
+                for (var i = 0; i < bytes.length; i++) {
+                    arraybuffer[i] = bytes.charCodeAt(i);
+                }
+                payload = arraybuffer.buffer;
+            } else if (payloadKind == 'S') {
+                payload = window.atob(message.slice(nextSpaceIdx + 2));
+            } else {
+                payload = JSON.parse(message.slice(nextSpaceIdx + 1));
             }
-            payload = arraybuffer.buffer;
-        } else if (payloadKind == 'S') {
-            payload = window.atob(message.slice(nextSpaceIdx + 2));
+            cordova.callbackFromNative(callbackId, success, status, [payload], keepCallback);
         } else {
-            payload = JSON.parse(message.slice(nextSpaceIdx + 1));
+            console.log("processMessage failed: invalid message:" + message);
         }
-        cordova.callbackFromNative(callbackId, success, status, [payload], keepCallback);
-    } else {
-        console.log("processMessage failed: invalid message:" + message);
+    } catch (e) {
+        console.log("processMessage failed: Message: " + message);
+        console.log("processMessage failed: Error: " + e);
+        console.log("processMessage failed: Stack: " + e.stack);
     }
 }
 
@@ -233,14 +239,11 @@ androidExec.processMessages = function(messages) {
             var msgLen = +messages.slice(0, spaceIdx);
             var message = messages.substr(spaceIdx + 1, msgLen);
             messages = messages.slice(spaceIdx + msgLen + 1);
-            try {
-                processMessage(message);
-            } finally {
-                if (messages) {
-                    messagesFromNative[0] = messages;
-                } else {
-                    messagesFromNative.shift();
-                }
+            processMessage(message);
+            if (messages) {
+                messagesFromNative[0] = messages;
+            } else {
+                messagesFromNative.shift();
             }
         }
     }


[4/8] js commit: implement exec for firefoxos

Posted by st...@apache.org.
implement exec for firefoxos


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/0bc7da8b
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/0bc7da8b
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/0bc7da8b

Branch: refs/heads/ffos
Commit: 0bc7da8b13db556e851362443bf41122bad8c9dc
Parents: 3be32a3
Author: James Long <lo...@gmail.com>
Authored: Wed Sep 11 16:34:38 2013 -0400
Committer: James Long <lo...@gmail.com>
Committed: Wed Sep 11 16:34:50 2013 -0400

----------------------------------------------------------------------
 lib/firefoxos/exec.js     | 11 ++++++++---
 lib/firefoxos/platform.js | 13 +++++++++++++
 2 files changed, 21 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/exec.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/exec.js b/lib/firefoxos/exec.js
index ab3311b..d9d958a 100644
--- a/lib/firefoxos/exec.js
+++ b/lib/firefoxos/exec.js
@@ -1,3 +1,8 @@
-module.exports = function() {
-    console.log('exec not implemented yet');
-}
+var firefoxos = require('cordova/platform');
+
+module.exports = function(success, fail, service, action, actionArgs) {
+    var plugin = firefoxos.getPlugin(service);
+    actionArgs.unshift(fail);
+    actionArgs.unshift(success);
+    plugin[action].apply(plugin, actionArgs);
+};

http://git-wip-us.apache.org/repos/asf/cordova-js/blob/0bc7da8b/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
index 4903014..b7158d8 100644
--- a/lib/firefoxos/platform.js
+++ b/lib/firefoxos/platform.js
@@ -19,9 +19,22 @@
  *
 */
 
+var plugins = {};
+
 module.exports = {
     id: 'firefoxos',
+    cordovaVersion: '3.0.0',
+
     bootstrap: function() {
         require('cordova/channel').onNativeReady.fire();
+    },
+
+    registerPlugin: function(name, plugin) {
+        plugins[name] = plugin;
+        console.log('registered ' + name);
+    },
+
+    getPlugin: function(name) {
+        return plugins[name];
     }
 };


[6/8] js commit: add firefoxos to gruntfile

Posted by st...@apache.org.
add firefoxos to gruntfile


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/6866193d
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/6866193d
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/6866193d

Branch: refs/heads/ffos
Commit: 6866193d2a0947c3dd35a55e11b5ec69f8e225cc
Parents: 01119a9
Author: James Long <lo...@gmail.com>
Authored: Fri Aug 16 13:19:33 2013 -0400
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:23 2013 -0700

----------------------------------------------------------------------
 Gruntfile.js | 1 +
 1 file changed, 1 insertion(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/6866193d/Gruntfile.js
----------------------------------------------------------------------
diff --git a/Gruntfile.js b/Gruntfile.js
index 94da640..9afeded 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -32,6 +32,7 @@ module.exports = function(grunt) {
           "test": {},
           "windows8": { useWindowsLineEndings: true },
           "windowsphone": { useWindowsLineEndings: true },
+          "firefoxos": {}
         },
         clean: ['pkg'],
         jshint: {


[5/8] js commit: platform.js

Posted by st...@apache.org.
platform.js


Project: http://git-wip-us.apache.org/repos/asf/cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-js/commit/01119a9a
Tree: http://git-wip-us.apache.org/repos/asf/cordova-js/tree/01119a9a
Diff: http://git-wip-us.apache.org/repos/asf/cordova-js/diff/01119a9a

Branch: refs/heads/ffos
Commit: 01119a9a2b60d83c9cbda4bfb450f313dcfc73b3
Parents: e2942e1
Author: Piotr Zalewa <pi...@zalewa.info>
Authored: Fri Aug 16 19:08:12 2013 +0200
Committer: Steven Gill <st...@gmail.com>
Committed: Wed Sep 11 15:47:23 2013 -0700

----------------------------------------------------------------------
 lib/firefoxos/platform.js | 37 +++++++++++++++++++++++++++++++++++++
 1 file changed, 37 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-js/blob/01119a9a/lib/firefoxos/platform.js
----------------------------------------------------------------------
diff --git a/lib/firefoxos/platform.js b/lib/firefoxos/platform.js
new file mode 100644
index 0000000..a9829c6
--- /dev/null
+++ b/lib/firefoxos/platform.js
@@ -0,0 +1,37 @@
+/*
+ *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *
+*/
+
+module.exports = {
+    id: 'firefoxos',
+    bootstrap: function() {
+        var channel = require('cordova/channel'),
+            cordova = require('cordova'),
+            exec = require('cordova/exec'),
+            modulemapper = require('cordova/modulemapper');
+
+        // Tell the JS that the native side is ready.
+        channel.onNativeReady.fire();
+
+        // TODO: Extract this as a proper plugin.
+        // modulemapper.clobbers('cordova/plugin/firefoxos/app', 'navigator.app');
+
+    }
+};