cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shaz...@apache.org
Subject ios commit: CB-8468 - Application freezes if breakpoint hits JavaScript callback invoked from native
Date Fri, 29 May 2015 00:26:48 GMT
Repository: cordova-ios
Updated Branches:
  refs/heads/4.0.x d75be3669 -> 81e3d6a4e


CB-8468 - Application freezes if breakpoint hits JavaScript callback invoked from native


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

Branch: refs/heads/4.0.x
Commit: 81e3d6a4eab29150a35c61313884aed7199c39e6
Parents: d75be36
Author: Shazron Abdullah <shazron@apache.org>
Authored: Thu May 28 17:27:54 2015 -0700
Committer: Shazron Abdullah <shazron@apache.org>
Committed: Thu May 28 17:27:54 2015 -0700

----------------------------------------------------------------------
 CordovaLib/Classes/Public/CDVCommandDelegateImpl.m |  7 ++++++-
 bin/templates/scripts/cordova/build-debug.xcconfig |  3 +++
 cordova-js-src/exec.js                             | 12 ++++++++++--
 3 files changed, 19 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/81e3d6a4/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m
----------------------------------------------------------------------
diff --git a/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m b/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m
index 6d168ab..a1c2c55 100644
--- a/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m
+++ b/CordovaLib/Classes/Public/CDVCommandDelegateImpl.m
@@ -137,8 +137,13 @@
     int status = [result.status intValue];
     BOOL keepCallback = [result.keepCallback boolValue];
     NSString* argumentsAsJSON = [result argumentsAsJSON];
+    BOOL debug = NO;
+    
+#ifdef DEBUG
+    debug = YES;
+#endif
 
-    NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d)",
callbackId, status, argumentsAsJSON, keepCallback];
+    NSString* js = [NSString stringWithFormat:@"cordova.require('cordova/exec').nativeCallback('%@',%d,%@,%d,
%d)", callbackId, status, argumentsAsJSON, keepCallback, debug];
 
     [self evalJsHelper:js];
 }

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/81e3d6a4/bin/templates/scripts/cordova/build-debug.xcconfig
----------------------------------------------------------------------
diff --git a/bin/templates/scripts/cordova/build-debug.xcconfig b/bin/templates/scripts/cordova/build-debug.xcconfig
index 124d020..3f11e59 100644
--- a/bin/templates/scripts/cordova/build-debug.xcconfig
+++ b/bin/templates/scripts/cordova/build-debug.xcconfig
@@ -22,4 +22,7 @@
 //
 
 #include "build.xcconfig"
+
+GCC_PREPROCESSOR_DEFINITIONS = DEBUG=1
+
 #include "build-extras.xcconfig"

http://git-wip-us.apache.org/repos/asf/cordova-ios/blob/81e3d6a4/cordova-js-src/exec.js
----------------------------------------------------------------------
diff --git a/cordova-js-src/exec.js b/cordova-js-src/exec.js
index 856b9b1..7e7b17b 100644
--- a/cordova-js-src/exec.js
+++ b/cordova-js-src/exec.js
@@ -301,11 +301,19 @@ iOSExec.nativeFetchMessages = function() {
     return json;
 };
 
-iOSExec.nativeCallback = function(callbackId, status, message, keepCallback) {
+iOSExec.nativeCallback = function(callbackId, status, message, keepCallback, debug) {
     return iOSExec.nativeEvalAndFetch(function() {
         var success = status === 0 || status === 1;
         var args = convertMessageToArgsNativeToJs(message);
-        cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
+        function nc2() {
+            cordova.callbackFromNative(callbackId, success, status, args, keepCallback);
+        };
+        // CB-8468
+        if (debug) {
+            setTimeout(nc2, 0);
+        } else {
+            nc2();
+        }
     });
 };
 


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


Mime
View raw message