使用javascript重新启动Google Chrome

G-M*_*Man 5 javascript google-chrome

在chrome中,如果我转到chrome:// flags /并在标记页面上进行更改(启用/禁用功能),页面底部会出现一个按钮,单击该按钮会重新启动chrome并重新打开页面打开.有谁知道javascript代码允许发生什么?

这是按钮出现的html

<div class="needs-restart" jsdisplay="needsRestart">
        <div i18n-content="flagsRestartNotice">NEEDS_RESTART</div>
        <button class="experiment-restart-button"
                type="button"
                i18n-content="flagsRestartButton">RESTART</button>
</div>
Run Code Online (Sandbox Code Playgroud)

谢谢

Ste*_*hen 8

从单击该按钮调用restartBrowser()函数.

来自flags.js:

/**
 * Asks the C++ FlagsDOMHandler to restart the browser (restoring tabs).
 */
function restartBrowser() {
  chrome.send('restartBrowser');
}
Run Code Online (Sandbox Code Playgroud)

就像评论所暗示的那样,它与Chrome背后的C++代码挂钩,后者将尝试重启.