Remove ScriptTypes and ScriptExtraHeaders headers

The first header was used to include the SpiderMonkey JS API at once,
with safeguards and preprocessor defines. Nowadays, SpiderMonkey
provides modular headers allowing us to include what we use, refs #8086.

Some defines have to be moved to compiler options but it is apparently
a mistake from the SM developers:
https://bugzilla.mozilla.org/show_bug.cgi?id=1987876
This commit is contained in:
Itms
2025-09-10 12:18:16 +02:00
parent c4762e22cc
commit 9150c20818
43 changed files with 35 additions and 138 deletions
-1
View File
@@ -30,7 +30,6 @@
#include "scriptinterface/FunctionWrapper.h"
#include "scriptinterface/ScriptExceptions.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/ScriptTypes.h"
#include <js/Exception.h>
#include <js/JSON.h>
-1
View File
@@ -20,7 +20,6 @@
#include "lib/file/vfs/vfs_path.h"
#include "lib/path.h"
#include "scriptinterface/ScriptTypes.h"
#include <cstddef>
#include <exception>
+1 -1
View File
@@ -23,12 +23,12 @@
#include "ps/CLogger.h"
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/ScriptTypes.h"
#include <cwchar>
#include <js/Array.h>
#include <js/GCVector.h>
#include <js/Id.h>
#include <js/Object.h>
#include <js/PropertyAndElement.h>
#include <js/PropertyDescriptor.h>
#include <js/RootingAPI.h>
-1
View File
@@ -29,7 +29,6 @@
#include "scriptinterface/ModuleLoader.h"
#include "scriptinterface/Promises.h"
#include "scriptinterface/ScriptEngine.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include <js/Context.h>
#include <js/GCAPI.h>
-3
View File
@@ -18,9 +18,6 @@
#ifndef INCLUDED_SCRIPTCONTEXT
#define INCLUDED_SCRIPTCONTEXT
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptTypes.h"
#include <cstdint>
#include <list>
#include <memory>
@@ -23,7 +23,6 @@
#include "lib/path.h"
#include "ps/CStr.h"
#include "scriptinterface/ScriptExceptions.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptRequest.h"
#include <cstddef>
@@ -23,7 +23,6 @@
#include "lib/types.h"
#include "ps/CStr.h"
#include "scriptinterface/ScriptExceptions.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptRequest.h"
#include <js/Array.h>
+7 -1
View File
@@ -20,11 +20,17 @@
#include "lib/debug.h"
#include "ps/Singleton.h"
#include "scriptinterface/ScriptTypes.h"
#include <js/Initialization.h>
#include <list>
#if MOZJS_MAJOR_VERSION != 128
#error Your compiler is trying to use an incorrect major version of the \
SpiderMonkey library. The SpiderMonkey API is subject to changes, and the \
game will not build with the selected version of the library. Make sure \
you have got all the right files and include paths.
#endif
struct JSContext;
/**
@@ -1,48 +0,0 @@
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SCRIPTEXTRAHEADERS
#define INCLUDED_SCRIPTEXTRAHEADERS
// Includes occasionally-used SpiderMonkey headers for typed arrays and debug API,
// with appropriate tweaks to fix warnings and build errors. (Most code should
// just include ScriptTypes.h directly to get the standard jsapi.h.)
#include "scriptinterface/ScriptTypes.h"
#include "jsfriendapi.h"
#include "js/AllocPolicy.h"
#include "js/Array.h"
#include "js/ArrayBuffer.h"
#include "js/CompilationAndEvaluation.h"
#include "js/Conversions.h"
#include "js/ContextOptions.h"
#include "js/ForOfIterator.h"
#include "js/GCAPI.h"
#include "js/GCHashTable.h"
#include "js/SourceText.h"
#include "js/Proxy.h"
#include "js/Warnings.h"
#include "js/experimental/TypedData.h"
#include "js/friend/ErrorMessages.h"
#undef signbit
#endif // INCLUDED_SCRIPTEXTRAHEADERS
@@ -33,7 +33,6 @@
#include "scriptinterface/ModuleLoader.h"
#include "scriptinterface/Object.h"
#include "scriptinterface/ScriptContext.h"
#include "scriptinterface/ScriptExtraHeaders.h"
#include "scriptinterface/ScriptStats.h"
#include "scriptinterface/StructuredClone.h"
-1
View File
@@ -24,7 +24,6 @@
#include "scriptinterface/ScriptConversions.h"
#include "scriptinterface/ScriptExceptions.h"
#include "scriptinterface/ScriptRequest.h"
#include "scriptinterface/ScriptTypes.h"
#include <functional>
#include <js/CallArgs.h>
-44
View File
@@ -1,44 +0,0 @@
/* Copyright (C) 2025 Wildfire Games.
* This file is part of 0 A.D.
*
* 0 A.D. is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* 0 A.D. is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with 0 A.D. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef INCLUDED_SCRIPTTYPES
#define INCLUDED_SCRIPTTYPES
#ifdef DEBUG
#define MOZ_DIAGNOSTIC_ASSERT_ENABLED
#endif
#ifdef _WIN32
# define XP_WIN
# ifndef WIN32
# define WIN32 // SpiderMonkey expects this
# endif
#endif
#include "jspubtd.h"
#include "jsapi.h"
#if MOZJS_MAJOR_VERSION != 128
#error Your compiler is trying to use an incorrect major version of the \
SpiderMonkey library. The SpiderMonkey API is subject to changes, and the \
game will not build with the selected version of the library. Make sure \
you have got all the right files and include paths.
#endif
class ScriptInterface;
#endif // INCLUDED_SCRIPTTYPES