diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-10-14 17:03:06 +1000 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-03-01 12:03:43 +0100 |
commit | 121ba5bcd134dbc37088e7fadf7dc60a695c7596 (patch) | |
tree | 8da682807ad8f0f885edd9ba78424267a2971831 /src/3rdparty/v8/src/api.cc | |
parent | 8a4d849a0152c76bd9107a1b38a641cf8c0ff226 (diff) |
[V8] Allow access to the calling script data
Change-Id: Ia62421388693604ca5666924337180734be891c0
Reviewed-by: Simon Hausmann <simon.hausmann@nokia.com>
Diffstat (limited to 'src/3rdparty/v8/src/api.cc')
-rw-r--r-- | src/3rdparty/v8/src/api.cc | 12 |
1 files changed, 12 insertions, 0 deletions
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<v8::Object> Context::GetCallingQmlGlobal() { } } +v8::Local<v8::Value> Context::GetCallingScriptData() +{ + i::Isolate* isolate = i::Isolate::Current(); + if (IsDeadCheck(isolate, "v8::Context::GetCallingScriptData()")) { + return Local<Object>(); + } + + i::JavaScriptFrameIterator it; + if (it.done()) return Local<Object>(); + i::Handle<i::Script> script(i::Script::cast(i::JSFunction::cast(it.frame()->function())->shared()->script())); + return Utils::ToLocal(i::Handle<i::Object>(script->data())); +} v8::Local<v8::Object> Context::Global() { if (IsDeadCheck(i::Isolate::Current(), "v8::Context::Global()")) { |