CB-10308 Unable to parse multi dimensional arrays with more than 2 levels - enabling tests - remove unused code
Project: http://git-wip-us.apache.org/repos/asf/cordova-osx/repo Commit: http://git-wip-us.apache.org/repos/asf/cordova-osx/commit/4b1b68e3 Tree: http://git-wip-us.apache.org/repos/asf/cordova-osx/tree/4b1b68e3 Diff: http://git-wip-us.apache.org/repos/asf/cordova-osx/diff/4b1b68e3 Branch: refs/heads/master Commit: 4b1b68e3644d7c4786f77ae83b5f17e16479567a Parents: dd620c9 Author: Tobias Bocanegra <[email protected]> Authored: Fri Jan 8 14:05:19 2016 -0800 Committer: Tobias Bocanegra <[email protected]> Committed: Fri Jan 8 14:05:19 2016 -0800 ---------------------------------------------------------------------- CordovaLib/CordovaLib/Classes/CDVBridge.m | 19 ------------------- tests/CordovaLibTests/CordovaLibApp/www/tests.js | 4 ++-- 2 files changed, 2 insertions(+), 21 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4b1b68e3/CordovaLib/CordovaLib/Classes/CDVBridge.m ---------------------------------------------------------------------- diff --git a/CordovaLib/CordovaLib/Classes/CDVBridge.m b/CordovaLib/CordovaLib/Classes/CDVBridge.m index 5a67d24..4eeb056 100644 --- a/CordovaLib/CordovaLib/Classes/CDVBridge.m +++ b/CordovaLib/CordovaLib/Classes/CDVBridge.m @@ -26,31 +26,12 @@ @implementation CDVBridge -- (BOOL) isArray:(id) item { - id win = [self.webView windowScriptObject]; - WebScriptObject* bridgeUtil = [win evaluateWebScript:@"CordovaBridgeUtil"]; - NSNumber* result = [bridgeUtil callWebScriptMethod:@"isArray" withArguments:@[item]]; - - return [result boolValue]; -} - -- (BOOL) isDictionary:(id) item { - id win = [self.webView windowScriptObject]; - WebScriptObject* bridgeUtil = [win evaluateWebScript:@"CordovaBridgeUtil"]; - NSNumber* result = [bridgeUtil callWebScriptMethod:@"isObject" withArguments:@[item]]; - return [result boolValue]; -} - - (void) registerJavaScriptHelpers { NSString* cordovaBridgeUtil = @"var CordovaBridgeUtil = {};"; - NSString* isArray = [NSString stringWithFormat:@"CordovaBridgeUtil.isArray = function(obj) { return obj.constructor == Array; };"]; - NSString* isObject = [NSString stringWithFormat:@"CordovaBridgeUtil.isObject = function(obj) { return obj.constructor == Object; };"]; NSString* dictionaryKeys = [NSString stringWithFormat:@"CordovaBridgeUtil.getDictionaryKeys = function(obj) { return Object.keys(obj);};"]; id win = [self.webView windowScriptObject]; [win evaluateWebScript:cordovaBridgeUtil]; - [win evaluateWebScript:isArray]; - [win evaluateWebScript:isObject]; [win evaluateWebScript:dictionaryKeys]; } http://git-wip-us.apache.org/repos/asf/cordova-osx/blob/4b1b68e3/tests/CordovaLibTests/CordovaLibApp/www/tests.js ---------------------------------------------------------------------- diff --git a/tests/CordovaLibTests/CordovaLibApp/www/tests.js b/tests/CordovaLibTests/CordovaLibApp/www/tests.js index 2f65b7b..57db1bf 100644 --- a/tests/CordovaLibTests/CordovaLibApp/www/tests.js +++ b/tests/CordovaLibTests/CordovaLibApp/www/tests.js @@ -29,8 +29,8 @@ function echoTests() { 'double': 3.141, 'array': ['a','b','c'], 'nested-array': ['a','b','c', [1,2,3]], - 'object': {a:'a', b:'b'} - // 'nested-object': {a:'a', b:'b', c:{d:'d'}} (does not work yet, CB-10308) + 'object': {a:'a', b:'b'}, + 'nested-object': {a:'a', b:'b', c:{d:'d'}} }; var tests = []; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
