Changeset 233891 in webkit
- Timestamp:
- Jul 17, 2018 11:23:36 AM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 15 edited
- 3 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r233886 r233891 1 2018-07-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add an SPI hook to allow clients to yield document parsing and script execution 4 https://bugs.webkit.org/show_bug.cgi?id=187682 5 <rdar://problem/42207453> 6 7 Reviewed by Ryosuke Niwa. 8 9 Using a single web process for both the Reader page and original web page on watchOS has multiple benefits, 10 including: (1) allowing the user to bail out of Reader and view the original web page without having to load it 11 again, and (2) improving the bringup time of the Reader page, since subresources are already cached in process 12 and we don't eat the additional cost of a web process launch if prewarming fails. 13 14 However, this has some drawbacks as well, one of which is that main thread work being done on behalf of the 15 original page may contend with work being done to load and render the Reader page. This is especially bad when 16 the page is in the middle of executing heavy script after Safari has already detected that the Reader version of 17 the page is available, but before it has finished loading the Reader page. The result is that script on the 18 original page may block the first paint of the Reader page (on New York Times articles, this often leads to an 19 apparent page load time of 25-35 seconds before the user sees anything besides a blank screen). 20 21 To mitigate this, we introduce a way for injected bundle clients to yield parsing and async script execution on 22 a document. This capability is surfaced in the form of an opaque token which clients may request from a 23 WKDOMDocument. Construction of the token causes the document to begin yielding and defer execution of previously 24 scheduled scripts, only if there were no active tokens on the document already. Similarly, destruction of all 25 active tokens on the document causes it to stop yielding and resume execution of scripts if needed. 26 27 Tests: ParserYieldTokenTests.PreventDocumentLoadByTakingParserYieldToken 28 ParserYieldTokenTests.TakeMultipleParserYieldTokens 29 ParserYieldTokenTests.DeferredScriptExecutesBeforeDocumentLoadWhenTakingParserYieldToken 30 ParserYieldTokenTests.AsyncScriptRunsWhenFetched 31 32 * dom/Document.cpp: 33 (WebCore::Document::implicitOpen): 34 35 If the parser yield token was taken before the document's parser was created, tell the parser's scheduler to 36 start yielding immediately after creation. 37 38 (WebCore::DocumentParserYieldToken::DocumentParserYieldToken): 39 (WebCore::DocumentParserYieldToken::~DocumentParserYieldToken): 40 * dom/Document.h: 41 42 Introduce a parser yield count to Document; as long as this count is greater than 0, we consider the Document to 43 have active yield tokens. When constructing or destroying a ParserYieldToken, we increment and decrement the 44 parser yield count (respectively). 45 46 (WebCore::Document::createParserYieldToken): 47 (WebCore::Document::hasActiveParserYieldToken const): 48 * dom/DocumentParser.h: 49 (WebCore::DocumentParser::didBeginYieldingParser): 50 (WebCore::DocumentParser::didEndYieldingParser): 51 52 Hooks for Document to tell its parser that we've started or finished yielding. This updates a flag on the 53 parser's scheduler which is consulted when we determine whether to yield before a pumping token or executing 54 script. 55 56 * dom/ScriptRunner.cpp: 57 (WebCore::ScriptRunner::resume): 58 (WebCore::ScriptRunner::notifyFinished): 59 * dom/ScriptRunner.h: 60 (WebCore::ScriptRunner::didBeginYieldingParser): 61 (WebCore::ScriptRunner::didEndYieldingParser): 62 63 Hooks for Document to tell its ScriptRunner that we've started or finished yielding. These wrap calls to suspend 64 and resume. 65 66 * html/parser/HTMLDocumentParser.cpp: 67 (WebCore::HTMLDocumentParser::didBeginYieldingParser): 68 (WebCore::HTMLDocumentParser::didEndYieldingParser): 69 70 Plumb to didBegin/didEnd calls to the HTMLParserScheduler. 71 72 * html/parser/HTMLDocumentParser.h: 73 * html/parser/HTMLParserScheduler.cpp: 74 (WebCore::HTMLParserScheduler::shouldYieldBeforeExecutingScript): 75 * html/parser/HTMLParserScheduler.h: 76 (WebCore::HTMLParserScheduler::shouldYieldBeforeToken): 77 78 Consult a flag when determining whether to yield. This flag is set to true only while the document has an active 79 parser yield token. 80 81 (WebCore::HTMLParserScheduler::isScheduledForResume const): 82 83 Consider the parser scheduler to be scheduled for resume if there are active tokens. Without this change, we 84 incorrectly consider the document to be finished loading when we have yield tokens, since it appears that the 85 parser is no longer scheduled to pump its tokenizer. 86 87 (WebCore::HTMLParserScheduler::didBeginYieldingParser): 88 (WebCore::HTMLParserScheduler::didEndYieldingParser): 89 90 When the Document begins yielding due to the documet having active tokens or ends yielding after the document 91 loses all of its yield tokens, update a flag on the parser scheduler. After we finish yielding, additionally 92 reschedule the parser if needed to ensure that we continue parsing the document; without this additional change 93 to resume, we'll never get the document load or load events after relinquishing the yield token. 94 1 95 2018-07-17 Dirk Schulze <krit@webkit.org> 2 96 -
trunk/Source/WebCore/dom/Document.cpp
r233865 r233891 2687 2687 cancelParsing(); 2688 2688 m_parser = createParser(); 2689 2690 if (hasActiveParserYieldToken()) 2691 m_parser->didBeginYieldingParser(); 2692 2689 2693 setParsing(true); 2690 2694 setReadyState(Loading); … … 6902 6906 } 6903 6907 6908 DocumentParserYieldToken::DocumentParserYieldToken(Document& document) 6909 : m_document(makeWeakPtr(document)) 6910 { 6911 if (++document.m_parserYieldTokenCount != 1) 6912 return; 6913 6914 document.scriptRunner()->didBeginYieldingParser(); 6915 if (auto* parser = document.parser()) 6916 parser->didBeginYieldingParser(); 6917 } 6918 6919 DocumentParserYieldToken::~DocumentParserYieldToken() 6920 { 6921 if (!m_document) 6922 return; 6923 6924 ASSERT(m_document->m_parserYieldTokenCount); 6925 if (--m_document->m_parserYieldTokenCount) 6926 return; 6927 6928 m_document->scriptRunner()->didEndYieldingParser(); 6929 if (auto* parser = m_document->parser()) 6930 parser->didEndYieldingParser(); 6931 } 6932 6904 6933 static RenderElement* nearestCommonHoverAncestor(RenderElement* obj1, RenderElement* obj2) 6905 6934 { -
trunk/Source/WebCore/dom/Document.h
r233794 r233891 318 318 >; 319 319 320 class DocumentParserYieldToken { 321 public: 322 WEBCORE_EXPORT DocumentParserYieldToken(Document&); 323 WEBCORE_EXPORT ~DocumentParserYieldToken(); 324 325 private: 326 WeakPtr<Document> m_document; 327 }; 328 320 329 class Document 321 330 : public ContainerNode … … 1267 1276 void decrementActiveParserCount(); 1268 1277 1278 std::unique_ptr<DocumentParserYieldToken> createParserYieldToken() 1279 { 1280 return std::make_unique<DocumentParserYieldToken>(*this); 1281 } 1282 1283 bool hasActiveParserYieldToken() const { return m_parserYieldTokenCount; } 1284 1269 1285 DocumentSharedObjectPool* sharedObjectPool() { return m_sharedObjectPool.get(); } 1270 1286 … … 1461 1477 1462 1478 private: 1479 friend class DocumentParserYieldToken; 1463 1480 friend class Node; 1464 1481 friend class IgnoreDestructiveWriteCountIncrementer; … … 1578 1595 Ref<CachedResourceLoader> m_cachedResourceLoader; 1579 1596 RefPtr<DocumentParser> m_parser; 1597 1598 unsigned m_parserYieldTokenCount { 0 }; 1580 1599 1581 1600 // Document URLs. -
trunk/Source/WebCore/dom/DocumentParser.h
r210216 r233891 97 97 virtual void resumeScheduledTasks(); 98 98 99 virtual void didBeginYieldingParser() { } 100 virtual void didEndYieldingParser() { } 101 99 102 protected: 100 103 explicit DocumentParser(Document&); -
trunk/Source/WebCore/dom/ScriptRunner.cpp
r215160 r233891 83 83 void ScriptRunner::resume() 84 84 { 85 if (hasPendingScripts() )85 if (hasPendingScripts() && !m_document.hasActiveParserYieldToken()) 86 86 m_timer.startOneShot(0_s); 87 87 } … … 96 96 } 97 97 pendingScript.clearClient(); 98 m_timer.startOneShot(0_s); 98 99 if (!m_document.hasActiveParserYieldToken()) 100 m_timer.startOneShot(0_s); 99 101 } 100 102 -
trunk/Source/WebCore/dom/ScriptRunner.h
r210319 r233891 51 51 void notifyScriptReady(ScriptElement*, ExecutionType); 52 52 53 void didBeginYieldingParser() { suspend(); } 54 void didEndYieldingParser() { resume(); } 55 53 56 private: 54 57 void timerFired(); -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.cpp
r233572 r233891 149 149 } 150 150 151 void HTMLDocumentParser::didBeginYieldingParser() 152 { 153 m_parserScheduler->didBeginYieldingParser(); 154 } 155 156 void HTMLDocumentParser::didEndYieldingParser() 157 { 158 m_parserScheduler->didEndYieldingParser(); 159 } 160 151 161 bool HTMLDocumentParser::isParsingFragment() const 152 162 { -
trunk/Source/WebCore/html/parser/HTMLDocumentParser.h
r212614 r233891 122 122 bool shouldDelayEnd() const; 123 123 124 void didBeginYieldingParser() final; 125 void didEndYieldingParser() final; 126 124 127 HTMLParserOptions m_options; 125 128 HTMLInputStream m_input; -
trunk/Source/WebCore/html/parser/HTMLParserScheduler.cpp
r229174 r233891 112 112 bool needsFirstPaint = document->view() && !document->view()->hasEverPainted(); 113 113 session.didSeeScript = true; 114 115 if (UNLIKELY(m_documentHasActiveParserYieldTokens)) 116 return true; 117 114 118 return needsFirstPaint && document->isLayoutTimerActive(); 115 119 } -
trunk/Source/WebCore/html/parser/HTMLParserScheduler.h
r229209 r233891 70 70 return true; 71 71 #endif 72 if (UNLIKELY(m_documentHasActiveParserYieldTokens)) 73 return true; 74 72 75 if (UNLIKELY(session.processedTokens > numberOfTokensBeforeCheckingForYield || session.didSeeScript)) 73 76 return checkForYield(session); … … 79 82 80 83 void scheduleForResume(); 81 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m_continueNextChunkTimer.isActive() ; }84 bool isScheduledForResume() const { return m_isSuspendedWithActiveTimer || m_continueNextChunkTimer.isActive() || m_documentHasActiveParserYieldTokens; } 82 85 83 86 void suspend(); 84 87 void resume(); 88 89 void didBeginYieldingParser() 90 { 91 ASSERT(!m_documentHasActiveParserYieldTokens); 92 m_documentHasActiveParserYieldTokens = true; 93 } 94 95 void didEndYieldingParser() 96 { 97 ASSERT(m_documentHasActiveParserYieldTokens); 98 m_documentHasActiveParserYieldTokens = false; 99 100 if (!isScheduledForResume()) 101 scheduleForResume(); 102 } 85 103 86 104 private: … … 113 131 bool m_suspended; 114 132 #endif 133 bool m_documentHasActiveParserYieldTokens { false }; 115 134 }; 116 135 -
trunk/Source/WebKit/ChangeLog
r233888 r233891 1 2018-07-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add an SPI hook to allow clients to yield document parsing and script execution 4 https://bugs.webkit.org/show_bug.cgi?id=187682 5 <rdar://problem/42207453> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add hooks to WKDOMDocument to create and return an internal WKDOMDocumentParserYieldToken object, whose lifetime 10 is tied to a document parser yield token. See WebCore ChangeLog for more detail. 11 12 * WebProcess/InjectedBundle/API/mac/WKDOMDocument.h: 13 * WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm: 14 (-[WKDOMDocumentParserYieldToken initWithDocument:]): 15 (-[WKDOMDocument parserYieldToken]): 16 1 17 2018-07-17 John Wilander <wilander@apple.com> 2 18 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.h
r230121 r233891 43 43 @property(readonly) WKDOMElement *body; 44 44 45 - (id)parserYieldToken WK_API_AVAILABLE(macosx(WK_MAC_TBA), ios(WK_IOS_TBA)); 46 45 47 @end 46 48 -
trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKDOMDocument.mm
r226467 r233891 36 36 #import <WebCore/markup.h> 37 37 38 @interface WKDOMDocumentParserYieldToken : NSObject 39 40 @end 41 42 @implementation WKDOMDocumentParserYieldToken { 43 std::unique_ptr<WebCore::DocumentParserYieldToken> _token; 44 } 45 46 - (instancetype)initWithDocument:(WebCore::Document&)document 47 { 48 if (self = [super init]) 49 _token = document.createParserYieldToken(); 50 return self; 51 } 52 53 @end 54 38 55 @implementation WKDOMDocument 39 56 … … 67 84 } 68 85 86 - (id)parserYieldToken 87 { 88 return [[[WKDOMDocumentParserYieldToken alloc] initWithDocument:downcast<WebCore::Document>(*_impl)] autorelease]; 89 } 90 69 91 @end 70 92 -
trunk/Tools/ChangeLog
r233890 r233891 1 2018-07-17 Wenson Hsieh <wenson_hsieh@apple.com> 2 3 Add an SPI hook to allow clients to yield document parsing and script execution 4 https://bugs.webkit.org/show_bug.cgi?id=187682 5 <rdar://problem/42207453> 6 7 Reviewed by Ryosuke Niwa. 8 9 Add a few tests to exercise the new document yield token SPI, verifying that clients can use the SPI to defer 10 document load, and that doing so doesn't cause deferred `script` to execute in the wrong order (i.e. before 11 synchronous script, or after "DOMContentLoaded"). 12 13 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 14 * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenPlugIn.mm: Added. 15 (-[ParserYieldTokenPlugIn takeDocumentParserTokenAfterCommittingLoad]): 16 (-[ParserYieldTokenPlugIn releaseDocumentParserToken]): 17 (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didCommitLoadForFrame:]): 18 (-[ParserYieldTokenPlugIn webProcessPlugIn:didCreateBrowserContextController:]): 19 (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didFinishDocumentLoadForFrame:]): 20 (-[ParserYieldTokenPlugIn webProcessPlugInBrowserContextController:didFinishLoadForFrame:]): 21 22 Add an injected bundle object that knows how to take and release multiple document parser yield tokens. 23 24 * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenTests.h: Added. 25 * TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenTests.mm: Added. 26 (+[ParserYieldTokenTestWebView webView]): 27 (-[ParserYieldTokenTestWebView bundle]): 28 (-[ParserYieldTokenTestWebView schemeHandler]): 29 (-[ParserYieldTokenTestWebView didFinishDocumentLoad]): 30 (-[ParserYieldTokenTestWebView didFinishLoad]): 31 (waitForDelay): 32 (TEST): 33 * TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.h: Added. 34 * TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.mm: Added. 35 (-[TestURLSchemeHandler webView:startURLSchemeTask:]): 36 (-[TestURLSchemeHandler webView:stopURLSchemeTask:]): 37 (-[TestURLSchemeHandler setStartURLSchemeTaskHandler:]): 38 (-[TestURLSchemeHandler startURLSchemeTaskHandler]): 39 (-[TestURLSchemeHandler setStopURLSchemeTaskHandler:]): 40 (-[TestURLSchemeHandler stopURLSchemeTaskHandler]): 41 42 Add a new test helper class to handle custom schemes via a block-based API. 43 44 * TestWebKitAPI/Tests/WebKitCocoa/text-with-async-script.html: Added. 45 46 New test HTML page that contains a deferred script element, a synchronous script element, another deferred 47 script element, and then some text, images, and links. 48 49 * TestWebKitAPI/Tests/WebKitCocoa/text-with-deferred-script.html: Added. 50 1 51 2018-07-17 Truitt Savell <tsavell@apple.com> 2 52 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r233798 r233891 782 782 F43E3BC120DADBC500A4E7ED /* fixed-nav-bar.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */; }; 783 783 F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */; }; 784 F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */; }; 785 F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */; }; 786 F44C7A0520FAAE3C0014478C /* text-with-deferred-script.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F44C7A0420FAAE320014478C /* text-with-deferred-script.html */; }; 784 787 F44D06451F395C26001A0E29 /* editor-state-test-harness.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */; }; 785 788 F44D06471F39627A001A0E29 /* EditorStateTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F44D06461F395C4D001A0E29 /* EditorStateTests.mm */; }; … … 812 815 F4C2AB221DD6D95E00E06D5B /* enormous-video-with-sound.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */; }; 813 816 F4C8797F2059D8D3009CD00B /* ScrollViewInsetTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */; }; 817 F4CD74C620FDACFA00DE3794 /* text-with-async-script.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = F4CD74C520FDACF500DE3794 /* text-with-async-script.html */; }; 818 F4CD74C920FDB49600DE3794 /* TestURLSchemeHandler.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */; }; 814 819 F4D4F3B61E4E2BCB00BB2767 /* DataInteractionSimulator.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4D4F3B41E4E2BCB00BB2767 /* DataInteractionSimulator.mm */; }; 815 820 F4D4F3B91E4E36E400BB2767 /* DataInteractionTests.mm in Sources */ = {isa = PBXBuildFile; fileRef = F4D4F3B71E4E36E400BB2767 /* DataInteractionTests.mm */; }; … … 899 904 dstSubfolderSpec = 7; 900 905 files = ( 901 46AE5A3720F9066D00E0873E /* SimpleServiceWorkerRegistrations-3.sqlite3 in Copy Resources */,902 906 1A9E52C913E65EF4006917F5 /* 18-characters.html in Copy Resources */, 903 907 379028B914FAC24C007E6B43 /* acceptsFirstMouse.html in Copy Resources */, … … 1126 1130 51E5C7021919C3B200D8B3E1 /* simple2.html in Copy Resources */, 1127 1131 51E5C7031919C3B200D8B3E1 /* simple3.html in Copy Resources */, 1132 46AE5A3720F9066D00E0873E /* SimpleServiceWorkerRegistrations-3.sqlite3 in Copy Resources */, 1128 1133 F4F405BD1D4C0D1C007A9707 /* skinny-autoplaying-video-with-audio.html in Copy Resources */, 1129 1134 C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */, … … 1139 1144 7AE9E5091AE5AE8B00CF874B /* test.pdf in Copy Resources */, 1140 1145 2E9896151D8F093800739892 /* text-and-password-inputs.html in Copy Resources */, 1146 F4CD74C620FDACFA00DE3794 /* text-with-async-script.html in Copy Resources */, 1147 F44C7A0520FAAE3C0014478C /* text-with-deferred-script.html in Copy Resources */, 1141 1148 F41AB9AA1EF4696B0083FA08 /* textarea-to-input.html in Copy Resources */, 1142 1149 F4451C761EB8FD890020C5DA /* two-paragraph-contenteditable.html in Copy Resources */, … … 1977 1984 F43E3BC020DADB8000A4E7ED /* fixed-nav-bar.html */ = {isa = PBXFileReference; lastKnownFileType = text.html; path = "fixed-nav-bar.html"; sourceTree = "<group>"; }; 1978 1985 F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "two-paragraph-contenteditable.html"; sourceTree = "<group>"; }; 1986 F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenPlugIn.mm; sourceTree = "<group>"; }; 1987 F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ParserYieldTokenTests.h; sourceTree = "<group>"; }; 1988 F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ParserYieldTokenTests.mm; sourceTree = "<group>"; }; 1989 F44C7A0420FAAE320014478C /* text-with-deferred-script.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "text-with-deferred-script.html"; sourceTree = "<group>"; }; 1979 1990 F44D06441F395C0D001A0E29 /* editor-state-test-harness.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "editor-state-test-harness.html"; sourceTree = "<group>"; }; 1980 1991 F44D06461F395C4D001A0E29 /* EditorStateTests.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EditorStateTests.mm; sourceTree = "<group>"; }; … … 2011 2022 F4C2AB211DD6D94100E06D5B /* enormous-video-with-sound.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "enormous-video-with-sound.html"; sourceTree = "<group>"; }; 2012 2023 F4C8797E2059D8D3009CD00B /* ScrollViewInsetTests.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollViewInsetTests.mm; sourceTree = "<group>"; }; 2024 F4CD74C520FDACF500DE3794 /* text-with-async-script.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "text-with-async-script.html"; sourceTree = "<group>"; }; 2025 F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TestURLSchemeHandler.h; sourceTree = "<group>"; }; 2026 F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = TestURLSchemeHandler.mm; sourceTree = "<group>"; }; 2013 2027 F4D4F3B41E4E2BCB00BB2767 /* DataInteractionSimulator.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DataInteractionSimulator.mm; sourceTree = "<group>"; }; 2014 2028 F4D4F3B51E4E2BCB00BB2767 /* DataInteractionSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataInteractionSimulator.h; sourceTree = "<group>"; }; … … 2275 2289 CEA6CF2219CCF5BD0064F5A7 /* OpenAndCloseWindow.mm */, 2276 2290 CEBCA12E1E3A660100C73293 /* OverrideContentSecurityPolicy.mm */, 2291 F44C79FB20F9E50C0014478C /* ParserYieldTokenPlugIn.mm */, 2292 F44C79FD20F9E8710014478C /* ParserYieldTokenTests.h */, 2293 F44C79FE20F9E8710014478C /* ParserYieldTokenTests.mm */, 2277 2294 9BCB7C2620130600003E7C0C /* PasteHTML.mm */, 2278 2295 9BDCCD851F7D0B0700009A18 /* PasteImage.mm */, … … 2303 2320 515BE1701D428BD100DD7C68 /* StoreBlobThenDelete.mm */, 2304 2321 1C734B5220788C4800F430EA /* SystemColors.mm */, 2322 F4CD74C720FDB49600DE3794 /* TestURLSchemeHandler.h */, 2323 F4CD74C820FDB49600DE3794 /* TestURLSchemeHandler.mm */, 2305 2324 5CB40B4D1F4B98BE007DC7B9 /* UIDelegate.mm */, 2306 2325 7CC3E1FA197E234100BE6252 /* UserContentController.mm */, … … 2644 2663 9BD6D39E1F7B201E00BD4962 /* sunset-in-cupertino-600px.jpg */, 2645 2664 2E9896141D8F092B00739892 /* text-and-password-inputs.html */, 2665 F4CD74C520FDACF500DE3794 /* text-with-async-script.html */, 2666 F44C7A0420FAAE320014478C /* text-with-deferred-script.html */, 2646 2667 F41AB9951EF4692C0083FA08 /* textarea-to-input.html */, 2647 2668 F4451C751EB8FD7C0020C5DA /* two-paragraph-contenteditable.html */, … … 3760 3781 7CCE7F091A411AE600447C4C /* ParentFrame.cpp in Sources */, 3761 3782 7C83E0511D0A641800FEBCF3 /* ParsedContentRange.cpp in Sources */, 3783 F44C79FF20F9E8710014478C /* ParserYieldTokenTests.mm in Sources */, 3762 3784 7CCE7F0A1A411AE600447C4C /* PasteboardNotifications.mm in Sources */, 3763 3785 9BCB7C2820130600003E7C0C /* PasteHTML.mm in Sources */, … … 3843 3865 A14FC5901B8AE36F00D107EB /* TestProtocol.mm in Sources */, 3844 3866 7CCE7EAE1A411A3400447C4C /* TestsController.cpp in Sources */, 3867 F4CD74C920FDB49600DE3794 /* TestURLSchemeHandler.mm in Sources */, 3845 3868 2EFF06D41D8AEDBB0004BB30 /* TestWKWebView.mm in Sources */, 3846 3869 F4517B672054C49500C26721 /* TestWKWebViewController.mm in Sources */, … … 3967 3990 5CB5B3C21FFC55CF00C27BB0 /* FrameHandleSerialization.mm in Sources */, 3968 3991 79C5D431209D768300F1E7CA /* InjectedBundleNodeHandleIsTextField.mm in Sources */, 3992 F44C7A0020F9EEBF0014478C /* ParserYieldTokenPlugIn.mm in Sources */, 3969 3993 A13EBBAB1B87434600097110 /* PlatformUtilitiesCocoa.mm in Sources */, 3970 3994 1A4F81CF1BDFFD53004E672E /* RemoteObjectRegistryPlugIn.mm in Sources */, -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/ParserYieldTokenTests.h
r233890 r233891 1 1 /* 2 * Copyright (C) 201 2Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 # import <WebKit/WKFoundation.h>26 #pragma once 27 27 28 #if WK_API_ENABLED 29 30 #import <WebKit/WKDOMNode.h> 31 32 @class WKDOMElement; 33 @class WKDOMText; 34 35 WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0)) 36 @interface WKDOMDocument : WKDOMNode 37 38 - (WKDOMElement *)createElement:(NSString *)tagName; 39 - (WKDOMText *)createTextNode:(NSString *)data; 40 - (WKDOMNode *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 41 - (WKDOMNode *)createDocumentFragmentWithText:(NSString *)text WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 42 43 @property(readonly) WKDOMElement *body; 44 28 @protocol ParserYieldTokenTestRunner <NSObject> 29 - (void)didFinishDocumentLoad; 30 - (void)didFinishLoad; 45 31 @end 46 32 47 #endif // WK_API_ENABLED 33 @protocol ParserYieldTokenTestBundle <NSObject> 34 - (void)takeDocumentParserTokenAfterCommittingLoad; 35 - (void)releaseDocumentParserToken; 36 @end -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.h
r233890 r233891 1 1 /* 2 * Copyright (C) 201 2Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import <WebKit/WKFoundation.h> 26 #pragma once 27 28 #import <WebKit/WebKit.h> 27 29 28 30 #if WK_API_ENABLED 29 31 30 #import <WebKit/WKDOMNode.h>32 @interface TestURLSchemeHandler : NSObject <WKURLSchemeHandler> 31 33 32 @class WKDOMElement; 33 @class WKDOMText; 34 35 WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0)) 36 @interface WKDOMDocument : WKDOMNode 37 38 - (WKDOMElement *)createElement:(NSString *)tagName; 39 - (WKDOMText *)createTextNode:(NSString *)data; 40 - (WKDOMNode *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 41 - (WKDOMNode *)createDocumentFragmentWithText:(NSString *)text WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 42 43 @property(readonly) WKDOMElement *body; 34 @property (nonatomic, copy) void (^startURLSchemeTaskHandler)(WKWebView *, id <WKURLSchemeTask>); 35 @property (nonatomic, copy) void (^stopURLSchemeTaskHandler)(WKWebView *, id <WKURLSchemeTask>); 44 36 45 37 @end -
trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/TestURLSchemeHandler.mm
r233890 r233891 1 1 /* 2 * Copyright (C) 201 2Apple Inc. All rights reserved.2 * Copyright (C) 2018 Apple Inc. All rights reserved. 3 3 * 4 4 * Redistribution and use in source and binary forms, with or without … … 24 24 */ 25 25 26 #import <WebKit/WKFoundation.h> 26 #include "config.h" 27 #include "TestURLSchemeHandler.h" 28 29 #import <wtf/BlockPtr.h> 27 30 28 31 #if WK_API_ENABLED 29 32 30 #import <WebKit/WKDOMNode.h> 33 @implementation TestURLSchemeHandler { 34 BlockPtr<void(WKWebView *, id <WKURLSchemeTask>)> _startURLSchemeTaskHandler; 35 BlockPtr<void(WKWebView *, id <WKURLSchemeTask>)> _stopURLSchemeTaskHandler; 36 } 31 37 32 @class WKDOMElement; 33 @class WKDOMText; 38 - (void)webView:(WKWebView *)webView startURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask 39 { 40 if (_startURLSchemeTaskHandler) 41 _startURLSchemeTaskHandler(webView, urlSchemeTask); 42 } 34 43 35 WK_CLASS_AVAILABLE(macosx(10.10), ios(8.0)) 36 @interface WKDOMDocument : WKDOMNode 44 - (void)webView:(WKWebView *)webView stopURLSchemeTask:(id <WKURLSchemeTask>)urlSchemeTask 45 { 46 if (_stopURLSchemeTaskHandler) 47 _stopURLSchemeTaskHandler(webView, urlSchemeTask); 48 } 37 49 38 - ( WKDOMElement *)createElement:(NSString *)tagName;39 - (WKDOMText *)createTextNode:(NSString *)data; 40 - (WKDOMNode *)createDocumentFragmentWithMarkupString:(NSString *)markupString baseURL:(NSURL *)baseURL WK_API_AVAILABLE(macosx(10.13.4), ios(11.3));41 - (WKDOMNode *)createDocumentFragmentWithText:(NSString *)text WK_API_AVAILABLE(macosx(10.13.4), ios(11.3)); 50 - (void)setStartURLSchemeTaskHandler:(void (^)(WKWebView *, id <WKURLSchemeTask>))block 51 { 52 _startURLSchemeTaskHandler = makeBlockPtr(block); 53 } 42 54 43 @property(readonly) WKDOMElement *body; 55 - (void (^)(WKWebView *, id <WKURLSchemeTask>))startURLSchemeTaskHandler 56 { 57 return _startURLSchemeTaskHandler.get(); 58 } 59 60 - (void)setStopURLSchemeTaskHandler:(void (^)(WKWebView *, id <WKURLSchemeTask>))block 61 { 62 _startURLSchemeTaskHandler = makeBlockPtr(block); 63 } 64 65 - (void (^)(WKWebView *, id <WKURLSchemeTask>))stopURLSchemeTaskHandler 66 { 67 return _stopURLSchemeTaskHandler.get(); 68 } 44 69 45 70 @end
Note: See TracChangeset
for help on using the changeset viewer.