* [ios] add js contentLength and md5 value when js runtime exception
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/ca5ad34f Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/ca5ad34f Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/ca5ad34f Branch: refs/heads/0.16-dev Commit: ca5ad34f11c5a583ac149e16a16e0040b5e15a9c Parents: 0753f50 Author: acton393 <zhangxing610...@gmail.com> Authored: Mon Sep 25 21:39:24 2017 +0800 Committer: acton393 <zhangxing610...@gmail.com> Committed: Mon Sep 25 21:39:24 2017 +0800 ---------------------------------------------------------------------- ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m | 2 +- ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ca5ad34f/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m index fb07935..ec81b22 100644 --- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m +++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.m @@ -158,7 +158,7 @@ id<WXJSExceptionProtocol> jsExceptionHandler = [WXHandlerFactory handlerForProtocol:@protocol(WXJSExceptionProtocol)]; WXSDKInstance *instance = [WXSDKEngine topInstance]; - WXJSExceptionInfo * jsExceptionInfo = [[WXJSExceptionInfo alloc] initWithInstanceId:instance.instanceId bundleUrl:[instance.scriptURL absoluteString] errorCode:[NSString stringWithFormat:@"%d", WX_ERR_JS_EXECUTE] functionName:@"" exception:[NSString stringWithFormat:@"[%@:%@] %@\n%@",exception[@"line"], exception[@"column"],[exception toString], exception[@"stack"]] userInfo:nil]; + WXJSExceptionInfo * jsExceptionInfo = [[WXJSExceptionInfo alloc] initWithInstanceId:instance.instanceId bundleUrl:[instance.scriptURL absoluteString] errorCode:[NSString stringWithFormat:@"%d", WX_ERR_JS_EXECUTE] functionName:@"" exception:[NSString stringWithFormat:@"[%@:%@] %@\n%@ \njsMainBundleStringContentLength:%@\njsMainBundleStringContentMd5:%@",exception[@"line"], exception[@"column"],[exception toString], exception[@"stack"], instance.userInfo[@"jsMainBundleStringContentLength"]?:@"",instance.userInfo[@"jsMainBundleStringContentMd5"]?:@""] userInfo:nil]; if ([jsExceptionHandler respondsToSelector:@selector(onJSException:)]) { [jsExceptionHandler onJSException:jsExceptionInfo]; } http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/ca5ad34f/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m ---------------------------------------------------------------------- diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m index 2afcf46..8fc2511 100644 --- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m +++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m @@ -300,6 +300,11 @@ typedef enum : NSUInteger { WX_MONITOR_FAIL_ON_PAGE(WXMTJSDownload, WX_ERR_JSBUNDLE_STRING_CONVERT, @"data converting to string failed.", strongSelf.pageName) return; } + if (!strongSelf.userInfo) { + strongSelf.userInfo = [NSMutableDictionary new]; + } + strongSelf.userInfo[@"jsMainBundleStringContentLength"] = @([jsBundleString length]); + strongSelf.userInfo[@"jsMainBundleStringContentMd5"] = [WXUtility md5:jsBundleString]; WX_MONITOR_SUCCESS_ON_PAGE(WXMTJSDownload, strongSelf.pageName); WX_MONITOR_INSTANCE_PERF_END(WXPTJSDownload, strongSelf);