Diff
Modified: trunk/LayoutTests/ChangeLog (198892 => 198893)
--- trunk/LayoutTests/ChangeLog 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/LayoutTests/ChangeLog 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,3 +1,17 @@
+2016-03-31 Brent Fulgham <[email protected]>
+
+ [WK2] Support download attribute feature
+ https://bugs.webkit.org/show_bug.cgi?id=102914
+ <rdar://problem/13177492>
+
+ Reviewed by Darin Adler.
+
+ * imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Update for
+ <a download>.
+ * imported/w3c/web-platform-tests/html/dom/reflection-text-expected.txt: Ditto.
+ * js/dom/dom-static-property-for-in-iteration-expected.txt: Ditto.
+ * platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt: Ditto.
+
2016-03-31 Ryan Haddad <[email protected]>
Marking three js/regress/string-repeat-* tests as flaky timeouts on Mac
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (198892 => 198893)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1592,7 +1592,7 @@
PASS HTMLAnchorElement interface: existence and properties of interface prototype object
PASS HTMLAnchorElement interface: existence and properties of interface prototype object's "constructor" property
PASS HTMLAnchorElement interface: attribute target
-FAIL HTMLAnchorElement interface: attribute download assert_true: The prototype object must have a property "download" expected true got false
+PASS HTMLAnchorElement interface: attribute download
PASS HTMLAnchorElement interface: attribute ping
PASS HTMLAnchorElement interface: attribute rel
PASS HTMLAnchorElement interface: attribute relList
@@ -1618,7 +1618,7 @@
PASS HTMLAnchorElement must be primary interface of document.createElement("a")
PASS Stringification of document.createElement("a")
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "target" with the proper type (0)
-FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "download" with the proper type (1) assert_inherits: property "download" not found in prototype chain
+PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "download" with the proper type (1)
FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "ping" with the proper type (2) assert_true: wrong type: not object or function expected true got false
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "rel" with the proper type (3)
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "relList" with the proper type (4)
Modified: trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-text-expected.txt (198892 => 198893)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-text-expected.txt 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/html/dom/reflection-text-expected.txt 2016-03-31 15:35:41 UTC (rev 198893)
@@ -673,83 +673,83 @@
PASS a.target: IDL set to object "test-valueOf" should not throw
PASS a.target: IDL set to object "test-valueOf" followed by getAttribute()
PASS a.target: IDL set to object "test-valueOf" followed by IDL get
-FAIL a.download: typeof IDL attribute assert_equals: expected "string" but got "undefined"
-FAIL a.download: IDL get with DOM attribute unset assert_equals: expected (string) "" but got (undefined) undefined
+PASS a.download: typeof IDL attribute
+PASS a.download: IDL get with DOM attribute unset
PASS a.download: setAttribute() to "" followed by getAttribute()
-FAIL a.download: setAttribute() to "" followed by IDL get assert_equals: expected (string) "" but got (undefined) undefined
+PASS a.download: setAttribute() to "" followed by IDL get
PASS a.download: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by getAttribute()
-FAIL a.download: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get assert_equals: expected (string) " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " but got (undefined) undefined
+PASS a.download: setAttribute() to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get
PASS a.download: setAttribute() to undefined followed by getAttribute()
-FAIL a.download: setAttribute() to undefined followed by IDL get assert_equals: expected (string) "undefined" but got (undefined) undefined
+PASS a.download: setAttribute() to undefined followed by IDL get
PASS a.download: setAttribute() to 7 followed by getAttribute()
-FAIL a.download: setAttribute() to 7 followed by IDL get assert_equals: expected (string) "7" but got (undefined) undefined
+PASS a.download: setAttribute() to 7 followed by IDL get
PASS a.download: setAttribute() to 1.5 followed by getAttribute()
-FAIL a.download: setAttribute() to 1.5 followed by IDL get assert_equals: expected (string) "1.5" but got (undefined) undefined
+PASS a.download: setAttribute() to 1.5 followed by IDL get
PASS a.download: setAttribute() to true followed by getAttribute()
-FAIL a.download: setAttribute() to true followed by IDL get assert_equals: expected (string) "true" but got (undefined) undefined
+PASS a.download: setAttribute() to true followed by IDL get
PASS a.download: setAttribute() to false followed by getAttribute()
-FAIL a.download: setAttribute() to false followed by IDL get assert_equals: expected (string) "false" but got (undefined) undefined
+PASS a.download: setAttribute() to false followed by IDL get
PASS a.download: setAttribute() to object "[object Object]" followed by getAttribute()
-FAIL a.download: setAttribute() to object "[object Object]" followed by IDL get assert_equals: expected (string) "[object Object]" but got (undefined) undefined
+PASS a.download: setAttribute() to object "[object Object]" followed by IDL get
PASS a.download: setAttribute() to NaN followed by getAttribute()
-FAIL a.download: setAttribute() to NaN followed by IDL get assert_equals: expected (string) "NaN" but got (undefined) undefined
+PASS a.download: setAttribute() to NaN followed by IDL get
PASS a.download: setAttribute() to Infinity followed by getAttribute()
-FAIL a.download: setAttribute() to Infinity followed by IDL get assert_equals: expected (string) "Infinity" but got (undefined) undefined
+PASS a.download: setAttribute() to Infinity followed by IDL get
PASS a.download: setAttribute() to -Infinity followed by getAttribute()
-FAIL a.download: setAttribute() to -Infinity followed by IDL get assert_equals: expected (string) "-Infinity" but got (undefined) undefined
+PASS a.download: setAttribute() to -Infinity followed by IDL get
PASS a.download: setAttribute() to "\0" followed by getAttribute()
-FAIL a.download: setAttribute() to "\0" followed by IDL get assert_equals: expected (string) "\0" but got (undefined) undefined
+PASS a.download: setAttribute() to "\0" followed by IDL get
PASS a.download: setAttribute() to null followed by getAttribute()
-FAIL a.download: setAttribute() to null followed by IDL get assert_equals: expected (string) "null" but got (undefined) undefined
+PASS a.download: setAttribute() to null followed by IDL get
PASS a.download: setAttribute() to object "test-toString" followed by getAttribute()
-FAIL a.download: setAttribute() to object "test-toString" followed by IDL get assert_equals: expected (string) "test-toString" but got (undefined) undefined
+PASS a.download: setAttribute() to object "test-toString" followed by IDL get
PASS a.download: setAttribute() to object "test-valueOf" followed by getAttribute()
-FAIL a.download: setAttribute() to object "test-valueOf" followed by IDL get assert_equals: expected (string) "test-valueOf" but got (undefined) undefined
+PASS a.download: setAttribute() to object "test-valueOf" followed by IDL get
PASS a.download: IDL set to "" should not throw
-FAIL a.download: IDL set to "" followed by getAttribute() assert_equals: expected "" but got "test-valueOf"
+PASS a.download: IDL set to "" followed by getAttribute()
PASS a.download: IDL set to "" followed by IDL get
PASS a.download: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " should not throw
-FAIL a.download: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by getAttribute() assert_equals: expected " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " but got "test-valueOf"
+PASS a.download: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by getAttribute()
PASS a.download: IDL set to " \0\x01\x02\x03\x04\x05\x06\x07 \b\t\n\v\f\r\x0e\x0f \x10\x11\x12\x13\x14\x15\x16\x17 \x18\x19\x1a\x1b\x1c\x1d\x1e\x1f foo " followed by IDL get
PASS a.download: IDL set to undefined should not throw
-FAIL a.download: IDL set to undefined followed by getAttribute() assert_equals: expected "undefined" but got "test-valueOf"
-FAIL a.download: IDL set to undefined followed by IDL get assert_equals: expected (string) "undefined" but got (undefined) undefined
+PASS a.download: IDL set to undefined followed by getAttribute()
+PASS a.download: IDL set to undefined followed by IDL get
PASS a.download: IDL set to 7 should not throw
-FAIL a.download: IDL set to 7 followed by getAttribute() assert_equals: expected "7" but got "test-valueOf"
-FAIL a.download: IDL set to 7 followed by IDL get assert_equals: expected (string) "7" but got (number) 7
+PASS a.download: IDL set to 7 followed by getAttribute()
+PASS a.download: IDL set to 7 followed by IDL get
PASS a.download: IDL set to 1.5 should not throw
-FAIL a.download: IDL set to 1.5 followed by getAttribute() assert_equals: expected "1.5" but got "test-valueOf"
-FAIL a.download: IDL set to 1.5 followed by IDL get assert_equals: expected (string) "1.5" but got (number) 1.5
+PASS a.download: IDL set to 1.5 followed by getAttribute()
+PASS a.download: IDL set to 1.5 followed by IDL get
PASS a.download: IDL set to true should not throw
-FAIL a.download: IDL set to true followed by getAttribute() assert_equals: expected "true" but got "test-valueOf"
-FAIL a.download: IDL set to true followed by IDL get assert_equals: expected (string) "true" but got (boolean) true
+PASS a.download: IDL set to true followed by getAttribute()
+PASS a.download: IDL set to true followed by IDL get
PASS a.download: IDL set to false should not throw
-FAIL a.download: IDL set to false followed by getAttribute() assert_equals: expected "false" but got "test-valueOf"
-FAIL a.download: IDL set to false followed by IDL get assert_equals: expected (string) "false" but got (boolean) false
+PASS a.download: IDL set to false followed by getAttribute()
+PASS a.download: IDL set to false followed by IDL get
PASS a.download: IDL set to object "[object Object]" should not throw
-FAIL a.download: IDL set to object "[object Object]" followed by getAttribute() assert_equals: expected "[object Object]" but got "test-valueOf"
-FAIL a.download: IDL set to object "[object Object]" followed by IDL get assert_equals: expected (string) "[object Object]" but got (object) object "[object Object]"
+PASS a.download: IDL set to object "[object Object]" followed by getAttribute()
+PASS a.download: IDL set to object "[object Object]" followed by IDL get
PASS a.download: IDL set to NaN should not throw
-FAIL a.download: IDL set to NaN followed by getAttribute() assert_equals: expected "NaN" but got "test-valueOf"
-FAIL a.download: IDL set to NaN followed by IDL get assert_equals: expected (string) "NaN" but got (number) NaN
+PASS a.download: IDL set to NaN followed by getAttribute()
+PASS a.download: IDL set to NaN followed by IDL get
PASS a.download: IDL set to Infinity should not throw
-FAIL a.download: IDL set to Infinity followed by getAttribute() assert_equals: expected "Infinity" but got "test-valueOf"
-FAIL a.download: IDL set to Infinity followed by IDL get assert_equals: expected (string) "Infinity" but got (number) Infinity
+PASS a.download: IDL set to Infinity followed by getAttribute()
+PASS a.download: IDL set to Infinity followed by IDL get
PASS a.download: IDL set to -Infinity should not throw
-FAIL a.download: IDL set to -Infinity followed by getAttribute() assert_equals: expected "-Infinity" but got "test-valueOf"
-FAIL a.download: IDL set to -Infinity followed by IDL get assert_equals: expected (string) "-Infinity" but got (number) -Infinity
+PASS a.download: IDL set to -Infinity followed by getAttribute()
+PASS a.download: IDL set to -Infinity followed by IDL get
PASS a.download: IDL set to "\0" should not throw
-FAIL a.download: IDL set to "\0" followed by getAttribute() assert_equals: expected "\0" but got "test-valueOf"
+PASS a.download: IDL set to "\0" followed by getAttribute()
PASS a.download: IDL set to "\0" followed by IDL get
PASS a.download: IDL set to null should not throw
-FAIL a.download: IDL set to null followed by getAttribute() assert_equals: expected "null" but got "test-valueOf"
-FAIL a.download: IDL set to null followed by IDL get assert_equals: expected (string) "null" but got (object) null
+PASS a.download: IDL set to null followed by getAttribute()
+PASS a.download: IDL set to null followed by IDL get
PASS a.download: IDL set to object "test-toString" should not throw
-FAIL a.download: IDL set to object "test-toString" followed by getAttribute() assert_equals: expected "test-toString" but got "test-valueOf"
-FAIL a.download: IDL set to object "test-toString" followed by IDL get assert_equals: expected (string) "test-toString" but got (object) object "test-toString"
+PASS a.download: IDL set to object "test-toString" followed by getAttribute()
+PASS a.download: IDL set to object "test-toString" followed by IDL get
PASS a.download: IDL set to object "test-valueOf" should not throw
PASS a.download: IDL set to object "test-valueOf" followed by getAttribute()
-FAIL a.download: IDL set to object "test-valueOf" followed by IDL get assert_equals: expected (string) "test-valueOf" but got (object) object "test-valueOf"
+PASS a.download: IDL set to object "test-valueOf" followed by IDL get
PASS a.ping: typeof IDL attribute
PASS a.ping: IDL get with DOM attribute unset
PASS a.ping: setAttribute() to "" followed by getAttribute()
Modified: trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt (198892 => 198893)
--- trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/LayoutTests/js/dom/dom-static-property-for-in-iteration-expected.txt 2016-03-31 15:35:41 UTC (rev 198893)
@@ -11,6 +11,7 @@
PASS a["snood"] is 6
PASS a["charset"] is
PASS a["coords"] is
+PASS a["download"] is
PASS a["hreflang"] is
PASS a["name"] is
PASS a["ping"] is
@@ -49,7 +50,7 @@
PASS a["style"] is [object CSSStyleDeclaration]
PASS a["id"] is foo
PASS a["offsetLeft"] is 8
-PASS a["offsetTop"] is 774
+PASS a["offsetTop"] is 789
PASS a["offsetWidth"] is 40
PASS a["offsetHeight"] is 18
PASS a["clientLeft"] is 0
Modified: trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt (198892 => 198893)
--- trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/LayoutTests/platform/ios-simulator/imported/w3c/web-platform-tests/html/dom/interfaces-expected.txt 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1592,7 +1592,7 @@
PASS HTMLAnchorElement interface: existence and properties of interface prototype object
PASS HTMLAnchorElement interface: existence and properties of interface prototype object's "constructor" property
PASS HTMLAnchorElement interface: attribute target
-FAIL HTMLAnchorElement interface: attribute download assert_true: The prototype object must have a property "download" expected true got false
+PASS HTMLAnchorElement interface: attribute download
PASS HTMLAnchorElement interface: attribute ping
PASS HTMLAnchorElement interface: attribute rel
PASS HTMLAnchorElement interface: attribute relList
@@ -1618,7 +1618,7 @@
PASS HTMLAnchorElement must be primary interface of document.createElement("a")
PASS Stringification of document.createElement("a")
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "target" with the proper type (0)
-FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "download" with the proper type (1) assert_inherits: property "download" not found in prototype chain
+PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "download" with the proper type (1)
FAIL HTMLAnchorElement interface: document.createElement("a") must inherit property "ping" with the proper type (2) assert_true: wrong type: not object or function expected true got false
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "rel" with the proper type (3)
PASS HTMLAnchorElement interface: document.createElement("a") must inherit property "relList" with the proper type (4)
Modified: trunk/Source/WTF/ChangeLog (198892 => 198893)
--- trunk/Source/WTF/ChangeLog 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WTF/ChangeLog 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,3 +1,14 @@
+2016-03-31 Brent Fulgham <[email protected]>
+
+ [WK2] Support download attribute feature
+ https://bugs.webkit.org/show_bug.cgi?id=102914
+ <rdar://problem/13177492>
+
+ Reviewed by Darin Adler.
+
+ * wtf/FeatureDefines.h: Turn the ENABLE_DOWNLOAD_ATTRIBUTE flag
+ on to see what happens.
+
2016-03-30 Brian Burg <[email protected]>
Web Automation: Add Automation.performKeyboardInteractions
Modified: trunk/Source/WTF/wtf/FeatureDefines.h (198892 => 198893)
--- trunk/Source/WTF/wtf/FeatureDefines.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WTF/wtf/FeatureDefines.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -436,7 +436,7 @@
#endif
#if !defined(ENABLE_DOWNLOAD_ATTRIBUTE)
-#define ENABLE_DOWNLOAD_ATTRIBUTE 0
+#define ENABLE_DOWNLOAD_ATTRIBUTE 1
#endif
#if !defined(ENABLE_DRAG_SUPPORT)
Modified: trunk/Source/WebCore/ChangeLog (198892 => 198893)
--- trunk/Source/WebCore/ChangeLog 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/ChangeLog 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,3 +1,46 @@
+2016-03-31 Brent Fulgham <[email protected]>
+
+ [WK2] Support download attribute feature
+ https://bugs.webkit.org/show_bug.cgi?id=102914
+ <rdar://problem/13177492>
+
+ Reviewed by Darin Adler.
+
+ Tested by imported/w3c/web-platform-tests/html/dom/interfaces.html
+ imported/w3c/web-platform-tests/html/dom/reflection-text.html
+
+ A first draft implementation of this feature.
+
+ * html/HTMLAnchorElement.cpp:
+ (WebCore::HTMLAnchorElement::handleClick): If the anchor has the 'download'
+ attribute, pass along the information to the rest of the load system.
+ * loader/FrameLoadRequest.h:
+ (WebCore::FrameLoadRequest::FrameLoadRequest): Create new overload that
+ accepts a download attribute flag and a suggested filename.
+ (WebCore::FrameLoadRequest::hasDownloadAttribute): Added.
+ (WebCore::FrameLoadRequest::suggestedFilename): Added.
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::urlSelected): Expand to accept the download attribute
+ flag and suggested filename.
+ (WebCore::FrameLoader::loadURL): Populate the NavigationAction with the new
+ download attribute flag and suggested filename.
+ (WebCore::FrameLoader::loadPostRequest): Ditto.
+ * loader/FrameLoader.h:
+ * loader/FrameLoaderTypes.h: Add new 'HasDownloadAttribute' enum.
+ * loader/NavigationAction.cpp:
+ (WebCore::navigationType):
+ (WebCore::NavigationAction::NavigationAction): Update to accept new download
+ attribute flag and suggested filename.
+ * loader/NavigationAction.h:
+ (WebCore::NavigationAction::hasDownloadAttribute): Added.
+ (WebCore::NavigationAction::suggestedFilename): Added.
+ * loader/PolicyChecker.cpp:
+ (WebCore::PolicyChecker::checkNavigationPolicy): Pass more information to
+ 'continueAfterNavigationPolicy'
+ (WebCore::PolicyChecker::continueAfterNavigationPolicy): Accept suggested
+ filename
+ * loader/PolicyChecker.h:
+
2016-03-31 Youenn Fablet <[email protected]>
[Fetch API] Add basic loading of resources for Workers
Modified: trunk/Source/WebCore/html/HTMLAnchorElement.cpp (198892 => 198893)
--- trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/html/HTMLAnchorElement.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -562,22 +562,12 @@
URL kurl = document().completeURL(url.toString());
#if ENABLE(DOWNLOAD_ATTRIBUTE)
- if (hasAttribute(downloadAttr)) {
- ResourceRequest request(kurl);
-
- // FIXME: Why are we not calling addExtraFieldsToMainResourceRequest() if this check fails? It sets many important header fields.
- if (!hasRel(RelationNoReferrer)) {
- String referrer = SecurityPolicy::generateReferrerHeader(document().referrerPolicy(), kurl, frame->loader().outgoingReferrer());
- if (!referrer.isEmpty())
- request.setHTTPReferrer(referrer);
- frame->loader().addExtraFieldsToMainResourceRequest(request);
- }
-
- frame->loader().client().startDownload(request, fastGetAttribute(downloadAttr));
- } else
+ auto downloadAttribute = fastGetAttribute(downloadAttr);
+#else
+ auto downloadAttribute = nullAtom;
#endif
- frame->loader().urlSelected(kurl, target(), event, LockHistory::No, LockBackForwardList::No, hasRel(RelationNoReferrer) ? NeverSendReferrer : MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate());
+ frame->loader().urlSelected(kurl, target(), event, LockHistory::No, LockBackForwardList::No, hasRel(RelationNoReferrer) ? NeverSendReferrer : MaybeSendReferrer, document().shouldOpenExternalURLsPolicyToPropagate(), downloadAttribute);
sendPings(kurl);
}
Modified: trunk/Source/WebCore/loader/FrameLoadRequest.h (198892 => 198893)
--- trunk/Source/WebCore/loader/FrameLoadRequest.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/FrameLoadRequest.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2003, 2006, 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -38,7 +38,6 @@
public:
FrameLoadRequest(SecurityOrigin* requester, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
: m_requester(requester)
- , m_shouldCheckNewWindowPolicy(false)
, m_lockHistory(lockHistory)
, m_lockBackForwardList(lockBackForwardList)
, m_shouldSendReferrer(shouldSendReferrer)
@@ -52,7 +51,6 @@
FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
: m_requester(requester)
, m_resourceRequest(resourceRequest)
- , m_shouldCheckNewWindowPolicy(false)
, m_lockHistory(lockHistory)
, m_lockBackForwardList(lockBackForwardList)
, m_shouldSendReferrer(shouldSendReferrer)
@@ -67,7 +65,6 @@
: m_requester(requester)
, m_resourceRequest(resourceRequest)
, m_frameName(frameName)
- , m_shouldCheckNewWindowPolicy(false)
, m_lockHistory(lockHistory)
, m_lockBackForwardList(lockBackForwardList)
, m_shouldSendReferrer(shouldSendReferrer)
@@ -82,7 +79,6 @@
: m_requester(requester)
, m_resourceRequest(resourceRequest)
, m_frameName(frameName)
- , m_shouldCheckNewWindowPolicy(false)
, m_lockHistory(lockHistory)
, m_lockBackForwardList(lockBackForwardList)
, m_shouldSendReferrer(shouldSendReferrer)
@@ -93,6 +89,21 @@
{
}
+ FrameLoadRequest(SecurityOrigin* requester, const ResourceRequest& resourceRequest, const String& frameName, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, AllowNavigationToInvalidURL allowNavigationToInvalidURL, NewFrameOpenerPolicy newFrameOpenerPolicy, ShouldReplaceDocumentIfJavaScriptURL shouldReplaceDocumentIfJavaScriptURL, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute)
+ : m_requester(requester)
+ , m_resourceRequest(resourceRequest)
+ , m_frameName(frameName)
+ , m_lockHistory(lockHistory)
+ , m_lockBackForwardList(lockBackForwardList)
+ , m_shouldSendReferrer(shouldSendReferrer)
+ , m_allowNavigationToInvalidURL(allowNavigationToInvalidURL)
+ , m_newFrameOpenerPolicy(newFrameOpenerPolicy)
+ , m_shouldReplaceDocumentIfJavaScriptURL(shouldReplaceDocumentIfJavaScriptURL)
+ , m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+ , m_downloadAttribute(downloadAttribute)
+ {
+ }
+
WEBCORE_EXPORT FrameLoadRequest(Frame*, const ResourceRequest&, ShouldOpenExternalURLsPolicy, const SubstituteData& = SubstituteData());
bool isEmpty() const { return m_resourceRequest.isEmpty(); }
@@ -125,11 +136,13 @@
void setShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy policy) { m_shouldOpenExternalURLsPolicy = policy; }
ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const { return m_shouldOpenExternalURLsPolicy; }
+ const AtomicString& downloadAttribute() const { return m_downloadAttribute; }
+
private:
RefPtr<SecurityOrigin> m_requester;
ResourceRequest m_resourceRequest;
String m_frameName;
- bool m_shouldCheckNewWindowPolicy;
+ bool m_shouldCheckNewWindowPolicy { false };
SubstituteData m_substituteData;
LockHistory m_lockHistory;
@@ -139,6 +152,7 @@
NewFrameOpenerPolicy m_newFrameOpenerPolicy;
ShouldReplaceDocumentIfJavaScriptURL m_shouldReplaceDocumentIfJavaScriptURL;
ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+ AtomicString m_downloadAttribute;
};
}
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (198892 => 198893)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) 2008 Alp Toker <[email protected]>
@@ -342,11 +342,18 @@
urlSelected(request, nullptr);
}
+void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute)
+{
+ NewFrameOpenerPolicy newFrameOpenerPolicy = shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow;
+
+ urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, DoNotReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy, downloadAttribute), triggeringEvent);
+}
+
void FrameLoader::urlSelected(const URL& url, const String& passedTarget, Event* triggeringEvent, LockHistory lockHistory, LockBackForwardList lockBackForwardList, ShouldSendReferrer shouldSendReferrer, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
{
NewFrameOpenerPolicy newFrameOpenerPolicy = shouldSendReferrer == NeverSendReferrer ? NewFrameOpenerPolicy::Suppress : NewFrameOpenerPolicy::Allow;
- urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, DoNotReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy), triggeringEvent);
+ urlSelected(FrameLoadRequest(m_frame.document()->securityOrigin(), ResourceRequest(url), passedTarget, lockHistory, lockBackForwardList, shouldSendReferrer, AllowNavigationToInvalidURL::Yes, newFrameOpenerPolicy, DoNotReplaceDocumentIfJavaScriptURL, shouldOpenExternalURLsPolicy, nullAtom), triggeringEvent);
}
void FrameLoader::urlSelected(const FrameLoadRequest& passedRequest, Event* triggeringEvent)
@@ -1206,7 +1213,7 @@
if (m_pageDismissalEventBeingDispatched != PageDismissalType::None)
return;
- NavigationAction action(request, newLoadType, isFormSubmission, event, frameLoadRequest.shouldOpenExternalURLsPolicy());
+ NavigationAction action(request, newLoadType, isFormSubmission, event, frameLoadRequest.shouldOpenExternalURLsPolicy(), frameLoadRequest.downloadAttribute());
if (!targetFrame && !frameName.isEmpty()) {
action = "" frameLoadRequest.shouldOpenExternalURLsPolicy()));
@@ -2692,7 +2699,7 @@
workingResourceRequest.setHTTPContentType(contentType);
addExtraFieldsToRequest(workingResourceRequest, loadType, true);
- NavigationAction action(workingResourceRequest, loadType, true, event, request.shouldOpenExternalURLsPolicy());
+ NavigationAction action(workingResourceRequest, loadType, true, event, request.shouldOpenExternalURLsPolicy(), request.downloadAttribute());
if (!frameName.isEmpty()) {
// The search for a target frame is done earlier in the case of form submission.
Modified: trunk/Source/WebCore/loader/FrameLoader.h (198892 => 198893)
--- trunk/Source/WebCore/loader/FrameLoader.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/FrameLoader.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009, 2011, 2013 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
* Copyright (C) Research In Motion Limited 2009. All rights reserved.
* Copyright (C) 2011 Google Inc. All rights reserved.
@@ -120,6 +120,7 @@
unsigned long loadResourceSynchronously(const ResourceRequest&, StoredCredentials, ClientCredentialPolicy, ResourceError&, ResourceResponse&, RefPtr<SharedBuffer>& data);
void changeLocation(const FrameLoadRequest&);
+ WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute);
WEBCORE_EXPORT void urlSelected(const URL&, const String& target, Event*, LockHistory, LockBackForwardList, ShouldSendReferrer, ShouldOpenExternalURLsPolicy);
void submitForm(PassRefPtr<FormSubmission>);
Modified: trunk/Source/WebCore/loader/NavigationAction.cpp (198892 => 198893)
--- trunk/Source/WebCore/loader/NavigationAction.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/NavigationAction.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -48,60 +48,71 @@
return NavigationType::Other;
}
-NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, Event* event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, Event* event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute)
: m_resourceRequest(resourceRequest)
, m_type(type)
, m_event(event)
, m_processingUserGesture(ScriptController::processingUserGesture())
, m_shouldOpenExternalURLsPolicy(shouldOpenExternalURLsPolicy)
+ , m_downloadAttribute(downloadAttribute)
{
}
NavigationAction::NavigationAction()
- : NavigationAction(ResourceRequest(), NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(ResourceRequest(), NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest)
- : NavigationAction(resourceRequest, NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(resourceRequest, NavigationType::Other, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
- : NavigationAction(resourceRequest, NavigationType::Other, nullptr, shouldOpenExternalURLsPolicy)
+ : NavigationAction(resourceRequest, NavigationType::Other, nullptr, shouldOpenExternalURLsPolicy, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type)
- : NavigationAction(resourceRequest, type, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(resourceRequest, type, nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, Event* event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
+ : NavigationAction(resourceRequest, type, event, shouldOpenExternalURLsPolicy, nullAtom)
+{
+}
+
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission)
- : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, 0), nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, 0), nullptr, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, Event* event)
- : NavigationAction(resourceRequest, type, event, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(resourceRequest, type, event, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, NavigationType type, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
- : NavigationAction(resourceRequest, type, nullptr, shouldOpenExternalURLsPolicy)
+ : NavigationAction(resourceRequest, type, nullptr, shouldOpenExternalURLsPolicy, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission, Event* event)
- : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, ShouldOpenExternalURLsPolicy::ShouldNotAllow)
+ : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, ShouldOpenExternalURLsPolicy::ShouldNotAllow, nullAtom)
{
}
NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission, Event* event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy)
- : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, shouldOpenExternalURLsPolicy)
+ : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, shouldOpenExternalURLsPolicy, nullAtom)
{
}
+NavigationAction::NavigationAction(const ResourceRequest& resourceRequest, FrameLoadType frameLoadType, bool isFormSubmission, Event* event, ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute)
+ : NavigationAction(resourceRequest, navigationType(frameLoadType, isFormSubmission, event), event, shouldOpenExternalURLsPolicy, downloadAttribute)
+{
+}
+
NavigationAction NavigationAction::copyWithShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy) const
{
NavigationAction result(*this);
Modified: trunk/Source/WebCore/loader/NavigationAction.h (198892 => 198893)
--- trunk/Source/WebCore/loader/NavigationAction.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/NavigationAction.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -47,9 +47,11 @@
NavigationAction(const ResourceRequest&, ShouldOpenExternalURLsPolicy);
NavigationAction(const ResourceRequest&, NavigationType, Event*);
NavigationAction(const ResourceRequest&, NavigationType, Event*, ShouldOpenExternalURLsPolicy);
+ NavigationAction(const ResourceRequest&, NavigationType, Event*, ShouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute);
NavigationAction(const ResourceRequest&, NavigationType, ShouldOpenExternalURLsPolicy);
NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, Event*);
NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, Event*, ShouldOpenExternalURLsPolicy);
+ NavigationAction(const ResourceRequest&, FrameLoadType, bool isFormSubmission, Event*, ShouldOpenExternalURLsPolicy, const AtomicString& downloadAttribute);
NavigationAction copyWithShouldOpenExternalURLsPolicy(ShouldOpenExternalURLsPolicy) const;
@@ -65,12 +67,15 @@
ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy() const { return m_shouldOpenExternalURLsPolicy; }
+ const AtomicString& downloadAttribute() const { return m_downloadAttribute; }
+
private:
ResourceRequest m_resourceRequest;
- NavigationType m_type;
+ NavigationType m_type { NavigationType::Other };
RefPtr<Event> m_event;
bool m_processingUserGesture;
- ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy;
+ ShouldOpenExternalURLsPolicy m_shouldOpenExternalURLsPolicy { ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+ AtomicString m_downloadAttribute;
};
}
Modified: trunk/Source/WebCore/loader/PolicyChecker.cpp (198892 => 198893)
--- trunk/Source/WebCore/loader/PolicyChecker.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/PolicyChecker.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies)
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
@@ -117,6 +117,7 @@
#endif
m_delegateIsDecidingNavigationPolicy = true;
+ m_suggestedFilename = action.downloadAttribute();
m_frame.loader().client().dispatchDecidePolicyForNavigationAction(action, request, formState, [this](PolicyAction action) {
continueAfterNavigationPolicy(action);
});
@@ -185,7 +186,7 @@
case PolicyDownload: {
ResourceRequest request = callback.request();
m_frame.loader().setOriginalURLForDownloadRequest(request);
- m_frame.loader().client().startDownload(request);
+ m_frame.loader().client().startDownload(request, m_suggestedFilename);
callback.clearRequest();
break;
}
Modified: trunk/Source/WebCore/loader/PolicyChecker.h (198892 => 198893)
--- trunk/Source/WebCore/loader/PolicyChecker.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebCore/loader/PolicyChecker.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
* Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.torchmobile.com/)
*
* Redistribution and use in source and binary forms, with or without
@@ -69,6 +69,8 @@
FrameLoadType loadType() const { return m_loadType; }
void setLoadType(FrameLoadType loadType) { m_loadType = loadType; }
+ void setSuggestedFilename(const String& suggestedFilename) { m_suggestedFilename = suggestedFilename; }
+
bool delegateIsDecidingNavigationPolicy() const { return m_delegateIsDecidingNavigationPolicy; }
bool delegateIsHandlingUnimplementablePolicy() const { return m_delegateIsHandlingUnimplementablePolicy; }
@@ -100,6 +102,7 @@
// on navigation action delegate callbacks.
FrameLoadType m_loadType;
PolicyCallback m_callback;
+ String m_suggestedFilename;
#if ENABLE(CONTENT_FILTERING)
ContentFilterUnblockHandler m_contentFilterUnblockHandler;
Modified: trunk/Source/WebKit2/ChangeLog (198892 => 198893)
--- trunk/Source/WebKit2/ChangeLog 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/ChangeLog 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,3 +1,57 @@
+2016-03-31 Brent Fulgham <[email protected]>
+
+ [WK2] Support download attribute feature
+ https://bugs.webkit.org/show_bug.cgi?id=102914
+ <rdar://problem/13177492>
+
+ Reviewed by Darin Adler.
+
+ A first draft implementation of this feature.
+
+ * NetworkProcess/Downloads/Download.cpp:
+ (WebKit::Download::Download): Update to accept default filename.
+ (WebKit::Download::didStart): Send default filename in message.
+ * NetworkProcess/Downloads/Download.h:
+ * NetworkProcess/Downloads/DownloadManager.cpp:
+ (WebKit::DownloadManager::startDownload): Expect a default filename argument.
+ * NetworkProcess/Downloads/DownloadManager.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.cpp:
+ (WebKit::NetworkConnectionToWebProcess::startDownload): Expect a default
+ filename argument.
+ * NetworkProcess/NetworkConnectionToWebProcess.h:
+ * NetworkProcess/NetworkConnectionToWebProcess.messages.in: Update messages to
+ expect a default filename argument.
+ * Shared/NavigationActionData.cpp:
+ (WebKit::NavigationActionData::encode): Handle the download attribute flag and
+ the default filename.
+ (WebKit::NavigationActionData::decode): Ditto.
+ * Shared/NavigationActionData.h:
+ * UIProcess/API/APINavigationAction.h:
+ * UIProcess/Downloads/DownloadProxy.cpp:
+ (WebKit::DownloadProxy::didStart): Expect a default filename argument.
+ (WebKit::DownloadProxy::decideDestinationWithSuggestedFilename): Use the suggested
+ filename if the client delegate does not override it.
+ * UIProcess/Downloads/DownloadProxy.h:
+ * UIProcess/Downloads/DownloadProxy.messages.in: Include a default filename value.
+ * UIProcess/WebPageProxy.cpp:
+ (WebKit::WebPageProxy::receivedPolicyDecision): If the feature is enabled, and
+ the load was started with a download attribute, convert a "PolicyUse" decision
+ to "PolicyDownload".
+ (WebKit::WebPageProxy::decidePolicyForNavigationAction): Remember if the load
+ is happening due to a 'download' attribute link.
+ * UIProcess/WebPageProxy.h:
+ * WebProcess/WebCoreSupport/WebChromeClient.cpp:
+ (WebKit::WebChromeClient::createWindow): Populate the navigationActionData object
+ with any download attribute and suggested filename.
+ * WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
+ (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNewWindowAction): Populate the
+ navigationActionData object with any download attribute and suggested filename.
+ (WebKit::WebFrameLoaderClient::dispatchDecidePolicyForNavigationAction): Ditto.
+ (WebKit::WebFrameLoaderClient::startDownload): Expect a suggested filename argument.
+ * WebProcess/WebPage/WebFrame.cpp:
+ (WebKit::WebFrame::startDownload): Expect a suggested filename argument.
+ * WebProcess/WebPage/WebFrame.h:
+
2016-03-30 Alex Christensen <[email protected]>
CMake build fix.
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,9 +44,9 @@
namespace WebKit {
#if USE(NETWORK_SESSION) && PLATFORM(COCOA)
-Download::Download(DownloadManager& downloadManager, DownloadID downloadID, NSURLSessionDownloadTask* download)
+Download::Download(DownloadManager& downloadManager, DownloadID downloadID, NSURLSessionDownloadTask* download, const String& suggestedName)
#else
-Download::Download(DownloadManager& downloadManager, DownloadID downloadID, const ResourceRequest& request)
+Download::Download(DownloadManager& downloadManager, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
#endif
: m_downloadManager(downloadManager)
, m_downloadID(downloadID)
@@ -56,6 +56,7 @@
#if USE(NETWORK_SESSION) && PLATFORM(COCOA)
, m_download(download)
#endif
+ , m_suggestedName(suggestedName)
{
ASSERT(m_downloadID.downloadID());
@@ -72,7 +73,7 @@
#if !USE(NETWORK_SESSION)
void Download::didStart()
{
- send(Messages::DownloadProxy::DidStart(m_request));
+ send(Messages::DownloadProxy::DidStart(m_request, m_suggestedName));
}
#endif
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/Download.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -76,9 +76,9 @@
WTF_MAKE_NONCOPYABLE(Download);
public:
#if USE(NETWORK_SESSION) && PLATFORM(COCOA)
- Download(DownloadManager&, DownloadID, NSURLSessionDownloadTask*);
+ Download(DownloadManager&, DownloadID, NSURLSessionDownloadTask*, const String& suggestedFilename = { });
#else
- Download(DownloadManager&, DownloadID, const WebCore::ResourceRequest&);
+ Download(DownloadManager&, DownloadID, const WebCore::ResourceRequest&, const String& suggestedFilename = { });
#endif
~Download();
@@ -144,6 +144,7 @@
std::unique_ptr<WebCore::ResourceHandleClient> m_downloadClient;
RefPtr<WebCore::ResourceHandle> m_resourceHandle;
#endif
+ String m_suggestedName;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -44,7 +44,7 @@
{
}
-void DownloadManager::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request)
+void DownloadManager::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
{
#if USE(NETWORK_SESSION)
auto* networkSession = SessionTracker::networkSession(sessionID);
@@ -56,7 +56,7 @@
parameters.clientCredentialPolicy = AskClientForAllCredentials;
m_pendingDownloads.add(downloadID, std::make_unique<PendingDownload>(parameters, downloadID));
#else
- auto download = std::make_unique<Download>(*this, downloadID, request);
+ auto download = std::make_unique<Download>(*this, downloadID, request, suggestedName);
download->start();
ASSERT(!m_downloads.contains(downloadID));
Modified: trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/Downloads/DownloadManager.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -74,7 +74,7 @@
explicit DownloadManager(Client&);
- void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
+ void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedName = { });
#if USE(NETWORK_SESSION)
std::pair<RefPtr<NetworkDataTask>, std::unique_ptr<PendingDownload>> dataTaskBecameDownloadTask(DownloadID, std::unique_ptr<Download>&&);
void continueCanAuthenticateAgainstProtectionSpace(DownloadID, bool canAuthenticate);
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -186,9 +186,9 @@
return NetworkStorageSession::defaultStorageSession();
}
-void NetworkConnectionToWebProcess::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request)
+void NetworkConnectionToWebProcess::startDownload(SessionID sessionID, DownloadID downloadID, const ResourceRequest& request, const String& suggestedName)
{
- NetworkProcess::singleton().downloadManager().startDownload(sessionID, downloadID, request);
+ NetworkProcess::singleton().downloadManager().startDownload(sessionID, downloadID, request, suggestedName);
}
void NetworkConnectionToWebProcess::convertMainResourceLoadToDownload(SessionID sessionID, uint64_t mainResourceLoadIdentifier, DownloadID downloadID, const ResourceRequest& request, const ResourceResponse& response)
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -77,7 +77,7 @@
void removeLoadIdentifier(ResourceLoadIdentifier);
void setDefersLoading(ResourceLoadIdentifier, bool);
void crossOriginRedirectReceived(ResourceLoadIdentifier, const WebCore::URL& redirectURL);
- void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&);
+ void startDownload(WebCore::SessionID, DownloadID, const WebCore::ResourceRequest&, const String& suggestedName = { });
void convertMainResourceLoadToDownload(WebCore::SessionID, uint64_t mainResourceLoadIdentifier, DownloadID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
void cookiesForDOM(WebCore::SessionID, const WebCore::URL& firstParty, const WebCore::URL&, String& result);
Modified: trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in (198892 => 198893)
--- trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/NetworkProcess/NetworkConnectionToWebProcess.messages.in 2016-03-31 15:35:41 UTC (rev 198893)
@@ -29,7 +29,7 @@
SetDefersLoading(uint64_t resourceLoadIdentifier, bool defers)
PrefetchDNS(String hostname)
- StartDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request)
+ StartDownload(WebCore::SessionID sessionID, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, String suggestedName)
ConvertMainResourceLoadToDownload(WebCore::SessionID sessionID, uint64_t mainResourceLoadIdentifier, WebKit::DownloadID downloadID, WebCore::ResourceRequest request, WebCore::ResourceResponse response)
CookiesForDOM(WebCore::SessionID sessionID, WebCore::URL firstParty, WebCore::URL url) -> (String result)
Modified: trunk/Source/WebKit2/Shared/NavigationActionData.cpp (198892 => 198893)
--- trunk/Source/WebKit2/Shared/NavigationActionData.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/Shared/NavigationActionData.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -26,6 +26,7 @@
#include "config.h"
#include "NavigationActionData.h"
+#include "ArgumentCoders.h"
#include "ArgumentDecoder.h"
#include "ArgumentEncoder.h"
@@ -41,6 +42,7 @@
encoder << isProcessingUserGesture;
encoder << canHandleRequest;
encoder.encodeEnum(shouldOpenExternalURLsPolicy);
+ encoder << downloadAttribute;
}
bool NavigationActionData::decode(IPC::ArgumentDecoder& decoder, NavigationActionData& result)
@@ -57,6 +59,8 @@
return false;
if (!decoder.decodeEnum(result.shouldOpenExternalURLsPolicy))
return false;
+ if (!decoder.decode(result.downloadAttribute))
+ return false;
return true;
}
Modified: trunk/Source/WebKit2/Shared/NavigationActionData.h (198892 => 198893)
--- trunk/Source/WebKit2/Shared/NavigationActionData.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/Shared/NavigationActionData.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -46,6 +46,7 @@
bool isProcessingUserGesture { false };
bool canHandleRequest { false };
WebCore::ShouldOpenExternalURLsPolicy shouldOpenExternalURLsPolicy { WebCore::ShouldOpenExternalURLsPolicy::ShouldNotAllow };
+ WTF::String downloadAttribute;
};
}
Modified: trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/API/APINavigationAction.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -66,6 +66,7 @@
bool canHandleRequest() const { return m_navigationActionData.canHandleRequest; }
bool shouldOpenExternalSchemes() const { return m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow || m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllowExternalSchemes; }
bool shouldOpenAppLinks() const { return m_shouldOpenAppLinks && m_navigationActionData.shouldOpenExternalURLsPolicy == WebCore::ShouldOpenExternalURLsPolicy::ShouldAllow; }
+ bool shouldPerformDownload() const { return !m_navigationActionData.downloadAttribute.isNull(); }
private:
RefPtr<FrameInfo> m_sourceFrame;
Modified: trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/Cocoa/NavigationState.mm 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -301,7 +301,10 @@
RetainPtr<NSURLRequest> nsURLRequest = adoptNS(wrapper(API::URLRequest::create(localNavigationAction->request()).leakRef()));
if ([NSURLConnection canHandleRequest:nsURLRequest.get()]) {
- localListener->use();
+ if (localNavigationAction->shouldPerformDownload())
+ localListener->download();
+ else
+ localListener->use();
return;
}
Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -91,9 +91,10 @@
m_processPool->downloadClient().processDidCrash(m_processPool.get(), this);
}
-void DownloadProxy::didStart(const ResourceRequest& request)
+void DownloadProxy::didStart(const ResourceRequest& request, const AtomicString& suggestedFilename)
{
m_request = request;
+ m_suggestedFilename = suggestedFilename;
if (!m_processPool)
return;
@@ -196,7 +197,11 @@
if (!m_processPool)
return;
- destination = m_processPool->downloadClient().decideDestinationWithSuggestedFilename(m_processPool.get(), this, filename, allowOverwrite);
+ String suggestedFilename = filename;
+ if (!m_suggestedFilename.isNull())
+ suggestedFilename = m_suggestedFilename;
+
+ destination = m_processPool->downloadClient().decideDestinationWithSuggestedFilename(m_processPool.get(), this, suggestedFilename, allowOverwrite);
if (!destination.isNull())
SandboxExtension::createHandle(destination, SandboxExtension::ReadWrite, sandboxExtensionHandle);
Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -77,7 +77,7 @@
void didReceiveSyncMessage(IPC::Connection&, IPC::MessageDecoder&, std::unique_ptr<IPC::MessageEncoder>&) override;
// Message handlers.
- void didStart(const WebCore::ResourceRequest&);
+ void didStart(const WebCore::ResourceRequest&, const AtomicString& suggestedFilename);
void didReceiveAuthenticationChallenge(const WebCore::AuthenticationChallenge&, uint64_t challengeID);
void didReceiveResponse(const WebCore::ResourceResponse&);
void didReceiveData(uint64_t length);
@@ -101,6 +101,7 @@
RefPtr<API::Data> m_resumeData;
WebCore::ResourceRequest m_request;
+ AtomicString m_suggestedFilename;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/Downloads/DownloadProxy.messages.in 2016-03-31 15:35:41 UTC (rev 198893)
@@ -21,7 +21,7 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
messages -> DownloadProxy {
- DidStart(WebCore::ResourceRequest request)
+ DidStart(WebCore::ResourceRequest request, AtomicString suggestedFilename)
DidReceiveAuthenticationChallenge(WebCore::AuthenticationChallenge challenge, uint64_t challengeID)
#if USE(NETWORK_SESSION)
WillSendRequest(WebCore::ResourceRequest redirectRequest, WebCore::ResourceResponse redirectResponse));
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -2048,6 +2048,11 @@
if (action == PolicyIgnore)
m_pageLoadState.clearPendingAPIRequestURL(transaction);
+#if ENABLE(DOWNLOAD_ATTRIBUTE)
+ if (m_syncNavigationActionHasDownloadAttribute && action == PolicyUse)
+ action = ""
+#endif
+
DownloadID downloadID = { };
if (action == PolicyDownload) {
// Create a download proxy.
@@ -3344,6 +3349,9 @@
m_inDecidePolicyForNavigationAction = true;
m_syncNavigationActionPolicyActionIsValid = false;
+#if ENABLE(DOWNLOAD_ATTRIBUTE)
+ m_syncNavigationActionHasDownloadAttribute = !navigationActionData.downloadAttribute.isNull();
+#endif
if (m_navigationClient) {
RefPtr<API::FrameInfo> destinationFrameInfo;
Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (198892 => 198893)
--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1808,6 +1808,10 @@
bool m_hasDeferredStartAssistingNode { false };
std::unique_ptr<NodeAssistanceArguments> m_deferredNodeAssistanceArguments;
#endif
+
+#if ENABLE(DOWNLOAD_ATTRIBUTE)
+ bool m_syncNavigationActionHasDownloadAttribute { false };
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp (198892 => 198893)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebChromeClient.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
* Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
*
* Redistribution and use in source and binary forms, with or without
@@ -223,6 +223,7 @@
navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
navigationActionData.canHandleRequest = m_page->canHandleRequest(request.resourceRequest());
navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
uint64_t newPageID = 0;
WebPageCreationParameters parameters;
Modified: trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp (198892 => 198893)
--- trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010, 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -747,6 +747,7 @@
navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
WebCore::Frame* coreFrame = m_frame ? m_frame->coreFrame() : nullptr;
webPage->send(Messages::WebPageProxy::DecidePolicyForNewWindowAction(m_frame->frameID(), SecurityOriginData::fromFrame(coreFrame), navigationActionData, request, frameName, listenerID, UserData(WebProcess::singleton().transformObjectsToHandles(userData.get()).get())));
@@ -812,6 +813,7 @@
navigationActionData.isProcessingUserGesture = navigationAction.processingUserGesture();
navigationActionData.canHandleRequest = webPage->canHandleRequest(request);
navigationActionData.shouldOpenExternalURLsPolicy = navigationAction.shouldOpenExternalURLsPolicy();
+ navigationActionData.downloadAttribute = navigationAction.downloadAttribute();
WebCore::Frame* coreFrame = m_frame->coreFrame();
WebDocumentLoader* documentLoader = static_cast<WebDocumentLoader*>(coreFrame->loader().policyDocumentLoader());
@@ -910,9 +912,9 @@
notImplemented();
}
-void WebFrameLoaderClient::startDownload(const ResourceRequest& request, const String& /* suggestedName */)
+void WebFrameLoaderClient::startDownload(const ResourceRequest& request, const String& suggestedName)
{
- m_frame->startDownload(request);
+ m_frame->startDownload(request, suggestedName);
}
void WebFrameLoaderClient::willChangeTitle(DocumentLoader*)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp (198892 => 198893)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.cpp 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -246,7 +246,7 @@
function(action);
}
-void WebFrame::startDownload(const WebCore::ResourceRequest& request)
+void WebFrame::startDownload(const WebCore::ResourceRequest& request, const String& suggestedName)
{
ASSERT(m_policyDownloadID.downloadID());
@@ -255,7 +255,7 @@
auto& webProcess = WebProcess::singleton();
SessionID sessionID = page() ? page()->sessionID() : SessionID::defaultSessionID();
- webProcess.networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::StartDownload(sessionID, policyDownloadID, request), 0);
+ webProcess.networkConnection()->connection()->send(Messages::NetworkConnectionToWebProcess::StartDownload(sessionID, policyDownloadID, request, suggestedName), 0);
}
void WebFrame::convertMainResourceLoadToDownload(DocumentLoader* documentLoader, SessionID sessionID, const ResourceRequest& request, const ResourceResponse& response)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h (198892 => 198893)
--- trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2016-03-31 14:57:47 UTC (rev 198892)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebFrame.h 2016-03-31 15:35:41 UTC (rev 198893)
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2010 Apple Inc. All rights reserved.
+ * Copyright (C) 2010-2016 Apple Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@@ -83,7 +83,7 @@
void invalidatePolicyListener();
void didReceivePolicyDecision(uint64_t listenerID, WebCore::PolicyAction, uint64_t navigationID, DownloadID);
- void startDownload(const WebCore::ResourceRequest&);
+ void startDownload(const WebCore::ResourceRequest&, const String& suggestedName = { });
void convertMainResourceLoadToDownload(WebCore::DocumentLoader*, WebCore::SessionID, const WebCore::ResourceRequest&, const WebCore::ResourceResponse&);
String source() const;