| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2008 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2009 Google Inc. All rights reserved. | 3 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 ResourceResponse::SignedCertificateTimestamp::IsolatedCopy() const { | 68 ResourceResponse::SignedCertificateTimestamp::IsolatedCopy() const { |
| 69 return SignedCertificateTimestamp( | 69 return SignedCertificateTimestamp( |
| 70 status_.IsolatedCopy(), origin_.IsolatedCopy(), | 70 status_.IsolatedCopy(), origin_.IsolatedCopy(), |
| 71 log_description_.IsolatedCopy(), log_id_.IsolatedCopy(), timestamp_, | 71 log_description_.IsolatedCopy(), log_id_.IsolatedCopy(), timestamp_, |
| 72 hash_algorithm_.IsolatedCopy(), signature_algorithm_.IsolatedCopy(), | 72 hash_algorithm_.IsolatedCopy(), signature_algorithm_.IsolatedCopy(), |
| 73 signature_data_.IsolatedCopy()); | 73 signature_data_.IsolatedCopy()); |
| 74 } | 74 } |
| 75 | 75 |
| 76 ResourceResponse::ResourceResponse() | 76 ResourceResponse::ResourceResponse() |
| 77 : expected_content_length_(0), | 77 : expected_content_length_(0), |
| 78 connection_id_(0), |
| 78 http_status_code_(0), | 79 http_status_code_(0), |
| 80 remote_port_(0), |
| 79 was_cached_(false), | 81 was_cached_(false), |
| 80 connection_id_(0), | |
| 81 connection_reused_(false), | 82 connection_reused_(false), |
| 82 is_null_(true), | 83 is_null_(true), |
| 83 have_parsed_age_header_(false), | 84 have_parsed_age_header_(false), |
| 84 have_parsed_date_header_(false), | 85 have_parsed_date_header_(false), |
| 85 have_parsed_expires_header_(false), | 86 have_parsed_expires_header_(false), |
| 86 have_parsed_last_modified_header_(false), | 87 have_parsed_last_modified_header_(false), |
| 87 age_(0.0), | |
| 88 date_(0.0), | |
| 89 expires_(0.0), | |
| 90 last_modified_(0.0), | |
| 91 has_major_certificate_errors_(false), | 88 has_major_certificate_errors_(false), |
| 92 security_style_(kSecurityStyleUnknown), | |
| 93 http_version_(kHTTPVersionUnknown), | |
| 94 app_cache_id_(0), | |
| 95 was_fetched_via_spdy_(false), | 89 was_fetched_via_spdy_(false), |
| 96 was_fetched_via_proxy_(false), | 90 was_fetched_via_proxy_(false), |
| 97 was_fetched_via_service_worker_(false), | 91 was_fetched_via_service_worker_(false), |
| 98 was_fetched_via_foreign_fetch_(false), | 92 was_fetched_via_foreign_fetch_(false), |
| 99 was_fallback_required_by_service_worker_(false), | 93 was_fallback_required_by_service_worker_(false), |
| 94 did_service_worker_navigation_preload_(false), |
| 100 service_worker_response_type_(kWebServiceWorkerResponseTypeDefault), | 95 service_worker_response_type_(kWebServiceWorkerResponseTypeDefault), |
| 101 did_service_worker_navigation_preload_(false), | 96 http_version_(kHTTPVersionUnknown), |
| 97 security_style_(kSecurityStyleUnknown), |
| 98 age_(0.0), |
| 99 date_(0.0), |
| 100 expires_(0.0), |
| 101 last_modified_(0.0), |
| 102 app_cache_id_(0), |
| 102 response_time_(0), | 103 response_time_(0), |
| 103 remote_port_(0), | |
| 104 encoded_data_length_(0), | 104 encoded_data_length_(0), |
| 105 encoded_body_length_(0), | 105 encoded_body_length_(0), |
| 106 decoded_body_length_(0) {} | 106 decoded_body_length_(0) {} |
| 107 | 107 |
| 108 ResourceResponse::ResourceResponse(const KURL& url, | 108 ResourceResponse::ResourceResponse(const KURL& url, |
| 109 const AtomicString& mime_type, | 109 const AtomicString& mime_type, |
| 110 long long expected_length, | 110 long long expected_length, |
| 111 const AtomicString& text_encoding_name) | 111 const AtomicString& text_encoding_name) |
| 112 : url_(url), | 112 : url_(url), |
| 113 mime_type_(mime_type), | 113 mime_type_(mime_type), |
| 114 expected_content_length_(expected_length), | 114 expected_content_length_(expected_length), |
| 115 text_encoding_name_(text_encoding_name), | 115 text_encoding_name_(text_encoding_name), |
| 116 connection_id_(0), |
| 116 http_status_code_(0), | 117 http_status_code_(0), |
| 118 remote_port_(0), |
| 117 was_cached_(false), | 119 was_cached_(false), |
| 118 connection_id_(0), | |
| 119 connection_reused_(false), | 120 connection_reused_(false), |
| 120 is_null_(false), | 121 is_null_(false), |
| 121 have_parsed_age_header_(false), | 122 have_parsed_age_header_(false), |
| 122 have_parsed_date_header_(false), | 123 have_parsed_date_header_(false), |
| 123 have_parsed_expires_header_(false), | 124 have_parsed_expires_header_(false), |
| 124 have_parsed_last_modified_header_(false), | 125 have_parsed_last_modified_header_(false), |
| 125 age_(0.0), | |
| 126 date_(0.0), | |
| 127 expires_(0.0), | |
| 128 last_modified_(0.0), | |
| 129 has_major_certificate_errors_(false), | 126 has_major_certificate_errors_(false), |
| 130 security_style_(kSecurityStyleUnknown), | |
| 131 http_version_(kHTTPVersionUnknown), | |
| 132 app_cache_id_(0), | |
| 133 was_fetched_via_spdy_(false), | 127 was_fetched_via_spdy_(false), |
| 134 was_fetched_via_proxy_(false), | 128 was_fetched_via_proxy_(false), |
| 135 was_fetched_via_service_worker_(false), | 129 was_fetched_via_service_worker_(false), |
| 136 was_fetched_via_foreign_fetch_(false), | 130 was_fetched_via_foreign_fetch_(false), |
| 137 was_fallback_required_by_service_worker_(false), | 131 was_fallback_required_by_service_worker_(false), |
| 132 did_service_worker_navigation_preload_(false), |
| 138 service_worker_response_type_(kWebServiceWorkerResponseTypeDefault), | 133 service_worker_response_type_(kWebServiceWorkerResponseTypeDefault), |
| 139 did_service_worker_navigation_preload_(false), | 134 http_version_(kHTTPVersionUnknown), |
| 135 security_style_(kSecurityStyleUnknown), |
| 136 age_(0.0), |
| 137 date_(0.0), |
| 138 expires_(0.0), |
| 139 last_modified_(0.0), |
| 140 app_cache_id_(0), |
| 140 response_time_(0), | 141 response_time_(0), |
| 141 remote_port_(0), | |
| 142 encoded_data_length_(0), | 142 encoded_data_length_(0), |
| 143 encoded_body_length_(0), | 143 encoded_body_length_(0), |
| 144 decoded_body_length_(0) {} | 144 decoded_body_length_(0) {} |
| 145 | 145 |
| 146 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) | 146 ResourceResponse::ResourceResponse(CrossThreadResourceResponseData* data) |
| 147 : ResourceResponse() { | 147 : ResourceResponse() { |
| 148 SetURL(data->url_); | 148 SetURL(data->url_); |
| 149 SetMimeType(AtomicString(data->mime_type_)); | 149 SetMimeType(AtomicString(data->mime_type_)); |
| 150 SetExpectedContentLength(data->expected_content_length_); | 150 SetExpectedContentLength(data->expected_content_length_); |
| 151 SetTextEncodingName(AtomicString(data->text_encoding_name_)); | 151 SetTextEncodingName(AtomicString(data->text_encoding_name_)); |
| 152 | 152 |
| 153 SetHTTPStatusCode(data->http_status_code_); | 153 SetHTTPStatusCode(data->http_status_code_); |
| 154 SetHTTPStatusText(AtomicString(data->http_status_text_)); | 154 SetHTTPStatusText(AtomicString(data->http_status_text_)); |
| 155 | 155 |
| 156 http_header_fields_.Adopt(std::move(data->http_headers_)); | 156 http_header_fields_.Adopt(std::move(data->http_headers_)); |
| 157 SetResourceLoadTiming(std::move(data->resource_load_timing_)); | 157 SetResourceLoadTiming(std::move(data->resource_load_timing_)); |
| 158 remote_ip_address_ = AtomicString(data->remote_ip_address_); |
| 159 remote_port_ = data->remote_port_; |
| 158 has_major_certificate_errors_ = data->has_major_certificate_errors_; | 160 has_major_certificate_errors_ = data->has_major_certificate_errors_; |
| 161 was_fetched_via_spdy_ = data->was_fetched_via_spdy_; |
| 162 was_fetched_via_proxy_ = data->was_fetched_via_proxy_; |
| 163 was_fetched_via_service_worker_ = data->was_fetched_via_service_worker_; |
| 164 was_fetched_via_foreign_fetch_ = data->was_fetched_via_foreign_fetch_; |
| 165 was_fallback_required_by_service_worker_ = |
| 166 data->was_fallback_required_by_service_worker_; |
| 167 did_service_worker_navigation_preload_ = |
| 168 data->did_service_worker_navigation_preload_; |
| 169 service_worker_response_type_ = data->service_worker_response_type_; |
| 159 security_style_ = data->security_style_; | 170 security_style_ = data->security_style_; |
| 160 security_details_.protocol = data->security_details_.protocol; | 171 security_details_.protocol = data->security_details_.protocol; |
| 161 security_details_.cipher = data->security_details_.cipher; | 172 security_details_.cipher = data->security_details_.cipher; |
| 162 security_details_.key_exchange = data->security_details_.key_exchange; | 173 security_details_.key_exchange = data->security_details_.key_exchange; |
| 163 security_details_.key_exchange_group = | 174 security_details_.key_exchange_group = |
| 164 data->security_details_.key_exchange_group; | 175 data->security_details_.key_exchange_group; |
| 165 security_details_.mac = data->security_details_.mac; | 176 security_details_.mac = data->security_details_.mac; |
| 166 security_details_.subject_name = data->security_details_.subject_name; | 177 security_details_.subject_name = data->security_details_.subject_name; |
| 167 security_details_.san_list = data->security_details_.san_list; | 178 security_details_.san_list = data->security_details_.san_list; |
| 168 security_details_.issuer = data->security_details_.issuer; | 179 security_details_.issuer = data->security_details_.issuer; |
| 169 security_details_.valid_from = data->security_details_.valid_from; | 180 security_details_.valid_from = data->security_details_.valid_from; |
| 170 security_details_.valid_to = data->security_details_.valid_to; | 181 security_details_.valid_to = data->security_details_.valid_to; |
| 171 for (auto& cert : data->certificate_) | 182 for (auto& cert : data->certificate_) |
| 172 security_details_.certificate.push_back(AtomicString(cert)); | 183 security_details_.certificate.push_back(AtomicString(cert)); |
| 173 security_details_.sct_list = data->security_details_.sct_list; | 184 security_details_.sct_list = data->security_details_.sct_list; |
| 174 http_version_ = data->http_version_; | 185 http_version_ = data->http_version_; |
| 175 app_cache_id_ = data->app_cache_id_; | 186 app_cache_id_ = data->app_cache_id_; |
| 176 app_cache_manifest_url_ = data->app_cache_manifest_url_.Copy(); | 187 app_cache_manifest_url_ = data->app_cache_manifest_url_.Copy(); |
| 177 multipart_boundary_ = data->multipart_boundary_; | 188 multipart_boundary_ = data->multipart_boundary_; |
| 178 was_fetched_via_spdy_ = data->was_fetched_via_spdy_; | |
| 179 was_fetched_via_proxy_ = data->was_fetched_via_proxy_; | |
| 180 was_fetched_via_service_worker_ = data->was_fetched_via_service_worker_; | |
| 181 was_fetched_via_foreign_fetch_ = data->was_fetched_via_foreign_fetch_; | |
| 182 was_fallback_required_by_service_worker_ = | |
| 183 data->was_fallback_required_by_service_worker_; | |
| 184 service_worker_response_type_ = data->service_worker_response_type_; | |
| 185 url_list_via_service_worker_ = data->url_list_via_service_worker_; | 189 url_list_via_service_worker_ = data->url_list_via_service_worker_; |
| 186 cache_storage_cache_name_ = data->cache_storage_cache_name_; | 190 cache_storage_cache_name_ = data->cache_storage_cache_name_; |
| 187 did_service_worker_navigation_preload_ = | |
| 188 data->did_service_worker_navigation_preload_; | |
| 189 response_time_ = data->response_time_; | 191 response_time_ = data->response_time_; |
| 190 remote_ip_address_ = AtomicString(data->remote_ip_address_); | |
| 191 remote_port_ = data->remote_port_; | |
| 192 encoded_data_length_ = data->encoded_data_length_; | 192 encoded_data_length_ = data->encoded_data_length_; |
| 193 encoded_body_length_ = data->encoded_body_length_; | 193 encoded_body_length_ = data->encoded_body_length_; |
| 194 decoded_body_length_ = data->decoded_body_length_; | 194 decoded_body_length_ = data->decoded_body_length_; |
| 195 downloaded_file_path_ = data->downloaded_file_path_; | 195 downloaded_file_path_ = data->downloaded_file_path_; |
| 196 downloaded_file_handle_ = data->downloaded_file_handle_; | 196 downloaded_file_handle_ = data->downloaded_file_handle_; |
| 197 | 197 |
| 198 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 198 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
| 199 // whatever values may be present in the opaque m_extraData structure. | 199 // whatever values may be present in the opaque m_extraData structure. |
| 200 } | 200 } |
| 201 | 201 |
| 202 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; | 202 ResourceResponse::ResourceResponse(const ResourceResponse&) = default; |
| 203 ResourceResponse& ResourceResponse::operator=(const ResourceResponse&) = | 203 ResourceResponse& ResourceResponse::operator=(const ResourceResponse&) = |
| 204 default; | 204 default; |
| 205 | 205 |
| 206 std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::CopyData() | 206 std::unique_ptr<CrossThreadResourceResponseData> ResourceResponse::CopyData() |
| 207 const { | 207 const { |
| 208 std::unique_ptr<CrossThreadResourceResponseData> data = | 208 std::unique_ptr<CrossThreadResourceResponseData> data = |
| 209 WTF::WrapUnique(new CrossThreadResourceResponseData); | 209 WTF::WrapUnique(new CrossThreadResourceResponseData); |
| 210 data->url_ = Url().Copy(); | 210 data->url_ = Url().Copy(); |
| 211 data->mime_type_ = MimeType().GetString().IsolatedCopy(); | 211 data->mime_type_ = MimeType().GetString().IsolatedCopy(); |
| 212 data->expected_content_length_ = ExpectedContentLength(); | 212 data->expected_content_length_ = ExpectedContentLength(); |
| 213 data->text_encoding_name_ = TextEncodingName().GetString().IsolatedCopy(); | 213 data->text_encoding_name_ = TextEncodingName().GetString().IsolatedCopy(); |
| 214 data->http_status_code_ = HttpStatusCode(); | 214 data->http_status_code_ = HttpStatusCode(); |
| 215 data->http_status_text_ = HttpStatusText().GetString().IsolatedCopy(); | 215 data->http_status_text_ = HttpStatusText().GetString().IsolatedCopy(); |
| 216 data->http_headers_ = HttpHeaderFields().CopyData(); | 216 data->http_headers_ = HttpHeaderFields().CopyData(); |
| 217 if (resource_load_timing_) | 217 if (resource_load_timing_) |
| 218 data->resource_load_timing_ = resource_load_timing_->DeepCopy(); | 218 data->resource_load_timing_ = resource_load_timing_->DeepCopy(); |
| 219 data->remote_ip_address_ = remote_ip_address_.GetString().IsolatedCopy(); |
| 220 data->remote_port_ = remote_port_; |
| 219 data->has_major_certificate_errors_ = has_major_certificate_errors_; | 221 data->has_major_certificate_errors_ = has_major_certificate_errors_; |
| 222 data->was_fetched_via_spdy_ = was_fetched_via_spdy_; |
| 223 data->was_fetched_via_proxy_ = was_fetched_via_proxy_; |
| 224 data->was_fetched_via_service_worker_ = was_fetched_via_service_worker_; |
| 225 data->was_fetched_via_foreign_fetch_ = was_fetched_via_foreign_fetch_; |
| 226 data->was_fallback_required_by_service_worker_ = |
| 227 was_fallback_required_by_service_worker_; |
| 228 data->did_service_worker_navigation_preload_ = |
| 229 did_service_worker_navigation_preload_; |
| 230 data->service_worker_response_type_ = service_worker_response_type_; |
| 220 data->security_style_ = security_style_; | 231 data->security_style_ = security_style_; |
| 221 data->security_details_.protocol = security_details_.protocol.IsolatedCopy(); | 232 data->security_details_.protocol = security_details_.protocol.IsolatedCopy(); |
| 222 data->security_details_.cipher = security_details_.cipher.IsolatedCopy(); | 233 data->security_details_.cipher = security_details_.cipher.IsolatedCopy(); |
| 223 data->security_details_.key_exchange = | 234 data->security_details_.key_exchange = |
| 224 security_details_.key_exchange.IsolatedCopy(); | 235 security_details_.key_exchange.IsolatedCopy(); |
| 225 data->security_details_.key_exchange_group = | 236 data->security_details_.key_exchange_group = |
| 226 security_details_.key_exchange_group.IsolatedCopy(); | 237 security_details_.key_exchange_group.IsolatedCopy(); |
| 227 data->security_details_.mac = security_details_.mac.IsolatedCopy(); | 238 data->security_details_.mac = security_details_.mac.IsolatedCopy(); |
| 228 data->security_details_.subject_name = | 239 data->security_details_.subject_name = |
| 229 security_details_.subject_name.IsolatedCopy(); | 240 security_details_.subject_name.IsolatedCopy(); |
| 230 data->security_details_.san_list = IsolatedCopy(security_details_.san_list); | 241 data->security_details_.san_list = IsolatedCopy(security_details_.san_list); |
| 231 data->security_details_.issuer = security_details_.issuer.IsolatedCopy(); | 242 data->security_details_.issuer = security_details_.issuer.IsolatedCopy(); |
| 232 data->security_details_.valid_from = security_details_.valid_from; | 243 data->security_details_.valid_from = security_details_.valid_from; |
| 233 data->security_details_.valid_to = security_details_.valid_to; | 244 data->security_details_.valid_to = security_details_.valid_to; |
| 234 for (auto& cert : security_details_.certificate) | 245 for (auto& cert : security_details_.certificate) |
| 235 data->certificate_.push_back(cert.GetString().IsolatedCopy()); | 246 data->certificate_.push_back(cert.GetString().IsolatedCopy()); |
| 236 data->security_details_.sct_list = IsolatedCopy(security_details_.sct_list); | 247 data->security_details_.sct_list = IsolatedCopy(security_details_.sct_list); |
| 237 data->http_version_ = http_version_; | 248 data->http_version_ = http_version_; |
| 238 data->app_cache_id_ = app_cache_id_; | 249 data->app_cache_id_ = app_cache_id_; |
| 239 data->app_cache_manifest_url_ = app_cache_manifest_url_.Copy(); | 250 data->app_cache_manifest_url_ = app_cache_manifest_url_.Copy(); |
| 240 data->multipart_boundary_ = multipart_boundary_; | 251 data->multipart_boundary_ = multipart_boundary_; |
| 241 data->was_fetched_via_spdy_ = was_fetched_via_spdy_; | |
| 242 data->was_fetched_via_proxy_ = was_fetched_via_proxy_; | |
| 243 data->was_fetched_via_service_worker_ = was_fetched_via_service_worker_; | |
| 244 data->was_fetched_via_foreign_fetch_ = was_fetched_via_foreign_fetch_; | |
| 245 data->was_fallback_required_by_service_worker_ = | |
| 246 was_fallback_required_by_service_worker_; | |
| 247 data->service_worker_response_type_ = service_worker_response_type_; | |
| 248 data->url_list_via_service_worker_.resize( | 252 data->url_list_via_service_worker_.resize( |
| 249 url_list_via_service_worker_.size()); | 253 url_list_via_service_worker_.size()); |
| 250 std::transform(url_list_via_service_worker_.begin(), | 254 std::transform(url_list_via_service_worker_.begin(), |
| 251 url_list_via_service_worker_.end(), | 255 url_list_via_service_worker_.end(), |
| 252 data->url_list_via_service_worker_.begin(), | 256 data->url_list_via_service_worker_.begin(), |
| 253 [](const KURL& url) { return url.Copy(); }); | 257 [](const KURL& url) { return url.Copy(); }); |
| 254 data->cache_storage_cache_name_ = CacheStorageCacheName().IsolatedCopy(); | 258 data->cache_storage_cache_name_ = CacheStorageCacheName().IsolatedCopy(); |
| 255 data->did_service_worker_navigation_preload_ = | |
| 256 did_service_worker_navigation_preload_; | |
| 257 data->response_time_ = response_time_; | 259 data->response_time_ = response_time_; |
| 258 data->remote_ip_address_ = remote_ip_address_.GetString().IsolatedCopy(); | |
| 259 data->remote_port_ = remote_port_; | |
| 260 data->encoded_data_length_ = encoded_data_length_; | 260 data->encoded_data_length_ = encoded_data_length_; |
| 261 data->encoded_body_length_ = encoded_body_length_; | 261 data->encoded_body_length_ = encoded_body_length_; |
| 262 data->decoded_body_length_ = decoded_body_length_; | 262 data->decoded_body_length_ = decoded_body_length_; |
| 263 data->downloaded_file_path_ = downloaded_file_path_.IsolatedCopy(); | 263 data->downloaded_file_path_ = downloaded_file_path_.IsolatedCopy(); |
| 264 data->downloaded_file_handle_ = downloaded_file_handle_; | 264 data->downloaded_file_handle_ = downloaded_file_handle_; |
| 265 | 265 |
| 266 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support | 266 // Bug https://bugs.webkit.org/show_bug.cgi?id=60397 this doesn't support |
| 267 // whatever values may be present in the opaque m_extraData structure. | 267 // whatever values may be present in the opaque m_extraData structure. |
| 268 | 268 |
| 269 return data; | 269 return data; |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 628 if (a.GetResourceLoadTiming() != b.GetResourceLoadTiming()) | 628 if (a.GetResourceLoadTiming() != b.GetResourceLoadTiming()) |
| 629 return false; | 629 return false; |
| 630 if (a.EncodedBodyLength() != b.EncodedBodyLength()) | 630 if (a.EncodedBodyLength() != b.EncodedBodyLength()) |
| 631 return false; | 631 return false; |
| 632 if (a.DecodedBodyLength() != b.DecodedBodyLength()) | 632 if (a.DecodedBodyLength() != b.DecodedBodyLength()) |
| 633 return false; | 633 return false; |
| 634 return true; | 634 return true; |
| 635 } | 635 } |
| 636 | 636 |
| 637 } // namespace blink | 637 } // namespace blink |
| OLD | NEW |