cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [2/2] ios commit: Update cordova.js
Date Tue, 10 Nov 2015 01:01:54 GMT
Update cordova.js


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

Branch: refs/heads/master
Commit: 3618162251e21f1ec6d7d83be403a984152a4c55
Parents: 21a71fe
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Mon Nov 9 16:04:43 2015 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Mon Nov 9 16:04:43 2015 -0800

----------------------------------------------------------------------
 CordovaLib/cordova.js | 78 +++++++++++-----------------------------------
 1 file changed, 19 insertions(+), 59 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/36181622/CordovaLib/cordova.js
----------------------------------------------------------------------
diff --git a/CordovaLib/cordova.js b/CordovaLib/cordova.js
index 5469497..0bda072 100644
--- a/CordovaLib/cordova.js
+++ b/CordovaLib/cordova.js
@@ -1,5 +1,5 @@
 // Platform: ios
-// 7703d38498920bdcfadd574e475553a26fc490e5
+// 8e9610fe33fc743fcaf5d920064f0deb2cad1715
 /*
  Licensed to the Apache Software Foundation (ASF) under one
  or more contributor license agreements.  See the NOTICE file
@@ -817,28 +817,19 @@ module.exports = channel;
 
 });
 
-// file: /Users/shaz/Documents/Git/Apache/cordova-ios/cordova-js-src/exec.js
+// file: /Repos/cordova/cordova-ios/cordova-js-src/exec.js
 define("cordova/exec", function(require, exports, module) {
 
+/*global require, module, atob, document */
+
 /**
  * Creates a gap bridge iframe used to notify the native code about queued
  * commands.
  */
 var cordova = require('cordova'),
-    channel = require('cordova/channel'),
     utils = require('cordova/utils'),
     base64 = require('cordova/base64'),
-    jsToNativeModes = {
-        IFRAME_NAV: 0, // Default. Uses a new iframe for each poke.
-        WK_WEBVIEW_BINDING: 1 // Only way that works for WKWebView :)
-    },
-    bridgeMode,
     execIframe,
-    execHashIframe,
-    hashToggle = 1,
-    execXhr,
-    requestCount = 0,
-    vcHeaderValue = null,
     commandQueue = [], // Contains pending JS->Native messages.
     isInContextOfEvalJs = 0,
     failSafeTimerId = 0;
@@ -893,17 +884,10 @@ function convertMessageToArgsNativeToJs(message) {
 }
 
 function iOSExec() {
-    if (bridgeMode === undefined) {
-        bridgeMode = jsToNativeModes.IFRAME_NAV;
-    }
-
-    if (window.webkit && window.webkit.messageHandlers && window.webkit.messageHandlers.cordova
&& window.webkit.messageHandlers.cordova.postMessage) {
-        bridgeMode = jsToNativeModes.WK_WEBVIEW_BINDING;
-    }
 
-    var successCallback, failCallback, service, action, actionArgs, splitCommand;
+    var successCallback, failCallback, service, action, actionArgs;
     var callbackId = null;
-    if (typeof arguments[0] !== "string") {
+    if (typeof arguments[0] !== 'string') {
         // FORMAT ONE
         successCallback = arguments[0];
         failCallback = arguments[1];
@@ -937,21 +921,17 @@ function iOSExec() {
 
     var command = [callbackId, service, action, actionArgs];
 
-    if (bridgeMode === jsToNativeModes.WK_WEBVIEW_BINDING) {
-        window.webkit.messageHandlers.cordova.postMessage(command);
-    } else {
-        // Stringify and queue the command. We stringify to command now to
-        // effectively clone the command arguments in case they are mutated before
-        // the command is executed.
-        commandQueue.push(JSON.stringify(command));
-    
-        // If we're in the context of a stringByEvaluatingJavaScriptFromString call,
-        // then the queue will be flushed when it returns; no need for a poke.
-        // Also, if there is already a command in the queue, then we've already
-        // poked the native side, so there is no reason to do so again.
-        if (!isInContextOfEvalJs && commandQueue.length == 1) {
-            pokeNative();
-        }
+    // Stringify and queue the command. We stringify to command now to
+    // effectively clone the command arguments in case they are mutated before
+    // the command is executed.
+    commandQueue.push(JSON.stringify(command));
+
+    // If we're in the context of a stringByEvaluatingJavaScriptFromString call,
+    // then the queue will be flushed when it returns; no need for a poke.
+    // Also, if there is already a command in the queue, then we've already
+    // poked the native side, so there is no reason to do so again.
+    if (!isInContextOfEvalJs && commandQueue.length == 1) {
+        pokeNative();
     }
 }
 
@@ -985,21 +965,6 @@ function pokeNative() {
     }, 50); // Making this > 0 improves performance (marginally) in the normal case (where
it doesn't fire).
 }
 
-iOSExec.jsToNativeModes = jsToNativeModes;
-
-iOSExec.setJsToNativeBridgeMode = function(mode) {
-    // Remove the iFrame since it may be no longer required, and its existence
-    // can trigger browser bugs.
-    // https://issues.apache.org/jira/browse/CB-593
-    if (execIframe) {
-        if (execIframe.parentNode) {
-            execIframe.parentNode.removeChild(execIframe);
-        }
-        execIframe = null;
-    }
-    bridgeMode = mode;
-};
-
 iOSExec.nativeFetchMessages = function() {
     // Stop listing for window detatch once native side confirms poke.
     if (failSafeTimerId) {
@@ -1022,12 +987,7 @@ iOSExec.nativeCallback = function(callbackId, status, message, keepCallback,
deb
         function nc2() {
             cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
         }
-        // CB-8468
-        if (debug) {
-            setTimeout(nc2, 0);
-        } else {
-            nc2();
-        }
+        setTimeout(nc2, 0);
     });
 };
 
@@ -1527,7 +1487,7 @@ exports.reset();
 
 });
 
-// file: /Users/shaz/Documents/Git/Apache/cordova-ios/cordova-js-src/platform.js
+// file: /Repos/cordova/cordova-ios/cordova-js-src/platform.js
 define("cordova/platform", function(require, exports, module) {
 
 module.exports = {


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org


Mime
View raw message