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

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

Issue 2774843002: Pass AccessControlStatus to compileModule() (Closed)
Patch Set: const 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
diff --git a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
index 675f108e172feb16cd85abe992394085c30dd35e..64b04480324a927db18ebed6df53039557e0c9b1 100644
--- a/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
+++ b/third_party/WebKit/Source/core/loader/modulescript/ModuleScriptLoader.cpp
@@ -200,12 +200,16 @@ void ModuleScriptLoader::notifyFinished(Resource*) {
// Step 8. Let source text be the result of UTF-8 decoding response's body.
String sourceText = resource()->script();
+ AccessControlStatus accessControlStatus =
+ resource()->calculateAccessControlStatus(m_modulator->securityOrigin());
+
// Step 9. Let module script be the result of creating a module script given
// source text, module map settings object, response's url, cryptographic
// nonce, parser state, and credentials mode.
m_moduleScript = createModuleScript(
sourceText, resource()->response().url(), m_modulator, m_nonce,
- m_parserState, resource()->resourceRequest().fetchCredentialsMode());
+ m_parserState, resource()->resourceRequest().fetchCredentialsMode(),
+ accessControlStatus);
advanceState(State::Finished);
}
@@ -217,7 +221,8 @@ ModuleScript* ModuleScriptLoader::createModuleScript(
Modulator* modulator,
const String& nonce,
ParserDisposition parserState,
- WebURLRequest::FetchCredentialsMode credentialsMode) {
+ WebURLRequest::FetchCredentialsMode credentialsMode,
+ AccessControlStatus accessControlStatus) {
// Step 1. Let script be a new module script that this algorithm will
// subsequently initialize.
// Step 2. Set script's settings object to the environment settings object
@@ -225,7 +230,8 @@ ModuleScript* ModuleScriptLoader::createModuleScript(
// Note: "script's settings object" will be "modulator".
// Delegate to Modulator::compileModule to process Steps 3-6.
- ScriptModule result = modulator->compileModule(sourceText, url.getString());
+ ScriptModule result = modulator->compileModule(sourceText, url.getString(),
+ accessControlStatus);
// Step 6: "...return null, and abort these steps."
if (result.isNull())
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698