OLD | NEW |
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/ScriptState.h" |
8 #include "bindings/core/v8/ScriptValue.h" | 8 #include "bindings/core/v8/ScriptValue.h" |
9 #include "v8/include/v8.h" | 9 #include "v8/include/v8.h" |
| 10 #include "bindings/core/v8/V8BindingForCore.h" |
10 | 11 |
11 namespace blink { | 12 namespace blink { |
12 | 13 |
13 void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) { | 14 void ModuleScript::SetInstantiationErrorAndClearRecord(ScriptValue error) { |
14 // Implements Step 7.1 of: | 15 // Implements Step 7.1 of: |
15 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 16 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
16 | 17 |
17 // "set script's instantiation state to "errored", ..." | 18 // "set script's instantiation state to "errored", ..." |
18 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); | 19 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); |
19 instantiation_state_ = ModuleInstantiationState::kErrored; | 20 instantiation_state_ = ModuleInstantiationState::kErrored; |
20 | 21 |
21 // "its instantiation error to instantiationStatus.[[Value]], and ..." | 22 // "its instantiation error to instantiationStatus.[[Value]], and ..." |
22 DCHECK(!error.IsEmpty()); | 23 DCHECK(!error.IsEmpty()); |
23 { | 24 { |
24 ScriptState::Scope scope(error.GetScriptState()); | 25 ScriptState::Scope scope(error.GetScriptState()); |
| 26 // String str = ToCoreString( |
| 27 // error.V8Value()->ToString(error.GetContext()).ToLocalChecked()); |
| 28 // fprintf(stderr, "[%s]\n", str.Utf8().Data()); |
25 instantiation_error_.Set(error.GetIsolate(), error.V8Value()); | 29 instantiation_error_.Set(error.GetIsolate(), error.V8Value()); |
26 } | 30 } |
27 | 31 |
28 // "its module record to null." | 32 // "its module record to null." |
29 record_ = ScriptModule(); | 33 record_ = ScriptModule(); |
30 } | 34 } |
31 | 35 |
32 void ModuleScript::SetInstantiationSuccess() { | 36 void ModuleScript::SetInstantiationSuccess() { |
33 // Implements Step 7.2 of: | 37 // Implements Step 7.2 of: |
34 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure | 38 // https://html.spec.whatwg.org/multipage/webappapis.html#internal-module-scri
pt-graph-fetching-procedure |
(...skipping 27 matching lines...) Expand all Loading... |
62 } | 66 } |
63 | 67 |
64 String ModuleScript::InlineSourceTextForCSP() const { | 68 String ModuleScript::InlineSourceTextForCSP() const { |
65 // Currently we don't support inline module scripts. | 69 // Currently we don't support inline module scripts. |
66 // TODO(hiroshige): Implement this. | 70 // TODO(hiroshige): Implement this. |
67 NOTREACHED(); | 71 NOTREACHED(); |
68 return String(); | 72 return String(); |
69 } | 73 } |
70 | 74 |
71 } // namespace blink | 75 } // namespace blink |
OLD | NEW |