Commit d0210f38 authored by Yuki Shiino's avatar Yuki Shiino

Adds a crash key to V8EventListener to help diagnose crbug.com/621730 .

This change can be reverted after a day or two of data.

BUG=621730
R=haraken@chromium.org, rsesek@chromium.org

Review URL: https://codereview.chromium.org/2107773002 .

Cr-Commit-Position: refs/heads/master@{#402609}
parent aaf2d34b
......@@ -73,6 +73,9 @@ size_t RegisterEngineCrashKeys() {
// Temporary for https://crbug.com/612711.
{ "aci_wrong_sp_extension_id", crash_keys::kSmallSize },
// Temporary for http://crbug.com/621730.
{ "postmessage_script_info", crash_keys::kLargeSize },
// Temporary for https://crbug.com/616149.
{ "existing_extension_pref_value_type", crash_keys::kSmallSize },
};
......
......@@ -194,6 +194,9 @@ size_t RegisterChromeCrashKeys() {
// Temporary for https://crbug.com/612711.
{ "aci_wrong_sp_extension_id", kSmallSize },
// Temporary for http://crbug.com/621730
{ "postmessage_script_info", kLargeSize },
// Temporary for https://crbug.com/616149.
{ "existing_extension_pref_value_type", crash_keys::kSmallSize },
};
......
......@@ -33,7 +33,9 @@
#include "bindings/core/v8/ScriptController.h"
#include "bindings/core/v8/V8Binding.h"
#include "core/dom/Document.h"
#include "core/events/Event.h"
#include "core/frame/LocalFrame.h"
#include "wtf/debug/CrashLogging.h"
namespace blink {
......@@ -90,6 +92,28 @@ v8::Local<v8::Value> V8EventListener::callListenerFunction(ScriptState* scriptSt
if (scriptState->world().isMainWorld() && !frame->script().canExecuteScripts(AboutToExecuteScript))
return v8::Local<v8::Value>();
// Temporary instrumentation for http://crbug.com/621730.
String scriptInfo;
if (event->type() == EventTypeNames::message) {
v8::HandleScope handleScope(isolate());
StringBuilder scriptInfoBuilder;
V8StringResource<> functionName = handlerFunction->GetDebugName();
if (functionName.prepare()) {
scriptInfoBuilder.append(static_cast<String>(functionName));
}
scriptInfoBuilder.append(':');
scriptInfoBuilder.appendNumber(handlerFunction->GetScriptLineNumber());
scriptInfoBuilder.append(':');
scriptInfoBuilder.appendNumber(handlerFunction->GetScriptColumnNumber());
scriptInfoBuilder.append(':');
V8StringResource<> scriptName = handlerFunction->GetScriptOrigin().ResourceName();
if (scriptName.prepare()) {
scriptInfoBuilder.append(static_cast<String>(scriptName));
}
scriptInfo = scriptInfoBuilder.toString();
}
WTF::debug::ScopedCrashKey("postmessage_script_info", scriptInfo.utf8().data());
v8::Local<v8::Value> parameters[1] = { jsEvent };
v8::Local<v8::Value> result;
if (!frame->script().callFunction(handlerFunction, receiver, WTF_ARRAY_LENGTH(parameters), parameters).ToLocal(&result))
......
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