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 | 46 | // Get the script manager: |
| 47 | 47 | auto engine = Scriptable::engine(); |
| 48 | 48 | if (!engine) { |
| 49 | − qDebug() << "ScriptPermissions::isCurrentScriptAllowed called outside script engine for permission: " << scriptPermissionNames[permissionIndex]; | |
| 50 | − return false; | |
| 49 | + // When this happens it means that function was called from QML or C++ and should always be allowed | |
| 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 | 56 | auto manager = engine->manager(); |
| 53 | 57 | if (!manager) { |
| @@ -76,7 +80,7 @@ bool ScriptPermissions::isCurrentScriptAllowed(ScriptPermissions::Permission per · 22 unmodified lines | ||
| 76 | 80 | } |
| 77 | 81 | // Check if the script is allowed: |
| 78 | 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 | 84 | Setting::Handle<QString> allowedURLsSetting(scriptPermissionSettingKeyNames[permissionIndex]); |
| 81 | 85 | QList<QString> allowedURLs = allowedURLsSetting.get().split("\n"); |
| 82 | 86 | |