Chromium Code Reviews| 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/V8Binding.h" | |
| 8 #include "bindings/core/v8/V8ThrowException.h" | |
| 9 #include "core/dom/Modulator.h" | |
| 10 | |
| 7 namespace blink { | 11 namespace blink { |
| 8 | 12 |
| 9 void ModuleScript::SetInstantiationError(v8::Isolate* isolate, | 13 void ModuleScript::SetInstantiationError(v8::Isolate* isolate, |
| 10 v8::Local<v8::Value> error) { | 14 v8::Local<v8::Value> error) { |
| 11 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); | 15 DCHECK_EQ(instantiation_state_, ModuleInstantiationState::kUninstantiated); |
| 12 instantiation_state_ = ModuleInstantiationState::kErrored; | 16 instantiation_state_ = ModuleInstantiationState::kErrored; |
| 13 | 17 |
| 14 DCHECK(!error.IsEmpty()); | 18 DCHECK(!error.IsEmpty()); |
| 15 instantiation_error_.Set(isolate, error); | 19 instantiation_error_.Set(isolate, error); |
| 16 } | 20 } |
| (...skipping 16 matching lines...) Expand all Loading... | |
| 33 } | 37 } |
| 34 | 38 |
| 35 bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document, | 39 bool ModuleScript::CheckMIMETypeBeforeRunScript(Document* context_document, |
| 36 const SecurityOrigin*) const { | 40 const SecurityOrigin*) const { |
| 37 // We don't check MIME type here because we check the MIME type in | 41 // We don't check MIME type here because we check the MIME type in |
| 38 // ModuleScriptLoader::WasModuleLoadSuccessful(). | 42 // ModuleScriptLoader::WasModuleLoadSuccessful(). |
| 39 return true; | 43 return true; |
| 40 } | 44 } |
| 41 | 45 |
| 42 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const { | 46 void ModuleScript::RunScript(LocalFrame* frame, const SecurityOrigin*) const { |
| 43 // TODO(hiroshige): Implement this once Modulator::ExecuteModule() is landed. | 47 fprintf(stderr, "ModuleScript: isNull=%d state=%d\n", record_.IsNull(), |
| 44 NOTREACHED(); | 48 InstantiationState()); |
|
haraken
2017/04/17 07:33:43
Remove fprintf.
hiroshige
2017/04/26 00:50:03
Done.
| |
| 49 | |
| 50 settings_object_->ExecuteModule(this); | |
| 45 } | 51 } |
| 46 | 52 |
| 47 String ModuleScript::InlineSourceTextForCSP() const { | 53 String ModuleScript::InlineSourceTextForCSP() const { |
| 48 // Currently we don't support inline module scripts. | 54 // Currently we don't support inline module scripts. |
| 49 // TODO(hiroshige): Implement this. | 55 // TODO(hiroshige): Implement this. |
| 50 NOTREACHED(); | 56 NOTREACHED(); |
| 51 return String(); | 57 return String(); |
| 52 } | 58 } |
| 53 | 59 |
| 54 } // namespace blink | 60 } // namespace blink |
| OLD | NEW |