JSCONTEXT:JS execution environment, including all the functions and objects required by JS execution;
When JS executes, it executes the function that is needed in the execution of the environment search, or saves the incoming variable or function;
Jscontext *jscontext = [Self.webview valueforkeypath:@ "DocumentView.webView.mainFrame.javaScriptContext"];
jscontext[@ "Sayhi"] = ^ (NSString *name) {
NSLog (@ "Say hi to%@", name);
};
<div data-role= "Collapsible" >
<p id= "Systemversion" ></p>
</div>
* Thread #7: tid = 0x15e622, 0x000000010f557f13 jstest ' __27-[viewcontroller refreshxx]_block_invoke (. block_descriptor= <UNAVAILABLE>, [email protected] "systemversion") + at viewcontroller.m:70, name = ' Webthread ', stop reason = Brea Kpoint 1.1
* Frame #0:0x000000010f557f13 jstest ' __27-[viewcontroller refreshxx]_block_invoke (.block_descriptor=< UNAVAILABLE>, [email protected] "systemversion") + 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::P rotocallframe*) + 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::d ispatchevent (webcore::node*, WTF::P assrefptr< webcore::event>) + 920
Frame #17:0x0000000115c2dc5d webcore ' Webcore::node::d ispatchevent (WTF::P assrefptr<webcore::event>) + 29
Frame #18:0x000000011551561e webcore ' webcore::element::d ispatchmouseevent (webcore::P latformmouseevent const& Wtf::atomicstring const&, int, webcore::element*) + 318
Frame #19:0x00000001155328df webcore ' Webcore::eventhandler::d ispatchmouseevent (wtf::atomicstring const&, webcore::node*, bool, int, WebCore::P latformmouseevent const&, BOOL) + 111
Frame #20:0x0000000115534108 webcore ' webcore::eventhandler::handlemousereleaseevent (webcore::P latformmouseevent 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
IOS JS use with Jscontext