Skip to content
This repository was archived by the owner on Jun 24, 2022. It is now read-only.

Commit bed33c6

Browse files
Remove downloadAttribute from DocumentLoader
https://bugs.webkit.org/show_bug.cgi?id=210493 Patch by Rob Buis <[email protected]> on 2020-04-28 Reviewed by Darin Adler. Remove downloadAttribute from DocumentLoader since this can be obtained from the NavigationAction. * loader/DocumentLoader.h: (WebCore::DocumentLoader::downloadAttribute const): (WebCore::DocumentLoader::setDownloadAttribute): Deleted. * loader/FrameLoader.cpp: (WebCore::FrameLoader::loadURL): (WebCore::FrameLoader::loadWithNavigationAction): (WebCore::FrameLoader::loadPostRequest): * loader/FrameLoader.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@260843 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent b307c4d commit bed33c6

File tree

4 files changed

+26
-10
lines changed

4 files changed

+26
-10
lines changed

Source/WebCore/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2020-04-28 Rob Buis <[email protected]>
2+
3+
Remove downloadAttribute from DocumentLoader
4+
https://bugs.webkit.org/show_bug.cgi?id=210493
5+
6+
Reviewed by Darin Adler.
7+
8+
Remove downloadAttribute from DocumentLoader since this
9+
can be obtained from the NavigationAction.
10+
11+
* loader/DocumentLoader.h:
12+
(WebCore::DocumentLoader::downloadAttribute const):
13+
(WebCore::DocumentLoader::setDownloadAttribute): Deleted.
14+
* loader/FrameLoader.cpp:
15+
(WebCore::FrameLoader::loadURL):
16+
(WebCore::FrameLoader::loadWithNavigationAction):
17+
(WebCore::FrameLoader::loadPostRequest):
18+
* loader/FrameLoader.h:
19+
120
2020-04-28 Jack Lee <[email protected]>
221

322
Nullptr crash in EditCommand::EditCommand via CompositeEditCommand::removeNode

Source/WebCore/loader/DocumentLoader.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -397,8 +397,7 @@ class DocumentLoader
397397
void setAllowsDataURLsForMainFrame(bool allowsDataURLsForMainFrame) { m_allowsDataURLsForMainFrame = allowsDataURLsForMainFrame; }
398398
bool allowsDataURLsForMainFrame() const { return m_allowsDataURLsForMainFrame; }
399399

400-
void setDownloadAttribute(const String& attribute) { m_downloadAttribute = attribute; }
401-
const String& downloadAttribute() const { return m_downloadAttribute; }
400+
const AtomString& downloadAttribute() const { return m_triggeringAction.downloadAttribute(); }
402401

403402
WEBCORE_EXPORT void applyPoliciesToSettings();
404403

@@ -645,7 +644,6 @@ class DocumentLoader
645644

646645
bool m_allowsWebArchiveForMainFrame { false };
647646
bool m_allowsDataURLsForMainFrame { false };
648-
String m_downloadAttribute;
649647
};
650648

651649
inline void DocumentLoader::recordMemoryCacheLoadForFutureClientNotification(const ResourceRequest& request)

Source/WebCore/loader/FrameLoader.cpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,7 +1418,7 @@ void FrameLoader::loadURL(FrameLoadRequest&& frameLoadRequest, const String& ref
14181418
if (isSystemPreview)
14191419
request.setSystemPreviewInfo(frameLoadRequest.systemPreviewInfo());
14201420
#endif
1421-
loadWithNavigationAction(request, WTFMove(action), newLoadType, WTFMove(formState), allowNavigationToInvalidURL, frameLoadRequest.downloadAttribute(), [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] () mutable {
1421+
loadWithNavigationAction(request, WTFMove(action), newLoadType, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, sameURL, newLoadType, protectedFrame = makeRef(m_frame), completionHandler = completionHandlerCaller.release()] () mutable {
14221422
if (isRedirect) {
14231423
m_quickRedirectComing = false;
14241424
if (m_provisionalDocumentLoader)
@@ -1495,12 +1495,11 @@ void FrameLoader::load(FrameLoadRequest&& request)
14951495
load(loader.get());
14961496
}
14971497

1498-
void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, NavigationAction&& action, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, const String& downloadAttribute, CompletionHandler<void()>&& completionHandler)
1498+
void FrameLoader::loadWithNavigationAction(const ResourceRequest& request, NavigationAction&& action, FrameLoadType type, RefPtr<FormState>&& formState, AllowNavigationToInvalidURL allowNavigationToInvalidURL, CompletionHandler<void()>&& completionHandler)
14991499
{
15001500
FRAMELOADER_RELEASE_LOG_IF_ALLOWED(ResourceLoading, "loadWithNavigationAction: frame load started");
15011501

15021502
Ref<DocumentLoader> loader = m_client->createDocumentLoader(request, defaultSubstituteDataForURL(request.url()));
1503-
loader->setDownloadAttribute(downloadAttribute);
15041503
applyShouldOpenExternalURLsPolicyToNewDocumentLoader(m_frame, loader, action.initiatedByMainFrame(), action.shouldOpenExternalURLsPolicy());
15051504

15061505
if (action.lockHistory() == LockHistory::Yes && m_documentLoader)
@@ -3012,13 +3011,13 @@ void FrameLoader::loadPostRequest(FrameLoadRequest&& request, const String& refe
30123011
if (Document* document = m_frame.document())
30133012
document->contentSecurityPolicy()->upgradeInsecureRequestIfNeeded(workingResourceRequest, ContentSecurityPolicy::InsecureRequestType::Load);
30143013

3015-
NavigationAction action { request.requester(), workingResourceRequest, request.initiatedByMainFrame(), loadType, true, event, request.shouldOpenExternalURLsPolicy(), request.downloadAttribute() };
3014+
NavigationAction action { request.requester(), workingResourceRequest, request.initiatedByMainFrame(), loadType, true, event, request.shouldOpenExternalURLsPolicy(), { } };
30163015
action.setLockHistory(lockHistory);
30173016

30183017
if (!frameName.isEmpty()) {
30193018
// The search for a target frame is done earlier in the case of form submission.
30203019
if (auto* targetFrame = formState ? nullptr : findFrameForNavigation(frameName)) {
3021-
targetFrame->loader().loadWithNavigationAction(workingResourceRequest, WTFMove(action), loadType, WTFMove(formState), allowNavigationToInvalidURL, { }, WTFMove(completionHandler));
3020+
targetFrame->loader().loadWithNavigationAction(workingResourceRequest, WTFMove(action), loadType, WTFMove(formState), allowNavigationToInvalidURL, WTFMove(completionHandler));
30223021
return;
30233022
}
30243023

@@ -3031,7 +3030,7 @@ void FrameLoader::loadPostRequest(FrameLoadRequest&& request, const String& refe
30313030

30323031
// must grab this now, since this load may stop the previous load and clear this flag
30333032
bool isRedirect = m_quickRedirectComing;
3034-
loadWithNavigationAction(workingResourceRequest, WTFMove(action), loadType, WTFMove(formState), allowNavigationToInvalidURL, { }, [this, isRedirect, protectedFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] () mutable {
3033+
loadWithNavigationAction(workingResourceRequest, WTFMove(action), loadType, WTFMove(formState), allowNavigationToInvalidURL, [this, isRedirect, protectedFrame = makeRef(m_frame), completionHandler = WTFMove(completionHandler)] () mutable {
30353034
if (isRedirect) {
30363035
m_quickRedirectComing = false;
30373036
if (m_provisionalDocumentLoader)

Source/WebCore/loader/FrameLoader.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ class FrameLoader final {
388388
void loadWithDocumentLoader(DocumentLoader*, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, CompletionHandler<void()>&& = [] { }); // Calls continueLoadAfterNavigationPolicy
389389
void load(DocumentLoader&); // Calls loadWithDocumentLoader
390390

391-
void loadWithNavigationAction(const ResourceRequest&, NavigationAction&&, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, const String& downloadAttribute = { }, CompletionHandler<void()>&& = [] { }); // Calls loadWithDocumentLoader
391+
void loadWithNavigationAction(const ResourceRequest&, NavigationAction&&, FrameLoadType, RefPtr<FormState>&&, AllowNavigationToInvalidURL, CompletionHandler<void()>&& = [] { }); // Calls loadWithDocumentLoader
392392

393393
void loadPostRequest(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, CompletionHandler<void()>&&);
394394
void loadURL(FrameLoadRequest&&, const String& referrer, FrameLoadType, Event*, RefPtr<FormState>&&, Optional<AdClickAttribution>&&, CompletionHandler<void()>&&);

0 commit comments

Comments
 (0)