You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by cx...@apache.org on 2018/11/26 11:30:59 UTC

[incubator-weex] branch master updated: Fix multicontext recreate (#1818)

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

cxfeng 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 adfa157  Fix multicontext recreate (#1818)
adfa157 is described below

commit adfa157737424d9f6424f032e42001b5273007f4
Author: wqyfavor <wq...@163.com>
AuthorDate: Mon Nov 26 19:30:54 2018 +0800

    Fix multicontext recreate (#1818)
    
    * [iOS] Remove multicontext switch.
    
    * [iOS] Remove multicontext switch.
    
    * [iOS] For normal instance, do not create default jscontext which will be deallocated soon.
---
 ios/sdk/WeexSDK.xcodeproj/project.pbxproj        |  6 --
 ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m | 49 +++++-------
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h  |  5 +-
 ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm | 99 ++++++++++++------------
 ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m     | 17 ----
 ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h   |  2 -
 ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m    | 21 +----
 7 files changed, 79 insertions(+), 120 deletions(-)

diff --git a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
index d6aca1d..aeb4d3b 100644
--- a/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
+++ b/ios/sdk/WeexSDK.xcodeproj/project.pbxproj
@@ -923,7 +923,6 @@
 		DCA445C41EFA57E300D0CFA8 /* WXAppConfiguration.h in Headers */ = {isa = PBXBuildFile; fileRef = 74A4BA941CB365D100195969 /* WXAppConfiguration.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DCA445C51EFA57E800D0CFA8 /* WXAComponent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2AE5B7501CAB7DBD0082FDDB /* WXAComponent.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DCA445C61EFA57EE00D0CFA8 /* NSObject+WXSwizzle.h in Headers */ = {isa = PBXBuildFile; fileRef = 74896F2E1D1AC79400D1D593 /* NSObject+WXSwizzle.h */; settings = {ATTRIBUTES = (Public, ); }; };
-		DCA445C91EFA58CE00D0CFA8 /* native-bundle-main.js in Resources */ = {isa = PBXBuildFile; fileRef = DCF0CD9D1EAF3A6B0062CA8F /* native-bundle-main.js */; };
 		DCA445CA1EFA58CE00D0CFA8 /* wx_load_error@3x.png in Resources */ = {isa = PBXBuildFile; fileRef = 59AC02501D2A7E6E00355112 /* wx_load_error@3x.png */; };
 		DCA445CB1EFA590600D0CFA8 /* WXComponent+Layout.h in Headers */ = {isa = PBXBuildFile; fileRef = 744BEA571D0520F300452B5D /* WXComponent+Layout.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DCA445CC1EFA592800D0CFA8 /* WXResourceLoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 742AD7381DF98C8B007DC46C /* WXResourceLoader.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1030,7 +1029,6 @@
 		DCEA54631F2B7DBA000ECB23 /* WXTracingManager.m in Sources */ = {isa = PBXBuildFile; fileRef = C4E97D321F1EF46D00ABC314 /* WXTracingManager.m */; };
 		DCF087611DCAE161005CD6EB /* WXInvocationConfig.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF0875F1DCAE161005CD6EB /* WXInvocationConfig.h */; };
 		DCF087621DCAE161005CD6EB /* WXInvocationConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = DCF087601DCAE161005CD6EB /* WXInvocationConfig.m */; };
-		DCF0CD9E1EAF3A6B0062CA8F /* native-bundle-main.js in Resources */ = {isa = PBXBuildFile; fileRef = DCF0CD9D1EAF3A6B0062CA8F /* native-bundle-main.js */; };
 		DCF343671E49CAEE00A2FB34 /* WXJSExceptionInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = DCF343651E49CAEE00A2FB34 /* WXJSExceptionInfo.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DCF343681E49CAEE00A2FB34 /* WXJSExceptionInfo.m in Sources */ = {isa = PBXBuildFile; fileRef = DCF343661E49CAEE00A2FB34 /* WXJSExceptionInfo.m */; };
 		ED053500207F4DEB007B4568 /* JSContext+Weex.h in Headers */ = {isa = PBXBuildFile; fileRef = ED0534FE207F4DEB007B4568 /* JSContext+Weex.h */; settings = {ATTRIBUTES = (Public, ); }; };
@@ -1599,7 +1597,6 @@
 		DCE7F1EE20AD358A00D471E7 /* WXPageEventNotifyEvent.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WXPageEventNotifyEvent.h; path = Protocol/WXPageEventNotifyEvent.h; sourceTree = "<group>"; };
 		DCF0875F1DCAE161005CD6EB /* WXInvocationConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXInvocationConfig.h; sourceTree = "<group>"; };
 		DCF087601DCAE161005CD6EB /* WXInvocationConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXInvocationConfig.m; sourceTree = "<group>"; };
-		DCF0CD9D1EAF3A6B0062CA8F /* native-bundle-main.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; name = "native-bundle-main.js"; path = "../../../../pre-build/native-bundle-main.js"; sourceTree = "<group>"; };
 		DCF343651E49CAEE00A2FB34 /* WXJSExceptionInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WXJSExceptionInfo.h; sourceTree = "<group>"; };
 		DCF343661E49CAEE00A2FB34 /* WXJSExceptionInfo.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WXJSExceptionInfo.m; sourceTree = "<group>"; };
 		ED0534FE207F4DEB007B4568 /* JSContext+Weex.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "JSContext+Weex.h"; sourceTree = "<group>"; };
@@ -1926,7 +1923,6 @@
 				DCD8D0F22073392A0002C420 /* weex-polyfill.js */,
 				DC15A3D92010BC93009C8977 /* weex-main-jsfm.js */,
 				DC15A3DA2010BC93009C8977 /* weex-rax-api.js */,
-				DCF0CD9D1EAF3A6B0062CA8F /* native-bundle-main.js */,
 				59AC02501D2A7E6E00355112 /* wx_load_error@3x.png */,
 			);
 			path = Resources;
@@ -3409,7 +3405,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				DC15A3DC2010BC93009C8977 /* weex-rax-api.js in Resources */,
-				DCF0CD9E1EAF3A6B0062CA8F /* native-bundle-main.js in Resources */,
 				DCD8D0F32073392A0002C420 /* weex-polyfill.js in Resources */,
 				DC15A3DB2010BC93009C8977 /* weex-main-jsfm.js in Resources */,
 				59AC02511D2A7E6E00355112 /* wx_load_error@3x.png in Resources */,
@@ -3421,7 +3416,6 @@
 			buildActionMask = 2147483647;
 			files = (
 				DCD8D0F52073393B0002C420 /* weex-main-jsfm.js in Resources */,
-				DCA445C91EFA58CE00D0CFA8 /* native-bundle-main.js in Resources */,
 				DCD8D0F42073392A0002C420 /* weex-polyfill.js in Resources */,
 				DCD8D0F62073393B0002C420 /* weex-rax-api.js in Resources */,
 				DCA445CA1EFA58CE00D0CFA8 /* wx_load_error@3x.png in Resources */,
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
index 811ed62..0dfe18d 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXBridgeContext.m
@@ -264,7 +264,7 @@ _Pragma("clang diagnostic pop") \
         NSMutableDictionary * newOptions = options ? [options mutableCopy] : [NSMutableDictionary new];
         NSMutableArray * newArguments = [arguments mutableCopy];
         
-        if ([WXSDKManager sharedInstance].multiContext && [instance.bundleType.lowercaseString isEqualToString:@"rax"]) {
+        if ([instance.bundleType.lowercaseString isEqualToString:@"rax"]) {
             // we need to adjust __weex_options__ params in arguments to options compatible with rax javaScript framework.
             NSDictionary * weexOptions = nil;
             for(int i = 0;i < [arguments count]; i ++) {
@@ -420,13 +420,9 @@ _Pragma("clang diagnostic pop") \
     NSArray *args = nil;
     WX_MONITOR_INSTANCE_PERF_START(WXFirstScreenJSFExecuteTime, [WXSDKManager instanceForID:instanceIdString]);
     WX_MONITOR_INSTANCE_PERF_START(WXPTJSCreateInstance, [WXSDKManager instanceForID:instanceIdString]);
-    BOOL shoudMultiContext = [WXSDKManager sharedInstance].multiContext;
-    NSString * bundleType = nil;
-    
-    if (shoudMultiContext) {
-        bundleType = [self _pareJSBundleType:instanceIdString jsBundleString:jsBundleString]; // bundleType can be Vue, Rax and the new framework.
-    }
-    if (bundleType&&shoudMultiContext) {
+
+    NSString * bundleType = [self _pareJSBundleType:instanceIdString jsBundleString:jsBundleString]; // bundleType can be Vue, Rax and the new framework.
+    if (bundleType) {
         [sdkInstance.apmInstance setProperty:KEY_PAGE_PROPERTIES_BUNDLE_TYPE withValue:bundleType];
         NSMutableDictionary *newOptions = [options mutableCopy];
         if (!options) {
@@ -1029,29 +1025,26 @@ _Pragma("clang diagnostic pop") \
             NSDictionary *userInfo = nil;
             BOOL commitException = YES;
             WXSDKInstance * instance = nil;
-            if ([WXSDKManager sharedInstance].multiContext) {
-                if (context.instanceId) {
-                    // instance page javaScript runtime exception
-                     instance = [WXSDKManager instanceForID:context.instanceId];
-                    if (instance) {
-                        // instance already existed
-                        commitException = YES;
-                    } else {
-                        // instance already destroyed
-                        commitException = NO;
-                    }
+
+            if (context.instanceId) {
+                // instance page javaScript runtime exception
+                 instance = [WXSDKManager instanceForID:context.instanceId];
+                if (instance) {
+                    // instance already existed
+                    commitException = YES;
                 } else {
-                    // weex-main-jsfm.js runtime exception throws
-                    message = [NSString stringWithFormat:@"[WX_KEY_EXCEPTION_WXBRIDGE] [%@:%@:%@] %@ js stack: %@", exception[@"sourceURL"], exception[@"line"], exception[@"column"], [exception toString], [exception[@"stack"] toObject]];
-                    if (!JSValueIsUndefined(context.JSGlobalContextRef, exception[@"sourceURL"].JSValueRef)) {
-                        bundleUrl = exception[@"sourceURL"].toString;
-                    } else {
-                        bundleUrl = @"weex-main-jsfm";
-                    }
-                    userInfo = [NSDictionary dictionary];
+                    // instance already destroyed
+                    commitException = NO;
                 }
             } else {
-                instance = [WXSDKEngine topInstance];
+                // weex-main-jsfm.js runtime exception throws
+                message = [NSString stringWithFormat:@"[WX_KEY_EXCEPTION_WXBRIDGE] [%@:%@:%@] %@ js stack: %@", exception[@"sourceURL"], exception[@"line"], exception[@"column"], [exception toString], [exception[@"stack"] toObject]];
+                if (!JSValueIsUndefined(context.JSGlobalContextRef, exception[@"sourceURL"].JSValueRef)) {
+                    bundleUrl = exception[@"sourceURL"].toString;
+                } else {
+                    bundleUrl = @"weex-main-jsfm";
+                }
+                userInfo = [NSDictionary dictionary];
             }
             
             NSDictionary* wxExtFuncInfo = [context[@"wxExtFuncInfo"] toDictionary];
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h
index 6472ea7..f0f61e4 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.h
@@ -20,5 +20,8 @@
 #import "WXBridgeProtocol.h"
 
 @interface WXJSCoreBridge : NSObject <WXBridgeProtocol>
-@property (nonatomic,assign)BOOL multiContext;
+
+- (instancetype)init;
+- (instancetype)initWithoutDefaultContext;
+
 @end
diff --git a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
index ade954d..de414bd 100644
--- a/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
+++ b/ios/sdk/WeexSDK/Sources/Bridge/WXJSCoreBridge.mm
@@ -60,54 +60,18 @@
 
 - (instancetype)init
 {
-    self = [super init];
-    
-    if(self){
+    self = [self initWithoutDefaultContext];
+    [self createDefaultContext];
+    return self;
+}
 
-        _jsContext = [[JSContext alloc] init];
-        if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
-            _jsContext.name = @"Weex Context";
-        }
+- (instancetype)initWithoutDefaultContext
+{
+    if (self = [super init]) {
         _timers = [NSMutableArray new];
         _callbacks = [NSMutableDictionary new];
         _intervalTimerId = 0;
         _intervaltimers = [NSMutableDictionary new];
-        _multiContext = NO;
-
-        __weak typeof(self) weakSelf = self;
-
-        [WXBridgeContext mountContextEnvironment:_jsContext];
-        
-        _jsContext[@"setTimeout"] = ^(JSValue *function, JSValue *timeout) {
-            // this setTimeout is used by internal logic in JS framework, normal setTimeout called by users will call WXTimerModule's method;
-            [weakSelf performSelector: @selector(triggerTimeout:) withObject:^() {
-                [function callWithArguments:@[]];
-            } afterDelay:[timeout toDouble] / 1000];
-        };
-        
-        _jsContext[@"setTimeoutWeex"] = ^(JSValue *appId, JSValue *ret,JSValue *arg ) {
-            [weakSelf triggerTimeout:[appId toString] ret:[ret toString] arg:[arg toString]];
-        };
-        
-        _jsContext[@"setIntervalWeex"] = ^(JSValue *appId, JSValue *function,JSValue *arg) {
-            return [weakSelf triggerInterval:[appId toString] function:^() {
-                [function callWithArguments:@[]];
-            } arg:[arg toString]];
-        };
-        
-        _jsContext[@"clearIntervalWeex"] = ^(JSValue *appId, JSValue *ret,JSValue *arg) {
-            
-            [weakSelf triggerClearInterval:[appId toString] ret:[[ret toNumber] longLongValue]];
-        };
-        
-        _jsContext[@"clearTimeoutWeex"] = ^(JSValue *ret) {
-            [weakSelf triggerClearTimeout:[ret toString]];
-        };
-        
-        _jsContext[@"extendCallNative"] = ^(JSValue *value ) {
-            return [weakSelf extendCallNative:[value toDictionary]];
-        };
-
     }
     return self;
 }
@@ -145,11 +109,7 @@
 
     WXAssertParam(frameworkScript);
     if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
-        NSString * fileName = @"native-bundle-main.js";
-        if ([WXSDKManager sharedInstance].multiContext) {
-            fileName = @"weex-main-jsfm.js";
-        }
-        [_jsContext evaluateScript:frameworkScript withSourceURL:[NSURL URLWithString:fileName]];
+        [_jsContext evaluateScript:frameworkScript withSourceURL:[NSURL URLWithString:@"weex-main-jsfm.js"]];
     }else{
         [_jsContext evaluateScript:frameworkScript];
     }
@@ -426,6 +386,49 @@
 }
 
 #pragma mark - Private
+
+- (void)createDefaultContext
+{
+    __weak typeof(self) weakSelf = self;
+    
+    _jsContext = [[JSContext alloc] init];
+    if (WX_SYS_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0")) {
+        _jsContext.name = @"Weex Context";
+    }
+    
+    [WXBridgeContext mountContextEnvironment:_jsContext];
+    
+    _jsContext[@"setTimeout"] = ^(JSValue *function, JSValue *timeout) {
+        // this setTimeout is used by internal logic in JS framework, normal setTimeout called by users will call WXTimerModule's method;
+        [weakSelf performSelector: @selector(triggerTimeout:) withObject:^() {
+            [function callWithArguments:@[]];
+        } afterDelay:[timeout toDouble] / 1000];
+    };
+    
+    _jsContext[@"setTimeoutWeex"] = ^(JSValue *appId, JSValue *ret,JSValue *arg ) {
+        [weakSelf triggerTimeout:[appId toString] ret:[ret toString] arg:[arg toString]];
+    };
+    
+    _jsContext[@"setIntervalWeex"] = ^(JSValue *appId, JSValue *function,JSValue *arg) {
+        return [weakSelf triggerInterval:[appId toString] function:^() {
+            [function callWithArguments:@[]];
+        } arg:[arg toString]];
+    };
+    
+    _jsContext[@"clearIntervalWeex"] = ^(JSValue *appId, JSValue *ret,JSValue *arg) {
+        
+        [weakSelf triggerClearInterval:[appId toString] ret:[[ret toNumber] longLongValue]];
+    };
+    
+    _jsContext[@"clearTimeoutWeex"] = ^(JSValue *ret) {
+        [weakSelf triggerClearTimeout:[ret toString]];
+    };
+    
+    _jsContext[@"extendCallNative"] = ^(JSValue *value ) {
+        return [weakSelf extendCallNative:[value toDictionary]];
+    };
+}
+
 -(void)addInstance:(NSString *)instance callback:(NSString *)callback
 {
     if(instance.length > 0){
diff --git a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
index 980d4fd..47a2880 100644
--- a/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
+++ b/ios/sdk/WeexSDK/Sources/Engine/WXSDKEngine.m
@@ -224,15 +224,6 @@
 + (void)initSDKEnvironment
 {
     NSString *fileName = @"weex-main-jsfm";
-    [WXSDKManager sharedInstance].multiContext = YES;
-    
-    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"createInstanceUsingMutliContext"]) {
-        BOOL createInstanceUsingMutliContext = [[[NSUserDefaults standardUserDefaults] objectForKey:@"createInstanceUsingMutliContext"] boolValue];
-        if (!createInstanceUsingMutliContext) {
-            fileName = @"native-bundle-main";
-            [WXSDKManager sharedInstance].multiContext = NO;
-        }
-    }
     NSString *filePath = [[NSBundle bundleForClass:self] pathForResource:fileName ofType:@"js"];
 	if (filePath == nil) {
 		filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"js"];
@@ -330,14 +321,6 @@ static NSDictionary *_customEnvironment;
 + (void)restart
 {
     NSString *fileName = @"weex-main-jsfm";
-    [WXSDKManager sharedInstance].multiContext = YES;
-    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"createInstanceUsingMutliContext"]) {
-        BOOL createInstanceUsingMutliContext = [[[NSUserDefaults standardUserDefaults] objectForKey:@"createInstanceUsingMutliContext"] boolValue];
-        if (!createInstanceUsingMutliContext) {
-            fileName = @"native-bundle-main";
-            [WXSDKManager sharedInstance].multiContext = NO;
-        }
-    }
     NSString *filePath = [[NSBundle bundleForClass:self] pathForResource:fileName ofType:@"js"];
 	if (filePath == nil) {
 		filePath = [[NSBundle mainBundle] pathForResource:fileName ofType:@"js"];
diff --git a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
index f272347..9f8e454 100644
--- a/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
+++ b/ios/sdk/WeexSDK/Sources/Manager/WXSDKManager.h
@@ -25,8 +25,6 @@
 
 @interface WXSDKManager : NSObject
 
-@property (nonatomic, assign) BOOL multiContext;
-
 /**
  *@abstract Returns sdk manager
  */
diff --git a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
index 4a04c14..deb383e 100644
--- a/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
+++ b/ios/sdk/WeexSDK/Sources/Model/WXSDKInstance.m
@@ -142,7 +142,7 @@ typedef enum : NSUInteger {
     }
     
     // WXDebugger is a singleton actually and should not call its init twice.
-    _instanceJavaScriptContext = _debugJS ? [NSClassFromString(@"WXDebugger") alloc] : [[WXJSCoreBridge alloc] init];
+    _instanceJavaScriptContext = _debugJS ? [NSClassFromString(@"WXDebugger") alloc] : [[WXJSCoreBridge alloc] initWithoutDefaultContext];
     if (!_debugJS) {
         id<WXBridgeProtocol> jsBridge = [[WXSDKManager bridgeMgr] valueForKeyPath:@"bridgeCtx.jsBridge"];
         JSContext* globalContex = jsBridge.javaScriptContext;
@@ -450,30 +450,15 @@ typedef enum : NSUInteger {
 		
         BOOL enableRTLLayoutDirection = [[configCenter configForKey:@"iOS_weex_ext_config.enableRTLLayoutDirection" defaultValue:@(YES) isDefault:NULL] boolValue];
         [WXUtility setEnableRTLLayoutDirection:enableRTLLayoutDirection];
-
-        BOOL shoudMultiContext = NO;
-        shoudMultiContext = [[configCenter configForKey:@"iOS_weex_ext_config.createInstanceUsingMutliContext" defaultValue:@(YES) isDefault:NULL] boolValue];
-        if(shoudMultiContext && ![WXSDKManager sharedInstance].multiContext) {
-            [WXSDKManager sharedInstance].multiContext = YES;
-            [[NSUserDefaults standardUserDefaults] setObject:@"1" forKey:@"createInstanceUsingMutliContext"];
-            [WXSDKEngine restart];
-            return YES;
-        }
-        if (!shoudMultiContext && [WXSDKManager sharedInstance].multiContext) {
-            [WXSDKManager sharedInstance].multiContext = NO;
-            [[NSUserDefaults standardUserDefaults] setObject:@"0" forKey:@"createInstanceUsingMutliContext"];
-            [WXSDKEngine restart];
-            return YES;
-        }
     }
     return NO;
 }
 
-- (void)renderWithMainBundleString:(NSNotification*)notification {
+- (void)renderWithMainBundleString:(NSNotification*)notification
+{
     [self _renderWithMainBundleString:_mainBundleString];
 }
 
-
 - (void)_renderWithRequest:(WXResourceRequest *)request options:(NSDictionary *)options data:(id)data;
 {
     NSURL *url = request.URL;