From: Aaron Kennedy Date: Fri, 14 Oct 2011 07:03:06 +0000 (+1000) Subject: [V8] Allow access to the calling script data X-Git-Tag: qt-v5.0.0-alpha1~27 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=121ba5bcd134dbc37088e7fadf7dc60a695c7596;hp=8a4d849a0152c76bd9107a1b38a641cf8c0ff226;p=profile%2Fivi%2Fqtjsbackend.git [V8] Allow access to the calling script data Change-Id: Ia62421388693604ca5666924337180734be891c0 Reviewed-by: Simon Hausmann --- diff --git a/src/3rdparty/v8/include/v8.h b/src/3rdparty/v8/include/v8.h index 193e2fe..c094d08 100644 --- a/src/3rdparty/v8/include/v8.h +++ b/src/3rdparty/v8/include/v8.h @@ -3517,6 +3517,7 @@ class V8EXPORT Context { */ static Local GetCalling(); static Local GetCallingQmlGlobal(); + static Local GetCallingScriptData(); /** * Sets the security token for the context. To access an object in diff --git a/src/3rdparty/v8/src/api.cc b/src/3rdparty/v8/src/api.cc index 780d1bb..a51fdc4 100644 --- a/src/3rdparty/v8/src/api.cc +++ b/src/3rdparty/v8/src/api.cc @@ -4365,6 +4365,18 @@ v8::Local Context::GetCallingQmlGlobal() { } } +v8::Local Context::GetCallingScriptData() +{ + i::Isolate* isolate = i::Isolate::Current(); + if (IsDeadCheck(isolate, "v8::Context::GetCallingScriptData()")) { + return Local(); + } + + i::JavaScriptFrameIterator it; + if (it.done()) return Local(); + i::Handle script(i::Script::cast(i::JSFunction::cast(it.frame()->function())->shared()->script())); + return Utils::ToLocal(i::Handle(script->data())); +} v8::Local Context::Global() { if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) {