IOS Safari reading mode analysis process

Source: Internet
Author: User

IOS Safari reading mode analysis process
This article is a record of the analysis process of Safari reading mode, which is not well organized. For the final output, see another iOS Safari reading mode study. 1. break on evaluateb JSC: evaluate (JSC: ExecState *, JSC: ScopeChainNode *, JSC: SourceCode const &, JSC: JSValue, JSC: JSValue *) dump the source content from JSC: SourceCode
Printing description of source. m_provider.m_ptr-> m_url:
(WTF: String) m_url = {length = 0, contents = ''}{
M_impl = {
M_ptr = 0x0000000000000000 {length = 0, is8bit = 0, contents = ''}
}
}
Printing description of source. m_provider.m_ptr-> m_source:
(WTF: String) m_source = {length = 66370, contents = '/*
* Copyright©2010 Apple Inc. All rights reserved.
*/...... 2. Call Stack 3.(Lldb) Image list[0] 396DF4E9-18D6-3C39-B1FB-E783D7F9B947Zero x 00001000/Applications/Xcode. app/Contents/Developer/Platforms/iPhoneSimulator. platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Applications/MobileSafari. app/MobileSafari-> browse (0x702a5)-> 0x6fdc8 (0x6fe19)-> 0x6fd9a (0x6fdb5)-> XREF:-[ReaderTestProcessor _ processReaderTestResult: tabDocument:] &-[ReaderContext isReaderAvailable] 0x6eac5 (0x6eae5)->-[ReaderContext isReaderAvailable] 0xa3d84 (0xa3dd3)-> XREF:-[TabDocument _ signature] HandleRunSource I. find the starting point 3483-> 0xa3d15-[TabDocument _ detectReaderAvailabilityOnWebThread] 3490-> 0xa3f56 (0xa404b)-[TabDocument_detectReaderAvailabilityNow] ii. who initiated _ detectReaderAvailabilityNow-[BrowserController stopFromAddressView:]-[TabDocument _ progressDidStall]-[TabDocument webView: didFinishLoadForFrame:] ->-[TabDocument detectReaderAvailabilitySoon] 3496-> 0xa4279-[TabDocument succeeded] 3274-> 0x9c16b (0x9c1ad)-[TabDocument webView: didFinishLoadForFrame:] 4. (FAILED)B-[UIView setHidden:](Lldb) ShowParameters 3
$56 = 0x09a43aa0 >
0x08d60840: "setHidden :" 5. B-[UIView setFrame:](Lldb) ShowParameters 3
$26 = 0x0a984730 >
0x07b37881: "setFrame :"
0x07b3788b: "addSubview:" 96-> 0x6d38 (0x6f9d):-[AddressView _ blank: forEditing: textField: showInactiveFieldWhileEditing:] 257-> 0x126a4 (0x1288a ): -[AddressView layoutReaderButton] 3482-> 0xa3927 (0xa3caf):-[TabDocument _ partition:] 3485-> 0xa3e3f (0xa3e6b): (MEM: partition)-[AddressViewaccessibility (SafeCategory) layoutReaderButton] 6. (FAILED) according to the WebKit Objective-C Programming Guide, to obtain JS data, you must first obtain the window object: Id win = [webview windowScriptObject];And all JS objects are packaged using WebScriptObject. Summary: webcore'-[WebScriptObject valueForKey:] Address: WebCore [0x00d35b30] (WebCore. _ TEXT. _ text + 13843984) (Lldb) B webcore'-[WebScriptObject valueForKey:]
Breakpoint 14: where = webcore'-[WebScriptObject valueForKey:], address = 0x03581700 7. tabDocument:-(void) _ region; // IMP = 0x000a3f56-(void) _ region; // IMP = 0x000a3d15-(void) _ didDetectReaderAvailability :( BOOL) arg1; // IMP = 0x000a3927 8.var ReaderArticleFinderJS = new ReaderArticleFinder (document ); 6fdc8 (6fe24)-> 1b3ba (1b3d6)-> isReaderModeAvailable  9. breakJSObjectGetProperty (Lldb) P/X' * (int *) ($ ebp + 16 )'
(Int) $33 = 0x000debdf
(Lldb) Mem read '$33'
0x000debdf: 69 73 52 65 61 64 65 72 4d 6f 64 65 41 76 61 69 isReaderModeAvai
0x000debef: 6c 61 62 6c 65 00 70 72 65 70 61 72 65 54 6f 54 lable. prepareToT 10. you also need to get the object 450-> 0x1b774 (0x1b777)-> returnReaderArticleFinderJS1656-> 0x5a70c (0x5a76e)-> 2193-> 0x70224 (0x70315) -> 2186-> 0x6fdc8 (0x6fe19)-> 2185-> 0x6fd9a (0x6fdb5)-> XREF:-[ReaderTestProcessor _ processReaderTestResult: tabDocument:] &-[ReaderContext isReaderAvailable] 2125-> 0x6eac5 (0x6eae5)->-[ReaderContext isReaderA Vailable] 3484-> 0xa3d84 (0xa3dd3)-> XREF:-[TabDocument _ detectReaderAvailabilityOnWebThread] 11. click the "Reader" button0.. confirm again Reader Mode 2193-> 0x70224 (0x702a5) 2186-> 0x6fdc8 (0x6fe19) 2195-> 0x70372 (0x70387) WebThreadLock, call 6fdc8. 2146-> 0x6f3cd (0x6f3f1)->-[ReaderContext createArticleFinder] 978-> 0x38445 (0x384f5) [BrowserController setShowingReader: animated] 122-> 0x995c (0x99bc) -> bShowing = [[ BrowserControllersharedBrowserController] isShowingReader]; [[BrowserControllersharedBrowserController] setShowingReader: bShowing animated: YES] B. display content I. load html file-> loadRequest (Reader ~ Ipad.html) 2132-> 0x6ee1e (0x6ee96) [ReaderContextloadReaderDocument] 2118-> 0x6e85b (0x6e959) [ReaderContext createWebViewIfNeeded] 3491-> 0xa4053 (0xa4097) [TabDocumentcreateBrowserReaderViewIfNeeded] 979-> 0x38549 (0x38610) [BrowserControllershowReaderForTabDocument] 978-> 0x38445 (0x38526) [BrowserController setShowingReader: animated] 122-> 0x995c (0x99bc) bShowing = [[BrowserControllersharedBrowserController] isShowingReader]; [[BrowserControllersharedBrowserController] setShowingReader: bShowing animated: YES] ii. when WebView allows window object modification, execute the Read mode processing script 2205-> 0x705ce (0x7066f) 2127-> 0x6eb17 (0x6eb62)-[ReaderContext initReaderJSController:] 1296-> 0x4952c (0x49588) [BrowserReaderViewuiWebView: didClearWindowObject: forFrame] iii. after the page is loaded, the following JavaScript code is executed:

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.