From 55a1ef339f4534ab1a8e1a0f82818f78f3408fab Mon Sep 17 00:00:00 2001 From: epriestley Date: Mon, 10 Dec 2018 11:39:43 -0800 Subject: [PATCH] Fix a bad method call signature throwing exceptions in newer Node Summary: Ref T13222. See PHI996. Ref T10743. For context, perhaps see T12171. Node changed some signatures, behaviors, and error handling here in recent versions. As far as I can tell: - The `script.runInNewContext(...)` method has never taken a `path` parameter, and passing the path has always been wrong. - The `script.runInNewContext(...)` method started taking an `[options]` parameter at some point, and validating it, so the bad `path` parameter now throws. - `vm.createScript(...)` is "soft deprecated" but basically fine, and keeping it looks more compatible. This seems like the smallest and most compatible correct change. Test Plan: Under Node 10, started Aphlict. Before: fatal error on bad `options` parameter to `runInNewContext()` (expected dictionary). After: notification server starts. Reviewers: amckinley Reviewed By: amckinley Maniphest Tasks: T13222, T10743 Differential Revision: https://secure.phabricator.com/D19860 --- resources/celerity/map.php | 2 +- webroot/rsrc/externals/javelin/core/init_node.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/resources/celerity/map.php b/resources/celerity/map.php index 4223d94095..3b86ebeeb4 100644 --- a/resources/celerity/map.php +++ b/resources/celerity/map.php @@ -214,7 +214,7 @@ return array( 'rsrc/externals/javelin/core/__tests__/stratcom.js' => '88bf7313', 'rsrc/externals/javelin/core/__tests__/util.js' => 'e251703d', 'rsrc/externals/javelin/core/init.js' => '8d83d2a1', - 'rsrc/externals/javelin/core/init_node.js' => 'c234aded', + 'rsrc/externals/javelin/core/init_node.js' => 'f7732951', 'rsrc/externals/javelin/core/install.js' => '05270951', 'rsrc/externals/javelin/core/util.js' => '93cc50d6', 'rsrc/externals/javelin/docs/Base.js' => '74676256', diff --git a/webroot/rsrc/externals/javelin/core/init_node.js b/webroot/rsrc/externals/javelin/core/init_node.js index 19834664b4..1a7999e253 100644 --- a/webroot/rsrc/externals/javelin/core/init_node.js +++ b/webroot/rsrc/externals/javelin/core/init_node.js @@ -49,7 +49,7 @@ JX.require = function(thing) { } vm.createScript(content, path) - .runInNewContext(sandbox, path); + .runInNewContext(sandbox); }; exports.JX = JX;