WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
NEW
193908
"async" and "defer" script elements delay painting
https://bugs.webkit.org/show_bug.cgi?id=193908
Summary
"async" and "defer" script elements delay painting
darren.hebner
Reported
2019-01-28 07:40:07 PST
Created
attachment 360341
[details]
GIF showing the expected behaviour and the current behaviour in Safari I'm noticing that Safari does not render anything until all JavaScript has been downloaded and executed. This includes deferred and async scripts as well as scripts that appear just before the closing body tag. I've created a small site to demonstrate this behaviour:
https://wkwebviewtest.surge.sh/
This demo site features a script tag with the "defer" attribute in the <head> of the document. This script is intentionally slow and takes ~5s to execute. When the script is finished, it appends a message to the page. The expected behaviour is for the HTML to render immediately since the pages JavaScript is deferred. To reproduce, visit the demo site in new window or tab. You will see that the browser waits until the script has finished executing (~5s) before it renders anything. It's worth noting that I'm seeing the same behaviour in all of these scenarios: - The script is in the <head> with the "defer" attribute - The script is in the <head> with the "async" attribute - The script is just before the closing </body> tag. This behaviour is detrimental to performance and goes against the benefits of using the defer attribute. Thank you in advance for your help!
Attachments
GIF showing the expected behaviour and the current behaviour in Safari
(6.26 MB, image/gif)
2019-01-28 07:40 PST
,
darren.hebner
no flags
Details
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2019-01-28 11:00:44 PST
Zalan, does your new first paint stuff improve this?
Radar WebKit Bug Importer
Comment 2
2019-01-28 11:00:49 PST
<
rdar://problem/47602939
>
zalan
Comment 3
2019-02-04 20:54:55 PST
first part of the fix:
bug 194168
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug