Don't allow Web surfaces created by non-client scripts to access files
Showing the changes to interface/src/Application.cpp (1 of 26 files). Show all
Unified · Split
| @@ -6619,11 +6619,12 @@ void Application::registerScriptEngineWithApplicationServices(ScriptEnginePointe · 6618 unmodified lines | ||
| 6619 | 6619 | scriptEngine->registerGetterSetter("location", LocationScriptingInterface::locationGetter, |
| 6620 | 6620 | LocationScriptingInterface::locationSetter); |
| 6621 | 6621 | |
| 6622 | + bool clientScript = scriptEngine->isClientScript(); | |
| 6623 | + scriptEngine->registerFunction("OverlayWindow", clientScript ? QmlWindowClass::constructor : QmlWindowClass::restricted_constructor); | |
| 6622 | 6624 | #if !defined(Q_OS_ANDROID) |
| 6623 | − scriptEngine->registerFunction("OverlayWebWindow", QmlWebWindowClass::constructor); | |
| 6625 | + scriptEngine->registerFunction("OverlayWebWindow", clientScript ? QmlWebWindowClass::constructor : QmlWebWindowClass::restricted_constructor); | |
| 6624 | 6626 | #endif |
| 6625 | − scriptEngine->registerFunction("OverlayWindow", QmlWindowClass::constructor); | |
| 6626 | − scriptEngine->registerFunction("QmlFragment", QmlFragmentClass::constructor); | |
| 6627 | + scriptEngine->registerFunction("QmlFragment", clientScript ? QmlFragmentClass::constructor : QmlFragmentClass::restricted_constructor); | |
| 6627 | 6628 | |
| 6628 | 6629 | scriptEngine->registerGlobalObject("Menu", MenuScriptingInterface::getInstance()); |
| 6629 | 6630 | scriptEngine->registerGlobalObject("DesktopPreviewProvider", DependencyManager::get<DesktopPreviewProvider>().data()); |