Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(362)

Side by Side Diff: third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp

Issue 2724673002: [WIP] Introduce ScriptResourceData
Patch Set: Fix Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "core/loader/modulescript/ModuleScriptLoader.h" 5 #include "core/loader/modulescript/ModuleScriptLoader.h"
6 6
7 #include "core/dom/Modulator.h" 7 #include "core/dom/Modulator.h"
8 #include "core/dom/ModuleScript.h" 8 #include "core/dom/ModuleScript.h"
9 #include "core/loader/modulescript/ModuleScriptLoaderClient.h" 9 #include "core/loader/modulescript/ModuleScriptLoaderClient.h"
10 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h" 10 #include "core/loader/modulescript/ModuleScriptLoaderRegistry.h"
(...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 // wasModuleLoadSuccessful(). 191 // wasModuleLoadSuccessful().
192 // Step 7. If any of the following conditions are met, set moduleMap[url] to 192 // Step 7. If any of the following conditions are met, set moduleMap[url] to
193 // null, asynchronously complete this algorithm with null, and abort these 193 // null, asynchronously complete this algorithm with null, and abort these
194 // steps. 194 // steps.
195 if (!WasModuleLoadSuccessful(GetResource())) { 195 if (!WasModuleLoadSuccessful(GetResource())) {
196 AdvanceState(State::kFinished); 196 AdvanceState(State::kFinished);
197 return; 197 return;
198 } 198 }
199 199
200 // Step 8. Let source text be the result of UTF-8 decoding response's body. 200 // Step 8. Let source text be the result of UTF-8 decoding response's body.
201 String source_text = GetResource()->SourceText(); 201 const ScriptResourceData* resource_data_ = GetResource()->ResourceData();
202 String source_text = resource_data_->SourceText();
202 203
203 AccessControlStatus access_control_status = 204 AccessControlStatus access_control_status =
204 GetResource()->CalculateAccessControlStatus( 205 resource_data_->CalculateAccessControlStatus(
205 modulator_->GetSecurityOrigin()); 206 modulator_->GetSecurityOrigin());
206 207
207 // Step 9. Let module script be the result of creating a module script given 208 // Step 9. Let module script be the result of creating a module script given
208 // source text, module map settings object, response's url, cryptographic 209 // source text, module map settings object, response's url, cryptographic
209 // nonce, parser state, and credentials mode. 210 // nonce, parser state, and credentials mode.
210 module_script_ = ModuleScript::Create( 211 module_script_ = ModuleScript::Create(
211 source_text, modulator_, GetResource()->GetResponse().Url(), nonce_, 212 source_text, modulator_, resource_data_->GetResponse().Url(), nonce_,
212 parser_state_, 213 parser_state_,
213 GetResource()->GetResourceRequest().GetFetchCredentialsMode(), 214 GetResource()->GetResourceRequest().GetFetchCredentialsMode(),
214 access_control_status); 215 access_control_status);
215 216
216 AdvanceState(State::kFinished); 217 AdvanceState(State::kFinished);
217 } 218 }
218 219
219 DEFINE_TRACE(ModuleScriptLoader) { 220 DEFINE_TRACE(ModuleScriptLoader) {
220 visitor->Trace(modulator_); 221 visitor->Trace(modulator_);
221 visitor->Trace(module_script_); 222 visitor->Trace(module_script_);
222 visitor->Trace(registry_); 223 visitor->Trace(registry_);
223 visitor->Trace(client_); 224 visitor->Trace(client_);
224 ResourceOwner<ScriptResource>::Trace(visitor); 225 ResourceOwner<ScriptResource>::Trace(visitor);
225 } 226 }
226 227
227 } // namespace blink 228 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698