Commit c9ab660e authored by jl's avatar jl Committed by Commit bot

[inspector] Add some context scopes to inspector code

Currently, the external API (e.g. v8::Object::Get()) will enter the
context passed to it automatically. This is incorrect and causes some
trouble for Blink, so we want to change that.

It then becomes a potential problem to call the external API without
first entering a context, which the inspector code does in some
places. This patch aims to correct this.

BUG=v8:6307

Review-Url: https://codereview.chromium.org/2841053002
Cr-Commit-Position: refs/heads/master@{#44917}
parent 7b26234c
......@@ -75,6 +75,8 @@ v8::Local<v8::Value> V8FunctionCall::call(bool& hadException,
}
v8::Local<v8::Value> V8FunctionCall::callWithoutExceptionHandling() {
v8::Context::Scope contextScope(m_context);
v8::Local<v8::Object> thisObject = v8::Local<v8::Object>::Cast(m_value);
v8::Local<v8::Value> value;
if (!thisObject->Get(m_context, m_name).ToLocal(&value))
......
......@@ -49,6 +49,7 @@ int V8Regex::match(const String16& string, int startFrom,
v8::Isolate* isolate = m_inspector->isolate();
v8::HandleScope handleScope(isolate);
v8::Local<v8::Context> context = m_inspector->regexContext();
v8::Context::Scope contextScope(context);
v8::MicrotasksScope microtasks(isolate,
v8::MicrotasksScope::kDoNotRunMicrotasks);
v8::TryCatch tryCatch(isolate);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment