WebKit Bugzilla
Attachment 342049 Details for
Bug 186349
: Don't start service worker fetch when there is substitute data
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch
substitute-data-sw-2.patch (text/plain), 4.61 KB, created by
Antti Koivisto
on 2018-06-06 08:51:17 PDT
(
hide
)
Description:
patch
Filename:
MIME Type:
Creator:
Antti Koivisto
Created:
2018-06-06 08:51:17 PDT
Size:
4.61 KB
patch
obsolete
>Index: Source/WebCore/ChangeLog >=================================================================== >--- Source/WebCore/ChangeLog (revision 232539) >+++ Source/WebCore/ChangeLog (working copy) >@@ -1,3 +1,31 @@ >+2018-06-06 Antti Koivisto <antti@apple.com> >+ >+ Don't start service worker fetch when there is substitute data >+ https://bugs.webkit.org/show_bug.cgi?id=186349 >+ <rdar://problem/38881568> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Loading content via WKWebView.loadData may also end up starting a main resource service worker fetch. >+ This breaks DocumentWriter assumptions. >+ >+ * loader/DocumentLoader.cpp: >+ (WebCore::DocumentLoader::tryLoadingRequestFromApplicationCache): >+ (WebCore::DocumentLoader::tryLoadingSubstituteData): >+ >+ Factor substitute resource loading out from tryLoadingRequestFromApplicationCache. >+ >+ (WebCore::DocumentLoader::startLoadingMainResource): >+ >+ If we have substitute data already (typically from WKWebView.loadData), allow service worker registration >+ but load the main resource using the substitute data. >+ >+ (WebCore::DocumentLoader::handleSubstituteDataLoadSoon): Deleted. >+ >+ Merge tryLoadingSubstituteData. >+ >+ * loader/DocumentLoader.h: >+ > 2018-06-06 Antti Koivisto <antti@apple.com> > > Use minimal coverage rect for tiled layers when under memory pressure >Index: Source/WebCore/loader/DocumentLoader.cpp >=================================================================== >--- Source/WebCore/loader/DocumentLoader.cpp (revision 232538) >+++ Source/WebCore/loader/DocumentLoader.cpp (working copy) >@@ -478,14 +478,6 @@ void DocumentLoader::startDataLoadTimer( > #endif > } > >-void DocumentLoader::handleSubstituteDataLoadSoon() >-{ >- if (!m_deferMainResourceDataLoad || frameLoader()->loadsSynchronously()) >- handleSubstituteDataLoadNow(); >- else >- startDataLoadTimer(); >-} >- > #if ENABLE(SERVICE_WORKER) > void DocumentLoader::matchRegistration(const URL& url, SWClientConnection::RegistrationCallback&& callback) > { >@@ -671,15 +663,24 @@ void DocumentLoader::willSendRequest(Res > bool DocumentLoader::tryLoadingRequestFromApplicationCache() > { > m_applicationCacheHost->maybeLoadMainResource(m_request, m_substituteData); >+ return tryLoadingSubstituteData(); >+} > >+bool DocumentLoader::tryLoadingSubstituteData() >+{ > if (!m_substituteData.isValid() || !m_frame->page()) > return false; > >- RELEASE_LOG_IF_ALLOWED("startLoadingMainResource: Returning cached main resource (frame = %p, main = %d)", m_frame, m_frame->isMainFrame()); >+ RELEASE_LOG_IF_ALLOWED("startLoadingMainResource: Returning substitute data (frame = %p, main = %d)", m_frame, m_frame->isMainFrame()); > m_identifierForLoadWithoutResourceLoader = m_frame->page()->progress().createUniqueIdentifier(); > frameLoader()->notifier().assignIdentifierToInitialRequest(m_identifierForLoadWithoutResourceLoader, this, m_request); > frameLoader()->notifier().dispatchWillSendRequest(this, m_identifierForLoadWithoutResourceLoader, m_request, ResourceResponse()); >- handleSubstituteDataLoadSoon(); >+ >+ if (!m_deferMainResourceDataLoad || frameLoader()->loadsSynchronously()) >+ handleSubstituteDataLoadNow(); >+ else >+ startDataLoadTimer(); >+ > return true; > } > >@@ -1728,6 +1729,11 @@ void DocumentLoader::startLoadingMainRes > return; > > m_serviceWorkerRegistrationData = WTFMove(registrationData); >+ >+ if (m_substituteData.isValid()) { >+ this->tryLoadingSubstituteData(); >+ return; >+ } > if (!m_serviceWorkerRegistrationData && this->tryLoadingRequestFromApplicationCache()) > return; > this->loadMainResource(WTFMove(request)); >Index: Source/WebCore/loader/DocumentLoader.h >=================================================================== >--- Source/WebCore/loader/DocumentLoader.h (revision 232538) >+++ Source/WebCore/loader/DocumentLoader.h (working copy) >@@ -377,6 +377,7 @@ private: > bool isPostOrRedirectAfterPost(const ResourceRequest&, const ResourceResponse&); > > bool tryLoadingRequestFromApplicationCache(); >+ bool tryLoadingSubstituteData(); > bool tryLoadingRedirectRequestFromApplicationCache(const ResourceRequest&); > #if ENABLE(SERVICE_WORKER) > void restartLoadingDueToServiceWorkerRegistrationChange(ResourceRequest&&, std::optional<ServiceWorkerRegistrationData>&&); >@@ -391,7 +392,6 @@ private: > #else > typedef Timer DocumentLoaderTimer; > #endif >- void handleSubstituteDataLoadSoon(); > void handleSubstituteDataLoadNow(); > void startDataLoadTimer(); >
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 186349
:
342046
|
342049
|
342136
|
342148
|
342150
|
342151
|
342157