Diff
Modified: trunk/LayoutTests/imported/w3c/ChangeLog (223440 => 223441)
--- trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/LayoutTests/imported/w3c/ChangeLog 2017-10-16 21:57:27 UTC (rev 223441)
@@ -1,3 +1,17 @@
+2017-10-16 Youenn Fablet <[email protected]>
+
+ [FETCH] Remove Request.type getter
+ https://bugs.webkit.org/show_bug.cgi?id=177798
+
+ Reviewed by Chris Dumez.
+
+ Refreshing fetch WPT tests.
+
+ * web-platform-tests/fetch/api/request/request-type-attribute-historical-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/request-type-attribute-historical.html: Added.
+ * web-platform-tests/fetch/api/request/url-encoding-expected.txt: Added.
+ * web-platform-tests/fetch/api/request/url-encoding.html: Added.
+
2017-10-16 Chris Dumez <[email protected]>
Clicks on Link with download attribute causes all (other) links to trigger download when clicked
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical-expected.txt (0 => 223441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical-expected.txt 2017-10-16 21:57:27 UTC (rev 223441)
@@ -0,0 +1,3 @@
+
+PASS 'type' getter should not exist on Request objects
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html (0 => 223441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html 2017-10-16 21:57:27 UTC (rev 223441)
@@ -0,0 +1,11 @@
+<!DOCTYPE html>
+<title>Request.type attribute should not exist</title>
+<script src=""
+<script src=""
+<div id=log></div>
+<script>
+ var request = new Request("https://domfarolino.com");
+ test(() => {
+ assert_equals(request.type, undefined, "request.type should be undefined");
+ }, "'type' getter should not exist on Request objects");
+</script>
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt (0 => 223441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding-expected.txt 2017-10-16 21:57:27 UTC (rev 223441)
@@ -0,0 +1,4 @@
+
+FAIL URL encoding and Request assert_equals: expected "http://localhost:8800/fetch/api/request/url-encoding.html?%C3%9F" but got "http://localhost:8800/fetch/api/request/url-encoding.html?%DF"
+FAIL URL encoding and fetch() assert_equals: expected "http://localhost:8800/fetch/api/request/url-encoding.html?%C3%9F" but got "http://localhost:8800/fetch/api/request/url-encoding.html?%DF"
+
Added: trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html (0 => 223441)
--- trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html (rev 0)
+++ trunk/LayoutTests/imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html 2017-10-16 21:57:27 UTC (rev 223441)
@@ -0,0 +1,25 @@
+<!doctype html>
+<meta charset=windows-1252>
+<title>Fetch: URL encoding</title>
+<script src=""
+<script src=""
+<script>
+const expectedURL = new URL("?%C3%9F", location.href).href;
+const expectedURL2 = new URL("?%EF%BF%BD", location.href).href;
+test(() => {
+ let r = new Request("?\u00DF");
+ assert_equals(r.url, expectedURL);
+
+ r = new Request("?\uD83D");
+ assert_equals(r.url, expectedURL2);
+}, "URL encoding and Request");
+
+promise_test(() => {
+ return fetch("?\u00DF").then(res => {
+ assert_equals(res.url, expectedURL);
+ return fetch("?\uD83D").then(res2 => {
+ assert_equals(res2.url, expectedURL2);
+ });
+ });
+}, "URL encoding and fetch()");
+</script>
Modified: trunk/Source/WebCore/ChangeLog (223440 => 223441)
--- trunk/Source/WebCore/ChangeLog 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/ChangeLog 2017-10-16 21:57:27 UTC (rev 223441)
@@ -1,3 +1,43 @@
+2017-10-16 Youenn Fablet <[email protected]>
+
+ [FETCH] Remove Request.type getter
+ https://bugs.webkit.org/show_bug.cgi?id=177798
+
+ Reviewed by Chris Dumez.
+
+ Tests: imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html
+ imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html
+
+ Removing FetchRequest type getter.
+ Merging Type and Destination as per https://fetch.spec.whatwg.org/#concept-request-destination.
+ Setting destination of request within CachedResourceLoader as this will be useful to Service Workers.
+
+ * Modules/fetch/FetchRequest.h:
+ * Modules/fetch/FetchRequest.idl:
+ * loader/FetchOptions.h:
+ (WebCore::FetchOptions::isolatedCopy const):
+ (WebCore::FetchOptions::FetchOptions):
+ (WebCore::FetchOptions::encode const):
+ (WebCore::FetchOptions::decode):
+ * loader/ThreadableLoader.cpp:
+ (WebCore::ThreadableLoaderOptions::isolatedCopy const):
+ * loader/cache/CachedResourceLoader.cpp:
+ (WebCore::CachedResourceLoader::requestImage):
+ (WebCore::CachedResourceLoader::requestFont):
+ (WebCore::CachedResourceLoader::requestTextTrack):
+ (WebCore::CachedResourceLoader::requestCSSStyleSheet):
+ (WebCore::CachedResourceLoader::requestUserCSSStyleSheet):
+ (WebCore::CachedResourceLoader::requestScript):
+ (WebCore::CachedResourceLoader::requestXSLStyleSheet):
+ (WebCore::CachedResourceLoader::requestMedia):
+ (WebCore::CachedResourceLoader::requestIcon):
+ (WebCore::CachedResourceLoader::requestRawResource):
+ (WebCore::CachedResourceLoader::requestBeaconResource):
+ (WebCore::CachedResourceLoader::requestMainResource):
+ * loader/cache/CachedResourceRequest.cpp:
+ (WebCore::CachedResourceRequest::setDestinationIfNotSet):
+ * loader/cache/CachedResourceRequest.h:
+
2017-10-15 Ryosuke Niwa <[email protected]>
Cannot access images included in the content pasted from Microsoft Word
Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.h (223440 => 223441)
--- trunk/Source/WebCore/Modules/fetch/FetchRequest.h 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.h 2017-10-16 21:57:27 UTC (rev 223441)
@@ -51,7 +51,6 @@
using Destination = FetchOptions::Destination;
using Mode = FetchOptions::Mode;
using Redirect = FetchOptions::Redirect;
- using Type = FetchOptions::Type;
static ExceptionOr<Ref<FetchRequest>> create(ScriptExecutionContext&, Info&&, Init&&);
@@ -62,7 +61,6 @@
FetchHeaders& headers() { return m_headers.get(); }
const FetchHeaders& headers() const { return m_headers.get(); }
- Type type() const { return m_options.type; }
Destination destination() const { return m_options.destination; }
String referrer() const;
ReferrerPolicy referrerPolicy() const { return m_options.referrerPolicy; }
Modified: trunk/Source/WebCore/Modules/fetch/FetchRequest.idl (223440 => 223441)
--- trunk/Source/WebCore/Modules/fetch/FetchRequest.idl 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/Modules/fetch/FetchRequest.idl 2017-10-16 21:57:27 UTC (rev 223441)
@@ -26,8 +26,7 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-enum FetchRequestType { "", "audio", "font", "image", "script", "style", "track", "video" };
-enum FetchRequestDestination { "", "document", "sharedworker", "subresource", "unknown", "worker" };
+enum FetchRequestDestination { "", "audio", "document", "embed", "font", "image", "manifest", "object", "report", "script", "serviceworker", "sharedworker", "style", "track", "video", "worker", "xslt" };
typedef (FetchRequest or USVString) RequestInfo;
@@ -46,7 +45,6 @@
[ImplementedAs=urlString] readonly attribute USVString url;
readonly attribute FetchHeaders headers; // FIXME: Should be [SameObject].
- readonly attribute FetchRequestType type;
readonly attribute FetchRequestDestination destination;
readonly attribute USVString referrer;
readonly attribute FetchReferrerPolicy referrerPolicy;
Modified: trunk/Source/WebCore/loader/FetchOptions.h (223440 => 223441)
--- trunk/Source/WebCore/loader/FetchOptions.h 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/loader/FetchOptions.h 2017-10-16 21:57:27 UTC (rev 223441)
@@ -34,8 +34,7 @@
namespace WebCore {
struct FetchOptions {
- enum class Type { EmptyString, Audio, Font, Image, Script, Style, Track, Video };
- enum class Destination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker };
+ enum class Destination { EmptyString, Audio, Document, Embed, Font, Image, Manifest, Object, Report, Script, Serviceworker, Sharedworker, Style, Track, Video, Worker, Xslt };
enum class Mode { Navigate, SameOrigin, NoCors, Cors };
enum class Credentials { Omit, SameOrigin, Include };
enum class Cache { Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached };
@@ -42,13 +41,12 @@
enum class Redirect { Follow, Error, Manual };
FetchOptions() = default;
- FetchOptions(Type, Destination, Mode, Credentials, Cache, Redirect, ReferrerPolicy, String&&, bool);
- FetchOptions isolatedCopy() const { return { type, destination, mode, credentials, cache, redirect, referrerPolicy, integrity.isolatedCopy(), keepAlive }; }
+ FetchOptions(Destination, Mode, Credentials, Cache, Redirect, ReferrerPolicy, String&&, bool);
+ FetchOptions isolatedCopy() const { return { destination, mode, credentials, cache, redirect, referrerPolicy, integrity.isolatedCopy(), keepAlive }; }
template<class Encoder> void encode(Encoder&) const;
template<class Decoder> static bool decode(Decoder&, FetchOptions&);
- Type type { Type::EmptyString };
Destination destination { Destination::EmptyString };
Mode mode { Mode::NoCors };
Credentials credentials { Credentials::Omit };
@@ -59,9 +57,8 @@
bool keepAlive { false };
};
-inline FetchOptions::FetchOptions(Type type, Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive)
- : type(type)
- , destination(destination)
+inline FetchOptions::FetchOptions(Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive)
+ : destination(destination)
, mode(mode)
, credentials(credentials)
, cache(cache)
@@ -76,29 +73,26 @@
namespace WTF {
-template<> struct EnumTraits<WebCore::FetchOptions::Type> {
- using values = EnumValues<
- WebCore::FetchOptions::Type,
- WebCore::FetchOptions::Type::EmptyString,
- WebCore::FetchOptions::Type::Audio,
- WebCore::FetchOptions::Type::Font,
- WebCore::FetchOptions::Type::Image,
- WebCore::FetchOptions::Type::Script,
- WebCore::FetchOptions::Type::Style,
- WebCore::FetchOptions::Type::Track,
- WebCore::FetchOptions::Type::Video
- >;
-};
-
template<> struct EnumTraits<WebCore::FetchOptions::Destination> {
using values = EnumValues<
WebCore::FetchOptions::Destination,
WebCore::FetchOptions::Destination::EmptyString,
+ WebCore::FetchOptions::Destination::Audio,
WebCore::FetchOptions::Destination::Document,
+ WebCore::FetchOptions::Destination::Embed,
+ WebCore::FetchOptions::Destination::Font,
+ WebCore::FetchOptions::Destination::Image,
+ WebCore::FetchOptions::Destination::Manifest,
+ WebCore::FetchOptions::Destination::Object,
+ WebCore::FetchOptions::Destination::Report,
+ WebCore::FetchOptions::Destination::Script,
+ WebCore::FetchOptions::Destination::Serviceworker,
WebCore::FetchOptions::Destination::Sharedworker,
- WebCore::FetchOptions::Destination::Subresource,
- WebCore::FetchOptions::Destination::Unknown,
- WebCore::FetchOptions::Destination::Worker
+ WebCore::FetchOptions::Destination::Style,
+ WebCore::FetchOptions::Destination::Track,
+ WebCore::FetchOptions::Destination::Video,
+ WebCore::FetchOptions::Destination::Worker,
+ WebCore::FetchOptions::Destination::Xslt
>;
};
@@ -148,7 +142,6 @@
template<class Encoder> inline void FetchOptions::encode(Encoder& encoder) const
{
- encoder << type;
encoder << destination;
encoder << mode;
encoder << credentials;
@@ -161,10 +154,6 @@
template<class Decoder> inline bool FetchOptions::decode(Decoder& decoder, FetchOptions& options)
{
- FetchOptions::Type type;
- if (!decoder.decode(type))
- return false;
-
FetchOptions::Destination destination;
if (!decoder.decode(destination))
return false;
@@ -197,7 +186,6 @@
if (!decoder.decode(keepAlive))
return false;
- options.type = type;
options.destination = destination;
options.mode = mode;
options.credentials = credentials;
Modified: trunk/Source/WebCore/loader/ThreadableLoader.cpp (223440 => 223441)
--- trunk/Source/WebCore/loader/ThreadableLoader.cpp 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/loader/ThreadableLoader.cpp 2017-10-16 21:57:27 UTC (rev 223441)
@@ -65,7 +65,6 @@
ThreadableLoaderOptions copy;
// FetchOptions
- copy.type = this->type;
copy.destination = this->destination;
copy.mode = this->mode;
copy.credentials = this->credentials;
Modified: trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp (223440 => 223441)
--- trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp 2017-10-16 21:57:27 UTC (rev 223441)
@@ -192,6 +192,7 @@
ResourceErrorOr<CachedResourceHandle<CachedImage>> CachedResourceLoader::requestImage(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Image);
if (Frame* frame = this->frame()) {
if (frame->loader().pageDismissalEventBeingDispatched() != FrameLoader::PageDismissalType::None) {
if (Document* document = frame->document())
@@ -209,6 +210,7 @@
ResourceErrorOr<CachedResourceHandle<CachedFont>> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Font);
#if ENABLE(SVG_FONTS)
if (isSVG)
return castCachedResourceTo<CachedFont>(requestResource(CachedResource::SVGFontResource, WTFMove(request)));
@@ -221,6 +223,7 @@
#if ENABLE(VIDEO_TRACK)
ResourceErrorOr<CachedResourceHandle<CachedTextTrack>> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Track);
return castCachedResourceTo<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request)));
}
#endif
@@ -227,11 +230,14 @@
ResourceErrorOr<CachedResourceHandle<CachedCSSStyleSheet>> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Style);
return castCachedResourceTo<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request)));
}
CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Style);
+
ASSERT(document());
request.setDomainForCachePartition(*document());
@@ -258,6 +264,7 @@
ResourceErrorOr<CachedResourceHandle<CachedScript>> CachedResourceLoader::requestScript(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Script);
return castCachedResourceTo<CachedScript>(requestResource(CachedResource::Script, WTFMove(request)));
}
@@ -264,6 +271,7 @@
#if ENABLE(XSLT)
ResourceErrorOr<CachedResourceHandle<CachedXSLStyleSheet>> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Xslt);
return castCachedResourceTo<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request)));
}
#endif
@@ -284,26 +292,31 @@
ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestMedia(CachedResourceRequest&& request)
{
+ // FIXME: Set destination to either audio or video.
return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request)));
}
ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestIcon(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Image);
return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request)));
}
ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request)
{
+ ASSERT(request.options().destination == FetchOptions::Destination::EmptyString);
return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request)));
}
ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request)
{
+ ASSERT(request.options().destination == FetchOptions::Destination::EmptyString);
return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Beacon, WTFMove(request)));
}
ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request)
{
+ request.setDestinationIfNotSet(FetchOptions::Destination::Document);
return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request)));
}
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp (223440 => 223441)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp 2017-10-16 21:57:27 UTC (rev 223441)
@@ -266,4 +266,11 @@
return !origin->canRequest(requestURL);
}
+void CachedResourceRequest::setDestinationIfNotSet(FetchOptions::Destination destination)
+{
+ if (m_options.destination != FetchOptions::Destination::EmptyString)
+ return;
+ m_options.destination = destination;
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/loader/cache/CachedResourceRequest.h (223440 => 223441)
--- trunk/Source/WebCore/loader/cache/CachedResourceRequest.h 2017-10-16 21:44:28 UTC (rev 223440)
+++ trunk/Source/WebCore/loader/cache/CachedResourceRequest.h 2017-10-16 21:57:27 UTC (rev 223441)
@@ -68,6 +68,8 @@
bool ignoreForRequestCount() const { return m_ignoreForRequestCount; }
void setIgnoreForRequestCount(bool ignoreForRequestCount) { m_ignoreForRequestCount = ignoreForRequestCount; }
+ void setDestinationIfNotSet(FetchOptions::Destination);
+
void setAsPotentiallyCrossOrigin(const String&, Document&);
void updateForAccessControl(Document&);