|
@@ -0,0 +1,29 @@
|
|
|
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
+From: Samuel Attard <[email protected]>
|
|
|
+Date: Thu, 25 Jun 2020 09:29:04 -0700
|
|
|
+Subject: fix: do not register the ESM loader in renderer processes
|
|
|
+
|
|
|
+Only one ESM loader can be registered per isolate, in renderer processes this should be blink. This patches node so that it won't register it's handler (overriding blinks) in non-browser processes.
|
|
|
+
|
|
|
+This has been upstreamed in:
|
|
|
+ * https://github.com/nodejs/node/pull/34060
|
|
|
+ * https://github.com/nodejs/node/pull/34127
|
|
|
+
|
|
|
+We can't easily rebase on that accepted solution here but we can as soon as we upgrade to
|
|
|
+Node.js v14, since we need to leverage the new version of node::CreateEnvironment
|
|
|
+introduced in https://github.com/nodejs/node/pull/30467.
|
|
|
+
|
|
|
+diff --git a/lib/internal/bootstrap/pre_execution.js b/lib/internal/bootstrap/pre_execution.js
|
|
|
+index b4a0f71af5853f427a10449b52509052fbe3facd..ba5b0b6e51bcddbc5b9dd9c31231585d61b131a0 100644
|
|
|
+--- a/lib/internal/bootstrap/pre_execution.js
|
|
|
++++ b/lib/internal/bootstrap/pre_execution.js
|
|
|
+@@ -411,6 +411,9 @@ function initializeESMLoader() {
|
|
|
+ // Create this WeakMap in js-land because V8 has no C++ API for WeakMap.
|
|
|
+ internalBinding('module_wrap').callbackMap = new SafeWeakMap();
|
|
|
+
|
|
|
++ // Do not hook the ESM loader in renderer processes as it overrides blinks loader
|
|
|
++ if (typeof process.type === 'string' && process.type !== 'browser') return;
|
|
|
++
|
|
|
+ const {
|
|
|
+ setImportModuleDynamicallyCallback,
|
|
|
+ setInitializeImportMetaObjectCallback
|