ma1 pushed to branch base-browser-115.16.0esr-13.5-1 at The Tor Project / Applications / Tor Browser
Commits:
-
d2d5566b
by Andreas Farre at 2024-10-16T14:46:47+02:00
3 changed files:
- browser/actors/BrowserTabChild.sys.mjs
- browser/base/content/browser.js
- docshell/shistory/nsISHistory.idl
Changes:
| ... | ... | @@ -3,12 +3,6 @@ |
| 3 | 3 | * License, v. 2.0. If a copy of the MPL was not distributed with this
|
| 4 | 4 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
| 5 | 5 | |
| 6 | -const lazy = {};
|
|
| 7 | - |
|
| 8 | -ChromeUtils.defineESModuleGetters(lazy, {
|
|
| 9 | - E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
|
|
| 10 | -});
|
|
| 11 | - |
|
| 12 | 6 | export class BrowserTabChild extends JSWindowActorChild {
|
| 13 | 7 | constructor() {
|
| 14 | 8 | super();
|
| ... | ... | @@ -19,34 +13,6 @@ export class BrowserTabChild extends JSWindowActorChild { |
| 19 | 13 | let docShell = context.docShell;
|
| 20 | 14 | |
| 21 | 15 | switch (message.name) {
|
| 22 | - // XXX(nika): Should we try to call this in the parent process instead?
|
|
| 23 | - case "Browser:Reload":
|
|
| 24 | - /* First, we'll try to use the session history object to reload so
|
|
| 25 | - * that framesets are handled properly. If we're in a special
|
|
| 26 | - * window (such as view-source) that has no session history, fall
|
|
| 27 | - * back on using the web navigation's reload method.
|
|
| 28 | - */
|
|
| 29 | - let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
|
|
| 30 | - try {
|
|
| 31 | - if (webNav.sessionHistory) {
|
|
| 32 | - webNav = webNav.sessionHistory;
|
|
| 33 | - }
|
|
| 34 | - } catch (e) {}
|
|
| 35 | - |
|
| 36 | - let reloadFlags = message.data.flags;
|
|
| 37 | - if (message.data.handlingUserInput) {
|
|
| 38 | - reloadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_USER_ACTIVATION;
|
|
| 39 | - }
|
|
| 40 | - |
|
| 41 | - try {
|
|
| 42 | - lazy.E10SUtils.wrapHandlingUserInput(
|
|
| 43 | - this.document.defaultView,
|
|
| 44 | - message.data.handlingUserInput,
|
|
| 45 | - () => webNav.reload(reloadFlags)
|
|
| 46 | - );
|
|
| 47 | - } catch (e) {}
|
|
| 48 | - break;
|
|
| 49 | - |
|
| 50 | 16 | case "ForceEncodingDetection":
|
| 51 | 17 | docShell.forceEncodingDetection();
|
| 52 | 18 | break;
|
| ... | ... | @@ -3507,17 +3507,29 @@ function BrowserReloadWithFlags(reloadFlags) { |
| 3507 | 3507 | gIdentityHandler.hidePopup();
|
| 3508 | 3508 | gPermissionPanel.hidePopup();
|
| 3509 | 3509 | |
| 3510 | - let handlingUserInput = document.hasValidTransientUserGestureActivation;
|
|
| 3510 | + if (document.hasValidTransientUserGestureActivation) {
|
|
| 3511 | + reloadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_USER_ACTIVATION;
|
|
| 3512 | + }
|
|
| 3511 | 3513 | |
| 3512 | 3514 | for (let tab of unchangedRemoteness) {
|
| 3513 | 3515 | if (tab.linkedPanel) {
|
| 3514 | - sendReloadMessage(tab);
|
|
| 3516 | + const { browsingContext } = tab.linkedBrowser;
|
|
| 3517 | + const { sessionHistory } = browsingContext;
|
|
| 3518 | + if (sessionHistory) {
|
|
| 3519 | + sessionHistory.reload(reloadFlags);
|
|
| 3520 | + } else {
|
|
| 3521 | + browsingContext.reload(reloadFlags);
|
|
| 3522 | + }
|
|
| 3515 | 3523 | } else {
|
| 3516 | 3524 | // Shift to fully loaded browser and make
|
| 3517 | 3525 | // sure load handler is instantiated.
|
| 3518 | - tab.addEventListener("SSTabRestoring", () => sendReloadMessage(tab), {
|
|
| 3519 | - once: true,
|
|
| 3520 | - });
|
|
| 3526 | + tab.addEventListener(
|
|
| 3527 | + "SSTabRestoring",
|
|
| 3528 | + () => tab.linkedBrowser.browsingContext.reload(reloadFlags),
|
|
| 3529 | + {
|
|
| 3530 | + once: true,
|
|
| 3531 | + }
|
|
| 3532 | + );
|
|
| 3521 | 3533 | gBrowser._insertBrowser(tab);
|
| 3522 | 3534 | }
|
| 3523 | 3535 | }
|
| ... | ... | @@ -3529,13 +3541,6 @@ function BrowserReloadWithFlags(reloadFlags) { |
| 3529 | 3541 | });
|
| 3530 | 3542 | }
|
| 3531 | 3543 | |
| 3532 | - function sendReloadMessage(tab) {
|
|
| 3533 | - tab.linkedBrowser.sendMessageToActor(
|
|
| 3534 | - "Browser:Reload",
|
|
| 3535 | - { flags: reloadFlags, handlingUserInput },
|
|
| 3536 | - "BrowserTab"
|
|
| 3537 | - );
|
|
| 3538 | - }
|
|
| 3539 | 3544 | }
|
| 3540 | 3545 | |
| 3541 | 3546 | // TODO: can we pull getPEMString in from pippki.js instead of
|
| ... | ... | @@ -268,8 +268,7 @@ interface nsISHistory: nsISupports |
| 268 | 268 | [noscript, notxpcom]
|
| 269 | 269 | void RemoveFrameEntries(in nsISHEntry aEntry);
|
| 270 | 270 | |
| 271 | - [noscript]
|
|
| 272 | - void Reload(in unsigned long aReloadFlags);
|
|
| 271 | + void reload(in unsigned long aReloadFlags);
|
|
| 273 | 272 | |
| 274 | 273 | [notxpcom] void EnsureCorrectEntryAtCurrIndex(in nsISHEntry aEntry);
|
| 275 | 274 |