You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by lo...@apache.org on 2013/09/19 22:57:54 UTC

webworks commit: updating version and js to 3.1.0-rc1

Updated Branches:
  refs/heads/3.1.x [created] 6deeefb1f


updating version and js to 3.1.0-rc1


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

Branch: refs/heads/3.1.x
Commit: 6deeefb1f98bdc733fe5bf63cd4336ac4a17aefb
Parents: 7016c62
Author: lorinbeer <lo...@adobe.com>
Authored: Thu Sep 19 13:57:24 2013 -0700
Committer: lorinbeer <lo...@adobe.com>
Committed: Thu Sep 19 13:57:24 2013 -0700

----------------------------------------------------------------------
 blackberry10/VERSION                            |   2 +-
 blackberry10/javascript/cordova.blackberry10.js | 633 ++++++++-----------
 2 files changed, 274 insertions(+), 361 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/6deeefb1/blackberry10/VERSION
----------------------------------------------------------------------
diff --git a/blackberry10/VERSION b/blackberry10/VERSION
index 4a36342..7eb4a21 100644
--- a/blackberry10/VERSION
+++ b/blackberry10/VERSION
@@ -1 +1 @@
-3.0.0
+3.1.0-rc1

http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/6deeefb1/blackberry10/javascript/cordova.blackberry10.js
----------------------------------------------------------------------
diff --git a/blackberry10/javascript/cordova.blackberry10.js b/blackberry10/javascript/cordova.blackberry10.js
index da055c9..be5af0c 100644
--- a/blackberry10/javascript/cordova.blackberry10.js
+++ b/blackberry10/javascript/cordova.blackberry10.js
@@ -1,5 +1,5 @@
 // Platform: blackberry10
-// 3.0.0-0-ge670de9
+// 3.1.0-rc1
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,7 +19,7 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.0.0-0-ge670de9';
+var CORDOVA_JS_BUILD_LABEL = '3.1.0-rc1';
 // file: lib/scripts/require.js
 
 var require,
@@ -100,16 +100,7 @@ define("cordova", function(require, exports, module) {
 
 
 var channel = require('cordova/channel');
-
-/**
- * Listen for DOMContentLoaded and notify our channel subscribers.
- */
-document.addEventListener('DOMContentLoaded', function() {
-    channel.onDOMContentLoaded.fire();
-}, false);
-if (document.readyState == 'complete' || document.readyState == 'interactive') {
-    channel.onDOMContentLoaded.fire();
-}
+var platform = require('cordova/platform');
 
 /**
  * Intercept calls to addEventListener + removeEventListener and handle deviceready,
@@ -177,21 +168,12 @@ function createEvent(type, data) {
     return event;
 }
 
-if(typeof window.console === "undefined") {
-    window.console = {
-        log:function(){}
-    };
-}
-// there are places in the framework where we call `warn` also, so we should make sure it exists
-if(typeof window.console.warn === "undefined") {
-    window.console.warn = function(msg) {
-        this.log("warn: " + msg);
-    }
-}
 
 var cordova = {
     define:define,
     require:require,
+    version:CORDOVA_JS_BUILD_LABEL,
+    platformId:platform.id,
     /**
      * Methods to add/remove your own addEventListener hijacking on document + window.
      */
@@ -227,16 +209,16 @@ var cordova = {
         var evt = createEvent(type, data);
         if (typeof documentEventHandlers[type] != 'undefined') {
             if( bNoDetach ) {
-              documentEventHandlers[type].fire(evt);
+                documentEventHandlers[type].fire(evt);
             }
             else {
-              setTimeout(function() {
-                  // Fire deviceready on listeners that were registered before cordova.js was loaded.
-                  if (type == 'deviceready') {
-                      document.dispatchEvent(evt);
-                  }
-                  documentEventHandlers[type].fire(evt);
-              }, 0);
+                setTimeout(function() {
+                    // Fire deviceready on listeners that were registered before cordova.js was loaded.
+                    if (type == 'deviceready') {
+                        document.dispatchEvent(evt);
+                    }
+                    documentEventHandlers[type].fire(evt);
+                }, 0);
             }
         } else {
             document.dispatchEvent(evt);
@@ -326,10 +308,6 @@ var cordova = {
     }
 };
 
-// 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');
 
 module.exports = cordova;
 
@@ -353,7 +331,7 @@ var typeMap = {
 };
 
 function extractParamName(callee, argIndex) {
-  return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
+    return (/.*?\((.*?)\)/).exec(callee)[1].split(', ')[argIndex];
 }
 
 function checkArgs(spec, functionName, args, opt_callee) {
@@ -407,8 +385,8 @@ define("cordova/base64", function(require, exports, module) {
 var base64 = exports;
 
 base64.fromArrayBuffer = function(arrayBuffer) {
-  var array = new Uint8Array(arrayBuffer);
-  return uint8ToBase64(array);
+    var array = new Uint8Array(arrayBuffer);
+    return uint8ToBase64(array);
 };
 
 //------------------------------------------------------------------------------
@@ -430,7 +408,7 @@ var b64_12bitTable = function() {
     }
     b64_12bitTable = function() { return b64_12bit; };
     return b64_12bit;
-}
+};
 
 function uint8ToBase64(rawData) {
     var numBytes = rawData.byteLength;
@@ -497,36 +475,36 @@ function assignOrWrapInDeprecateGetter(obj, key, value, message) {
 function include(parent, objects, clobber, merge) {
     each(objects, function (obj, key) {
         try {
-          var result = obj.path ? require(obj.path) : {};
-
-          if (clobber) {
-              // Clobber if it doesn't exist.
-              if (typeof parent[key] === 'undefined') {
-                  assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
-              } else if (typeof obj.path !== 'undefined') {
-                  // If merging, merge properties onto parent, otherwise, clobber.
-                  if (merge) {
-                      recursiveMerge(parent[key], result);
-                  } else {
-                      assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
-                  }
-              }
-              result = parent[key];
-          } else {
-            // Overwrite if not currently defined.
-            if (typeof parent[key] == 'undefined') {
-              assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+            var result = obj.path ? require(obj.path) : {};
+
+            if (clobber) {
+                // Clobber if it doesn't exist.
+                if (typeof parent[key] === 'undefined') {
+                    assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+                } else if (typeof obj.path !== 'undefined') {
+                    // If merging, merge properties onto parent, otherwise, clobber.
+                    if (merge) {
+                        recursiveMerge(parent[key], result);
+                    } else {
+                        assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+                    }
+                }
+                result = parent[key];
             } else {
-              // Set result to what already exists, so we can build children into it if they exist.
-              result = parent[key];
+                // Overwrite if not currently defined.
+                if (typeof parent[key] == 'undefined') {
+                    assignOrWrapInDeprecateGetter(parent, key, result, obj.deprecated);
+                } else {
+                    // Set result to what already exists, so we can build children into it if they exist.
+                    result = parent[key];
+                }
             }
-          }
 
-          if (obj.children) {
-            include(result, obj.children, clobber, merge);
-          }
+            if (obj.children) {
+                include(result, obj.children, clobber, merge);
+            }
         } catch(e) {
-          utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
+            utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"');
         }
     });
 }
@@ -811,40 +789,124 @@ module.exports = channel;
 
 });
 
-// file: lib/common/commandProxy.js
-define("cordova/commandProxy", function(require, exports, module) {
+// file: lib/blackberry10/exec.js
+define("cordova/exec", function(require, exports, module) {
 
+module.exports = webworks.exec;
 
-// internal map of proxy function
-var CommandProxyMap = {};
+});
 
-module.exports = {
+// file: lib/common/init.js
+define("cordova/init", function(require, exports, module) {
 
-    // example: cordova.commandProxy.add("Accelerometer",{getCurrentAcceleration: function(successCallback, errorCallback, options) {...},...);
-    add:function(id,proxyObj) {
-        console.log("adding proxy for " + id);
-        CommandProxyMap[id] = proxyObj;
-        return proxyObj;
-    },
+var channel = require('cordova/channel');
+var cordova = require('cordova');
+var modulemapper = require('cordova/modulemapper');
+var platform = require('cordova/platform');
+var pluginloader = require('cordova/pluginloader');
 
-    // cordova.commandProxy.remove("Accelerometer");
-    remove:function(id) {
-        var proxy = CommandProxyMap[id];
-        delete CommandProxyMap[id];
-        CommandProxyMap[id] = null;
-        return proxy;
-    },
+var platformInitChannelsArray = [channel.onNativeReady, channel.onPluginsReady];
 
-    get:function(service,action) {
-        return ( CommandProxyMap[service] ? CommandProxyMap[service][action] : null );
+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) {
+            if (typeof origNavigator[key] == 'function') {
+                newNavigator[key] = origNavigator[key].bind(origNavigator);
+            }
+        }
+    }
+    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();
 });
 
-// file: lib/blackberry10/exec.js
-define("cordova/exec", function(require, exports, module) {
+/**
+ * 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);
 
-module.exports = webworks.exec;
 
 });
 
@@ -944,14 +1006,6 @@ exports.getOriginalSymbol = function(context, symbolPath) {
     return obj;
 };
 
-exports.loadMatchingModules = function(matchingRegExp) {
-    for (var k in moduleMap) {
-        if (matchingRegExp.exec(k)) {
-            require(k);
-        }
-    }
-};
-
 exports.reset();
 
 
@@ -962,14 +1016,13 @@ define("cordova/platform", function(require, exports, module) {
 
 module.exports = {
     id: "blackberry10",
-    initialize: function() {
-        var modulemapper = require('cordova/modulemapper'),
-            cordova = require('cordova'),
-            addDocumentEventListener = document.addEventListener;
-
-        modulemapper.loadMatchingModules(/cordova.*\/symbols$/);
-        modulemapper.loadMatchingModules(new RegExp('cordova/blackberry10/.*bbsymbols$'));
-        modulemapper.mapModules(window);
+    bootstrap: function() {
+        var cordova = require('cordova'),
+            channel = require('cordova/channel'),
+            addDocumentEventListener = document.addEventListener,
+            webworksReady = false,
+            alreadyFired = false,
+            listenerRegistered = false;
 
         //override to pass online/offline events to window
         document.addEventListener = function (type) {
@@ -977,55 +1030,115 @@ module.exports = {
                 window.addEventListener.apply(window, arguments);
             } else {
                 addDocumentEventListener.apply(document, arguments);
+                //Trapping when users add listeners to the webworks ready event
+                //This way we can make sure not to fire the event before there is a listener
+                if (event.toLowerCase() === 'webworksready') {
+                    listenerRegistered = true;
+                    fireWebworksReadyEvent();
+                }
             }
         };
-    }
-};
 
-});
+        channel.onPluginsReady.subscribe(function () {
+            webworksReady = true;
+            fireWebworksReadyEvent();
+        });
 
-// file: lib/common/plugin/echo.js
-define("cordova/plugin/echo", function(require, exports, module) {
+        //Only fire the webworks event when both webworks is ready and a listener is registered
+        function fireWebworksReadyEvent() {
+            var evt;
+            if (listenerRegistered && webworksReady && !alreadyFired) {
+                alreadyFired = true;
+                evt = document.createEvent('Events');
+                evt.initEvent('webworksready', true, true);
+                document.dispatchEvent(evt);
+                channel.onNativeReady.fire();
+            }
+        }
 
-var exec = require('cordova/exec'),
-    utils = require('cordova/utils');
+        function RemoteFunctionCall(functionUri) {
+            var params = {};
 
-/**
- * Sends the given message through exec() to the Echo plugin, which sends it back to the successCallback.
- * @param successCallback  invoked with a FileSystem object
- * @param errorCallback  invoked if error occurs retrieving file system
- * @param message  The string to be echoed.
- * @param forceAsync  Whether to force an async return value (for testing native->js bridge).
- */
-module.exports = function(successCallback, errorCallback, message, forceAsync) {
-    var action = 'echo';
-    var messageIsMultipart = (utils.typeName(message) == "Array");
-    var args = messageIsMultipart ? message : [message];
-
-    if (utils.typeName(message) == 'ArrayBuffer') {
-        if (forceAsync) {
-            console.warn('Cannot echo ArrayBuffer with forced async, falling back to sync.');
-        }
-        action += 'ArrayBuffer';
-    } else if (messageIsMultipart) {
-        if (forceAsync) {
-            console.warn('Cannot echo MultiPart Array with forced async, falling back to sync.');
+            function composeUri() {
+                return "http://localhost:8472/" + functionUri;
+            }
+
+            function createXhrRequest(uri, isAsync) {
+                var request = new XMLHttpRequest();
+                request.open("POST", uri, isAsync);
+                request.setRequestHeader("Content-Type", "application/json");
+                return request;
+            }
+
+            this.addParam = function (name, value) {
+                params[name] = encodeURIComponent(JSON.stringify(value));
+            };
+
+            this.makeSyncCall = function (success, error) {
+                var requestUri = composeUri(),
+                request = createXhrRequest(requestUri, false),
+                response,
+                errored,
+                cb,
+                data;
+
+                request.send(JSON.stringify(params));
+                response = JSON.parse(decodeURIComponent(request.responseText) || "null");
+                return response;
+            };
         }
-        action += 'MultiPart';
-    } else if (forceAsync) {
-        action += 'Async';
-    }
 
-    exec(successCallback, errorCallback, "Echo", action, args);
-};
+        window.webworks = {
+            exec: function (success, fail, service, action, args) {
+                var uri = service + "/" + action,
+                request = new RemoteFunctionCall(uri),
+                callbackId = service + cordova.callbackId++,
+                response,
+                name,
+                didSucceed;
+
+                for (name in args) {
+                    if (Object.hasOwnProperty.call(args, name)) {
+                        request.addParam(name, args[name]);
+                    }
+                }
+
+                cordova.callbacks[callbackId] = {success:success, fail:fail};
+                request.addParam("callbackId", callbackId);
+
+                response = request.makeSyncCall();
 
+                //Old WebWorks Extension success
+                if (response.code === 42) {
+                    if (success) {
+                        success(response.data, response);
+                    }
+                    delete cordova.callbacks[callbackId];
+                } else if (response.code < 0) {
+                    if (fail) {
+                        fail(response.msg, response);
+                    }
+                    delete cordova.callbacks[callbackId];
+                } else {
+                    didSucceed = response.code === cordova.callbackStatus.OK || response.code === cordova.callbackStatus.NO_RESULT;
+                    cordova.callbackFromNative(callbackId, didSucceed, response.code, [ didSucceed ? response.data : response.msg ], !!response.keepCallback);
+                }
+            },
+            defineReadOnlyField: function (obj, field, value) {
+                Object.defineProperty(obj, field, {
+                    "value": value,
+                    "writable": false
+                });
+            }
+        };
+    }
+};
 
 });
 
 // file: lib/common/pluginloader.js
 define("cordova/pluginloader", function(require, exports, module) {
 
-var channel = require('cordova/channel');
 var modulemapper = require('cordova/modulemapper');
 
 // Helper function to inject a <script> tag.
@@ -1038,7 +1151,7 @@ function injectScript(url, onload, onerror) {
     document.head.appendChild(script);
 }
 
-function onScriptLoadingComplete(moduleList) {
+function onScriptLoadingComplete(moduleList, finishPluginLoading) {
     // Loop through all the plugins and then through their clobbers and merges.
     for (var i = 0, module; module = moduleList[i]; i++) {
         if (module) {
@@ -1071,18 +1184,11 @@ function onScriptLoadingComplete(moduleList) {
     finishPluginLoading();
 }
 
-// Called when:
-// * There are plugins defined and all plugins are finished loading.
-// * There are no plugins to load.
-function finishPluginLoading() {
-    channel.onPluginsReady.fire();
-}
-
 // Handler for the cordova_plugins.js content.
 // See plugman's plugin_loader.js for the details of this object.
 // This function is only called if the really is a plugins array that isn't empty.
 // Otherwise the onerror response handler will just call finishPluginLoading().
-function handlePluginsObject(path, moduleList) {
+function handlePluginsObject(path, moduleList, finishPluginLoading) {
     // Now inject the scripts.
     var scriptCounter = moduleList.length;
 
@@ -1092,7 +1198,7 @@ function handlePluginsObject(path, moduleList) {
     }
     function scriptLoadedCallback() {
         if (!--scriptCounter) {
-            onScriptLoadingComplete(moduleList);
+            onScriptLoadingComplete(moduleList, finishPluginLoading);
         }
     }
 
@@ -1101,17 +1207,17 @@ function handlePluginsObject(path, moduleList) {
     }
 }
 
-function injectPluginScript(pathPrefix) {
+function injectPluginScript(pathPrefix, finishPluginLoading) {
     injectScript(pathPrefix + 'cordova_plugins.js', function(){
         try {
             var moduleList = require("cordova/plugin_list");
-            handlePluginsObject(pathPrefix, moduleList);
+            handlePluginsObject(pathPrefix, moduleList, finishPluginLoading);
         } catch (e) {
             // Error loading cordova_plugins.js, file not found or something
             // this is an acceptable error, pre-3.0.0, so we just move on.
             finishPluginLoading();
         }
-    },finishPluginLoading); // also, add script load error handler for file not found
+    }, finishPluginLoading); // also, add script load error handler for file not found
 }
 
 function findCordovaPath() {
@@ -1131,28 +1237,32 @@ function findCordovaPath() {
 // Tries to load all plugins' js-modules.
 // This is an async process, but onDeviceReady is blocked on onPluginsReady.
 // onPluginsReady is fired when there are no plugins to load, or they are all done.
-exports.load = function() {
+exports.load = function(callback) {
     var pathPrefix = findCordovaPath();
     if (pathPrefix === null) {
         console.log('Could not find cordova.js script tag. Plugin loading may fail.');
         pathPrefix = '';
     }
-    injectPluginScript(pathPrefix);
+    injectPluginScript(pathPrefix, callback);
 };
 
 
 });
 
-// file: lib/common/symbols.js
-define("cordova/symbols", function(require, exports, module) {
+// file: lib/common/urlutil.js
+define("cordova/urlutil", function(require, exports, module) {
 
-var modulemapper = require('cordova/modulemapper');
+var urlutil = exports;
+var anchorEl = document.createElement('a');
 
-// Use merges here in case others symbols files depend on this running first,
-// but fail to declare the dependency with a require().
-modulemapper.merges('cordova', 'cordova');
-modulemapper.clobbers('cordova/exec', 'cordova.exec');
-modulemapper.clobbers('cordova/exec', 'Cordova.exec');
+/**
+ * For already absolute URLs, returns what is passed in.
+ * For relative URLs, converts them to absolute ones.
+ */
+urlutil.makeAbsolute = function(url) {
+  anchorEl.href = url;
+  return anchorEl.href;
+};
 
 });
 
@@ -1329,203 +1439,6 @@ function UUIDcreatePart(length) {
 window.cordova = require('cordova');
 // file: lib/scripts/bootstrap.js
 
-(function (context) {
-    if (context._cordovaJsLoaded) {
-        throw new Error('cordova.js included multiple times.');
-    }
-    context._cordovaJsLoaded = true;
-
-    var channel = require('cordova/channel');
-    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) {
-                if (typeof origNavigator[key] == 'function') {
-                    newNavigator[key] = origNavigator[key].bind(origNavigator);
-                }
-            }
-        }
-        return newNavigator;
-    }
-    if (context.navigator) {
-        context.navigator = replaceNavigator(context.navigator);
-    }
-
-    // _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();
-    }
-
-    /**
-     * Create all cordova objects once native side is ready.
-     */
-    channel.join(function() {
-        // Call the platform-specific initialization
-        require('cordova/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.
-        // This join call is deliberately made after platform.initialize() in
-        // order that plugins may manipulate channel.deviceReadyChannelsArray
-        // if necessary.
-        channel.join(function() {
-            require('cordova').fireDocumentEvent('deviceready');
-        }, channel.deviceReadyChannelsArray);
-
-    }, platformInitChannelsArray);
-
-    // Don't attempt to load when running unit tests.
-    if (typeof XMLHttpRequest != 'undefined') {
-        pluginloader.load();
-    }
-}(window));
-
-// file: lib/scripts/bootstrap-blackberry10.js
-(function () {
-    var docAddEventListener = document.addEventListener,
-        webworksReady = false,
-        alreadyFired = false,
-        listenerRegistered = false;
-
-    //Only fire the webworks event when both webworks is ready and a listener is registered
-    function fireWebworksReadyEvent() {
-        var evt;
-        if (listenerRegistered && webworksReady && !alreadyFired) {
-            alreadyFired = true;
-            evt = document.createEvent('Events');
-            evt.initEvent('webworksready', true, true);
-            document.dispatchEvent(evt);
-        }
-    }
-
-    //Trapping when users add listeners to the webworks ready event
-    //This way we can make sure not to fire the event before there is a listener
-    document.addEventListener = function (event, callback, capture) {
-        docAddEventListener.call(document, event, callback, capture);
-        if (event.toLowerCase() === 'webworksready') {
-            listenerRegistered = true;
-            fireWebworksReadyEvent();
-        }
-    };
-
-    function RemoteFunctionCall(functionUri) {
-        var params = {};
-
-        function composeUri() {
-            return "http://localhost:8472/" + functionUri;
-        }
-
-        function createXhrRequest(uri, isAsync) {
-            var request = new XMLHttpRequest();
-            request.open("POST", uri, isAsync);
-            request.setRequestHeader("Content-Type", "application/json");
-            return request;
-        }
-
-        this.addParam = function (name, value) {
-            params[name] = encodeURIComponent(JSON.stringify(value));
-        };
-
-        this.makeSyncCall = function (success, error) {
-            var requestUri = composeUri(),
-            request = createXhrRequest(requestUri, false),
-            response,
-            errored,
-            cb,
-            data;
-
-            request.send(JSON.stringify(params));
-            response = JSON.parse(decodeURIComponent(request.responseText) || "null");
-            return response;
-        };
-    }
-
-    window.webworks = {
-        exec: function (success, fail, service, action, args) {
-            var uri = service + "/" + action,
-            request = new RemoteFunctionCall(uri),
-            callbackId = service + cordova.callbackId++,
-            response,
-            name,
-            didSucceed;
-
-            for (name in args) {
-                if (Object.hasOwnProperty.call(args, name)) {
-                    request.addParam(name, args[name]);
-                }
-            }
-
-            cordova.callbacks[callbackId] = {success:success, fail:fail};
-            request.addParam("callbackId", callbackId);
-
-            response = request.makeSyncCall();
-
-            //Old WebWorks Extension success
-            if (response.code === 42) {
-                if (success) {
-                    success(response.data, response);
-                }
-                delete cordova.callbacks[callbackId];
-            } else if (response.code < 0) {
-                if (fail) {
-                    fail(response.msg, response);
-                }
-                delete cordova.callbacks[callbackId];
-            } else {
-                didSucceed = response.code === cordova.callbackStatus.OK || response.code === cordova.callbackStatus.NO_RESULT;
-                cordova.callbackFromNative(callbackId, didSucceed, response.code, [ didSucceed ? response.data : response.msg ], !!response.keepCallback);
-            }
-        },
-        defineReadOnlyField: function (obj, field, value) {
-            Object.defineProperty(obj, field, {
-                "value": value,
-                "writable": false
-            });
-        }
-    };
-
-    require("cordova/channel").onPluginsReady.subscribe(function () {
-        webworksReady = true;
-        fireWebworksReadyEvent();
-    });
-}());
-
-document.addEventListener("DOMContentLoaded", function () {
-    document.addEventListener("webworksready", function () {
-        require('cordova/channel').onNativeReady.fire();
-    });
-});
+require('cordova/init');
 
 })();
\ No newline at end of file