Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / Source / bindings / v8 / ScriptRegexp.cpp
index 0d5df30..5f951ca 100644 (file)
@@ -32,6 +32,7 @@
 #include "bindings/v8/V8Binding.h"
 #include "bindings/v8/V8PerIsolateData.h"
 #include "bindings/v8/V8ScriptRunner.h"
+#include "core/dom/ScriptForbiddenScope.h"
 
 namespace WebCore {
 
@@ -39,7 +40,7 @@ ScriptRegexp::ScriptRegexp(const String& pattern, TextCaseSensitivity caseSensit
 {
     v8::Isolate* isolate = v8::Isolate::GetCurrent();
     v8::HandleScope handleScope(isolate);
-    v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureRegexContext());
+    v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureDomInJSContext());
     v8::TryCatch tryCatch;
 
     unsigned flags = v8::RegExp::kNone;
@@ -67,9 +68,11 @@ int ScriptRegexp::match(const String& string, int startFrom, int* matchLength) c
     if (string.length() > INT_MAX)
         return -1;
 
+    ScriptForbiddenScope::AllowUserAgentScript allowScript;
+
     v8::Isolate* isolate = v8::Isolate::GetCurrent();
     v8::HandleScope handleScope(isolate);
-    v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureRegexContext());
+    v8::Context::Scope contextScope(V8PerIsolateData::from(isolate)->ensureDomInJSContext());
     v8::TryCatch tryCatch;
 
     v8::Local<v8::RegExp> regex = m_regex.newLocal(isolate);