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

Unified Diff: third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp

Issue 2843873002: Insert CHECK()s to ensure module-related code are not executed without the flag (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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
index 3afceafeb64f71d7006fb9501719058dc5e55f72..acd18ec4fe382d94323ed0b520198efaea9449cf 100644
--- a/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/ScriptModule.cpp
@@ -10,9 +10,26 @@
namespace blink {
+ScriptModule::ScriptModule() {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+}
+
+ScriptModule::ScriptModule(WTF::HashTableDeletedValueType)
+ : module_(WTF::kHashTableDeletedValue) {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+}
+
ScriptModule::ScriptModule(v8::Isolate* isolate, v8::Local<v8::Module> module)
: module_(SharedPersistent<v8::Module>::Create(module, isolate)),
identity_hash_(static_cast<unsigned>(module->GetIdentityHash())) {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+
DCHECK(!module_->IsEmpty());
}
@@ -22,6 +39,10 @@ ScriptModule ScriptModule::Compile(v8::Isolate* isolate,
const String& source,
const String& file_name,
AccessControlStatus access_control_status) {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+
v8::TryCatch try_catch(isolate);
try_catch.SetVerbose(true);
v8::Local<v8::Module> module;
@@ -78,6 +99,10 @@ void ScriptModule::Evaluate(ScriptState* script_state) const {
void ScriptModule::ReportException(ScriptState* script_state,
v8::Local<v8::Value> exception,
const String& file_name) {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+
v8::Isolate* isolate = script_state->GetIsolate();
v8::TryCatch try_catch(isolate);
@@ -107,6 +132,10 @@ v8::MaybeLocal<v8::Module> ScriptModule::ResolveModuleCallback(
v8::Local<v8::Context> context,
v8::Local<v8::String> specifier,
v8::Local<v8::Module> referrer) {
+ // We ensure module-related code is not executed without the flag.
+ // https://crbug.com/715376
+ CHECK(RuntimeEnabledFeatures::moduleScriptsEnabled());
+
v8::Isolate* isolate = context->GetIsolate();
Modulator* modulator = Modulator::From(ScriptState::From(context));
DCHECK(modulator);
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/ScriptModule.h ('k') | third_party/WebKit/Source/core/dom/ModulatorImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698