Title: [261323] trunk/Source
- Revision
- 261323
- Author
- da...@apple.com
- Date
- 2020-05-07 11:55:50 -0700 (Thu, 07 May 2020)
Log Message
Add some missing null checks for DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=211544
rdar://62843516
Reviewed by Anders Carlsson.
Source/WebCore:
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::transitionToCommitted): Use some more RefPtr,
and check for null before calling DocumentLoader::responseMIMEType.
Also removed a comment that made no sense, and an assertion that was
there for no reason, left over from some point in history where it
made sense.
* loader/HistoryController.cpp:
(WebCore::FrameLoader::HistoryController::updateForRedirectWithLockedBackForwardList):
Add checks for null before calling urlForHistory and isClientRedirect.
Source/WebKit:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
Add a null check before calling DocumentLoader::response.
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (261322 => 261323)
--- trunk/Source/WebCore/ChangeLog 2020-05-07 18:42:21 UTC (rev 261322)
+++ trunk/Source/WebCore/ChangeLog 2020-05-07 18:55:50 UTC (rev 261323)
@@ -1,5 +1,24 @@
2020-05-07 Darin Adler <da...@apple.com>
+ Add some missing null checks for DocumentLoader
+ https://bugs.webkit.org/show_bug.cgi?id=211544
+ rdar://62843516
+
+ Reviewed by Anders Carlsson.
+
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::transitionToCommitted): Use some more RefPtr,
+ and check for null before calling DocumentLoader::responseMIMEType.
+ Also removed a comment that made no sense, and an assertion that was
+ there for no reason, left over from some point in history where it
+ made sense.
+
+ * loader/HistoryController.cpp:
+ (WebCore::FrameLoader::HistoryController::updateForRedirectWithLockedBackForwardList):
+ Add checks for null before calling urlForHistory and isClientRedirect.
+
+2020-05-07 Darin Adler <da...@apple.com>
+
Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
https://bugs.webkit.org/show_bug.cgi?id=211525
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (261322 => 261323)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2020-05-07 18:42:21 UTC (rev 261322)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2020-05-07 18:55:50 UTC (rev 261323)
@@ -2146,10 +2146,10 @@
// The call to closeURL() invokes the unload event handler, which can execute arbitrary
// _javascript_. If the script initiates a new load, we need to abandon the current load,
// or the two will stomp each other.
- DocumentLoader* pdl = m_provisionalDocumentLoader.get();
+ auto originalProvisionalDocumentLoader = m_provisionalDocumentLoader;
if (m_documentLoader)
closeURL();
- if (pdl != m_provisionalDocumentLoader)
+ if (originalProvisionalDocumentLoader != m_provisionalDocumentLoader)
return;
if (m_documentLoader)
@@ -2161,7 +2161,7 @@
// Script can do anything. If the script initiates a new load, we need to abandon the
// current load or the two will stomp each other.
setDocumentLoader(m_provisionalDocumentLoader.get());
- if (pdl != m_provisionalDocumentLoader)
+ if (originalProvisionalDocumentLoader != m_provisionalDocumentLoader)
return;
FRAMELOADER_RELEASE_LOG_IF_ALLOWED(ResourceLoading, "transitionToCommitted: Clearing provisional document loader (m_provisionalDocumentLoader=%p)", m_provisionalDocumentLoader.get());
setProvisionalDocumentLoader(nullptr);
@@ -2170,7 +2170,7 @@
setState(FrameStateCommittedPage);
// Handle adding the URL to the back/forward list.
- DocumentLoader* dl = m_documentLoader.get();
+ auto documentLoader = m_documentLoader;
switch (m_loadType) {
case FrameLoadType::Forward:
@@ -2191,9 +2191,8 @@
// Create a document view for this document, or used the cached view.
if (cachedPage) {
- DocumentLoader* cachedDocumentLoader = cachedPage->documentLoader();
- ASSERT(cachedDocumentLoader);
- cachedDocumentLoader->attachToFrame(m_frame);
+ ASSERT(cachedPage->documentLoader());
+ cachedPage->documentLoader()->attachToFrame(m_frame);
m_client->transitionToCommittedFromCachedFrame(cachedPage->cachedMainFrame());
} else
m_client->transitionToCommittedForNewPage();
@@ -2222,11 +2221,9 @@
break;
}
- m_documentLoader->writer().setMIMEType(dl->responseMIMEType());
+ if (documentLoader)
+ documentLoader->writer().setMIMEType(documentLoader->responseMIMEType());
- // Tell the client we've committed this URL.
- ASSERT(m_frame.view());
-
if (m_stateMachine.creatingInitialEmptyDocument())
return;
Modified: trunk/Source/WebCore/loader/HistoryController.cpp (261322 => 261323)
--- trunk/Source/WebCore/loader/HistoryController.cpp 2020-05-07 18:42:21 UTC (rev 261322)
+++ trunk/Source/WebCore/loader/HistoryController.cpp 2020-05-07 18:55:50 UTC (rev 261323)
@@ -414,9 +414,9 @@
LOG(History, "HistoryController %p updateForRedirectWithLockedBackForwardList: Updating History for redirect load in frame %p (main frame %d) %s", this, &m_frame, m_frame.isMainFrame(), m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->url().string().utf8().data() : "");
bool usesEphemeralSession = m_frame.page() ? m_frame.page()->usesEphemeralSession() : true;
- const URL& historyURL = m_frame.loader().documentLoader()->urlForHistory();
+ auto historyURL = m_frame.loader().documentLoader() ? m_frame.loader().documentLoader()->urlForHistory() : URL { };
- if (m_frame.loader().documentLoader()->isClientRedirect()) {
+ if (m_frame.loader().documentLoader() && m_frame.loader().documentLoader()->isClientRedirect()) {
if (!m_currentItem && !m_frame.tree().parent()) {
if (!historyURL.isEmpty()) {
updateBackForwardListClippedAtTarget(true);
Modified: trunk/Source/WebKit/ChangeLog (261322 => 261323)
--- trunk/Source/WebKit/ChangeLog 2020-05-07 18:42:21 UTC (rev 261322)
+++ trunk/Source/WebKit/ChangeLog 2020-05-07 18:55:50 UTC (rev 261323)
@@ -1,5 +1,17 @@
2020-05-07 Darin Adler <da...@apple.com>
+ Add some missing null checks for DocumentLoader
+ https://bugs.webkit.org/show_bug.cgi?id=211544
+ rdar://62843516
+
+ Reviewed by Anders Carlsson.
+
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::transitionToCommittedForNewPage):
+ Add a null check before calling DocumentLoader::response.
+
+2020-05-07 Darin Adler <da...@apple.com>
+
Remove USE(INSERTION_UNDO_GROUPING) checks in macOS platform code
https://bugs.webkit.org/show_bug.cgi?id=211525
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (261322 => 261323)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-05-07 18:42:21 UTC (rev 261322)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2020-05-07 18:55:50 UTC (rev 261323)
@@ -1487,8 +1487,9 @@
shouldHideScrollbars = true;
#endif
- const ResourceResponse& response = m_frame->coreFrame()->loader().documentLoader()->response();
- m_frameHasCustomContentProvider = isMainFrame && webPage->shouldUseCustomContentProviderForResponse(response);
+ m_frameHasCustomContentProvider = isMainFrame
+ && m_frame->coreFrame()->loader().documentLoader()
+ && webPage->shouldUseCustomContentProviderForResponse(m_frame->coreFrame()->loader().documentLoader()->response());
m_frameCameFromBackForwardCache = false;
ScrollbarMode defaultScrollbarMode = shouldHideScrollbars ? ScrollbarAlwaysOff : ScrollbarAuto;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes