V8 native syntax in Chrome

风格不统一 提交于 2020-05-30 07:45:12

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!