From c8f02d664b86e68fdafd69e53cc87ed2ede413f1 Mon Sep 17 00:00:00 2001 From: Oneric Date: Thu, 16 Jun 2022 23:29:18 +0200 Subject: [PATCH] Enable strict mode in js This will make some types of bugs easier to detect and avoid accidental additions of code not working inside Modules, which always use strict mode. Performance measurements show no relevant performance difference between strict and non-strict mode, so this won't cause regressions in this regard. --- Makefile | 2 +- src/subtitles-octopus.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 50c35805..cd656b40 100644 --- a/Makefile +++ b/Makefile @@ -4,7 +4,7 @@ BASE_DIR:=$(dir $(realpath $(firstword $(MAKEFILE_LIST)))) DIST_DIR:=$(BASE_DIR)dist/libraries -export LDFLAGS = -O3 -s ENVIRONMENT=web,webview,worker -s NO_EXIT_RUNTIME=1 +export LDFLAGS = -O3 -s ENVIRONMENT=web,webview,worker -s NO_EXIT_RUNTIME=1 -s STRICT_JS=1 export CFLAGS = -O3 -s USE_PTHREADS=0 export CXXFLAGS = $(CFLAGS) export PKG_CONFIG_PATH = $(DIST_DIR)/lib/pkgconfig diff --git a/src/subtitles-octopus.js b/src/subtitles-octopus.js index 20369317..fec6a44a 100644 --- a/src/subtitles-octopus.js +++ b/src/subtitles-octopus.js @@ -1,3 +1,4 @@ +"use strict"; var SubtitlesOctopus = function (options) { var supportsWebAssembly = false; try {