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

Unified Diff: src/api.cc

Issue 265593002: Add v8::Message::GetScriptOrigin() with tests (Closed) Base URL: git://github.com/v8/v8.git@master
Patch Set: Created 6 years, 8 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
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/api.cc
diff --git a/src/api.cc b/src/api.cc
index ab4ded2472971ea519ba412b40c16bfc39804ad1..1e043bf3c5cf452ec21633c4549ec79768a8130a 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -1937,6 +1937,22 @@ v8::Handle<Value> Message::GetScriptResourceName() const {
}
+v8::Handle<Value> Message::GetScriptResourceNameOrSourceURL() const {
+ i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
+ ENTER_V8(isolate);
+ EscapableHandleScope scope(reinterpret_cast<Isolate*>(isolate));
+ i::Handle<i::JSMessageObject> message =
+ i::Handle<i::JSMessageObject>::cast(Utils::OpenHandle(this));
+
+ i::Handle<i::JSValue> scriptValue =
+ i::Handle<i::JSValue>::cast(i::Handle<i::Object>(message->script(),
+ isolate));
+ i::Handle<i::Script> script(i::Script::cast(scriptValue->value()));
+ i::Handle<i::Object> script_name = i::Script::GetNameOrSourceURL(script);
+ return scope.Escape(Utils::ToLocal(script_name));
+}
+
+
v8::Handle<v8::StackTrace> Message::GetStackTrace() const {
i::Isolate* isolate = Utils::OpenHandle(this)->GetIsolate();
ENTER_V8(isolate);
« include/v8.h ('K') | « include/v8.h ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698