mirror of https://github.com/axmolengine/axmol.git
Bug fix for shouldStartLoading method, should return value from JS, also fix that webview callback is already in Cocos Thread, don't need to post to cocos thread for running again.
This commit is contained in:
parent
e1656264fc
commit
65eb5fa4ba
|
@ -20,8 +20,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnShouldStartLoading(JSContext
|
|||
if(argc == 1){
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnShouldStartLoading([=](experimental::ui::WebView *sender, const std::string &url)->bool{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
{
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval arg[2];
|
||||
js_proxy_t *proxy = js_get_or_create_proxy(cx, sender);
|
||||
|
@ -36,8 +34,7 @@ static bool jsb_cocos2dx_experimental_webView_setOnShouldStartLoading(JSContext
|
|||
if (!ok && JS_IsExceptionPending(cx)) {
|
||||
JS_ReportPendingException(cx);
|
||||
}
|
||||
});
|
||||
return true;
|
||||
return rval.toBoolean();
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
@ -54,8 +51,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFinishLoading(JSContext *c
|
|||
if(argc == 1){
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnDidFinishLoading([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
{
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval arg[2];
|
||||
js_proxy_t *proxy = js_get_or_create_proxy(cx, sender);
|
||||
|
@ -71,7 +66,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFinishLoading(JSContext *c
|
|||
JS_ReportPendingException(cx);
|
||||
}
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -87,8 +81,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFailLoading(JSContext *cx,
|
|||
if(argc == 1){
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnDidFailLoading([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
{
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval arg[2];
|
||||
js_proxy_t *proxy = js_get_or_create_proxy(cx, sender);
|
||||
|
@ -104,7 +96,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnDidFailLoading(JSContext *cx,
|
|||
JS_ReportPendingException(cx);
|
||||
}
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -120,8 +111,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnJSCallback(JSContext *cx, uin
|
|||
if(argc == 1){
|
||||
std::shared_ptr<JSFunctionWrapper> func(new JSFunctionWrapper(cx, obj, args.get(0)));
|
||||
cobj->setOnJSCallback([=](experimental::ui::WebView *sender, const std::string &url)->void{
|
||||
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]
|
||||
{
|
||||
JSB_AUTOCOMPARTMENT_WITH_GLOBAL_OBJCET
|
||||
jsval arg[2];
|
||||
js_proxy_t *proxy = js_get_or_create_proxy(cx, sender);
|
||||
|
@ -137,7 +126,6 @@ static bool jsb_cocos2dx_experimental_webView_setOnJSCallback(JSContext *cx, uin
|
|||
JS_ReportPendingException(cx);
|
||||
}
|
||||
});
|
||||
});
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue