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

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

Issue 2838933003: [not-for-commit] kitsune changes + pending kouhei changes (Closed)
Patch Set: 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/dom/ModuleScript.h" 5 #include "core/dom/ModuleScript.h"
6 6
7 #include "bindings/core/v8/ScriptState.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "bindings/core/v8/ScriptValue.h"
9 #include "v8/include/v8.h"
10 8
11 namespace blink { 9 namespace blink {
12 10
13 void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) { 11 void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) {
14 // Implements Step 7.1 of: 12 // Implements Step 7.1 of:
15 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure 13 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure
16 14
17 // "set script's instantiation state to "errored", ..." 15 // "set script's instantiation state to "errored", ..."
18 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); 16 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated);
19 instantiation_state_ = ModuleInstantiationState::kErrored; 17 instantiation_state_ = ModuleInstantiationState::kErrored;
20 18
21 // "its instantiation error to instantiationStatus.[[Value]], and ..." 19 // "its instantiation error to instantiationStatus.[[Value]], and ..."
22 DCHECK(!error.IsEmpty()); 20 DCHECK(!error.IsEmpty());
23 { 21 {
24 ScriptState::Scope scope(error.GetScriptState()); 22 ScriptState::Scope scope(error.GetScriptState());
23 // String str = ToCoreString(
24 // error.V8Value()->ToString(error.GetContext()).ToLocalChecked());
25 // fprintf(stderr, "[%s]\n", str.Utf8().Data());
25 instantiation_error_.Set(error.GetIsolate(), error.V8Value()); 26 instantiation_error_.Set(error.GetIsolate(), error.V8Value());
26 } 27 }
27 28
28 // "its module record to null." 29 // "its module record to null."
29 record_ = ScriptModule(); 30 record_ = ScriptModule();
30 } 31 }
31 32
32 void ModuleScript::SetInstantiationSuccess() { 33 void ModuleScript::SetInstantiationSuccess() {
33 // Implements Step 7.2 of: 34 // Implements Step 7.2 of:
34 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure 35 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri pt-graph-fetching-procedure
(...skipping 16 matching lines...) Expand all
51 } 52 }
52 53
53 bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document, 54 bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document,
54 const SecurityOrigin*) const { 55 const SecurityOrigin*) const {
55 // We don't check MIME type here because we check the MIME type in 56 // We don't check MIME type here because we check the MIME type in
56 // ModuleScriptLoader::WasModuleLoadSuccessful(). 57 // ModuleScriptLoader::WasModuleLoadSuccessful().
57 return true; 58 return true;
58 } 59 }
59 60
60 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const { 61 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const {
61 // TODO(hiroshige): Implement this once Modulator::ExecuteModule() is landed. 62 settings_object_->ExecuteModule(this);
62 NOTREACHED();
63 } 63 }
64 64
65 String ModuleScript::InlineSourceTextForCSP() const { 65 String ModuleScript::InlineSourceTextForCSP() const {
66 // Currently we don't support inline module scripts. 66 // Currently we don't support inline module scripts.
67 // TODO(hiroshige): Implement this. 67 // TODO(hiroshige): Implement this.
68 NOTREACHED(); 68 NOTREACHED();
69 return String(); 69 return String();
70 } 70 }
71 71
72 } // namespace blink 72 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698