summaryrefslogtreecommitdiffstats
path: root/misc
diff options
context:
space:
mode:
Diffstat (limited to 'misc')
-rw-r--r--misc/dist/html/full-size.html25
-rw-r--r--misc/dist/html/service-worker.js172
-rw-r--r--misc/extension_api_validation/4.2-stable.expected47
-rwxr-xr-xmisc/hooks/pre-commit-clang-format3
-rwxr-xr-xmisc/scripts/black_format.sh2
-rwxr-xr-xmisc/scripts/clang_format.sh2
-rwxr-xr-xmisc/scripts/clang_tidy.sh2
-rwxr-xr-xmisc/scripts/codespell.sh2
-rwxr-xr-xmisc/scripts/dotnet_format.sh2
-rwxr-xr-xmisc/scripts/file_format.sh2
-rwxr-xr-xmisc/scripts/header_guards.sh2
11 files changed, 197 insertions, 64 deletions
diff --git a/misc/dist/html/full-size.html b/misc/dist/html/full-size.html
index 54571e27c7..8ae25362f8 100644
--- a/misc/dist/html/full-size.html
+++ b/misc/dist/html/full-size.html
@@ -218,8 +218,29 @@ const engine = new Engine(GODOT_CONFIG);
threads: GODOT_THREADS_ENABLED,
});
if (missing.length !== 0) {
- const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n';
- displayFailureNotice(missingMsg + missing.join('\n'));
+ if (GODOT_CONFIG['serviceWorker'] && GODOT_CONFIG['ensureCrossOriginIsolationHeaders'] && 'serviceWorker' in navigator) {
+ // There's a chance that installing the service worker would fix the issue
+ Promise.race([
+ navigator.serviceWorker.getRegistration().then((registration) => {
+ if (registration != null) {
+ return Promise.reject(new Error('Service worker already exists.'));
+ }
+ return registration;
+ }).then(() => engine.installServiceWorker()),
+ // For some reason, `getRegistration()` can stall
+ new Promise((resolve) => {
+ setTimeout(() => resolve(), 2000);
+ }),
+ ]).catch((err) => {
+ console.error('Error while registering service worker:', err);
+ }).then(() => {
+ window.location.reload();
+ });
+ } else {
+ // Display the message as usual
+ const missingMsg = 'Error\nThe following features required to run Godot projects on the Web are missing:\n';
+ displayFailureNotice(missingMsg + missing.join('\n'));
+ }
} else {
setStatusMode('indeterminate');
engine.startGame({
diff --git a/misc/dist/html/service-worker.js b/misc/dist/html/service-worker.js
index 70e7a399e1..a5da7482f4 100644
--- a/misc/dist/html/service-worker.js
+++ b/misc/dist/html/service-worker.js
@@ -3,101 +3,163 @@
// that they need an Internet connection to run the project if desired.
// Incrementing CACHE_VERSION will kick off the install event and force
// previously cached resources to be updated from the network.
-const CACHE_VERSION = "___GODOT_VERSION___";
-const CACHE_PREFIX = "___GODOT_NAME___-sw-cache-";
+/** @type {string} */
+const CACHE_VERSION = '___GODOT_VERSION___';
+/** @type {string} */
+const CACHE_PREFIX = '___GODOT_NAME___-sw-cache-';
const CACHE_NAME = CACHE_PREFIX + CACHE_VERSION;
-const OFFLINE_URL = "___GODOT_OFFLINE_PAGE___";
+/** @type {string} */
+const OFFLINE_URL = '___GODOT_OFFLINE_PAGE___';
+/** @type {boolean} */
+const ENSURE_CROSSORIGIN_ISOLATION_HEADERS = ___GODOT_ENSURE_CROSSORIGIN_ISOLATION_HEADERS___;
// Files that will be cached on load.
+/** @type {string[]} */
const CACHED_FILES = ___GODOT_CACHE___;
// Files that we might not want the user to preload, and will only be cached on first load.
+/** @type {string[]} */
const CACHABLE_FILES = ___GODOT_OPT_CACHE___;
const FULL_CACHE = CACHED_FILES.concat(CACHABLE_FILES);
-self.addEventListener("install", (event) => {
- event.waitUntil(caches.open(CACHE_NAME).then(cache => cache.addAll(CACHED_FILES)));
+self.addEventListener('install', (event) => {
+ event.waitUntil(caches.open(CACHE_NAME).then((cache) => cache.addAll(CACHED_FILES)));
});
-self.addEventListener("activate", (event) => {
+self.addEventListener('activate', (event) => {
event.waitUntil(caches.keys().then(
function (keys) {
// Remove old caches.
- return Promise.all(keys.filter(key => key.startsWith(CACHE_PREFIX) && key != CACHE_NAME).map(key => caches.delete(key)));
- }).then(function () {
- // Enable navigation preload if available.
- return ("navigationPreload" in self.registration) ? self.registration.navigationPreload.enable() : Promise.resolve();
- })
- );
+ return Promise.all(keys.filter((key) => key.startsWith(CACHE_PREFIX) && key !== CACHE_NAME).map((key) => caches.delete(key)));
+ }
+ ).then(function () {
+ // Enable navigation preload if available.
+ return ('navigationPreload' in self.registration) ? self.registration.navigationPreload.enable() : Promise.resolve();
+ }));
});
-async function fetchAndCache(event, cache, isCachable) {
+/**
+ * Ensures that the response has the correct COEP/COOP headers
+ * @param {Response} response
+ * @returns {Response}
+ */
+function ensureCrossOriginIsolationHeaders(response) {
+ if (response.headers.get('Cross-Origin-Embedder-Policy') === 'require-corp'
+ && response.headers.get('Cross-Origin-Opener-Policy') === 'same-origin') {
+ return response;
+ }
+
+ const crossOriginIsolatedHeaders = new Headers(response.headers);
+ crossOriginIsolatedHeaders.set('Cross-Origin-Embedder-Policy', 'require-corp');
+ crossOriginIsolatedHeaders.set('Cross-Origin-Opener-Policy', 'same-origin');
+ const newResponse = new Response(response.body, {
+ status: response.status,
+ statusText: response.statusText,
+ headers: crossOriginIsolatedHeaders,
+ });
+
+ return newResponse;
+}
+
+/**
+ * Calls fetch and cache the result if it is cacheable
+ * @param {FetchEvent} event
+ * @param {Cache} cache
+ * @param {boolean} isCacheable
+ * @returns {Response}
+ */
+async function fetchAndCache(event, cache, isCacheable) {
// Use the preloaded response, if it's there
+ /** @type { Response } */
let response = await event.preloadResponse;
- if (!response) {
+ if (response == null) {
// Or, go over network.
response = await self.fetch(event.request);
}
- if (isCachable) {
+
+ if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) {
+ response = ensureCrossOriginIsolationHeaders(response);
+ }
+
+ if (isCacheable) {
// And update the cache
cache.put(event.request, response.clone());
}
+
return response;
}
-self.addEventListener("fetch", (event) => {
- const isNavigate = event.request.mode === "navigate";
- const url = event.request.url || "";
- const referrer = event.request.referrer || "";
- const base = referrer.slice(0, referrer.lastIndexOf("/") + 1);
- const local = url.startsWith(base) ? url.replace(base, "") : "";
- const isCachable = FULL_CACHE.some(v => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0]));
- if (isNavigate || isCachable) {
- event.respondWith(async function () {
- // Try to use cache first
- const cache = await caches.open(CACHE_NAME);
- if (event.request.mode === "navigate") {
- // Check if we have full cache during HTML page request.
- const fullCache = await Promise.all(FULL_CACHE.map(name => cache.match(name)));
- const missing = fullCache.some(v => v === undefined);
- if (missing) {
- try {
- // Try network if some cached file is missing (so we can display offline page in case).
- return await fetchAndCache(event, cache, isCachable);
- } catch (e) {
- // And return the hopefully always cached offline page in case of network failure.
- console.error("Network error: ", e);
- return await caches.match(OFFLINE_URL);
+self.addEventListener(
+ 'fetch',
+ /**
+ * Triggered on fetch
+ * @param {FetchEvent} event
+ */
+ (event) => {
+ const isNavigate = event.request.mode === 'navigate';
+ const url = event.request.url || '';
+ const referrer = event.request.referrer || '';
+ const base = referrer.slice(0, referrer.lastIndexOf('/') + 1);
+ const local = url.startsWith(base) ? url.replace(base, '') : '';
+ const isCachable = FULL_CACHE.some((v) => v === local) || (base === referrer && base.endsWith(CACHED_FILES[0]));
+ if (isNavigate || isCachable) {
+ event.respondWith((async () => {
+ // Try to use cache first
+ const cache = await caches.open(CACHE_NAME);
+ if (isNavigate) {
+ // Check if we have full cache during HTML page request.
+ /** @type {Response[]} */
+ const fullCache = await Promise.all(FULL_CACHE.map((name) => cache.match(name)));
+ const missing = fullCache.some((v) => v === undefined);
+ if (missing) {
+ try {
+ // Try network if some cached file is missing (so we can display offline page in case).
+ const response = await fetchAndCache(event, cache, isCachable);
+ return response;
+ } catch (e) {
+ // And return the hopefully always cached offline page in case of network failure.
+ console.error('Network error: ', e); // eslint-disable-line no-console
+ return caches.match(OFFLINE_URL);
+ }
}
}
- }
- const cached = await cache.match(event.request);
- if (cached) {
- return cached;
- } else {
+ let cached = await cache.match(event.request);
+ if (cached != null) {
+ if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) {
+ cached = ensureCrossOriginIsolationHeaders(cached);
+ }
+ return cached;
+ }
// Try network if don't have it in cache.
- return await fetchAndCache(event, cache, isCachable);
- }
- }());
+ const response = await fetchAndCache(event, cache, isCachable);
+ return response;
+ })());
+ } else if (ENSURE_CROSSORIGIN_ISOLATION_HEADERS) {
+ event.respondWith((async () => {
+ let response = await fetch(event.request);
+ response = ensureCrossOriginIsolationHeaders(response);
+ return response;
+ })());
+ }
}
-});
+);
-self.addEventListener("message", (event) => {
+self.addEventListener('message', (event) => {
// No cross origin
- if (event.origin != self.origin) {
+ if (event.origin !== self.origin) {
return;
}
- const id = event.source.id || "";
- const msg = event.data || "";
+ const id = event.source.id || '';
+ const msg = event.data || '';
// Ensure it's one of our clients.
self.clients.get(id).then(function (client) {
if (!client) {
return; // Not a valid client.
}
- if (msg === "claim") {
+ if (msg === 'claim') {
self.skipWaiting().then(() => self.clients.claim());
- } else if (msg === "clear") {
+ } else if (msg === 'clear') {
caches.delete(CACHE_NAME);
- } else if (msg === "update") {
- self.skipWaiting().then(() => self.clients.claim()).then(() => self.clients.matchAll()).then(all => all.forEach(c => c.navigate(c.url)));
+ } else if (msg === 'update') {
+ self.skipWaiting().then(() => self.clients.claim()).then(() => self.clients.matchAll()).then((all) => all.forEach((c) => c.navigate(c.url)));
} else {
onClientMessage(event);
}
diff --git a/misc/extension_api_validation/4.2-stable.expected b/misc/extension_api_validation/4.2-stable.expected
index f6e3661c7b..a9390487ef 100644
--- a/misc/extension_api_validation/4.2-stable.expected
+++ b/misc/extension_api_validation/4.2-stable.expected
@@ -73,3 +73,50 @@ GH-87668
Validate extension JSON: Error: Field 'classes/Font/methods/find_variation/arguments': size changed value in new API, from 8 to 9.
Added optional "baseline_offset" argument. Compatibility method registered.
+
+
+GH-81996
+--------
+Validate extension JSON: Error: Field 'classes/GPUParticles2D/properties/process_material': type changed value in new API, from "ShaderMaterial,ParticleProcessMaterial" to "ParticleProcessMaterial,ShaderMaterial".
+Validate extension JSON: Error: Field 'classes/GPUParticles3D/properties/process_material': type changed value in new API, from "ShaderMaterial,ParticleProcessMaterial" to "ParticleProcessMaterial,ShaderMaterial".
+Validate extension JSON: Error: Field 'classes/Sky/properties/sky_material': type changed value in new API, from "ShaderMaterial,PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial" to "PanoramaSkyMaterial,ProceduralSkyMaterial,PhysicalSkyMaterial,ShaderMaterial".
+
+Property hints reordered to improve editor usability. The types allowed are still the same as before. No adjustments should be necessary.
+
+
+GH-68420
+--------
+Validate extension JSON: Error: Field 'classes/Node/methods/_get_configuration_warnings/return_value': type changed value in new API, from "PackedStringArray" to "Array".
+
+Allow configuration warnings to refer to a property. Compatibility method registered.
+
+
+GH-86907
+--------
+
+Validate extension JSON: Error: Field 'classes/AudioStreamPlayer/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/AudioStreamPlayer2D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/AudioStreamPlayer3D/methods/is_autoplay_enabled': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_buffer': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_length': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_offset': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_byte_stride': is_const changed value in new API, from false to true.
+Validate extension JSON: Error: Field 'classes/GLTFBufferView/methods/get_indices': is_const changed value in new API, from false to true.
+
+Change AudioStreamPlayer* is_autoplay_enabled and GLTFBufferView getters to be const.
+
+
+GH-87379
+--------
+Validate extension JSON: API was removed: classes/TileMap/methods/get_tileset
+Validate extension JSON: API was removed: classes/TileMap/methods/set_tileset
+Validate extension JSON: API was removed: classes/TileMap/properties/tile_set
+
+Moved to the parent TileMapLayerGroup class. No change should be necessary.
+
+
+GH-87340
+--------
+Validate extension JSON: JSON file: Field was added in a way that breaks compatibility 'classes/RenderingDevice/methods/screen_get_framebuffer_format': arguments
+
+screen_get_framebuffer_format can now specify the screen it should get the format from. The argument defaults to the main window to emulate the behavior of the old function.
diff --git a/misc/hooks/pre-commit-clang-format b/misc/hooks/pre-commit-clang-format
index e5cf0c4aa2..eddbc59364 100755
--- a/misc/hooks/pre-commit-clang-format
+++ b/misc/hooks/pre-commit-clang-format
@@ -140,6 +140,9 @@ do
if grep -q "\-so_wrap." <<< $file; then
continue;
fi
+ if grep -q "tests/python_build" <<< $file; then
+ continue;
+ fi
# ignore file if we do check for file extensions and the file
# does not match any of the extensions specified in $FILE_EXTS
diff --git a/misc/scripts/black_format.sh b/misc/scripts/black_format.sh
index 3a64284eb6..48dc14c734 100755
--- a/misc/scripts/black_format.sh
+++ b/misc/scripts/black_format.sh
@@ -20,7 +20,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1
diff --git a/misc/scripts/clang_format.sh b/misc/scripts/clang_format.sh
index 40d94d4276..8b59519606 100755
--- a/misc/scripts/clang_format.sh
+++ b/misc/scripts/clang_format.sh
@@ -47,7 +47,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1
diff --git a/misc/scripts/clang_tidy.sh b/misc/scripts/clang_tidy.sh
index c4811b903c..0c6998b491 100755
--- a/misc/scripts/clang_tidy.sh
+++ b/misc/scripts/clang_tidy.sh
@@ -27,7 +27,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1
diff --git a/misc/scripts/codespell.sh b/misc/scripts/codespell.sh
index 2de440679f..7dad25fa23 100755
--- a/misc/scripts/codespell.sh
+++ b/misc/scripts/codespell.sh
@@ -3,6 +3,6 @@ SKIP_LIST="./.*,./**/.*,./bin,./thirdparty,*.desktop,*.gen.*,*.po,*.pot,*.rc,./A
SKIP_LIST+="./core/input/gamecontrollerdb.txt,./core/string/locales.h,./editor/renames_map_3_to_4.cpp,./misc/scripts/codespell.sh,"
SKIP_LIST+="./platform/android/java/lib/src/com,./platform/web/node_modules,./platform/web/package-lock.json,"
-IGNORE_LIST="breaked,curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,mis,nd,numer,ot,requestor,te,vai"
+IGNORE_LIST="breaked,cancelled,curvelinear,doubleclick,expct,findn,gird,hel,inout,lod,mis,nd,numer,ot,requestor,te,vai"
codespell -w -q 3 -S "${SKIP_LIST}" -L "${IGNORE_LIST}" --builtin "clear,rare,en-GB_to_en-US"
diff --git a/misc/scripts/dotnet_format.sh b/misc/scripts/dotnet_format.sh
index cac00f5cb1..e2b4ba5e43 100755
--- a/misc/scripts/dotnet_format.sh
+++ b/misc/scripts/dotnet_format.sh
@@ -31,7 +31,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1
diff --git a/misc/scripts/file_format.sh b/misc/scripts/file_format.sh
index 94a3affbd7..ad58657883 100755
--- a/misc/scripts/file_format.sh
+++ b/misc/scripts/file_format.sh
@@ -82,7 +82,7 @@ then
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
- printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+ printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
fi
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
diff --git a/misc/scripts/header_guards.sh b/misc/scripts/header_guards.sh
index ce0b3f334d..a79ccd4bee 100755
--- a/misc/scripts/header_guards.sh
+++ b/misc/scripts/header_guards.sh
@@ -81,7 +81,7 @@ fi
# A diff has been created, notify the user, clean up, and exit.
printf "\n\e[1;33m*** The following changes must be made to comply with the formatting rules:\e[0m\n\n"
# Perl commands replace trailing spaces with `·` and tabs with `<TAB>`.
-printf "$diff\n" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
+printf "%s\n" "$diff" | perl -pe 's/(.*[^ ])( +)(\e\[m)$/my $spaces="·" x length($2); sprintf("$1$spaces$3")/ge' | perl -pe 's/(.*[^\t])(\t+)(\e\[m)$/my $tabs="<TAB>" x length($2); sprintf("$1$tabs$3")/ge'
printf "\n\e[1;91m*** Please fix your commit(s) with 'git commit --amend' or 'git rebase -i <hash>'\e[0m\n"
exit 1