1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 /* eslint-env mozilla/remote-page */
7 var AboutRestartRequired = {
8 /* Only do autofocus if we're the toplevel frame; otherwise we
9 don't want to call attention to ourselves! The key part is
10 that autofocus happens on insertion into the tree, so we
11 can remove the button, add @autofocus, and reinsert the
15 if (window.top == window) {
16 var button = document.getElementById("restart");
17 var parent = button.parentNode;
19 button.setAttribute("autofocus", "true");
20 parent.insertAdjacentElement("afterbegin", button);
24 Services.startup.quit(
25 Ci.nsIAppStartup.eRestart | Ci.nsIAppStartup.eAttemptQuit
33 AboutRestartRequired.init();
35 let restartButton = document.getElementById("restart");
36 restartButton.onclick = function () {
37 AboutRestartRequired.restart();
40 // Dispatch this event so tests can detect that we finished loading the page.
41 let event = new CustomEvent("AboutRestartRequiredLoad", { bubbles: true });
42 document.dispatchEvent(event);