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

Unified Diff: third_party/WebKit/Source/core/dom/ModuleScript.cpp

Issue 2555653002: [WIP Prototype] ES6 https://html.spec.whatwg.org/#fetch-a-single-module-script implementation (Closed)
Patch Set: ModuleTreeLinkerTest.fetchTreeInstantiationFailure 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/dom/ModuleScript.cpp
diff --git a/third_party/WebKit/Source/core/dom/ModuleScript.cpp b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
index f175cd9c670962af74f915049f637d9ce2e2ef89..9c4a331526b6403be00fc2fbd88dc7a51de710bf 100644
--- a/third_party/WebKit/Source/core/dom/ModuleScript.cpp
+++ b/third_party/WebKit/Source/core/dom/ModuleScript.cpp
@@ -4,15 +4,24 @@
#include "core/dom/ModuleScript.h"
+#include "bindings/core/v8/V8Binding.h"
+#include "bindings/core/v8/V8ThrowException.h"
+#include "core/dom/Modulator.h"
+#include "core/dom/ScriptModuleResolver.h"
+
namespace blink {
-void ModuleScript::SetInstantiationError(v8::Isolate* isolate,
- v8::Local<v8::Value> error) {
+void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) {
DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated);
instantiation_state_ = ModuleInstantiationState::kErrored;
DCHECK(!error.IsEmpty());
- instantiation_error_.Set(isolate, error);
+ {
+ ScriptState::Scope scope(error.GetScriptState());
+ instantiation_error_.Set(error.GetIsolate(), error.V8Value());
+ }
+
+ record_ = ScriptModule();
}
void ModuleScript::SetInstantiationSuccess() {
@@ -40,8 +49,10 @@ bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document,
}
void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const {
- // TODO(hiroshige): Implement this once Modulator::ExecuteModule() is landed.
- NOTREACHED();
+ fprintf(stderr, "ModuleScript: isNull=%d state=%d\n", record_.IsNull(),
+ InstantiationState());
+
+ settings_object_->ExecuteModule(this);
}
String ModuleScript::InlineSourceTextForCSP() const {

Powered by Google App Engine
This is Rietveld 408576698