qt5base-lts/src/v8/0006-Allow-access-to-the-calling-script-data.patch
Kent Hansen 9830cb8e59 Add QtV8 library to QtBase
This adds Aaron's copy of V8 to src/3rdparty/v8 (as a
git submodule), and builds it as a "normal" Qt library
(without any dependencies on Qt itself).

The library can be added to a project with

QT += v8-private

V8 API headers are available as private includes, e.g.

 #include <private/v8.h>

The API is private because we're exposing a third-party
API directly, and we don't want to (and cannot) make
source or binary compatibility guarantees for it.

Since we want the V8 public API headers to be private
headers in Qt, syncqt and sync.profile were extended to
understand a new configuration option, the
@allmoduleheadersprivate array, that tells syncqt whether
all the library headers should be treated as private even
though they don't follow the _p.h Qt convention.

The V8 project files, patches and autotests are copied
from the QtDeclarative repository. The next step after
this commit is to remove QtDeclarative's copy of V8 and
link with QtV8 instead.

Task-number: QTBUG-20963
Change-Id: Ib8820362cdbc8fa662a5e97db841656cf38d1b62
Reviewed-on: http://codereview.qt.nokia.com/3092
Reviewed-by: Kent Hansen <kent.hansen@nokia.com>
Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
2011-08-29 10:16:01 +02:00

49 lines
1.5 KiB
Diff

From f890f0d1a1e5bd62711815489c87755a4f382436 Mon Sep 17 00:00:00 2001
From: Aaron Kennedy <aaron.kennedy@nokia.com>
Date: Wed, 25 May 2011 10:36:13 +1000
Subject: [PATCH 06/13] Allow access to the calling script data
---
include/v8.h | 1 +
src/api.cc | 12 ++++++++++++
2 files changed, 13 insertions(+), 0 deletions(-)
diff --git a/include/v8.h b/include/v8.h
index a858eae..9aba4a8 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -3336,6 +3336,7 @@ class V8EXPORT Context {
*/
static Local<Context> GetCalling();
static Local<Object> GetCallingQmlGlobal();
+ static Local<Value> GetCallingScriptData();
/**
* Sets the security token for the context. To access an object in
diff --git a/src/api.cc b/src/api.cc
index 39767f4..ff74efb 100644
--- a/src/api.cc
+++ b/src/api.cc
@@ -3976,6 +3976,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()")) {
--
1.7.2.3