Skip to content

Commit

Permalink
src: add no-op for --harmony-proxies flag
Browse files Browse the repository at this point in the history
The upgrade from V8 5.0 to V8 5.1 removed the --harmony-proxies flag.
This restores them as no-ops to prevent breakage.

Fixes: #8388
  • Loading branch information
evanlucas committed Sep 2, 2016
1 parent 180867d commit 6a27a39
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 4 deletions.
6 changes: 6 additions & 0 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -3801,6 +3801,12 @@ static void ParseArgs(int* argc,
} else if (strncmp(arg, "--icu-data-dir=", 15) == 0) {
icu_data_dir = arg + 15;
#endif
} else if (strcmp(arg, "--harmony-proxies") == 0 ||
strcmp(arg, "--harmony_proxies") == 0 ||
strcmp(arg, "-harmony-proxies") == 0 ||
strcmp(arg, "-harmony_proxies") == 0) {
// Keep V8 flags to make 5.0 -> 5.1 not breaking.
// This is only needed in v6.x.
} else if (strcmp(arg, "--expose-internals") == 0 ||
strcmp(arg, "--expose_internals") == 0) {
// consumed in js
Expand Down
21 changes: 17 additions & 4 deletions test/parallel/test-v8-flags.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
'use strict';
require('../common');
var assert = require('assert');
var v8 = require('v8');
var vm = require('vm');
const common = require('../common');
const assert = require('assert');
const exec = require('child_process').execSync;
const v8 = require('v8');
const vm = require('vm');

// Note: changing V8 flags after an isolate started is not guaranteed to work.
// Specifically here, V8 may cache compiled scripts between the flip of the
Expand All @@ -14,3 +15,15 @@ assert(vm.runInThisContext('%_IsSmi(43)'));
v8.setFlagsFromString('--noallow_natives_syntax');
assert.throws(function() { eval('%_IsSmi(44)'); }, SyntaxError);
assert.throws(function() { vm.runInThisContext('%_IsSmi(45)'); }, SyntaxError);

// Verify that the --harmony-proxies flag doesn't error
const flags = ['--harmony-proxies',
'--harmony_proxies',
'-harmony-proxies',
'-harmony_proxies'];

for (const flag of flags) {
assert.doesNotThrow(common.mustCall(() => {
exec(`${process.execPath} ${flag}`)
}));
}

0 comments on commit 6a27a39

Please sign in to comment.