youenn.fablet@crf.canon.fr | c28be40 | 2016-02-01 11:05:39 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 Canon Inc. |
| 3 | * |
| 4 | * Redistribution and use in source and binary forms, with or without |
| 5 | * modification, are permitted, provided that the following conditions |
| 6 | * are required to be met: |
| 7 | * |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. Neither the name of Canon Inc. nor the names of |
| 14 | * its contributors may be used to endorse or promote products derived |
| 15 | * from this software without specific prior written permission. |
| 16 | * |
| 17 | * THIS SOFTWARE IS PROVIDED BY CANON INC. AND ITS CONTRIBUTORS "AS IS" AND ANY |
| 18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 20 | * DISCLAIMED. IN NO EVENT SHALL CANON INC. AND ITS CONTRIBUTORS BE LIABLE FOR |
| 21 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 22 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
| 23 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
| 24 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
| 25 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
darin@apple.com | b3202b3 | 2016-05-02 00:17:55 +0000 | [diff] [blame] | 29 | #pragma once |
youenn.fablet@crf.canon.fr | c28be40 | 2016-02-01 11:05:39 +0000 | [diff] [blame] | 30 | |
cdumez@apple.com | 5a21cd7 | 2021-11-18 18:27:28 +0000 | [diff] [blame] | 31 | #include "ProcessQualified.h" |
cdumez@apple.com | 9870b2e | 2017-08-03 17:19:44 +0000 | [diff] [blame] | 32 | #include "ReferrerPolicy.h" |
cdumez@apple.com | 5a21cd7 | 2021-11-18 18:27:28 +0000 | [diff] [blame] | 33 | #include "ScriptExecutionContextIdentifier.h" |
ysuzuki@apple.com | 157c640 | 2020-02-12 22:51:19 +0000 | [diff] [blame] | 34 | #include <wtf/Markable.h> |
weinig@apple.com | b50adaa | 2017-05-09 22:53:13 +0000 | [diff] [blame] | 35 | #include <wtf/text/WTFString.h> |
| 36 | |
youenn.fablet@crf.canon.fr | c28be40 | 2016-02-01 11:05:39 +0000 | [diff] [blame] | 37 | namespace WebCore { |
| 38 | |
darin@apple.com | b3202b3 | 2016-05-02 00:17:55 +0000 | [diff] [blame] | 39 | struct FetchOptions { |
cdumez@apple.com | 8d990a2 | 2021-09-16 21:58:32 +0000 | [diff] [blame] | 40 | enum class Destination : uint8_t { EmptyString, Audio, Audioworklet, Document, Embed, Font, Image, Iframe, Manifest, Model, Object, Paintworklet, Report, Script, Serviceworker, Sharedworker, Style, Track, Video, Worker, Xslt }; |
simon.fraser@apple.com | 90e9625 | 2018-07-09 23:54:18 +0000 | [diff] [blame] | 41 | enum class Mode : uint8_t { Navigate, SameOrigin, NoCors, Cors }; |
| 42 | enum class Credentials : uint8_t { Omit, SameOrigin, Include }; |
| 43 | enum class Cache : uint8_t { Default, NoStore, Reload, NoCache, ForceCache, OnlyIfCached }; |
| 44 | enum class Redirect : uint8_t { Follow, Error, Manual }; |
commit-queue@webkit.org | 1e15ad6 | 2017-08-16 22:09:34 +0000 | [diff] [blame] | 45 | |
| 46 | FetchOptions() = default; |
youenn@apple.com | 3c0a3e2 | 2022-04-14 08:48:21 +0000 | [diff] [blame] | 47 | FetchOptions(Destination, Mode, Credentials, Cache, Redirect, ReferrerPolicy, String&&, bool, std::optional<ScriptExecutionContextIdentifier>); |
| 48 | FetchOptions isolatedCopy() const & { return { destination, mode, credentials, cache, redirect, referrerPolicy, integrity.isolatedCopy(), keepAlive, clientIdentifier }; } |
| 49 | FetchOptions isolatedCopy() && { return { destination, mode, credentials, cache, redirect, referrerPolicy, WTFMove(integrity).isolatedCopy(), keepAlive, clientIdentifier }; } |
commit-queue@webkit.org | 1e15ad6 | 2017-08-16 22:09:34 +0000 | [diff] [blame] | 50 | |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 51 | template<class Encoder> void encodePersistent(Encoder&) const; |
ddkilzer@apple.com | cca5c3d | 2020-04-14 17:03:25 +0000 | [diff] [blame] | 52 | template<class Decoder> static WARN_UNUSED_RETURN bool decodePersistent(Decoder&, FetchOptions&); |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 53 | template<class Encoder> void encode(Encoder&) const; |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 54 | template<class Decoder> static std::optional<FetchOptions> decode(Decoder&); |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 55 | |
commit-queue@webkit.org | 1e15ad6 | 2017-08-16 22:09:34 +0000 | [diff] [blame] | 56 | Destination destination { Destination::EmptyString }; |
| 57 | Mode mode { Mode::NoCors }; |
| 58 | Credentials credentials { Credentials::Omit }; |
| 59 | Cache cache { Cache::Default }; |
darin@apple.com | 53438e9 | 2016-05-03 05:47:34 +0000 | [diff] [blame] | 60 | Redirect redirect { Redirect::Follow }; |
darin@apple.com | b3202b3 | 2016-05-02 00:17:55 +0000 | [diff] [blame] | 61 | ReferrerPolicy referrerPolicy { ReferrerPolicy::EmptyString }; |
simon.fraser@apple.com | 90e9625 | 2018-07-09 23:54:18 +0000 | [diff] [blame] | 62 | String integrity; |
youenn@apple.com | 3c0a3e2 | 2022-04-14 08:48:21 +0000 | [diff] [blame] | 63 | bool keepAlive { false }; |
cdumez@apple.com | 5a21cd7 | 2021-11-18 18:27:28 +0000 | [diff] [blame] | 64 | std::optional<ScriptExecutionContextIdentifier> clientIdentifier; |
youenn.fablet@crf.canon.fr | c28be40 | 2016-02-01 11:05:39 +0000 | [diff] [blame] | 65 | }; |
| 66 | |
youenn@apple.com | 3c0a3e2 | 2022-04-14 08:48:21 +0000 | [diff] [blame] | 67 | inline FetchOptions::FetchOptions(Destination destination, Mode mode, Credentials credentials, Cache cache, Redirect redirect, ReferrerPolicy referrerPolicy, String&& integrity, bool keepAlive, std::optional<ScriptExecutionContextIdentifier> clientIdentifier) |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 68 | : destination(destination) |
commit-queue@webkit.org | 1e15ad6 | 2017-08-16 22:09:34 +0000 | [diff] [blame] | 69 | , mode(mode) |
| 70 | , credentials(credentials) |
| 71 | , cache(cache) |
| 72 | , redirect(redirect) |
| 73 | , referrerPolicy(referrerPolicy) |
simon.fraser@apple.com | 90e9625 | 2018-07-09 23:54:18 +0000 | [diff] [blame] | 74 | , integrity(WTFMove(integrity)) |
youenn@apple.com | 3c0a3e2 | 2022-04-14 08:48:21 +0000 | [diff] [blame] | 75 | , keepAlive(keepAlive) |
| 76 | , clientIdentifier(clientIdentifier) |
commit-queue@webkit.org | 1e15ad6 | 2017-08-16 22:09:34 +0000 | [diff] [blame] | 77 | { |
| 78 | } |
| 79 | |
cdumez@apple.com | 6bfc41d | 2017-10-19 22:44:57 +0000 | [diff] [blame] | 80 | inline bool isPotentialNavigationOrSubresourceRequest(FetchOptions::Destination destination) |
| 81 | { |
| 82 | return destination == FetchOptions::Destination::Object |
| 83 | || destination == FetchOptions::Destination::Embed; |
| 84 | } |
| 85 | |
youenn@apple.com | 59c7bc9 | 2021-11-30 10:48:04 +0000 | [diff] [blame] | 86 | // https://fetch.spec.whatwg.org/#navigation-request |
| 87 | inline bool isNavigationRequest(FetchOptions::Destination destination) |
| 88 | { |
| 89 | return destination == FetchOptions::Destination::Document |
| 90 | || destination == FetchOptions::Destination::Iframe |
| 91 | || destination == FetchOptions::Destination::Object |
| 92 | || destination == FetchOptions::Destination::Embed; |
| 93 | } |
| 94 | |
cdumez@apple.com | 8d990a2 | 2021-09-16 21:58:32 +0000 | [diff] [blame] | 95 | // https://fetch.spec.whatwg.org/#non-subresource-request |
cdumez@apple.com | 6bfc41d | 2017-10-19 22:44:57 +0000 | [diff] [blame] | 96 | inline bool isNonSubresourceRequest(FetchOptions::Destination destination) |
| 97 | { |
| 98 | return destination == FetchOptions::Destination::Document |
cdumez@apple.com | 8d990a2 | 2021-09-16 21:58:32 +0000 | [diff] [blame] | 99 | || destination == FetchOptions::Destination::Iframe |
cdumez@apple.com | 6bfc41d | 2017-10-19 22:44:57 +0000 | [diff] [blame] | 100 | || destination == FetchOptions::Destination::Report |
| 101 | || destination == FetchOptions::Destination::Serviceworker |
| 102 | || destination == FetchOptions::Destination::Sharedworker |
| 103 | || destination == FetchOptions::Destination::Worker; |
| 104 | } |
| 105 | |
dbates@webkit.org | 85ea93d | 2018-04-12 22:32:40 +0000 | [diff] [blame] | 106 | inline bool isScriptLikeDestination(FetchOptions::Destination destination) |
| 107 | { |
youenn@apple.com | 3a5896c | 2020-10-22 18:06:44 +0000 | [diff] [blame] | 108 | return destination == FetchOptions::Destination::Audioworklet |
| 109 | || destination == FetchOptions::Destination::Paintworklet |
| 110 | || destination == FetchOptions::Destination::Script |
dbates@webkit.org | 85ea93d | 2018-04-12 22:32:40 +0000 | [diff] [blame] | 111 | || destination == FetchOptions::Destination::Serviceworker |
cdumez@apple.com | 8fe2757 | 2022-02-11 22:57:33 +0000 | [diff] [blame] | 112 | || destination == FetchOptions::Destination::Sharedworker |
dbates@webkit.org | 85ea93d | 2018-04-12 22:32:40 +0000 | [diff] [blame] | 113 | || destination == FetchOptions::Destination::Worker; |
| 114 | } |
| 115 | |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 116 | } |
| 117 | |
| 118 | namespace WTF { |
| 119 | |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 120 | template<> struct EnumTraits<WebCore::FetchOptions::Destination> { |
| 121 | using values = EnumValues< |
| 122 | WebCore::FetchOptions::Destination, |
| 123 | WebCore::FetchOptions::Destination::EmptyString, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 124 | WebCore::FetchOptions::Destination::Audio, |
youenn@apple.com | 3a5896c | 2020-10-22 18:06:44 +0000 | [diff] [blame] | 125 | WebCore::FetchOptions::Destination::Audioworklet, |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 126 | WebCore::FetchOptions::Destination::Document, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 127 | WebCore::FetchOptions::Destination::Embed, |
| 128 | WebCore::FetchOptions::Destination::Font, |
| 129 | WebCore::FetchOptions::Destination::Image, |
cdumez@apple.com | 8d990a2 | 2021-09-16 21:58:32 +0000 | [diff] [blame] | 130 | WebCore::FetchOptions::Destination::Iframe, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 131 | WebCore::FetchOptions::Destination::Manifest, |
graouts@webkit.org | 57f7904 | 2021-02-03 15:08:38 +0000 | [diff] [blame] | 132 | WebCore::FetchOptions::Destination::Model, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 133 | WebCore::FetchOptions::Destination::Object, |
youenn@apple.com | 3a5896c | 2020-10-22 18:06:44 +0000 | [diff] [blame] | 134 | WebCore::FetchOptions::Destination::Paintworklet, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 135 | WebCore::FetchOptions::Destination::Report, |
| 136 | WebCore::FetchOptions::Destination::Script, |
| 137 | WebCore::FetchOptions::Destination::Serviceworker, |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 138 | WebCore::FetchOptions::Destination::Sharedworker, |
commit-queue@webkit.org | aa0494c | 2017-10-16 21:57:27 +0000 | [diff] [blame] | 139 | WebCore::FetchOptions::Destination::Style, |
| 140 | WebCore::FetchOptions::Destination::Track, |
| 141 | WebCore::FetchOptions::Destination::Video, |
| 142 | WebCore::FetchOptions::Destination::Worker, |
| 143 | WebCore::FetchOptions::Destination::Xslt |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 144 | >; |
| 145 | }; |
| 146 | |
| 147 | template<> struct EnumTraits<WebCore::FetchOptions::Mode> { |
| 148 | using values = EnumValues< |
| 149 | WebCore::FetchOptions::Mode, |
| 150 | WebCore::FetchOptions::Mode::Navigate, |
| 151 | WebCore::FetchOptions::Mode::SameOrigin, |
| 152 | WebCore::FetchOptions::Mode::NoCors, |
| 153 | WebCore::FetchOptions::Mode::Cors |
| 154 | >; |
| 155 | }; |
| 156 | |
| 157 | template<> struct EnumTraits<WebCore::FetchOptions::Credentials> { |
| 158 | using values = EnumValues< |
| 159 | WebCore::FetchOptions::Credentials, |
| 160 | WebCore::FetchOptions::Credentials::Omit, |
| 161 | WebCore::FetchOptions::Credentials::SameOrigin, |
| 162 | WebCore::FetchOptions::Credentials::Include |
| 163 | >; |
| 164 | }; |
| 165 | |
| 166 | template<> struct EnumTraits<WebCore::FetchOptions::Cache> { |
| 167 | using values = EnumValues< |
| 168 | WebCore::FetchOptions::Cache, |
| 169 | WebCore::FetchOptions::Cache::Default, |
| 170 | WebCore::FetchOptions::Cache::NoStore, |
| 171 | WebCore::FetchOptions::Cache::Reload, |
| 172 | WebCore::FetchOptions::Cache::NoCache, |
| 173 | WebCore::FetchOptions::Cache::ForceCache, |
| 174 | WebCore::FetchOptions::Cache::OnlyIfCached |
| 175 | >; |
| 176 | }; |
| 177 | |
| 178 | template<> struct EnumTraits<WebCore::FetchOptions::Redirect> { |
| 179 | using values = EnumValues< |
| 180 | WebCore::FetchOptions::Redirect, |
| 181 | WebCore::FetchOptions::Redirect::Follow, |
| 182 | WebCore::FetchOptions::Redirect::Error, |
| 183 | WebCore::FetchOptions::Redirect::Manual |
| 184 | >; |
| 185 | }; |
| 186 | |
| 187 | } |
| 188 | |
| 189 | namespace WebCore { |
| 190 | |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 191 | template<class Encoder> |
| 192 | inline void FetchOptions::encodePersistent(Encoder& encoder) const |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 193 | { |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 194 | // Changes to encoding here should bump NetworkCache Storage format version. |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 195 | encoder << destination; |
| 196 | encoder << mode; |
| 197 | encoder << credentials; |
| 198 | encoder << cache; |
| 199 | encoder << redirect; |
| 200 | encoder << referrerPolicy; |
| 201 | encoder << integrity; |
| 202 | encoder << keepAlive; |
| 203 | } |
| 204 | |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 205 | template<class Decoder> |
ddkilzer@apple.com | cca5c3d | 2020-04-14 17:03:25 +0000 | [diff] [blame] | 206 | inline bool FetchOptions::decodePersistent(Decoder& decoder, FetchOptions& options) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 207 | { |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 208 | std::optional<FetchOptions::Destination> destination; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 209 | decoder >> destination; |
| 210 | if (!destination) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 211 | return false; |
| 212 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 213 | std::optional<FetchOptions::Mode> mode; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 214 | decoder >> mode; |
| 215 | if (!mode) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 216 | return false; |
| 217 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 218 | std::optional<FetchOptions::Credentials> credentials; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 219 | decoder >> credentials; |
| 220 | if (!credentials) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 221 | return false; |
| 222 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 223 | std::optional<FetchOptions::Cache> cache; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 224 | decoder >> cache; |
| 225 | if (!cache) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 226 | return false; |
| 227 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 228 | std::optional<FetchOptions::Redirect> redirect; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 229 | decoder >> redirect; |
| 230 | if (!redirect) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 231 | return false; |
| 232 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 233 | std::optional<ReferrerPolicy> referrerPolicy; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 234 | decoder >> referrerPolicy; |
| 235 | if (!referrerPolicy) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 236 | return false; |
| 237 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 238 | std::optional<String> integrity; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 239 | decoder >> integrity; |
| 240 | if (!integrity) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 241 | return false; |
| 242 | |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 243 | std::optional<bool> keepAlive; |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 244 | decoder >> keepAlive; |
| 245 | if (!keepAlive) |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 246 | return false; |
| 247 | |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 248 | options.destination = *destination; |
| 249 | options.mode = *mode; |
| 250 | options.credentials = *credentials; |
| 251 | options.cache = *cache; |
| 252 | options.redirect = *redirect; |
| 253 | options.referrerPolicy = *referrerPolicy; |
| 254 | options.integrity = WTFMove(*integrity); |
| 255 | options.keepAlive = *keepAlive; |
commit-queue@webkit.org | a480fc0 | 2017-08-23 17:54:03 +0000 | [diff] [blame] | 256 | |
| 257 | return true; |
| 258 | } |
| 259 | |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 260 | template<class Encoder> |
| 261 | inline void FetchOptions::encode(Encoder& encoder) const |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 262 | { |
| 263 | encodePersistent(encoder); |
cdumez@apple.com | 5a21cd7 | 2021-11-18 18:27:28 +0000 | [diff] [blame] | 264 | encoder << clientIdentifier; |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 265 | } |
| 266 | |
commit-queue@webkit.org | 26bdece | 2020-04-11 06:39:36 +0000 | [diff] [blame] | 267 | template<class Decoder> |
darin@apple.com | a4ddc78 | 2021-05-30 16:11:40 +0000 | [diff] [blame] | 268 | inline std::optional<FetchOptions> FetchOptions::decode(Decoder& decoder) |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 269 | { |
| 270 | FetchOptions options; |
| 271 | if (!decodePersistent(decoder, options)) |
darin@apple.com | 7c840b6 | 2021-05-28 01:26:23 +0000 | [diff] [blame] | 272 | return std::nullopt; |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 273 | |
cdumez@apple.com | 5a21cd7 | 2021-11-18 18:27:28 +0000 | [diff] [blame] | 274 | std::optional<std::optional<ScriptExecutionContextIdentifier>> clientIdentifier; |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 275 | decoder >> clientIdentifier; |
| 276 | if (!clientIdentifier) |
darin@apple.com | 7c840b6 | 2021-05-28 01:26:23 +0000 | [diff] [blame] | 277 | return std::nullopt; |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 278 | options.clientIdentifier = WTFMove(clientIdentifier.value()); |
| 279 | |
mcatanzaro@igalia.com | a7ade27 | 2019-03-19 20:04:34 +0000 | [diff] [blame] | 280 | return options; |
commit-queue@webkit.org | 27605fe | 2017-11-29 21:47:37 +0000 | [diff] [blame] | 281 | } |
| 282 | |
youenn.fablet@crf.canon.fr | c28be40 | 2016-02-01 11:05:39 +0000 | [diff] [blame] | 283 | } // namespace WebCore |