Showing the changes to libraries/script-engine/src/ScriptPermissions.cpp (1 of 3 files). Show all
Unified · Split
| @@ -46,8 +46,12 @@ bool ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission per · 45 unmodified lines | |||
| 46 | // Get the script manager: | 46 | // Get the script manager: |
| 47 | auto engine = Scriptable::engine(); | 47 | auto engine = Scriptable::engine(); |
| 48 | if (!engine) { | 48 | if (!engine) { |
| 49 | qDebug() << "ScriptPermissions::isCurrentScriptAllowed called outside script engine for permission: " << scriptPermissionNames[permissionIndex]; | 49 | // When this happens it means that function was called from QML or C++ and should always be allowed |
| 50 | return false; | 50 | if (PERMISSIONS_DEBUG_ENABLED) { |
| 51 | qDebug() << "ScriptPermissions::isCurrentScriptAllowed called outside script engine for permission: " | ||
| 52 | << scriptPermissionNames[permissionIndex]; | ||
| 53 | } | ||
| 54 | return true; | ||
| 51 | } | 55 | } |
| 52 | auto manager = engine->manager(); | 56 | auto manager = engine->manager(); |
| 53 | if (!manager) { | 57 | if (!manager) { |
| @@ -76,7 +80,7 @@ bool ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission per · 22 unmodified lines | |||
| 76 | } | 80 | } |
| 77 | // Check if the script is allowed: | 81 | // Check if the script is allowed: |
| 78 | QList<QString> safeURLPrefixes = { "file:///", "qrc:/", NetworkingConstants::OVERTE_COMMUNITY_APPLICATIONS, | 82 | QList<QString> safeURLPrefixes = { "file:///", "qrc:/", NetworkingConstants::OVERTE_COMMUNITY_APPLICATIONS, |
| 79 | NetworkingConstants::OVERTE_TUTORIAL_SCRIPTS/*, "about:console"*/}; | 83 | NetworkingConstants::OVERTE_TUTORIAL_SCRIPTS, "about:console"}; |
| 80 | Setting::Handle<QString> allowedURLsSetting(scriptPermissionSettingKeyNames[permissionIndex]); | 84 | Setting::Handle<QString> allowedURLsSetting(scriptPermissionSettingKeyNames[permissionIndex]); |
| 81 | QList<QString> allowedURLs = allowedURLsSetting.get().split("\n"); | 85 | QList<QString> allowedURLs = allowedURLsSetting.get().split("\n"); |
| 82 | 86 | ||