Index: Source/bindings/v8/ScriptRegexp.cpp |
diff --git a/Source/bindings/v8/ScriptRegexp.cpp b/Source/bindings/v8/ScriptRegexp.cpp |
index e8f3c5fe6bde47382caeafac20b87cdccf3469d5..8614ee2bb8feee02a7b958d1ade8ae1f498e02dc 100644 |
--- a/Source/bindings/v8/ScriptRegexp.cpp |
+++ b/Source/bindings/v8/ScriptRegexp.cpp |
@@ -39,7 +39,12 @@ ScriptRegexp::ScriptRegexp(const String& pattern, TextCaseSensitivity caseSensit |
{ |
v8::Isolate* isolate = v8::Isolate::GetCurrent(); |
v8::HandleScope handleScope(isolate); |
- v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureDomInJSContext()); |
+ v8::Local<v8::Context> context = V8PerIsolateData::from(isolate)->ensureDomInJSContext(); |
+ if (context.IsEmpty()) { |
+ // The script execution is terminated. |
+ return; |
+ } |
+ v8::Context::Scope contextScope(context); |
v8::TryCatch tryCatch; |
unsigned flags = v8::RegExp::kNone; |