This is an automated email from the ASF dual-hosted git repository.

xifang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-weex.git


The following commit(s) were added to refs/heads/master by this push:
     new 1c79ada  [iOS] Protect dom.getComponentRect argument for there are so 
many misuses by front-end developers. (#2093)
1c79ada is described below

commit 1c79ada45cd94c1456df3e6f637f5694646254e2
Author: wqyfavor <[email protected]>
AuthorDate: Tue Jan 29 10:39:51 2019 +0800

    [iOS] Protect dom.getComponentRect argument for there are so many misuses 
by front-end developers. (#2093)
---
 ios/sdk/WeexSDK/Sources/Module/WXDomModule.m | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m 
b/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m
index f65f61a..dd4c51e 100644
--- a/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m
+++ b/ios/sdk/WeexSDK/Sources/Module/WXDomModule.m
@@ -211,6 +211,13 @@ WX_EXPORT_METHOD(@selector(endBatchMark))
 }
 
 - (void)getComponentRect:(NSString*)ref 
callback:(WXModuleKeepAliveCallback)callback {
+    if (ref == nil || ![ref isKindOfClass:[NSString class]]) {
+        if (callback) {
+            callback(@{@"result": @(NO), @"errMsg": @"Illegal parameter, ref 
must be a string."}, false);
+        }
+        return;
+    }
+    
     [self performBlockOnComponentManager:^(WXComponentManager * manager) {
         if ([ref isEqualToString:@"viewport"]) {
             dispatch_async(dispatch_get_main_queue(), ^{

Reply via email to