inspector: do not use injected script after wrapValue call
wrapValue can destroy injected script. R=dgozman@chromium.org Bug: chromium:898062 Cq-Include-Trybots: luci.chromium.try:linux_chromium_headless_rel;master.tryserver.blink:linux_trusty_blink_rel Change-Id: I60c8d4a4b510b896a175346a3ba72ca8be43bca5 Reviewed-on: https://chromium-review.googlesource.com/c/1297290 Reviewed-by: Dmitry Gozman <dgozman@chromium.org> Commit-Queue: Aleksey Kozyatinskiy <kozyatinskiy@chromium.org> Cr-Commit-Position: refs/heads/master@{#56919}
This commit is contained in:
parent
f5e13b2bf6
commit
1e505a0366
@ -395,6 +395,10 @@ Response InjectedScript::wrapObject(
|
||||
v8::HandleScope handles(m_context->isolate());
|
||||
v8::Local<v8::Value> wrappedObject;
|
||||
v8::Local<v8::Context> context = m_context->context();
|
||||
|
||||
int customPreviewEnabled = m_customPreviewEnabled;
|
||||
int sessionId = m_sessionId;
|
||||
|
||||
Response response = wrapValue(value, groupName, forceValueType,
|
||||
generatePreview, &wrappedObject);
|
||||
if (!response.isSuccess()) return response;
|
||||
@ -406,11 +410,11 @@ Response InjectedScript::wrapObject(
|
||||
*result =
|
||||
protocol::Runtime::RemoteObject::fromValue(protocolValue.get(), &errors);
|
||||
if (!result->get()) return Response::Error(errors.errors());
|
||||
if (m_customPreviewEnabled && value->IsObject()) {
|
||||
if (customPreviewEnabled && value->IsObject()) {
|
||||
std::unique_ptr<protocol::Runtime::CustomPreview> customPreview;
|
||||
generateCustomPreview(m_sessionId, groupName, m_context->context(),
|
||||
value.As<v8::Object>(), customPreviewConfig,
|
||||
maxCustomPreviewDepth, &customPreview);
|
||||
generateCustomPreview(sessionId, groupName, context, value.As<v8::Object>(),
|
||||
customPreviewConfig, maxCustomPreviewDepth,
|
||||
&customPreview);
|
||||
if (customPreview) (*result)->setCustomPreview(std::move(customPreview));
|
||||
}
|
||||
return Response::OK();
|
||||
|
Loading…
Reference in New Issue
Block a user