问题
Nodejs has special flag --allow-natives-syntax
. Is it possible to pass such thing to Google Chrome? Or maybe devtools provide some other way to access such information?
// running node with `--allow-natives-syntax` flag
var obj = { a: true, b: false };
console.log(%HasFastProperties(obj)); // true (Fast mode)
delete obj.a;
console.log(%HasFastProperties(obj)); // false (Dictionary mode)
回答1:
Yes, you can pass that flag to Google Chrome if you start Chrome with --js-flags="--allow-natives-syntax"
.
(I should point out that you should not generally run Chrome with that flag turned on; use it only for debugging of websites you trust.)
回答2:
No. You can find all available Chrome command line flags here: https://peter.sh/experiments/chromium-command-line-switches/
You might be able to do a custom Chromium build that passes along that flag. You could also hook into the Chrome process and set the value of the symbol manually. Both options suck.
来源:https://stackoverflow.com/questions/57192598/v8-native-syntax-in-chrome