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

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

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: rebased Created 3 years, 8 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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 return false; 171 return false;
172 } 172 }
173 173
174 // The result of extracting a MIME type from response's header list 174 // The result of extracting a MIME type from response's header list
175 // (ignoring parameters) is not a JavaScript MIME type 175 // (ignoring parameters) is not a JavaScript MIME type
176 // Note: For historical reasons, fetching a classic script does not include 176 // Note: For historical reasons, fetching a classic script does not include
177 // MIME type checking. In contrast, module scripts will fail to load if they 177 // MIME type checking. In contrast, module scripts will fail to load if they
178 // are not of a correct MIME type. 178 // are not of a correct MIME type.
179 // We use ResourceResponse::httpContentType() instead of mimeType(), as 179 // We use ResourceResponse::httpContentType() instead of mimeType(), as
180 // mimeType() may be rewritten by mime sniffer. 180 // mimeType() may be rewritten by mime sniffer.
181 if (!MIMETypeRegistry::IsSupportedJavaScriptMIMEType( 181 // if (!MIMETypeRegistry::IsSupportedJavaScriptMIMEType(
182 response.HttpContentType())) 182 // response.HttpContentType()))
183 return false; 183 // return false;
184 184
185 return true; 185 return true;
186 } 186 }
187 187
188 // ScriptResourceClient callback handler 188 // ScriptResourceClient callback handler
189 void ModuleScriptLoader::NotifyFinished(Resource*) { 189 void ModuleScriptLoader::NotifyFinished(Resource*) {
190 // Note: "conditions" referred in Step 7 is implemented in 190 // Note: "conditions" referred in Step 7 is implemented in
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
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 250
251 DEFINE_TRACE(ModuleScriptLoader) { 251 DEFINE_TRACE(ModuleScriptLoader) {
252 visitor->Trace(modulator_); 252 visitor->Trace(modulator_);
253 visitor->Trace(module_script_); 253 visitor->Trace(module_script_);
254 visitor->Trace(registry_); 254 visitor->Trace(registry_);
255 visitor->Trace(client_); 255 visitor->Trace(client_);
256 ResourceOwner<ScriptResource>::Trace(visitor); 256 ResourceOwner<ScriptResource>::Trace(visitor);
257 } 257 }
258 258
259 } // namespace blink 259 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698