Upgrade CanvasKit emscripten to version 1.39.16.

Changes are largely mechanical.  Non-mechanical changes to support newer
versions of emscripten are enumerated below, in format ${EMSCRIPTEN_VERSION}:
${RELEVANT_CHANGE}.

- 1.39.9: TOTAL_MEMORY has been renamed INITIAL_MEMORY.
- 1.39.12: passing of linker flags to wasm-ld has changed in a way that requires
  supplying `--no-entry` to avoid error message "wasm-ld: error: entry symbol
  not defined (pass --no-entry to suppress): main".
- 1.39.16: The factory function created by using `MODULARIZE` build option now
  returns a Promise instead of the module instance.  As such, the ready.js
  workaround is removed.  Note this is a breaking API change for CanvasKit,
  which now uses just `then()` and not `ready().then()`.
- 1.38.33: `emsdk install` hasn't required the `-64bit` suffix on version names
  since `1.38.33`, so we remove them.  E.g. `emsdk install sdk-1.39.6-64bit`
  simply becomes `emsdk install sdk-1.39.16`.

cf. https://github.com/emscripten-core/emscripten/blob/master/ChangeLog.md

Bug: NONE
Change-Id: Iabec4bd5ad7db2e0715ad42c2e4cf7d67b192b4c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/291182
Reviewed-by: Kevin Lubick <kjlubick@google.com>
diff --git a/infra/bots/recipe_modules/build/canvaskit.py b/infra/bots/recipe_modules/build/canvaskit.py
index d04b03b..c09a20f 100644
--- a/infra/bots/recipe_modules/build/canvaskit.py
+++ b/infra/bots/recipe_modules/build/canvaskit.py
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1'
+DOCKER_IMAGE = 'gcr.io/skia-public/canvaskit-emsdk:1.39.16_v1'
 INNER_BUILD_SCRIPT = '/SRC/skia/infra/canvaskit/build_canvaskit.sh'
 
 
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Debug-PathKit.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Debug-PathKit.json
index b5a7136..4f4b985 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Debug-PathKit.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Debug-PathKit.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/pathkit:/OUT",
-      "gcr.io/skia-public/emsdk-base:1.39.6_v1",
+      "gcr.io/skia-public/emsdk-base:1.39.16_v1",
       "/SRC/skia/infra/pathkit/build_pathkit.sh",
       "debug",
       "asm.js"
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Release-PathKit.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Release-PathKit.json
index b4afc8d..610ef89 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Release-PathKit.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-asmjs-Release-PathKit.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/pathkit:/OUT",
-      "gcr.io/skia-public/emsdk-base:1.39.6_v1",
+      "gcr.io/skia-public/emsdk-base:1.39.16_v1",
       "/SRC/skia/infra/pathkit/build_pathkit.sh",
       "asm.js"
     ],
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-CanvasKit.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-CanvasKit.json
index 69b66f5..04653c6 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-CanvasKit.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-CanvasKit.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/canvaskit:/OUT",
-      "gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1",
+      "gcr.io/skia-public/canvaskit-emsdk:1.39.16_v1",
       "/SRC/skia/infra/canvaskit/build_canvaskit.sh",
       "debug"
     ],
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-PathKit.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-PathKit.json
index 12b0cea..a55868a 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-PathKit.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Debug-PathKit.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/pathkit:/OUT",
-      "gcr.io/skia-public/emsdk-base:1.39.6_v1",
+      "gcr.io/skia-public/emsdk-base:1.39.16_v1",
       "/SRC/skia/infra/pathkit/build_pathkit.sh",
       "debug"
     ],
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-CanvasKit_CPU.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-CanvasKit_CPU.json
index ca8510c..4b32e69 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-CanvasKit_CPU.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-CanvasKit_CPU.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/canvaskit:/OUT",
-      "gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1",
+      "gcr.io/skia-public/canvaskit-emsdk:1.39.16_v1",
       "/SRC/skia/infra/canvaskit/build_canvaskit.sh",
       "cpu"
     ],
diff --git a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-PathKit.json b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-PathKit.json
index aec107d..18ddbb3 100644
--- a/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-PathKit.json
+++ b/infra/bots/recipe_modules/build/examples/full.expected/Build-Debian10-EMCC-wasm-Release-PathKit.json
@@ -23,7 +23,7 @@
       "[START_DIR]/cache/work:/SRC",
       "--volume",
       "[START_DIR]/cache/docker/pathkit:/OUT",
-      "gcr.io/skia-public/emsdk-base:1.39.6_v1",
+      "gcr.io/skia-public/emsdk-base:1.39.16_v1",
       "/SRC/skia/infra/pathkit/build_pathkit.sh"
     ],
     "env": {
diff --git a/infra/bots/recipe_modules/build/pathkit.py b/infra/bots/recipe_modules/build/pathkit.py
index 82dbca3..8fd7d62 100644
--- a/infra/bots/recipe_modules/build/pathkit.py
+++ b/infra/bots/recipe_modules/build/pathkit.py
@@ -2,7 +2,7 @@
 # Use of this source code is governed by a BSD-style license that can be
 # found in the LICENSE file.
 
-DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:1.39.6_v1'
+DOCKER_IMAGE = 'gcr.io/skia-public/emsdk-base:1.39.16_v1'
 INNER_BUILD_SCRIPT = '/SRC/skia/infra/pathkit/build_pathkit.sh'
 
 def compile_fn(api, checkout_root, _ignore):
diff --git a/infra/canvaskit/build_canvaskit.sh b/infra/canvaskit/build_canvaskit.sh
index fffc665..6879c95 100755
--- a/infra/canvaskit/build_canvaskit.sh
+++ b/infra/canvaskit/build_canvaskit.sh
@@ -9,7 +9,7 @@
 # is mounted at /OUT
 
 # For example:
-# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/canvaskit:/OUT gcr.io/skia-public/emsdk-base:1.39.6_v1 /SRC/infra/canvaskit/build_canvaskit.sh
+# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/canvaskit:/OUT gcr.io/skia-public/emsdk-base:1.39.16_v1 /SRC/infra/canvaskit/build_canvaskit.sh
 
 set +e
 set -x
diff --git a/infra/canvaskit/docker/Makefile b/infra/canvaskit/docker/Makefile
index e5a2bfa..e1f094b 100644
--- a/infra/canvaskit/docker/Makefile
+++ b/infra/canvaskit/docker/Makefile
@@ -1,4 +1,4 @@
-EMSDK_VERSION=1.39.6_v1
+EMSDK_VERSION=1.39.16_v1
 
 publish_canvaskit_emsdk:
 	docker build -t canvaskit-emsdk ./canvaskit-emsdk/
diff --git a/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile b/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile
index 27658f4..655887b 100644
--- a/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile
+++ b/infra/canvaskit/docker/canvaskit-emsdk/Dockerfile
@@ -1,7 +1,7 @@
 # A Docker image that augments the Emscripten SDK Docker image
 # with anything needed to build Canvaskit
 
-FROM gcr.io/skia-public/emsdk-base:1.39.6_v1
+FROM gcr.io/skia-public/emsdk-base:1.39.16_v1
 
 RUN apt-get update && apt-get upgrade -y && apt-get install -y \
-  libfreetype6-dev
\ No newline at end of file
+  libfreetype6-dev
diff --git a/infra/pathkit/build_pathkit.sh b/infra/pathkit/build_pathkit.sh
index b644f2c..de83eb0 100755
--- a/infra/pathkit/build_pathkit.sh
+++ b/infra/pathkit/build_pathkit.sh
@@ -9,7 +9,7 @@
 # is mounted at /OUT
 
 # For example:
-# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/dockerpathkit:/OUT gcr.io/skia-public/emsdk-base:1.39.6_v1 /SRC/infra/pathkit/build_pathkit.sh
+# docker run -v $SKIA_ROOT:/SRC -v $SKIA_ROOT/out/dockerpathkit:/OUT gcr.io/skia-public/emsdk-base:1.39.16_v1 /SRC/infra/pathkit/build_pathkit.sh
 
 set +e
 set -x
diff --git a/infra/wasm-common/docker/Makefile b/infra/wasm-common/docker/Makefile
index d47d2c6..15a38f7 100644
--- a/infra/wasm-common/docker/Makefile
+++ b/infra/wasm-common/docker/Makefile
@@ -1,4 +1,4 @@
-EMSDK_VERSION=1.39.6_v1
+EMSDK_VERSION=1.39.16_v1
 
 # Can check CHROME_VERSION with
 # docker run karma-chrome-tests /usr/bin/google-chrome-stable --version
diff --git a/infra/wasm-common/docker/emsdk-base/Dockerfile b/infra/wasm-common/docker/emsdk-base/Dockerfile
index 27c0829..7fd215b 100644
--- a/infra/wasm-common/docker/emsdk-base/Dockerfile
+++ b/infra/wasm-common/docker/emsdk-base/Dockerfile
@@ -16,9 +16,9 @@
 
 RUN ./emsdk update-tags
 
-RUN ./emsdk install sdk-1.39.6-64bit
+RUN ./emsdk install sdk-1.39.16
 
-RUN ./emsdk activate sdk-1.39.6-64bit
+RUN ./emsdk activate sdk-1.39.16
 
 RUN /bin/bash -c "source ./emsdk_env.sh"
 
diff --git a/modules/canvaskit/CHANGELOG.md b/modules/canvaskit/CHANGELOG.md
index deaf2ff..3ef0180 100644
--- a/modules/canvaskit/CHANGELOG.md
+++ b/modules/canvaskit/CHANGELOG.md
@@ -6,6 +6,13 @@
 
 ## [Unreleased]
 
+### Changed
+  - We now compile/ship with Emscripten v1.39.16.
+
+### Breaking
+ - `CanvasKitInit(...)` now directly returns a Promise. As such, `CanvasKitInit(...).ready()`
+   has been removed.
+
 ## [0.15.0] - 2020-05-14
 
 ### Added
diff --git a/modules/canvaskit/Makefile b/modules/canvaskit/Makefile
index 006771c..48f26fc 100644
--- a/modules/canvaskit/Makefile
+++ b/modules/canvaskit/Makefile
@@ -91,5 +91,5 @@
 	mkdir -p ${SKIA_ROOT}/out/canvaskit_wasm_docker
 	docker run --rm --volume ${SKIA_ROOT}:/SRC \
                --volume ${SKIA_ROOT}/out/canvaskit_wasm_docker:/OUT \
-               gcr.io/skia-public/canvaskit-emsdk:1.39.6_v1 \
+               gcr.io/skia-public/canvaskit-emsdk:1.39.16_v1 \
                /SRC/infra/canvaskit/build_canvaskit.sh
diff --git a/modules/canvaskit/README.md b/modules/canvaskit/README.md
index 32e5e10..b30dde6 100644
--- a/modules/canvaskit/README.md
+++ b/modules/canvaskit/README.md
@@ -51,9 +51,9 @@
   5. Edit `$SKIA_ROOT/infra/canvaskit/docker/Makefile` to have the same version
      from step 2. It's easiest to keep the `emsdk-base` and `canvaskit-emsdk` versions
      be in lock-step.
-  6. In `$SKIA_ROOT/infra/canvaskit/docker/`, make `publish_canvaskit_emsdk`.
+  6. In `$SKIA_ROOT/infra/canvaskit/docker/`, run `make publish_canvaskit_emsdk`.
   7. In `$SKIA_ROOT/infra/bots/recipe_modules/build/`, update `canvaskit.py`
-     and `pathkit.py` to have `DOCKER_IMAAGE` point to the desired tagged Docker
+     and `pathkit.py` to have `DOCKER_IMAGE` point to the desired tagged Docker
      containers from steps 2 and 5 (which should be the same).
   9. In `$SKIA_ROOT/infra/bots/`, run `make train` to re-train the recipes.
   10. Optional: Run something like `git grep 1\\.38\\.` in `$SKIA_ROOT` to see if
diff --git a/modules/canvaskit/canvaskit/README.md b/modules/canvaskit/canvaskit/README.md
index d71507e..6288299 100644
--- a/modules/canvaskit/canvaskit/README.md
+++ b/modules/canvaskit/canvaskit/README.md
@@ -10,16 +10,16 @@
     <script src="/node_modules/canvaskit-wasm/bin/canvaskit.js"></script>
     CanvasKitInit({
         locateFile: (file) => '/node_modules/canvaskit-wasm/bin/'+file,
-    }).ready().then((CanvasKit) => {
+    }).then((CanvasKit) => {
         // Code goes here using CanvasKit
     });
 
 As with all npm packages, there's a freely available CDN via unpkg.com:
 
-    <script src="https://unpkg.com/canvaskit-wasm@0.3.0/bin/canvaskit.js"></script>
+    <script src="https://unpkg.com/canvaskit-wasm@0.16.0/bin/canvaskit.js"></script>
     CanvasKitInit({
-         locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.3.0/bin/'+file,
-    }).ready().then(...)
+         locateFile: (file) => 'https://unpkg.com/canvaskit-wasm@0.16.0/bin/'+file,
+    }).then(...)
 
 ## Node
 To use CanvasKit in Node, it's similar to the browser:
@@ -27,7 +27,7 @@
     const CanvasKitInit = require('/node_modules/canvaskit-wasm/bin/canvaskit.js');
     CanvasKitInit({
         locateFile: (file) => __dirname + '/bin/'+file,
-    }).ready().then((CanvasKit) => {
+    }).then((CanvasKit) => {
         // Code goes here using CanvasKit
     });
 
@@ -41,7 +41,7 @@
 In the JS code, use require():
 
     const CanvasKitInit = require('canvaskit-wasm/bin/canvaskit.js')
-    CanvasKitInit().ready().then((CanvasKit) => {
+    CanvasKitInit().then((CanvasKit) => {
         // Code goes here using CanvasKit
     });
 
@@ -106,4 +106,4 @@
 Please file bugs at [skbug.com](skbug.com).
 It may be convenient to use [our online fiddle](jsfiddle.skia.org/canvaskit) to demonstrate any issues encountered.
 
-See CONTRIBUTING.md for more information on sending pull requests.
\ No newline at end of file
+See CONTRIBUTING.md for more information on sending pull requests.
diff --git a/modules/canvaskit/canvaskit/example.html b/modules/canvaskit/canvaskit/example.html
index b7527af..c10b5d0 100644
--- a/modules/canvaskit/canvaskit/example.html
+++ b/modules/canvaskit/canvaskit/example.html
@@ -59,7 +59,7 @@
   var cdn = 'https://storage.googleapis.com/skia-cdn/misc/';
   CanvasKitInit({
     locateFile: (file) => '/node_modules/canvaskit/bin/'+file,
-  }).ready().then((CK) => {
+  }).then((CK) => {
     CanvasKit = CK;
     DrawingExample(CanvasKit, robotoData);
     PathExample(CanvasKit);
diff --git a/modules/canvaskit/canvaskit/extra.html b/modules/canvaskit/canvaskit/extra.html
index 34a25b6..1d1882d 100644
--- a/modules/canvaskit/canvaskit/extra.html
+++ b/modules/canvaskit/canvaskit/extra.html
@@ -58,7 +58,7 @@
   var cdn = 'https://storage.googleapis.com/skia-cdn/misc/';
   const ckLoaded = CanvasKitInit({
     locateFile: (file) => '/node_modules/canvaskit/bin/'+file,
-  }).ready();
+  });
   ckLoaded.then((CK) => {
     CanvasKit = CK;
     // Set bounds to fix the 4:3 resolution of the legos
diff --git a/modules/canvaskit/canvaskit/node.example.js b/modules/canvaskit/canvaskit/node.example.js
index 04e7950..557dc09 100644
--- a/modules/canvaskit/canvaskit/node.example.js
+++ b/modules/canvaskit/canvaskit/node.example.js
@@ -4,7 +4,7 @@
 
 CanvasKitInit({
   locateFile: (file) => __dirname + '/bin/'+file,
-}).ready().then((CanvasKit) => {
+}).then((CanvasKit) => {
   let canvas = CanvasKit.MakeCanvas(300, 300);
 
   let img = fs.readFileSync(path.join(__dirname, 'test.png'));
@@ -111,4 +111,4 @@
     p.lineTo(X + R * Math.cos(a), Y + R * Math.sin(a));
   }
   return p;
-}
\ No newline at end of file
+}
diff --git a/modules/canvaskit/canvaskit/viewer.html b/modules/canvaskit/canvaskit/viewer.html
index f201f82..9b8a739 100644
--- a/modules/canvaskit/canvaskit/viewer.html
+++ b/modules/canvaskit/canvaskit/viewer.html
@@ -18,7 +18,7 @@
   var CanvasKit = null;
   CanvasKitInit({
     locateFile: (file) => '/node_modules/canvaskit/bin/'+file,
-  }).ready().then((CK) => {
+  }).then((CK) => {
     CanvasKit = CK;
     ViewerMain(CanvasKit);
   });
diff --git a/modules/canvaskit/compile.sh b/modules/canvaskit/compile.sh
index 70d3bf3..e2eb513 100755
--- a/modules/canvaskit/compile.sh
+++ b/modules/canvaskit/compile.sh
@@ -331,6 +331,7 @@
     $FONT_CFLAGS \
     -std=c++17 \
     --bind \
+    --no-entry \
     --pre-js $BASE_DIR/preamble.js \
     --pre-js $BASE_DIR/helper.js \
     --pre-js $BASE_DIR/interface.js \
@@ -343,7 +344,6 @@
     $RT_SHADER_JS \
     $HTML_CANVAS_API \
     --pre-js $BASE_DIR/postamble.js \
-    --post-js $BASE_DIR/ready.js \
     $BASE_DIR/canvaskit_bindings.cpp \
     $PARTICLES_BINDINGS \
     $SKOTTIE_BINDINGS \
@@ -365,7 +365,7 @@
     -s MODULARIZE=1 \
     -s NO_EXIT_RUNTIME=1 \
     -s STRICT=1 \
-    -s TOTAL_MEMORY=128MB \
+    -s INITIAL_MEMORY=128MB \
     -s WARN_UNALIGNED=1 \
     -s WASM=1 \
     -o $BUILD_DIR/canvaskit.js
diff --git a/modules/canvaskit/htmlcanvas/_namedcolors.js b/modules/canvaskit/htmlcanvas/_namedcolors.js
index 16dec34..69a736b 100644
--- a/modules/canvaskit/htmlcanvas/_namedcolors.js
+++ b/modules/canvaskit/htmlcanvas/_namedcolors.js
@@ -7,7 +7,7 @@
 
 CanvasKitInit({
   locateFile: (file) => __dirname + '/../canvaskit/bin/'+file,
-}).ready().then((CanvasKit) => {
+}).then((CanvasKit) => {
   let colorMap = {
     // From https://drafts.csswg.org/css-color/#named-colors
     'aliceblue': CanvasKit.Color(240, 248, 255),
@@ -162,4 +162,4 @@
   };
   console.log(JSON.stringify(colorMap));
 
-});
\ No newline at end of file
+});
diff --git a/modules/canvaskit/ready.js b/modules/canvaskit/ready.js
deleted file mode 100644
index 60f2486..0000000
--- a/modules/canvaskit/ready.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// See https://github.com/kripken/emscripten/issues/5820#issuecomment-385722568
-// for context on why the .then() that comes with Module breaks things (e.g. infinite loops)
-// and why the below fixes it.
-Module['ready'] = function() {
-  return new Promise(function (resolve, reject) {
-    Module['onAbort'] = reject;
-    if (runtimeInitialized) {
-      resolve(Module);
-    } else {
-      addOnPostRun(function() {
-        resolve(Module);
-      });
-    }
-  });
-}
-delete Module['then'];
\ No newline at end of file
diff --git a/modules/canvaskit/tests/canvaskitinit.js b/modules/canvaskit/tests/canvaskitinit.js
index 3ec16fc..fa73e10 100644
--- a/modules/canvaskit/tests/canvaskitinit.js
+++ b/modules/canvaskit/tests/canvaskitinit.js
@@ -7,7 +7,7 @@
     console.log('canvaskit loading', new Date());
     CanvasKitInit({
         locateFile: (file) => '/canvaskit/'+file,
-    }).ready().then((loaded) => {
+    }).then((loaded) => {
         console.log('canvaskit loaded', new Date());
         CanvasKit = loaded;
         resolve();
@@ -15,4 +15,4 @@
         console.error('canvaskit failed to load', new Date(), e);
         reject();
     });
-});
\ No newline at end of file
+});
diff --git a/modules/pathkit/CHANGELOG.md b/modules/pathkit/CHANGELOG.md
index dc0b628..9b968bd 100644
--- a/modules/pathkit/CHANGELOG.md
+++ b/modules/pathkit/CHANGELOG.md
@@ -7,7 +7,11 @@
 ## [Unreleased]
 
 ### Changed
- - Updated to emscripten 1.39.6
+ - Updated to emscripten 1.39.16
+
+### Breaking
+ - `PathKitInit(...)` now directly returns a Promise. As such, `PathKitInit(...).ready()`
+   has been removed.
 
 ## [0.6.0] 2019-02-25
 
diff --git a/modules/pathkit/compile.sh b/modules/pathkit/compile.sh
index 7d4660d..de66cff 100755
--- a/modules/pathkit/compile.sh
+++ b/modules/pathkit/compile.sh
@@ -110,9 +110,9 @@
 ${EMCXX} $RELEASE_CONF -std=c++17 \
 -I. \
 --bind \
+--no-entry \
 --pre-js $BASE_DIR/helper.js \
 --pre-js $BASE_DIR/chaining.js \
---post-js $BASE_DIR/ready.js \
 -DSK_DISABLE_READBUFFER=1 \
 -fno-rtti -fno-exceptions -DEMSCRIPTEN_HAS_UNBOUND_TYPE_NAMES=0 \
 $WASM_CONF \
diff --git a/modules/pathkit/npm-asmjs/README.md b/modules/pathkit/npm-asmjs/README.md
index ff71af1..ac05297 100644
--- a/modules/pathkit/npm-asmjs/README.md
+++ b/modules/pathkit/npm-asmjs/README.md
@@ -5,7 +5,7 @@
     <script src="/node_modules/pathkit-asmjs/bin/pathkit.js"></script>
     PathKitInit({
         locateFile: (file) => '/node_modules/pathkit-asmjs/bin/'+file,
-    }).ready().then((PathKit) => {
+    }).then((PathKit) => {
         // Code goes here using PathKit
     });
 
@@ -14,7 +14,7 @@
 is used to tell the JS loader where to find the .js.mem file. By default, it will
 look for /pathkit.js.mem, so if this is not the case, use `locateFile` to configure
 this properly.
-The `PathKit` object returned upon resolution of the .ready() Promise is fully loaded and ready to use.
+The `PathKit` object returned upon resolution of the PathKitInit Promise is fully loaded and ready to use.
 
 See the [API page](https://skia.org/user/modules/pathkit) and
 [example.html](https://github.com/google/skia/blob/master/modules/pathkit/npm-asmjs/example.html)
@@ -29,7 +29,7 @@
 In the JS code, use require():
 
     const PathKitInit = require('pathkit-asmjs/bin/pathkit.js')
-    PathKitInit().ready().then((PathKit) => {
+    PathKitInit().then((PathKit) => {
         // Code goes here using PathKit
     })
 
diff --git a/modules/pathkit/npm-asmjs/example.html b/modules/pathkit/npm-asmjs/example.html
index a2fc4c1..c50c453 100644
--- a/modules/pathkit/npm-asmjs/example.html
+++ b/modules/pathkit/npm-asmjs/example.html
@@ -53,7 +53,7 @@
 
   PathKitInit({
     locateFile: (file) => '/node_modules/pathkit-asmjs/bin/'+file,
-  }).ready().then((PathKit) => {
+  }).then((PathKit) => {
     window.PathKit = PathKit;
     OutputsExample(PathKit);
     Path2DExample(PathKit);
diff --git a/modules/pathkit/npm-wasm/README.md b/modules/pathkit/npm-wasm/README.md
index 815e417..2e7a6d7 100644
--- a/modules/pathkit/npm-wasm/README.md
+++ b/modules/pathkit/npm-wasm/README.md
@@ -5,7 +5,7 @@
     <script src="/node_modules/pathkit-wasm/bin/pathkit.js"></script>
     PathKitInit({
         locateFile: (file) => '/node_modules/pathkit-wasm/bin/'+file,
-    }).ready().then((PathKit) => {
+    }).then((PathKit) => {
         // Code goes here using PathKit
     });
 
@@ -14,7 +14,7 @@
 is used to tell the JS loader where to find the .wasm file. By default, it will
 look for /pathkit.wasm, so if this is not the case, use `locateFile` to configure
 this properly.
-The `PathKit` object returned upon resolution of the .ready() Promise is fully loaded and ready to use.
+The `PathKit` object returned upon resolution of the PathKitInit Promise is fully loaded and ready to use.
 
 See the [API page](https://skia.org/user/modules/pathkit) and
 [example.html](https://github.com/google/skia/blob/master/modules/pathkit/npm-wasm/example.html)
@@ -29,7 +29,7 @@
 In the JS code, use require():
 
     const PathKitInit = require('pathkit-wasm/bin/pathkit.js')
-    PathKitInit().ready().then((PathKit) => {
+    PathKitInit().then((PathKit) => {
         // Code goes here using PathKit
     })
 
diff --git a/modules/pathkit/npm-wasm/example.html b/modules/pathkit/npm-wasm/example.html
index d7c2469..488f6ec 100644
--- a/modules/pathkit/npm-wasm/example.html
+++ b/modules/pathkit/npm-wasm/example.html
@@ -53,7 +53,7 @@
 
   PathKitInit({
     locateFile: (file) => '/node_modules/pathkit-wasm/bin/'+file,
-  }).ready().then((PathKit) => {
+  }).then((PathKit) => {
     window.PathKit = PathKit;
     OutputsExample(PathKit);
     Path2DExample(PathKit);
diff --git a/modules/pathkit/ready.js b/modules/pathkit/ready.js
deleted file mode 100644
index 60f2486..0000000
--- a/modules/pathkit/ready.js
+++ /dev/null
@@ -1,16 +0,0 @@
-// See https://github.com/kripken/emscripten/issues/5820#issuecomment-385722568
-// for context on why the .then() that comes with Module breaks things (e.g. infinite loops)
-// and why the below fixes it.
-Module['ready'] = function() {
-  return new Promise(function (resolve, reject) {
-    Module['onAbort'] = reject;
-    if (runtimeInitialized) {
-      resolve(Module);
-    } else {
-      addOnPostRun(function() {
-        resolve(Module);
-      });
-    }
-  });
-}
-delete Module['then'];
\ No newline at end of file
diff --git a/modules/pathkit/tests/pathkitinit.js b/modules/pathkit/tests/pathkitinit.js
index 0fc9b71..2f9caf2 100644
--- a/modules/pathkit/tests/pathkitinit.js
+++ b/modules/pathkit/tests/pathkitinit.js
@@ -5,7 +5,7 @@
     console.log('pathkit loading', new Date());
     PathKitInit({
         locateFile: (file) => '/pathkit/'+file,
-    }).ready().then((_PathKit) => {
+    }).then((_PathKit) => {
         console.log('pathkit loaded', new Date());
         PathKit = _PathKit;
         resolve();