JSContext:js执行环境,包含了js执行时所需要的所有函数和对象;

js执行时,会在执行环境搜索需要的函数然后执行,或者保存传入的变量或函数;

JSContext *jsContext = [self.webView valueForKeyPath:@"documentView.webView.mainFrame.javaScriptContext"];

jsContext[@"sayhi"] = ^(NSString *name) {

NSLog(@"say hi to %@",name);

};

<div data-role="collapsible">

<h3 onclick="sayhi('systemVersion')">systemVersion</h3>

<p id="systemVersion"></p>

</div>

* thread #7: tid = 0x15e622, 0x000000010f557f13 jsTest`__27-[ViewController refreshXX]_block_invoke(.block_descriptor=<unavailable>, name=@"systemVersion") + 51 at ViewController.m:70, name = 'WebThread', stop reason = breakpoint 1.1

* frame #0: 0x000000010f557f13 jsTest`__27-[ViewController refreshXX]_block_invoke(.block_descriptor=<unavailable>, name=@"systemVersion") + 51 at ViewController.m:70

frame #1: 0x00000001106145cc CoreFoundation`__invoking___ + 140

frame #2: 0x000000011061441e CoreFoundation`-[NSInvocation invoke] + 286

frame #3: 0x000000010f9cedb3 JavaScriptCore`JSC::ObjCCallbackFunctionImpl::call(JSContext*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) + 451

frame #4: 0x000000010f9ce926 JavaScriptCore`JSC::objCCallbackFunctionCallAsFunction(OpaqueJSContext const*, OpaqueJSValue*, OpaqueJSValue*, unsigned long, OpaqueJSValue const* const*, OpaqueJSValue const**) + 262

frame #5: 0x000000010f9cfbad JavaScriptCore`long long JSC::APICallbackFunction::call<JSC::ObjCCallbackFunction>(JSC::ExecState*) + 573

frame #6: 0x000000010f999340 JavaScriptCore`JSC::LLInt::setUpCall(JSC::ExecState*, JSC::Instruction*, JSC::CodeSpecializationKind, JSC::JSValue, JSC::LLIntCallLinkInfo*) + 528

frame #7: 0x000000010f9a035d JavaScriptCore`llint_entry + 22900

frame #8: 0x000000010f99a7d9 JavaScriptCore`vmEntryToJavaScript + 326

frame #9: 0x000000010f86c959 JavaScriptCore`JSC::JITCode::execute(JSC::VM*, JSC::ProtoCallFrame*) + 169

frame #10: 0x000000010f8535ad JavaScriptCore`JSC::Interpreter::executeCall(JSC::ExecState*, JSC::JSObject*, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&) + 493

frame #11: 0x000000010f627bd7 JavaScriptCore`JSC::call(JSC::ExecState*, JSC::JSValue, JSC::CallType, JSC::CallData const&, JSC::JSValue, JSC::ArgList const&, WTF::NakedPtr<JSC::Exception>&) + 71

frame #12: 0x00000001158f5c1a WebCore`WebCore::JSEventListener::handleEvent(WebCore::ScriptExecutionContext*, WebCore::Event*) + 1002

frame #13: 0x0000000115542630 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*, WebCore::EventTargetData*, WTF::Vector<WebCore::RegisteredEventListener, 1ul, WTF::CrashOnOverflow, 16ul>&) + 752

frame #14: 0x0000000115542267 WebCore`WebCore::EventTarget::fireEventListeners(WebCore::Event*) + 311

frame #15: 0x000000011552b50e WebCore`WebCore::MouseOrFocusEventContext::handleLocalEvents(WebCore::Event&) const + 174

frame #16: 0x000000011552c0b8 WebCore`WebCore::EventDispatcher::dispatchEvent(WebCore::Node*, WTF::PassRefPtr<WebCore::Event>) + 920

frame #17: 0x0000000115c2dc5d WebCore`WebCore::Node::dispatchEvent(WTF::PassRefPtr<WebCore::Event>) + 29

frame #18: 0x000000011551561e WebCore`WebCore::Element::dispatchMouseEvent(WebCore::PlatformMouseEvent const&, WTF::AtomicString const&, int, WebCore::Element*) + 318

frame #19: 0x00000001155328df WebCore`WebCore::EventHandler::dispatchMouseEvent(WTF::AtomicString const&, WebCore::Node*, bool, int, WebCore::PlatformMouseEvent const&, bool) + 111

frame #20: 0x0000000115534108 WebCore`WebCore::EventHandler::handleMouseReleaseEvent(WebCore::PlatformMouseEvent const&) + 1192

frame #21: 0x000000011553b50d WebCore`WebCore::EventHandler::mouseUp(WebEvent*) + 237

frame #22: 0x00000001150a2be3 WebKitLegacy`-[WebHTMLView mouseUp:] + 115

frame #23: 0x00000001160e230d WebCore`-[WAKView _selfHandleEvent:] + 125

frame #24: 0x00000001160e226f WebCore`-[WAKView handleEvent:] + 63

frame #25: 0x00000001160e546d WebCore`-[WAKWindow sendEventSynchronously:] + 269

frame #26: 0x0000000110e02e81 UIKit`__47-[UIWebDocumentView(Interaction) performClick:]_block_invoke + 740

frame #27: 0x0000000110e02b97 UIKit`-[UIWebDocumentView(Interaction) performClick:] + 68

frame #28: 0x0000000110e0349f UIKit`__64-[UIWebDocumentView(Interaction) _sendMouseMoveAndAttemptClick:]_block_invoke + 345

frame #29: 0x00000001160fd996 WebCore`HandleRunSource(void*) + 390

frame #30: 0x0000000110651301 CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 17

frame #31: 0x00000001106471a7 CoreFoundation`__CFRunLoopDoSources0 + 423

frame #32: 0x00000001106466e3 CoreFoundation`__CFRunLoopRun + 867

frame #33: 0x00000001106460f8 CoreFoundation`CFRunLoopRunSpecific + 488

frame #34: 0x00000001160fd325 WebCore`RunWebThread(void*) + 469

frame #35: 0x000000011286799d libsystem_pthread.dylib`_pthread_body + 131

frame #36: 0x000000011286791a libsystem_pthread.dylib`_pthread_start + 168

frame #37: 0x0000000112865351 libsystem_pthread.dylib`thread_start + 13

最新文章

  1. JDK动态代理实现原理
  2. JS获取当前浏览器的类型
  3. iframe无刷新跨域上传文件并获取返回值
  4. Purchase购物车实例分析
  5. TCP/IP详解学习笔记(12)-- TCP:传输控制协议
  6. Ubuntu16.04+hadoop2.7.3环境搭建
  7. android--多View切换viewpager
  8. PPAS上运行pg_dump经过
  9. UIcollectionView的使用(首页的搭建4)
  10. 不只是打车软件,中国车主们赋予了Uber更多意义
  11. 20160314 Servlet 入门
  12. 为当前的div 动态添加一个样式
  13. 能分析压缩的日志,且基于文件输入的PYTHON代码实现
  14. 从0到1搭建spark集群---企业集群搭建
  15. MySQL完全备份、增量备份与恢复[转]
  16. jvm学习笔记二(减少GC开销的建议)
  17. msyql备份还原
  18. 在 Ubuntu16.04 中搭建 Spark 单机开发环境 (JDK + Scala + Spark)
  19. 如何使用Java读写系统属性?
  20. “使用IDEA,配置文件是yml,无法获取[环境变量],值是null”的问题处理

热门文章

  1. Java - 使可访问性最小化
  2. 三、hive JavaAPI示例
  3. C/C++:Windows cmd 指令
  4. RESTful api 设计规范
  5. MVC 手机端页面 使用标签file 图片上传到后台处理
  6. UNIX 网络编程笔记-CH3:套接字编程简介
  7. Mac(OS X)中Git安装与GitHub基本使用
  8. BZOJ1492 [NOI2007]货币兑换
  9. 苹果ios,下拉菜单错位的问题(目前iphone x没发现有这个问题)
  10. Date()函数的用法