(request)
| 317 | // Called from the backend in order to change frame focus. |
| 318 | // |
| 319 | function focusThisFrame(request) { |
| 320 | // It should never be the case that we get a forceFocusThisFrame request on a window that isn't |
| 321 | // focusable, because the background script checks that the window is focusable before sending the |
| 322 | // focusFrame message. |
| 323 | if (!request.forceFocusThisFrame && !isWindowFocusable()) return; |
| 324 | |
| 325 | Utils.nextTick(function () { |
| 326 | globalThis.focus(); |
| 327 | // On Firefox, window.focus doesn't always draw focus back from a child frame (bug 554039). We |
| 328 | // blur the active element if it is an iframe, which gives the window back focus as intended. |
| 329 | if (document.activeElement.tagName.toLowerCase() === "iframe") { |
| 330 | document.activeElement.blur(); |
| 331 | } |
| 332 | if (request.highlight) { |
| 333 | flashFrame(); |
| 334 | } |
| 335 | }); |
| 336 | } |
| 337 | |
| 338 | // Used by the focusInput command. |
| 339 | globalThis.lastFocusedInput = (function () { |
no test coverage detected