mirror of
https://github.com/overte-org/overte.git
synced 2025-08-08 17:39:26 +02:00
Merge pull request #444 from overte-org/fix/private_access_v8
Hide private methods and QObject signals from script engine
This commit is contained in:
commit
5d08f3483a
3 changed files with 11 additions and 5 deletions
|
@ -271,7 +271,7 @@ void ScriptObjectV8Proxy::investigate() {
|
||||||
QMetaMethod method = metaObject->method(idx);
|
QMetaMethod method = metaObject->method(idx);
|
||||||
|
|
||||||
// perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible
|
// perhaps keep this comment? Calls (like AudioScriptingInterface::playSound) seem to expect non-public methods to be script-accessible
|
||||||
/* if (method.access() != QMetaMethod::Public) continue;*/
|
if (method.access() == QMetaMethod::Private) continue;
|
||||||
|
|
||||||
bool isSignal = false;
|
bool isSignal = false;
|
||||||
QByteArray szName = method.name();
|
QByteArray szName = method.name();
|
||||||
|
@ -280,6 +280,12 @@ void ScriptObjectV8Proxy::investigate() {
|
||||||
case QMetaMethod::Constructor:
|
case QMetaMethod::Constructor:
|
||||||
continue;
|
continue;
|
||||||
case QMetaMethod::Signal:
|
case QMetaMethod::Signal:
|
||||||
|
if (szName == "destroyed") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (szName == "objectNameChanged") {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
isSignal = true;
|
isSignal = true;
|
||||||
break;
|
break;
|
||||||
case QMetaMethod::Slot:
|
case QMetaMethod::Slot:
|
||||||
|
@ -389,6 +395,7 @@ ScriptObjectV8Proxy::QueryFlags ScriptObjectV8Proxy::queryProperty(const V8Scrip
|
||||||
v8::Local<v8::Context> context = _engine->getContext();
|
v8::Local<v8::Context> context = _engine->getContext();
|
||||||
v8::Context::Scope contextScope(context);
|
v8::Context::Scope contextScope(context);
|
||||||
QString nameStr(*v8::String::Utf8Value(isolate, name.constGet()));
|
QString nameStr(*v8::String::Utf8Value(isolate, name.constGet()));
|
||||||
|
// V8TODO: registering methods on V8 side would make API calls a lot faster
|
||||||
|
|
||||||
// check for methods
|
// check for methods
|
||||||
MethodNameMap::const_iterator method = _methodNameMap.find(nameStr);
|
MethodNameMap::const_iterator method = _methodNameMap.find(nameStr);
|
||||||
|
|
|
@ -39,8 +39,8 @@ var DEFAULT_SCRIPTS_COMBINED = [
|
||||||
"system/onEscape.js",
|
"system/onEscape.js",
|
||||||
"system/onFirstRun.js",
|
"system/onFirstRun.js",
|
||||||
"system/appreciate/appreciate_app.js",
|
"system/appreciate/appreciate_app.js",
|
||||||
"system/places/places.js",
|
"system/places/places.js"
|
||||||
"developer/debugging/scriptMemoryReport.js"
|
//"developer/debugging/scriptMemoryReport.js"
|
||||||
];
|
];
|
||||||
var DEFAULT_SCRIPTS_SEPARATE = [
|
var DEFAULT_SCRIPTS_SEPARATE = [
|
||||||
"system/controllers/controllerScripts.js",
|
"system/controllers/controllerScripts.js",
|
||||||
|
|
|
@ -41,8 +41,7 @@ var CONTOLLER_SCRIPTS = [
|
||||||
"controllerModules/trackedHandTablet.js"
|
"controllerModules/trackedHandTablet.js"
|
||||||
];
|
];
|
||||||
|
|
||||||
Script.include("../../developer/debugging/scriptMemoryReport.js");
|
//Script.include("../../developer/debugging/scriptMemoryReport.js");
|
||||||
//Script.include("developer/debugging/scriptMemoryReport.js");
|
|
||||||
|
|
||||||
var DEBUG_MENU_ITEM = "Debug defaultScripts.js";
|
var DEBUG_MENU_ITEM = "Debug defaultScripts.js";
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue