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

Side by Side Diff: third_party/WebKit/Source/core/dom/ModuleScript.cpp

Issue 2780463002: Introduce blink::Script (Closed)
Patch Set: Rebase 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/dom/ModuleScript.h" 5 #include "core/dom/ModuleScript.h"
6 6
7 namespace blink { 7 namespace blink {
8 8
9 void ModuleScript::SetInstantiationError(v8::Isolate* isolate, 9 void ModuleScript::SetInstantiationError(v8::Isolate* isolate,
10 v8::Local<v8::Value> error) { 10 v8::Local<v8::Value> error) {
11 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); 11 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated);
12 instantiation_state_ = ModuleInstantiationState::kErrored; 12 instantiation_state_ = ModuleInstantiationState::kErrored;
13 13
14 DCHECK(!error.IsEmpty()); 14 DCHECK(!error.IsEmpty());
15 instantiation_error_.Set(isolate, error); 15 instantiation_error_.Set(isolate, error);
16 } 16 }
17 17
18 void ModuleScript::SetInstantiationSuccess() { 18 void ModuleScript::SetInstantiationSuccess() {
19 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); 19 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated);
20 instantiation_state_ = ModuleInstantiationState::kInstantiated; 20 instantiation_state_ = ModuleInstantiationState::kInstantiated;
21 } 21 }
22 22
23 DEFINE_TRACE(ModuleScript) {} 23 DEFINE_TRACE(ModuleScript) {
24 Script::Trace(visitor);
25 }
24 DEFINE_TRACE_WRAPPERS(ModuleScript) { 26 DEFINE_TRACE_WRAPPERS(ModuleScript) {
27 Script::TraceWrappers(visitor);
25 visitor->TraceWrappers(instantiation_error_); 28 visitor->TraceWrappers(instantiation_error_);
26 } 29 }
27 30
31 bool ModuleScript::IsEmpty() const {
32 return false;
33 }
34
35 bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document,
36 const SecurityOrigin*) const {
37 // We don't check MIME type here because we check the MIME type in
38 // ModuleScriptLoader::WasModuleLoadSuccessful().
39 return true;
40 }
41
42 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const {
43 // TODO(hiroshige): Implement this once Modulator::ExecuteModule() is landed.
44 NOTREACHED();
45 }
46
47 String ModuleScript::InlineSourceTextForCSP() const {
48 // Currently we don't support inline module scripts.
49 // TODO(hiroshige): Implement this.
50 NOTREACHED();
51 return String();
52 }
53
28 } // namespace blink 54 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/dom/ModuleScript.h ('k') | third_party/WebKit/Source/core/dom/PendingScript.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698