WebKit Bugzilla
Attachment 372794 Details for
Bug 199173
: Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-199173-20190624133059.patch (text/plain), 5.62 KB, created by
Chris Dumez
on 2019-06-24 13:31:00 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Chris Dumez
Created:
2019-06-24 13:31:00 PDT
Size:
5.62 KB
patch
obsolete
>Subversion Revision: 246744 >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index 9d44f8e3995e16229fb3612f743fbe29129765b1..9c96e4245d158409ea40f0bf536c2a71373fe81c 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,27 @@ >+2019-06-24 Chris Dumez <cdumez@apple.com> >+ >+ Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint >+ https://bugs.webkit.org/show_bug.cgi?id=199173 >+ <rdar://problem/45968770> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Pages using Google's anti-flicker optimization [1] take ~5 seconds to do initial paint when >+ analytics.js load is blocked by a content blocker. >+ >+ To address the issue, this patch introduces a quirk behind an experimental feature flag that >+ calls window.dataLayer.hide.end() on the page when the load of https://www.google-analytics.com/analytics.js >+ is blocked by a content blocker. Note that this is more robust than dropping the 'async-hide' >+ class from document.documentElement since the class name is customizable by the caller. >+ A message is logged in the console when the quirk causes window.dataLayer.hide.end() to get called >+ early. >+ >+ [1] https://developers.google.com/optimize/ >+ >+ * contentextensions/ContentExtensionsBackend.cpp: >+ (WebCore::ContentExtensions::ContentExtensionsBackend::processContentRuleListsForLoad): >+ * page/Settings.yaml: >+ > 2019-06-24 Greg Doolittle <gr3g@apple.com> > > Web Inspector: AXI: Audit: image label test is throwing spurious errors on elements with existing alt attr, but no value: <img alt> >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index ceef29db7eea4117e0f6452944210c65c3c5f7e5..f67d3e851454be663e6ab28dabf09d0d2796cfb2 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,15 @@ >+2019-06-24 Chris Dumez <cdumez@apple.com> >+ >+ Pages using Google's anti-flicker optimization may take ~5 seconds to do initial paint >+ https://bugs.webkit.org/show_bug.cgi?id=199173 >+ <rdar://problem/45968770> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Add experimental feature for the quirk. >+ >+ * Shared/WebPreferences.yaml: >+ > 2019-06-24 Adrian Perez de Castro <aperez@igalia.com> > > [WPE][GTK] Fixes for compilation with unified builds disabled >diff --git a/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp b/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp >index a798b5f71b334a6b79f1b28a6a6f662b6412ec40..d4d3f345328c21d2bcba5a711129247383f297eb 100644 >--- a/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp >+++ b/Source/WebCore/contentextensions/ContentExtensionsBackend.cpp >@@ -43,6 +43,9 @@ > #include "FrameLoaderClient.h" > #include "Page.h" > #include "ResourceLoadInfo.h" >+#include "ScriptController.h" >+#include "ScriptSourceCode.h" >+#include "Settings.h" > #include <wtf/URL.h> > #include "UserContentController.h" > #include <wtf/NeverDestroyed.h> >@@ -231,6 +234,13 @@ ContentRuleListResults ContentExtensionsBackend::processContentRuleListsForLoad( > } > if (results.summary.blockedLoad) > currentDocument->addConsoleMessage(MessageSource::ContentBlocker, MessageLevel::Info, makeString("Content blocker prevented frame displaying ", mainDocumentURL.string(), " from loading a resource from ", url.string())); >+ >+ // Quirk for content-blocker interference with Google's anti-flicker optimization (rdar://problem/45968770). >+ // https://developers.google.com/optimize/ >+ if (currentDocument->settings().googleAntiFlickerOptimizationQuirkEnabled() && url == "https://www.google-analytics.com/analytics.js"_str) { >+ if (auto* frame = currentDocument->frame()) >+ frame->script().evaluate(ScriptSourceCode { "try { window.dataLayer.hide.end(); console.log('Called window.dataLayer.hide.end() in frame ' + document.URL + ' because the content blocker blocked the load of the https://www.google-analytics.com/analytics.js script'); } catch (e) { }"_s }); >+ } > } > > return results; >diff --git a/Source/WebCore/page/Settings.yaml b/Source/WebCore/page/Settings.yaml >index 20345a32d59662cbc16c497798a1a9456bd1f18f..cbc73a110fbd56491c3acfc4782a0e202a37bfc6 100644 >--- a/Source/WebCore/page/Settings.yaml >+++ b/Source/WebCore/page/Settings.yaml >@@ -153,6 +153,9 @@ resourceUsageOverlayVisible: > disableScreenSizeOverride: > initial: false > >+googleAntiFlickerOptimizationQuirkEnabled: >+ initial: true >+ > # This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching, > # making keyIdentifier available on keypress events, making charCode available on keydown/keyup events, > # and getting keypress dispatched in more cases. >diff --git a/Source/WebKit/Shared/WebPreferences.yaml b/Source/WebKit/Shared/WebPreferences.yaml >index b94658b1063556b2b0235d060ba12dd31123d780..850e7a2a419934fa83302d38c3baf8dbdc00d3b3 100644 >--- a/Source/WebKit/Shared/WebPreferences.yaml >+++ b/Source/WebKit/Shared/WebPreferences.yaml >@@ -55,6 +55,13 @@ ThirdPartyIframeRedirectBlockingEnabled: > humanReadableDescription: "Block top-level redirects by third-party iframes" > category: experimental > >+GoogleAntiFlickerOptimizationQuirkEnabled: >+ type: bool >+ defaultValue: true >+ humanReadableName: "Quirk to prevent delayed initial painting on sites using Google's Anti-Flicker optimization" >+ humanReadableDescription: "Quirk to prevent delayed initial painting on sites using Google's Anti-Flicker optimization" >+ category: experimental >+ > JavaEnabled: > type: bool > defaultValue: false
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 199173
: 372794