Changeset 256808 in webkit
- Timestamp:
- Feb 17, 2020 7:12:43 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r256786 r256808 1 2020-02-17 Chris Dumez <cdumez@apple.com> 2 3 Defer execution of async scripts until until the document is loaded 4 https://bugs.webkit.org/show_bug.cgi?id=207698 5 <rdar://problem/57625747> 6 7 Reviewed by Antti Koivisto. 8 9 Rebaseline WPT test to reflect behavior change. Some tests start passing and some other are now failing because 10 they rely on specific ordering at network level. 11 12 * web-platform-tests/content-security-policy/script-src/scripthash-changed-1-expected.txt: 13 * web-platform-tests/content-security-policy/script-src/scripthash-changed-2-expected.txt: 14 * web-platform-tests/content-security-policy/script-src/scriptnonce-changed-1-expected.txt: 15 * web-platform-tests/content-security-policy/script-src/scriptnonce-changed-2-expected.txt: 16 * web-platform-tests/html/semantics/scripting-1/the-script-element/async_005-expected.txt: 17 * web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/085-expected.txt: 18 * web-platform-tests/html/semantics/scripting-1/the-script-element/script-text-modifications-expected.txt: 19 1 20 2020-02-17 Rob Buis <rbuis@igalia.com> 2 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/script-src/scripthash-changed-1-expected.txt
r254133 r256808 1 1 2 FAIL scr1.innerText before modification should not be blocked assert_equals: expected "scr1 at #prepare-a-script" but got "" 2 PASS scr1.innerText before modification should not be blocked 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/script-src/scripthash-changed-2-expected.txt
r254133 r256808 1 1 2 FAIL scr2.innerText before modification should be blocked assert_equals: expected "" but got "scr2 at #execute-the-script-block" 2 PASS scr2.innerText before modification should be blocked 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/script-src/scriptnonce-changed-1-expected.txt
r254133 r256808 1 1 2 FAIL scr1 nonce before modification should not be blocked assert_equals: expected "scr1 executed" but got "" 2 PASS scr1 nonce before modification should not be blocked 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/content-security-policy/script-src/scriptnonce-changed-2-expected.txt
r254133 r256808 1 1 2 FAIL scr2 nonce before modification should be blocked assert_equals: expected "" but got "scr2 executed" 2 PASS scr2 nonce before modification should be blocked 3 3 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/async_005-expected.txt
r204090 r256808 1 1 2 PASS A script element with both async and defer set should execute asynchronously 3 2 1342 FAIL A script element with both async and defer set should execute asynchronously assert_equals: expected "2134" but got "2341" 3 2341 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/execution-timing/085-expected.txt
r249886 r256808 1 1 FAILED (This TC requires JavaScript enabled) 2 2 3 PASS scheduler: async script and slow-loading defer script 3 FAIL scheduler: async script and slow-loading defer script assert_array_equals: property 0, expected "external script #2" but got "external script #1" 4 4 -
trunk/LayoutTests/imported/w3c/web-platform-tests/html/semantics/scripting-1/the-script-element/script-text-modifications-expected.txt
r249886 r256808 1 1 2 FAIL Modify inline script element's text after prepare-a-script before evaluation assert_ unreached: This should not be evaluated Reached unreachable code2 FAIL Modify inline script element's text after prepare-a-script before evaluation assert_equals: <script>'s innerText should be already modified expected "t.unreached_func(\"This should not be evaluated\")();" but got "\nt.step(() => {\n // When this is evaluated after the stylesheet is loaded,\n // script0's innerText is modified by the async script above,\n // but the evaluated script is still the original script here,\n // not what is overwritten, because \"child text content\" is taken in\n // #prepare-a-script and passed to \"creating a classic script\".\n var s = document.getElementById('script0');\n assert_equals(s.innerText,\n 't.unreached_func(\"This should not be evaluated\")();',\n \"<script>'s innerText should be already modified\");\n assert_equals(s.text,\n 't.unreached_func(\"This should not be evaluated\")();',\n \"<script>'s text should be already modified\");\n t.done();\n });\n" 3 3 -
trunk/Source/WebCore/ChangeLog
r256805 r256808 1 2020-02-17 Chris Dumez <cdumez@apple.com> 2 3 Defer execution of async scripts until until the document is loaded 4 https://bugs.webkit.org/show_bug.cgi?id=207698 5 <rdar://problem/57625747> 6 7 Reviewed Antti Koivisto. 8 9 Defer execution of async scripts until until the document is loaded by default to reduce time 10 to first paint. 11 12 * dom/ScriptElement.h: 13 * dom/ScriptRunner.cpp: 14 (WebCore::ScriptRunner::timerFired): 15 Make sure we do not defer scripts that were not added by the parser and that do not have the 16 'async' attribute set. 17 18 * page/Settings.yaml: 19 1 20 2020-02-17 Youenn Fablet <youenn@apple.com> 2 21 -
trunk/Source/WebCore/dom/ScriptElement.h
r251290 r256808 54 54 55 55 void executePendingScript(PendingScript&); 56 57 virtual bool hasAsyncAttribute() const = 0; 56 58 57 59 // XML parser calls these … … 113 115 virtual String forAttributeValue() const = 0; 114 116 virtual String eventAttributeValue() const = 0; 115 virtual bool hasAsyncAttribute() const = 0;116 117 virtual bool hasDeferAttribute() const = 0; 117 118 virtual bool hasSourceAttribute() const = 0; -
trunk/Source/WebCore/dom/ScriptRunner.cpp
r233915 r256808 113 113 Vector<RefPtr<PendingScript>> scripts; 114 114 115 if (!m_document.shouldDeferAsynchronousScriptsUntilParsingFinishes()) 115 if (m_document.shouldDeferAsynchronousScriptsUntilParsingFinishes()) { 116 Vector<RefPtr<PendingScript>> scriptsToExecuteSoon; 117 // Scripts not added by the parser are executed asynchronously and yet do not have the 'async' attribute set. 118 // We only want to delay scripts that were explicitly marked as 'async' by the developer. 119 m_scriptsToExecuteSoon.removeAllMatching([&](auto& pendingScript) { 120 if (pendingScript->element().hasAsyncAttribute()) 121 return false; 122 scripts.append(WTFMove(pendingScript)); 123 return true; 124 }); 125 } else 116 126 scripts.swap(m_scriptsToExecuteSoon); 117 127 -
trunk/Source/WebCore/page/Settings.yaml
r256715 r256808 857 857 858 858 shouldDeferAsynchronousScriptsUntilAfterDocumentLoad: 859 initial: false859 initial: true 860 860 861 861 shouldIgnoreMetaViewport: -
trunk/Source/WebKit/ChangeLog
r256806 r256808 1 2020-02-17 Chris Dumez <cdumez@apple.com> 2 3 Defer execution of async scripts until until the document is loaded 4 https://bugs.webkit.org/show_bug.cgi?id=207698 5 <rdar://problem/57625747> 6 7 Reviewed by Antti Koivisto. 8 9 Defer execution of async scripts until until the document is loaded by default to reduce time 10 to first paint. 11 12 * UIProcess/API/Cocoa/WKWebViewConfiguration.mm: 13 (-[WKWebViewConfiguration init]): 14 1 15 2020-02-17 Tim Horton <timothy_horton@apple.com> 2 16 -
trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
r256571 r256808 259 259 _colorFilterEnabled = NO; 260 260 _incompleteImageBorderEnabled = NO; 261 _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = NO;261 _shouldDeferAsynchronousScriptsUntilAfterDocumentLoad = YES; 262 262 _drawsBackground = YES; 263 263
Note: See TracChangeset
for help on using the changeset viewer.