- Revision
- 246190
- Author
- [email protected]
- Date
- 2019-06-06 23:09:40 -0700 (Thu, 06 Jun 2019)
Log Message
process-swap-on-navigation error when loading blocked website on iOS 12.2 only.
https://bugs.webkit.org/show_bug.cgi?id=196930
<rdar://problem/47819301>
Reviewed by Chris Dumez.
When the content filter blocks a navigation, it will continue to load the content filter
error page in the provisional web process. When dispatching didFailProvisionalLoad, we need
to specify WillContinueLoading::Yes so that WebKit presents the error page rather than
switching back to the committed web process.
Testing blocked by <https://webkit.org/b/198626>.
* loader/ContentFilter.cpp:
(WebCore::ContentFilter::willHandleProvisionalLoadFailure):
(WebCore::ContentFilter::handleProvisionalLoadFailure):
* loader/ContentFilter.h:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchDidFailProvisionalLoad):
(WebCore::FrameLoader::checkLoadCompleteForThisFrame):
* loader/FrameLoader.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (246189 => 246190)
--- trunk/Source/WebCore/ChangeLog 2019-06-07 05:47:49 UTC (rev 246189)
+++ trunk/Source/WebCore/ChangeLog 2019-06-07 06:09:40 UTC (rev 246190)
@@ -1,3 +1,27 @@
+2019-06-06 Andy Estes <[email protected]>
+
+ process-swap-on-navigation error when loading blocked website on iOS 12.2 only.
+ https://bugs.webkit.org/show_bug.cgi?id=196930
+ <rdar://problem/47819301>
+
+ Reviewed by Chris Dumez.
+
+ When the content filter blocks a navigation, it will continue to load the content filter
+ error page in the provisional web process. When dispatching didFailProvisionalLoad, we need
+ to specify WillContinueLoading::Yes so that WebKit presents the error page rather than
+ switching back to the committed web process.
+
+ Testing blocked by <https://webkit.org/b/198626>.
+
+ * loader/ContentFilter.cpp:
+ (WebCore::ContentFilter::willHandleProvisionalLoadFailure):
+ (WebCore::ContentFilter::handleProvisionalLoadFailure):
+ * loader/ContentFilter.h:
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::dispatchDidFailProvisionalLoad):
+ (WebCore::FrameLoader::checkLoadCompleteForThisFrame):
+ * loader/FrameLoader.h:
+
2019-06-06 Chris Dumez <[email protected]>
RELEASE_ASSERT hit in CachedFrame constructor
Modified: trunk/Source/WebCore/loader/ContentFilter.cpp (246189 => 246190)
--- trunk/Source/WebCore/loader/ContentFilter.cpp 2019-06-07 05:47:49 UTC (rev 246189)
+++ trunk/Source/WebCore/loader/ContentFilter.cpp 2019-06-07 06:09:40 UTC (rev 246190)
@@ -274,16 +274,22 @@
return true;
}
-void ContentFilter::handleProvisionalLoadFailure(const ResourceError& error)
+bool ContentFilter::willHandleProvisionalLoadFailure(const ResourceError& error) const
{
if (m_state != State::Blocked)
- return;
+ return false;
if (m_blockedError.errorCode() != error.errorCode() || m_blockedError.domain() != error.domain())
- return;
+ return false;
ASSERT(m_blockedError.failingURL() == error.failingURL());
+ return true;
+}
+void ContentFilter::handleProvisionalLoadFailure(const ResourceError& error)
+{
+ ASSERT(willHandleProvisionalLoadFailure(error));
+
RefPtr<SharedBuffer> replacementData { m_blockingContentFilter->replacementData() };
ResourceResponse response { URL(), "text/html"_s, static_cast<long long>(replacementData->size()), "UTF-8"_s };
SubstituteData substituteData { WTFMove(replacementData), error.failingURL(), response, SubstituteData::SessionHistoryVisibility::Hidden };
Modified: trunk/Source/WebCore/loader/ContentFilter.h (246189 => 246190)
--- trunk/Source/WebCore/loader/ContentFilter.h 2019-06-07 05:47:49 UTC (rev 246189)
+++ trunk/Source/WebCore/loader/ContentFilter.h 2019-06-07 06:09:40 UTC (rev 246190)
@@ -62,6 +62,7 @@
bool continueAfterNotifyFinished(CachedResource&);
static bool continueAfterSubstituteDataRequest(const DocumentLoader& activeLoader, const SubstituteData&);
+ bool willHandleProvisionalLoadFailure(const ResourceError&) const;
void handleProvisionalLoadFailure(const ResourceError&);
private:
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (246189 => 246190)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2019-06-07 05:47:49 UTC (rev 246189)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2019-06-07 06:09:40 UTC (rev 246190)
@@ -2427,6 +2427,35 @@
return CachePolicyVerify;
}
+void FrameLoader::dispatchDidFailProvisionalLoad(DocumentLoader& provisionalDocumentLoader, const ResourceError& error)
+{
+ m_provisionalLoadErrorBeingHandledURL = provisionalDocumentLoader.url();
+
+#if ENABLE(CONTENT_FILTERING)
+ auto contentFilter = provisionalDocumentLoader.contentFilter();
+ auto contentFilterWillContinueLoading = false;
+#endif
+
+ auto willContinueLoading = WillContinueLoading::No;
+ if (history().provisionalItem())
+ willContinueLoading = WillContinueLoading::Yes;
+#if ENABLE(CONTENT_FILTERING)
+ if (contentFilter && contentFilter->willHandleProvisionalLoadFailure(error)) {
+ willContinueLoading = WillContinueLoading::Yes;
+ contentFilterWillContinueLoading = true;
+ }
+#endif
+
+ m_client.dispatchDidFailProvisionalLoad(error, willContinueLoading);
+
+#if ENABLE(CONTENT_FILTERING)
+ if (contentFilterWillContinueLoading)
+ contentFilter->handleProvisionalLoadFailure(error);
+#endif
+
+ m_provisionalLoadErrorBeingHandledURL = { };
+}
+
void FrameLoader::checkLoadCompleteForThisFrame()
{
ASSERT(m_client.hasWebView());
@@ -2465,15 +2494,8 @@
bool shouldReset = !history().provisionalItem();
if (!pdl->isLoadingInAPISense() || pdl->isStopping()) {
RELEASE_LOG_IF_ALLOWED("checkLoadCompleteForThisFrame: Failed provisional load (frame = %p, main = %d, isTimeout = %d, isCancellation = %d, errorCode = %d)", &m_frame, m_frame.isMainFrame(), error.isTimeout(), error.isCancellation(), error.errorCode());
- m_provisionalLoadErrorBeingHandledURL = m_provisionalDocumentLoader->url();
- m_client.dispatchDidFailProvisionalLoad(error, history().provisionalItem() ? WillContinueLoading::Yes : WillContinueLoading::No);
-#if ENABLE(CONTENT_FILTERING)
- if (auto contentFilter = pdl->contentFilter())
- contentFilter->handleProvisionalLoadFailure(error);
-#endif
- m_provisionalLoadErrorBeingHandledURL = { };
-
+ dispatchDidFailProvisionalLoad(*pdl, error);
ASSERT(!pdl->isLoading());
// If we're in the middle of loading multipart data, we need to restore the document loader.
Modified: trunk/Source/WebCore/loader/FrameLoader.h (246189 => 246190)
--- trunk/Source/WebCore/loader/FrameLoader.h 2019-06-07 05:47:49 UTC (rev 246189)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2019-06-07 06:09:40 UTC (rev 246190)
@@ -361,6 +361,7 @@
bool shouldPerformFragmentNavigation(bool isFormSubmission, const String& httpMethod, FrameLoadType, const URL&);
void scrollToFragmentWithParentBoundary(const URL&, bool isNewNavigation = true);
+ void dispatchDidFailProvisionalLoad(DocumentLoader& provisionalDocumentLoader, const ResourceError&);
void checkLoadCompleteForThisFrame();
void setDocumentLoader(DocumentLoader*);