diff options
author | Aaron Kennedy <aaron.kennedy@nokia.com> | 2011-10-14 17:03:06 +1000 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-01-05 12:18:11 +0100 |
commit | b126a7c96ba8a0ae4bd91fd504a4b36a1034c199 (patch) | |
tree | 5f516909e353c5e37571879d112a9da9c837cd38 /src/3rdparty/v8/src/api.cc | |
parent | 2fe857938c3d1683df88133582bc3e7736264b10 (diff) |
[V8] Allow access to the calling script data
Change-Id: Iae8b5697d4ad73d7934ee50879859394c66c80da
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 2d3d97a..54df40d 100644 --- a/src/3rdparty/v8/src/api.cc +++ b/src/3rdparty/v8/src/api.cc @@ -4370,6 +4370,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()")) { |