From 2af94c589856bb8ecdea4943c848fac6d019c6d8 Mon Sep 17 00:00:00 2001 From: elexis Date: Sun, 5 Aug 2018 15:18:00 +0000 Subject: [PATCH] Remove disabled remains of the performance data (= profiler data + text input) upload feature from the UserReporter from 0da7e822ff. User-submitted text upload was removed in 2779512c6e in preference of the bugtracker. Remove leftover mainmenu.js function that this commit should have removed. Profiler data upload was disabled in b9e46f386b because the data amount was too large and because the two timing snapshots are inconclusive without further data. The hereby removed exposed JS functions could have been exploited by JS mods to upload 0ad userdata to arbitrary places. The performance data upload feature can be redesigned, implemented without JS exposure, with a more transparent privacy policy (refs #5257). Differential Revision: https://code.wildfiregames.com/D1597 Performance upload feature removal accepted by: Vladislav This was SVN commit r21858. --- .../mods/public/gui/manual/userreport.txt | 1 - .../data/mods/public/gui/pregame/mainmenu.js | 8 ------- .../data/mods/public/gui/session/session.js | 22 ------------------- source/ps/ProfileViewer.cpp | 17 +------------- source/ps/ProfileViewer.h | 8 +------ source/ps/scripting/JSInterface_Debug.cpp | 12 ---------- source/ps/scripting/JSInterface_Debug.h | 2 -- 7 files changed, 2 insertions(+), 68 deletions(-) diff --git a/binaries/data/mods/public/gui/manual/userreport.txt b/binaries/data/mods/public/gui/manual/userreport.txt index ec56a3d77f..eb7264dc85 100644 --- a/binaries/data/mods/public/gui/manual/userreport.txt +++ b/binaries/data/mods/public/gui/manual/userreport.txt @@ -5,7 +5,6 @@ The following data will be sent to our server: • A random user ID (stored in %APPDATA%\\0ad\\config\\user.cfg on Windows, ~/.config/0ad/config/user.cfg on Unix), to let us detect repeated reports from the same user. • Game version number and basic build settings (optimisation mode, CPU architecture, timestamp, compiler version). • Hardware details: OS version, graphics driver version, OpenGL capabilities, screen size, CPU details, RAM size. -• Performance details: a snapshot of timing data a few seconds after you start a match or change graphics settings. The data will only be a few kilobytes each time you run the game, so bandwidth usage is minimal. diff --git a/binaries/data/mods/public/gui/pregame/mainmenu.js b/binaries/data/mods/public/gui/pregame/mainmenu.js index 452d610693..84cbb80f00 100644 --- a/binaries/data/mods/public/gui/pregame/mainmenu.js +++ b/binaries/data/mods/public/gui/pregame/mainmenu.js @@ -79,14 +79,6 @@ function scrollBackgrounds() } } -function submitUserReportMessage() -{ - let input = Engine.GetGUIObjectByName("userReportMessageInput"); - if (input.caption.length) - Engine.SubmitUserReport("message", 1, input.caption); - input.caption = ""; -} - function formatUserReportStatus(status) { let d = status.split(/:/, 3); diff --git a/binaries/data/mods/public/gui/session/session.js b/binaries/data/mods/public/gui/session/session.js index 240b083f0a..3054b73df7 100644 --- a/binaries/data/mods/public/gui/session/session.js +++ b/binaries/data/mods/public/gui/session/session.js @@ -287,16 +287,6 @@ function init(initData, hotloadData) sendLobbyPlayerlistUpdate(); onSimulationUpdate(); setTimeout(displayGamestateNotifications, 1000); - - // Report the performance after 5 seconds (when we're still near - // the initial camera view) and a minute (when the profiler will - // have settled down if framerates as very low), to give some - // extremely rough indications of performance - // - // DISABLED: this information isn't currently useful for anything much, - // and it generates a massive amount of data to transmit and store - // setTimeout(function() { reportPerformance(5); }, 5000); - // setTimeout(function() { reportPerformance(60); }, 60000); } function initGUIObjects() @@ -713,18 +703,6 @@ function updateTopPanel() Engine.GetGUIObjectByName("lobbyButton").enabled = Engine.HasXmppClient(); } -function reportPerformance(time) -{ - let settings = g_GameAttributes.settings; - Engine.SubmitUserReport("profile", 3, JSON.stringify({ - "time": time, - "map": settings.Name, - "seed": settings.Seed, // only defined for random maps - "size": settings.Size, // only defined for random maps - "profiler": Engine.GetProfilerState() - })); -} - /** * Resign a player. * @param leaveGameAfterResign If player is quitting after resignation. diff --git a/source/ps/ProfileViewer.cpp b/source/ps/ProfileViewer.cpp index 24e0088708..e28b3c50bb 100644 --- a/source/ps/ProfileViewer.cpp +++ b/source/ps/ProfileViewer.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2018 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -600,21 +600,6 @@ void CProfileViewer::SaveToFile() m->outputStream.flush(); } -JS::Value CProfileViewer::SaveToJS(const ScriptInterface& scriptInterface) -{ - JSContext* cx = scriptInterface.GetContext(); - JSAutoRequest rq(cx); - - JS::RootedValue root(cx); - scriptInterface.Eval("({})", &root); - - std::vector tables = m->rootTables; - sort(tables.begin(), tables.end(), SortByName); - for_each(tables.begin(), tables.end(), DumpTable(scriptInterface, root)); - - return root; -} - void CProfileViewer::ShowTable(const CStr& table) { m->path.clear(); diff --git a/source/ps/ProfileViewer.h b/source/ps/ProfileViewer.h index f64d2c0ace..c152d9abe8 100644 --- a/source/ps/ProfileViewer.h +++ b/source/ps/ProfileViewer.h @@ -1,4 +1,4 @@ -/* Copyright (C) 2017 Wildfire Games. +/* Copyright (C) 2018 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -187,12 +187,6 @@ public: */ void SaveToFile(); - /** - * SaveToJS: Return a script value containing the current profiler data - * (for all profile tables). - */ - JS::Value SaveToJS(const ScriptInterface& scriptInterface); - /** * ShowTable: Set the named profile table to be the displayed one. If it * is not found, no profile is displayed. diff --git a/source/ps/scripting/JSInterface_Debug.cpp b/source/ps/scripting/JSInterface_Debug.cpp index c222d7c007..ec25ce3d3e 100644 --- a/source/ps/scripting/JSInterface_Debug.cpp +++ b/source/ps/scripting/JSInterface_Debug.cpp @@ -55,11 +55,6 @@ void JSI_Debug::DisplayErrorDialog(ScriptInterface::CxPrivate* UNUSED(pCxPrivate debug_DisplayError(msg.c_str(), DE_NO_DEBUG_INFO, NULL, NULL, NULL, 0, NULL, NULL); } -JS::Value JSI_Debug::GetProfilerState(ScriptInterface::CxPrivate* pCxPrivate) -{ - return g_ProfileViewer.SaveToJS(*(pCxPrivate->pScriptInterface)); -} - // Return the date/time at which the current executable was compiled. // params: mode OR an integer specifying // what to display: -1 for "date time (svn revision)", 0 for date, 1 for time, 2 for svn revision @@ -137,23 +132,16 @@ std::string JSI_Debug::GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pC return g_UserReporter.GetStatus(); } -void JSI_Debug::SubmitUserReport(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& type, int version, const std::wstring& data) -{ - g_UserReporter.SubmitReport(type.c_str(), version, utf8_from_wstring(data)); -} - void JSI_Debug::RegisterScriptFunctions(const ScriptInterface& scriptInterface) { scriptInterface.RegisterFunction("GetMicroseconds"); scriptInterface.RegisterFunction("Crash"); scriptInterface.RegisterFunction("DebugWarn"); scriptInterface.RegisterFunction("DisplayErrorDialog"); - scriptInterface.RegisterFunction("GetProfilerState"); scriptInterface.RegisterFunction("GetBuildTimestamp"); // User report functions scriptInterface.RegisterFunction("IsUserReportEnabled"); scriptInterface.RegisterFunction("SetUserReportEnabled"); scriptInterface.RegisterFunction("GetUserReportStatus"); - scriptInterface.RegisterFunction("SubmitUserReport"); } diff --git a/source/ps/scripting/JSInterface_Debug.h b/source/ps/scripting/JSInterface_Debug.h index 463b85badf..fdc504ea73 100644 --- a/source/ps/scripting/JSInterface_Debug.h +++ b/source/ps/scripting/JSInterface_Debug.h @@ -25,11 +25,9 @@ namespace JSI_Debug int Crash(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)); void DebugWarn(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)); void DisplayErrorDialog(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::wstring& msg); - JS::Value GetProfilerState(ScriptInterface::CxPrivate* pCxPrivate); bool IsUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)); void SetUserReportEnabled(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), bool enabled); std::string GetUserReportStatus(ScriptInterface::CxPrivate* UNUSED(pCxPrivate)); - void SubmitUserReport(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), const std::string& type, int version, const std::wstring& data); std::wstring GetBuildTimestamp(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), int mode); double GetMicroseconds(ScriptInterface::CxPrivate* UNUSED(pCxPrivate));