Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TheOneric] Enable strict mode in js #46

Draft
wants to merge 5 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM docker.io/emscripten/emsdk:2.0.34
FROM docker.io/emscripten/emsdk:3.1.24

RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
Expand Down
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
BASE_DIR:=$(dir $(realpath $(firstword $(MAKEFILE_LIST))))
DIST_DIR:=$(BASE_DIR)dist/libraries

export LDFLAGS = -O3 -s EVAL_CTORS=1 -flto -s ENVIRONMENT=web,webview,worker -s NO_EXIT_RUNTIME=1
export LDFLAGS = -O3 -flto -s ENVIRONMENT=web,webview,worker -s NO_EXIT_RUNTIME=1 -s STRICT_JS=1
export CFLAGS = -O3 -flto -s USE_PTHREADS=0
export CXXFLAGS = $(CFLAGS)
export PKG_CONFIG_PATH = $(DIST_DIR)/lib/pkgconfig
Expand Down Expand Up @@ -175,6 +175,7 @@ dist/js/subtitles-octopus-worker.js: src/subtitles-octopus-worker.bc src/pre-wor
--post-js src/SubOctpInterface.js \
--post-js src/post-worker.js \
-s WASM=1 \
-s EVAL_CTORS=1 \
$(EMCC_COMMON_ARGS)

dist/js/subtitles-octopus-worker-legacy.js: src/subtitles-octopus-worker.bc src/polyfill.js src/pre-worker.js src/SubOctpInterface.js src/post-worker.js build/lib/brotli/js/decode.js build/lib/brotli/js/polyfill.js
Expand All @@ -190,6 +191,7 @@ dist/js/subtitles-octopus-worker-legacy.js: src/subtitles-octopus-worker.bc src/
-s LEGACY_VM_SUPPORT=1 \
-s MIN_CHROME_VERSION=27 \
-s MIN_SAFARI_VERSION=60005 \
--closure=0 \
$(EMCC_COMMON_ARGS)

dist/js/subtitles-octopus.js: dist/license/all src/subtitles-octopus.js
Expand Down
7 changes: 7 additions & 0 deletions src/pre-worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ function isBrotliFile(url) {
Module = Module || {};

Module["preRun"] = Module["preRun"] || [];
Module["postRun"] = Module["postRun"] || [];

Module["preRun"].push(function () {
Module["FS_createPath"]("/", "fonts", true, true);
Expand Down Expand Up @@ -103,6 +104,12 @@ Module["preRun"].push(function () {
}
});

var calledMain = false;

Module["postRun"].push(function () {
calledMain = true;
});

Module['onRuntimeInitialized'] = function () {
self.octObj = new Module.SubtitleOctopus();

Expand Down
1 change: 1 addition & 0 deletions src/subtitles-octopus.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
"use strict";
// minimum time difference between frames
var FRAMETIME_ULP = 0.001;
// minimum time difference between subtitle events
Expand Down