diff options
| author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2021-04-22 19:20:32 +0100 |
|---|---|---|
| committer | Simon Tatham <anakin@pobox.com> | 2021-04-22 21:22:48 +0100 |
| commit | 77866e1335bd1ea7189f11c19ff2947be17aa517 (patch) | |
| tree | 1f5d0dd32cc71e20d67c44033b23e38726af64d7 /html | |
| parent | 56ef86f92b77412bfe27d7206d25b323475e71fe (diff) | |
| download | puzzles-77866e1335bd1ea7189f11c19ff2947be17aa517.zip puzzles-77866e1335bd1ea7189f11c19ff2947be17aa517.tar.gz puzzles-77866e1335bd1ea7189f11c19ff2947be17aa517.tar.bz2 puzzles-77866e1335bd1ea7189f11c19ff2947be17aa517.tar.xz | |
wasm/js/emscripten: Fix page loading race
Using a stunt webserver which artificially introduces a 3s delay just
before the last line of the HTML output, I have reproduced a
uwer-reported loading/startup race bug:
Previously the wasm loading was started by the <script> element,
synchronously. If the wasm loading is fast, and finishes before the
HTML loading, the onRuntimeInitialized event may occur before
initPuzzles. But initPuzzles sets up the event handler.
Fix this bug, and introduce a new comment containing an argument for
the correctness of the new approach.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'html')
| -rwxr-xr-x | html/jspage.pl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/html/jspage.pl b/html/jspage.pl index 2101030..70d7209 100755 --- a/html/jspage.pl +++ b/html/jspage.pl @@ -73,7 +73,7 @@ EOF <head> <meta http-equiv="Content-Type" content="text/html; charset=ASCII" /> <title>${puzzlename}, ${unfinishedtitlefragment}from Simon Tatham's Portable Puzzle Collection</title> -<script type="text/javascript" src="${jspath}${filename}.js"></script> +<script defer type="text/javascript" src="${jspath}${filename}.js"></script> <style class="text/css"> /* Margins and centring on the top-level div for the game menu */ #gamemenu { margin-top: 0; margin-bottom: 0.5em; text-align: center } @@ -217,7 +217,7 @@ EOF } </style> </head> -<body onLoad="initPuzzle();"> +<body> <h1 align=center>${puzzlename}</h1> ${unfinishedheading} <h2 align=center>from Simon Tatham's Portable Puzzle Collection</h2> |