cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bhigg...@apache.org
Subject [1/2] webworks commit: Update JS snapshot to version 3.4.0-rc1
Date Fri, 24 Jan 2014 15:20:02 GMT
Updated Branches:
  refs/heads/3.4.x [created] 6b596f873


Update JS snapshot to version 3.4.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/6162c642
Tree: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/tree/6162c642
Diff: http://git-wip-us.apache.org/repos/asf/cordova-blackberry/diff/6162c642

Branch: refs/heads/3.4.x
Commit: 6162c642ddb6795edfd65a8068d2f17a2930e62a
Parents: 73d3c30
Author: Bryan Higgins <bryan@bryanhiggins.net>
Authored: Fri Jan 24 10:15:13 2014 -0500
Committer: Bryan Higgins <bryan@bryanhiggins.net>
Committed: Fri Jan 24 10:15:13 2014 -0500

----------------------------------------------------------------------
 blackberry10/javascript/cordova.blackberry10.js | 106 +++++++++++--------
 1 file changed, 60 insertions(+), 46 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-blackberry/blob/6162c642/blackberry10/javascript/cordova.blackberry10.js
----------------------------------------------------------------------
diff --git a/blackberry10/javascript/cordova.blackberry10.js b/blackberry10/javascript/cordova.blackberry10.js
index 545395d..fd35cfb 100644
--- a/blackberry10/javascript/cordova.blackberry10.js
+++ b/blackberry10/javascript/cordova.blackberry10.js
@@ -1,5 +1,5 @@
 // Platform: blackberry10
-// 3.4.0-dev-286dff2
+// 3.4.0-rc1
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -19,8 +19,8 @@
  under the License.
 */
 ;(function() {
-var CORDOVA_JS_BUILD_LABEL = '3.4.0-dev-286dff2';
-// file: lib/scripts/require.js
+var CORDOVA_JS_BUILD_LABEL = '3.4.0-rc1';
+// file: src/scripts/require.js
 
 /*jshint -W079 */
 /*jshint -W020 */
@@ -98,7 +98,7 @@ if (typeof module === "object" && typeof require === "function")
{
     module.exports.define = define;
 }
 
-// file: lib/cordova.js
+// file: src/cordova.js
 define("cordova", function(require, exports, module) {
 
 
@@ -316,7 +316,7 @@ module.exports = cordova;
 
 });
 
-// file: lib/common/argscheck.js
+// file: src/common/argscheck.js
 define("cordova/argscheck", function(require, exports, module) {
 
 var exec = require('cordova/exec');
@@ -382,7 +382,7 @@ moduleExports.enableChecks = true;
 
 });
 
-// file: lib/common/base64.js
+// file: src/common/base64.js
 define("cordova/base64", function(require, exports, module) {
 
 var base64 = exports;
@@ -438,7 +438,7 @@ function uint8ToBase64(rawData) {
 
 });
 
-// file: lib/common/builder.js
+// file: src/common/builder.js
 define("cordova/builder", function(require, exports, module) {
 
 var utils = require('cordova/utils');
@@ -551,7 +551,7 @@ exports.replaceHookForTesting = function() {};
 
 });
 
-// file: lib/common/channel.js
+// file: src/common/channel.js
 define("cordova/channel", function(require, exports, module) {
 
 var utils = require('cordova/utils'),
@@ -792,7 +792,7 @@ module.exports = channel;
 
 });
 
-// file: lib/blackberry10/exec.js
+// file: src/blackberry10/exec.js
 define("cordova/exec", function(require, exports, module) {
 
 var cordova = require('cordova'),
@@ -816,15 +816,42 @@ function RemoteFunctionCall(functionUri) {
         params[name] = encodeURIComponent(JSON.stringify(value));
     };
 
-    this.makeSyncCall = function () {
+    this.makeAsyncCall = function () {
         var requestUri = composeUri(),
-        request = createXhrRequest(requestUri, false),
-        response;
+            request = new XMLHttpRequest(),
+            didSucceed,
+            response,
+            fail = function () {
+                var callbackId = JSON.parse(decodeURIComponent(params.callbackId));
+                response = JSON.parse(decodeURIComponent(request.responseText) || "null");
+                cordova.callbacks[callbackId].fail && cordova.callbacks[callbackId].fail(response.msg,
response);
+                delete cordova.callbacks[callbackId];
+            };
+
+        request.open("POST", requestUri, true /* async */);
+        request.setRequestHeader("Content-Type", "application/json");
+        request.timeout = 1000; // Timeout in 1000ms
+        request.ontimeout = fail;
+        request.onerror = fail;
+
+        request.onload = function () {
+            response = JSON.parse(decodeURIComponent(request.responseText) || "null");
+            if (request.status === 200) {
+                didSucceed = response.code === cordova.callbackStatus.OK || response.code
=== cordova.callbackStatus.NO_RESULT;
+                cordova.callbackFromNative(
+                        JSON.parse(decodeURIComponent(params.callbackId)),
+                        didSucceed,
+                        response.code,
+                        [ didSucceed ? response.data : response.msg ],
+                        !!response.keepCallback
+                        );
+            } else {
+                fail();
+            }
+        };
+
         request.send(JSON.stringify(params));
-        response = JSON.parse(decodeURIComponent(request.responseText) || "null");
-        return response;
     };
-
 }
 
 module.exports = function (success, fail, service, action, args) {
@@ -832,7 +859,6 @@ module.exports = function (success, fail, service, action, args) {
     request = new RemoteFunctionCall(uri),
     callbackId = service + cordova.callbackId++,
     proxy,
-    response,
     name,
     didSucceed;
 
@@ -856,31 +882,15 @@ module.exports = function (success, fail, service, action, args) {
                 request.addParam(name, args[name]);
             }
         }
-        
-        response = request.makeSyncCall();
 
-        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
-            );
-        }
+        request.makeAsyncCall();
     }
 
 };
 
 });
 
-// file: lib/common/exec/proxy.js
+// file: src/common/exec/proxy.js
 define("cordova/exec/proxy", function(require, exports, module) {
 
 
@@ -910,7 +920,7 @@ module.exports = {
 };
 });
 
-// file: lib/common/init.js
+// file: src/common/init.js
 define("cordova/init", function(require, exports, module) {
 
 var channel = require('cordova/channel');
@@ -1024,7 +1034,7 @@ channel.join(function() {
 
 });
 
-// file: lib/common/modulemapper.js
+// file: src/common/modulemapper.js
 define("cordova/modulemapper", function(require, exports, module) {
 
 var builder = require('cordova/builder'),
@@ -1125,7 +1135,7 @@ exports.reset();
 
 });
 
-// file: lib/blackberry10/platform.js
+// file: src/blackberry10/platform.js
 define("cordova/platform", function(require, exports, module) {
 
 module.exports = {
@@ -1167,10 +1177,11 @@ module.exports = {
 
 });
 
-// file: lib/common/pluginloader.js
+// file: src/common/pluginloader.js
 define("cordova/pluginloader", function(require, exports, module) {
 
 var modulemapper = require('cordova/modulemapper');
+var urlutil = require('cordova/urlutil');
 
 // Helper function to inject a <script> tag.
 function injectScript(url, onload, onerror) {
@@ -1239,11 +1250,14 @@ function handlePluginsObject(path, moduleList, finishPluginLoading)
{
 }
 
 function injectPluginScript(pathPrefix, finishPluginLoading) {
-    injectScript(pathPrefix + 'cordova_plugins.js', function(){
+    var pluginPath = pathPrefix + 'cordova_plugins.js';
+
+    injectScript(pluginPath, function() {
         try {
             var moduleList = require("cordova/plugin_list");
             handlePluginsObject(pathPrefix, moduleList, finishPluginLoading);
-        } catch (e) {
+        }
+        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();
@@ -1280,24 +1294,24 @@ exports.load = function(callback) {
 
 });
 
-// file: lib/common/urlutil.js
+// file: src/common/urlutil.js
 define("cordova/urlutil", function(require, exports, module) {
 
-var urlutil = exports;
-var anchorEl = document.createElement('a');
 
 /**
  * For already absolute URLs, returns what is passed in.
  * For relative URLs, converts them to absolute ones.
  */
-urlutil.makeAbsolute = function(url) {
+exports.makeAbsolute = function makeAbsolute(url) {
+    var anchorEl = document.createElement('a');
     anchorEl.href = url;
     return anchorEl.href;
 };
 
+
 });
 
-// file: lib/common/utils.js
+// file: src/common/utils.js
 define("cordova/utils", function(require, exports, module) {
 
 var utils = exports;
@@ -1468,7 +1482,7 @@ function UUIDcreatePart(length) {
 });
 
 window.cordova = require('cordova');
-// file: lib/scripts/bootstrap.js
+// file: src/scripts/bootstrap.js
 
 require('cordova/init');
 


Mime
View raw message