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

Unified Diff: Source/bindings/core/v8/PrivateScriptRunner.cpp

Issue 478623002: Blink-in-JS: Output a correct JS file name and line number when an exception is thrown (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/bindings/core/v8/PrivateScriptRunner.cpp
diff --git a/Source/bindings/core/v8/PrivateScriptRunner.cpp b/Source/bindings/core/v8/PrivateScriptRunner.cpp
index eb6e41bbbaea71f89eafd4e12595d065fc17e5c9..373e77bc9de3384a8bc80943c5efe2122ea801e8 100644
--- a/Source/bindings/core/v8/PrivateScriptRunner.cpp
+++ b/Source/bindings/core/v8/PrivateScriptRunner.cpp
@@ -23,8 +23,13 @@ static void dumpV8Message(v8::Handle<v8::Message> message)
if (message.IsEmpty())
return;
- // FIXME: How can we get a resource name when an exception is thrown by DOM attributes/methods
- // implemented in private scripts? In that case, currently ResourceName() returns an empty handle.
+ // FIXME: GetScriptOrigin() and GetLineNumber() return empty handles
+ // when they are called at the first time if V8 has a pending exception.
+ // So we need to call twice to get a correct ScriptOrigin and line number.
+ // This is a bug of V8.
Jens Widell 2014/08/15 04:55:29 Is there a bug report?
haraken 2014/08/15 04:57:23 Not yet, I'm writing a fix :)
+ message->GetScriptOrigin();
+ message->GetLineNumber();
+
v8::Handle<v8::Value> resourceName = message->GetScriptOrigin().ResourceName();
String fileName = "Unknown JavaScript file";
if (!resourceName.IsEmpty() && resourceName->IsString())
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698