cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From purplecabb...@apache.org
Subject [1/2] ios commit: Removed wk-webview exec and some linting
Date Tue, 10 Nov 2015 01:01:53 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/master 4a0bb3a8c -> 361816225


Removed wk-webview exec and some linting


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

Branch: refs/heads/master
Commit: 21a71fe89ffe575d1b70ce51aa9957777ac23f17
Parents: 4a0bb3a
Author: Jesse MacFadyen <purplecabbage@gmail.com>
Authored: Fri Nov 6 17:53:29 2015 -0800
Committer: Jesse MacFadyen <purplecabbage@gmail.com>
Committed: Fri Nov 6 17:53:29 2015 -0800

----------------------------------------------------------------------
 cordova-js-src/exec.js | 72 ++++++++++-----------------------------------
 1 file changed, 16 insertions(+), 56 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/21a71fe8/cordova-js-src/exec.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index d5354b1..11c6f55 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -19,25 +19,16 @@
  *
 */
 
+/*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;
@@ -92,17 +83,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];
@@ -136,21 +120,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();
     }
 }
 
@@ -184,21 +164,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) {
@@ -221,12 +186,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);
     });
 };
 


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


Mime
View raw message