Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(357)

Unified Diff: third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp

Issue 2107773002: Adds a crash key to V8EventListener to help diagnose crbug.com/621730 . (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@crashkey-at-postmessage
Patch Set: Synced. Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
diff --git a/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp b/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
index 017860884af8edf851e764f06149694d09abcff1..9a460ddeb0cf448e40230c7d999b84175ac0fcd8 100644
--- a/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
+++ b/third_party/WebKit/Source/bindings/core/v8/V8EventListener.cpp
@@ -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))
« no previous file with comments | « chrome/common/crash_keys.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698