Changeset 223441 in webkit
- Timestamp:
- Oct 16, 2017 2:57:27 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/imported/w3c/ChangeLog
r223413 r223441 1 2017-10-16 Youenn Fablet <youenn@apple.com> 2 3 [FETCH] Remove Request.type getter 4 https://bugs.webkit.org/show_bug.cgi?id=177798 5 6 Reviewed by Chris Dumez. 7 8 Refreshing fetch WPT tests. 9 10 * web-platform-tests/fetch/api/request/request-type-attribute-historical-expected.txt: Added. 11 * web-platform-tests/fetch/api/request/request-type-attribute-historical.html: Added. 12 * web-platform-tests/fetch/api/request/url-encoding-expected.txt: Added. 13 * web-platform-tests/fetch/api/request/url-encoding.html: Added. 14 1 15 2017-10-16 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/Source/WebCore/ChangeLog
r223440 r223441 1 2017-10-16 Youenn Fablet <youenn@apple.com> 2 3 [FETCH] Remove Request.type getter 4 https://bugs.webkit.org/show_bug.cgi?id=177798 5 6 Reviewed by Chris Dumez. 7 8 Tests: imported/w3c/web-platform-tests/fetch/api/request/request-type-attribute-historical.html 9 imported/w3c/web-platform-tests/fetch/api/request/url-encoding.html 10 11 Removing FetchRequest type getter. 12 Merging Type and Destination as per https://fetch.spec.whatwg.org/#concept-request-destination. 13 Setting destination of request within CachedResourceLoader as this will be useful to Service Workers. 14 15 * Modules/fetch/FetchRequest.h: 16 * Modules/fetch/FetchRequest.idl: 17 * loader/FetchOptions.h: 18 (WebCore::FetchOptions::isolatedCopy const): 19 (WebCore::FetchOptions::FetchOptions): 20 (WebCore::FetchOptions::encode const): 21 (WebCore::FetchOptions::decode): 22 * loader/ThreadableLoader.cpp: 23 (WebCore::ThreadableLoaderOptions::isolatedCopy const): 24 * loader/cache/CachedResourceLoader.cpp: 25 (WebCore::CachedResourceLoader::requestImage): 26 (WebCore::CachedResourceLoader::requestFont): 27 (WebCore::CachedResourceLoader::requestTextTrack): 28 (WebCore::CachedResourceLoader::requestCSSStyleSheet): 29 (WebCore::CachedResourceLoader::requestUserCSSStyleSheet): 30 (WebCore::CachedResourceLoader::requestScript): 31 (WebCore::CachedResourceLoader::requestXSLStyleSheet): 32 (WebCore::CachedResourceLoader::requestMedia): 33 (WebCore::CachedResourceLoader::requestIcon): 34 (WebCore::CachedResourceLoader::requestRawResource): 35 (WebCore::CachedResourceLoader::requestBeaconResource): 36 (WebCore::CachedResourceLoader::requestMainResource): 37 * loader/cache/CachedResourceRequest.cpp: 38 (WebCore::CachedResourceRequest::setDestinationIfNotSet): 39 * loader/cache/CachedResourceRequest.h: 40 1 41 2017-10-15 Ryosuke Niwa <rniwa@webkit.org> 2 42 -
trunk/Source/WebCore/Modules/fetch/FetchRequest.h
r221397 r223441 52 52 using Mode = FetchOptions::Mode; 53 53 using Redirect = FetchOptions::Redirect; 54 using Type = FetchOptions::Type;55 54 56 55 … … 63 62 const FetchHeaders& headers() const { return m_headers.get(); } 64 63 65 Type type() const { return m_options.type; }66 64 Destination destination() const { return m_options.destination; } 67 65 String referrer() const; -
trunk/Source/WebCore/Modules/fetch/FetchRequest.idl
r221201 r223441 27 27 */ 28 28 29 enum FetchRequestType { "", "audio", "font", "image", "script", "style", "track", "video" }; 30 enum FetchRequestDestination { "", "document", "sharedworker", "subresource", "unknown", "worker" }; 29 enum FetchRequestDestination { "", "audio", "document", "embed", "font", "image", "manifest", "object", "report", "script", "serviceworker", "sharedworker", "style", "track", "video", "worker", "xslt" }; 31 30 32 31 typedef (FetchRequest or USVString) RequestInfo; … … 47 46 readonly attribute FetchHeaders headers; // FIXME: Should be [SameObject]. 48 47 49 readonly attribute FetchRequestType type;50 48 readonly attribute FetchRequestDestination destination; 51 49 readonly attribute USVString referrer; -
trunk/Source/WebCore/loader/FetchOptions.h
r221086 r223441 35 35 36 36 struct FetchOptions { 37 enum class Type { EmptyString, Audio, Font, Image, Script, Style, Track, Video }; 38 enum class Destination { EmptyString, Document, Sharedworker, Subresource, Unknown, Worker }; 37 enum class Destination { EmptyString, Audio, Document, Embed, Font, Image, Manifest, Object, Report, Script, Serviceworker, Sharedworker, Style, Track, Video, Worker, Xslt }; 39 38 enum class Mode { Navigate, SameOrigin, NoCors, Cors }; 40 39 enum class Credentials { Omit, SameOrigin, Include }; … … 43 42 44 43 FetchOptions() = default; 45 FetchOptions( Type,Destination, Mode, Credentials, Cache, Redirect, ReferrerPolicy, String&&, bool);46 FetchOptions isolatedCopy() const { return { type,destination, mode, credentials, cache, redirect, referrerPolicy, integrity.isolatedCopy(), keepAlive }; }44 FetchOptions(Destination, Mode, Credentials, Cache, Redirect, ReferrerPolicy, String&&, bool); 45 FetchOptions isolatedCopy() const { return { destination, mode, credentials, cache, redirect, referrerPolicy, integrity.isolatedCopy(), keepAlive }; } 47 46 48 47 template<class Encoder> void encode(Encoder&) const; 49 48 template<class Decoder> static bool decode(Decoder&, FetchOptions&); 50 49 51 Type type { Type::EmptyString };52 50 Destination destination { Destination::EmptyString }; 53 51 Mode mode { Mode::NoCors }; … … 60 58 }; 61 59 62 inline FetchOptions::FetchOptions(Type type, Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive) 63 : type(type) 64 , destination(destination) 60 inline FetchOptions::FetchOptions(Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive) 61 : destination(destination) 65 62 , mode(mode) 66 63 , credentials(credentials) … … 77 74 namespace WTF { 78 75 79 template<> struct EnumTraits<WebCore::FetchOptions::Type> {80 using values = EnumValues<81 WebCore::FetchOptions::Type,82 WebCore::FetchOptions::Type::EmptyString,83 WebCore::FetchOptions::Type::Audio,84 WebCore::FetchOptions::Type::Font,85 WebCore::FetchOptions::Type::Image,86 WebCore::FetchOptions::Type::Script,87 WebCore::FetchOptions::Type::Style,88 WebCore::FetchOptions::Type::Track,89 WebCore::FetchOptions::Type::Video90 >;91 };92 93 76 template<> struct EnumTraits<WebCore::FetchOptions::Destination> { 94 77 using values = EnumValues< 95 78 WebCore::FetchOptions::Destination, 96 79 WebCore::FetchOptions::Destination::EmptyString, 80 WebCore::FetchOptions::Destination::Audio, 97 81 WebCore::FetchOptions::Destination::Document, 82 WebCore::FetchOptions::Destination::Embed, 83 WebCore::FetchOptions::Destination::Font, 84 WebCore::FetchOptions::Destination::Image, 85 WebCore::FetchOptions::Destination::Manifest, 86 WebCore::FetchOptions::Destination::Object, 87 WebCore::FetchOptions::Destination::Report, 88 WebCore::FetchOptions::Destination::Script, 89 WebCore::FetchOptions::Destination::Serviceworker, 98 90 WebCore::FetchOptions::Destination::Sharedworker, 99 WebCore::FetchOptions::Destination::Subresource, 100 WebCore::FetchOptions::Destination::Unknown, 101 WebCore::FetchOptions::Destination::Worker 91 WebCore::FetchOptions::Destination::Style, 92 WebCore::FetchOptions::Destination::Track, 93 WebCore::FetchOptions::Destination::Video, 94 WebCore::FetchOptions::Destination::Worker, 95 WebCore::FetchOptions::Destination::Xslt 102 96 >; 103 97 }; … … 149 143 template<class Encoder> inline void FetchOptions::encode(Encoder& encoder) const 150 144 { 151 encoder << type;152 145 encoder << destination; 153 146 encoder << mode; … … 162 155 template<class Decoder> inline bool FetchOptions::decode(Decoder& decoder, FetchOptions& options) 163 156 { 164 FetchOptions::Type type;165 if (!decoder.decode(type))166 return false;167 168 157 FetchOptions::Destination destination; 169 158 if (!decoder.decode(destination)) … … 198 187 return false; 199 188 200 options.type = type;201 189 options.destination = destination; 202 190 options.mode = mode; -
trunk/Source/WebCore/loader/ThreadableLoader.cpp
r222467 r223441 66 66 67 67 // FetchOptions 68 copy.type = this->type;69 68 copy.destination = this->destination; 70 69 copy.mode = this->mode; -
trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp
r223001 r223441 193 193 ResourceErrorOr<CachedResourceHandle<CachedImage>> CachedResourceLoader::requestImage(CachedResourceRequest&& request) 194 194 { 195 request.setDestinationIfNotSet(FetchOptions::Destination::Image); 195 196 if (Frame* frame = this->frame()) { 196 197 if (frame->loader().pageDismissalEventBeingDispatched() != FrameLoader::PageDismissalType::None) { … … 210 211 ResourceErrorOr<CachedResourceHandle<CachedFont>> CachedResourceLoader::requestFont(CachedResourceRequest&& request, bool isSVG) 211 212 { 213 request.setDestinationIfNotSet(FetchOptions::Destination::Font); 212 214 #if ENABLE(SVG_FONTS) 213 215 if (isSVG) … … 222 224 ResourceErrorOr<CachedResourceHandle<CachedTextTrack>> CachedResourceLoader::requestTextTrack(CachedResourceRequest&& request) 223 225 { 226 request.setDestinationIfNotSet(FetchOptions::Destination::Track); 224 227 return castCachedResourceTo<CachedTextTrack>(requestResource(CachedResource::TextTrackResource, WTFMove(request))); 225 228 } … … 228 231 ResourceErrorOr<CachedResourceHandle<CachedCSSStyleSheet>> CachedResourceLoader::requestCSSStyleSheet(CachedResourceRequest&& request) 229 232 { 233 request.setDestinationIfNotSet(FetchOptions::Destination::Style); 230 234 return castCachedResourceTo<CachedCSSStyleSheet>(requestResource(CachedResource::CSSStyleSheet, WTFMove(request))); 231 235 } … … 233 237 CachedResourceHandle<CachedCSSStyleSheet> CachedResourceLoader::requestUserCSSStyleSheet(CachedResourceRequest&& request) 234 238 { 239 request.setDestinationIfNotSet(FetchOptions::Destination::Style); 240 235 241 ASSERT(document()); 236 242 request.setDomainForCachePartition(*document()); … … 259 265 ResourceErrorOr<CachedResourceHandle<CachedScript>> CachedResourceLoader::requestScript(CachedResourceRequest&& request) 260 266 { 267 request.setDestinationIfNotSet(FetchOptions::Destination::Script); 261 268 return castCachedResourceTo<CachedScript>(requestResource(CachedResource::Script, WTFMove(request))); 262 269 } … … 265 272 ResourceErrorOr<CachedResourceHandle<CachedXSLStyleSheet>> CachedResourceLoader::requestXSLStyleSheet(CachedResourceRequest&& request) 266 273 { 274 request.setDestinationIfNotSet(FetchOptions::Destination::Xslt); 267 275 return castCachedResourceTo<CachedXSLStyleSheet>(requestResource(CachedResource::XSLStyleSheet, WTFMove(request))); 268 276 } … … 285 293 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestMedia(CachedResourceRequest&& request) 286 294 { 295 // FIXME: Set destination to either audio or video. 287 296 return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::MediaResource, WTFMove(request))); 288 297 } … … 290 299 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestIcon(CachedResourceRequest&& request) 291 300 { 301 request.setDestinationIfNotSet(FetchOptions::Destination::Image); 292 302 return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Icon, WTFMove(request))); 293 303 } … … 295 305 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestRawResource(CachedResourceRequest&& request) 296 306 { 307 ASSERT(request.options().destination == FetchOptions::Destination::EmptyString); 297 308 return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::RawResource, WTFMove(request))); 298 309 } … … 300 311 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestBeaconResource(CachedResourceRequest&& request) 301 312 { 313 ASSERT(request.options().destination == FetchOptions::Destination::EmptyString); 302 314 return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::Beacon, WTFMove(request))); 303 315 } … … 305 317 ResourceErrorOr<CachedResourceHandle<CachedRawResource>> CachedResourceLoader::requestMainResource(CachedResourceRequest&& request) 306 318 { 319 request.setDestinationIfNotSet(FetchOptions::Destination::Document); 307 320 return castCachedResourceTo<CachedRawResource>(requestResource(CachedResource::MainResource, WTFMove(request))); 308 321 } -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.cpp
r222602 r223441 267 267 } 268 268 269 void CachedResourceRequest::setDestinationIfNotSet(FetchOptions::Destination destination) 270 { 271 if (m_options.destination != FetchOptions::Destination::EmptyString) 272 return; 273 m_options.destination = destination; 274 } 275 269 276 } // namespace WebCore -
trunk/Source/WebCore/loader/cache/CachedResourceRequest.h
r223001 r223441 69 69 void setIgnoreForRequestCount(bool ignoreForRequestCount) { m_ignoreForRequestCount = ignoreForRequestCount; } 70 70 71 void setDestinationIfNotSet(FetchOptions::Destination); 72 71 73 void setAsPotentiallyCrossOrigin(const String&, Document&); 72 74 void updateForAccessControl(Document&);
Note: See TracChangeset
for help on using the changeset viewer.