Verified Commit fcb89c7a authored by Andreas Farre's avatar Andreas Farre Committed by ma1
Browse files

Bug 1886222 - Start reload by calling reload in the parent....

Bug 1886222 - Start reload by calling reload in the parent. r=Gijs,canadahonk,smaug, a=dsmith (esr128->esr115 backport)

Differential Revision: https://phabricator.services.mozilla.com/D211519
parent dab3093f
Loading
Loading
Loading
Loading
+0 −34
Original line number Diff line number Diff line
@@ -3,12 +3,6 @@
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

const lazy = {};

ChromeUtils.defineESModuleGetters(lazy, {
  E10SUtils: "resource://gre/modules/E10SUtils.sys.mjs",
});

export class BrowserTabChild extends JSWindowActorChild {
  constructor() {
    super();
@@ -19,34 +13,6 @@ export class BrowserTabChild extends JSWindowActorChild {
    let docShell = context.docShell;

    switch (message.name) {
      // XXX(nika): Should we try to call this in the parent process instead?
      case "Browser:Reload":
        /* First, we'll try to use the session history object to reload so
         * that framesets are handled properly. If we're in a special
         * window (such as view-source) that has no session history, fall
         * back on using the web navigation's reload method.
         */
        let webNav = docShell.QueryInterface(Ci.nsIWebNavigation);
        try {
          if (webNav.sessionHistory) {
            webNav = webNav.sessionHistory;
          }
        } catch (e) {}

        let reloadFlags = message.data.flags;
        if (message.data.handlingUserInput) {
          reloadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_USER_ACTIVATION;
        }

        try {
          lazy.E10SUtils.wrapHandlingUserInput(
            this.document.defaultView,
            message.data.handlingUserInput,
            () => webNav.reload(reloadFlags)
          );
        } catch (e) {}
        break;

      case "ForceEncodingDetection":
        docShell.forceEncodingDetection();
        break;
+17 −12
Original line number Diff line number Diff line
@@ -3488,17 +3488,29 @@ function BrowserReloadWithFlags(reloadFlags) {
  gIdentityHandler.hidePopup();
  gPermissionPanel.hidePopup();

  let handlingUserInput = document.hasValidTransientUserGestureActivation;
  if (document.hasValidTransientUserGestureActivation) {
    reloadFlags |= Ci.nsIWebNavigation.LOAD_FLAGS_USER_ACTIVATION;
  }

  for (let tab of unchangedRemoteness) {
    if (tab.linkedPanel) {
      sendReloadMessage(tab);
      const { browsingContext } = tab.linkedBrowser;
      const { sessionHistory } = browsingContext;
      if (sessionHistory) {
        sessionHistory.reload(reloadFlags);
      } else {
        browsingContext.reload(reloadFlags);
      }
    } else {
      // Shift to fully loaded browser and make
      // sure load handler is instantiated.
      tab.addEventListener("SSTabRestoring", () => sendReloadMessage(tab), {
      tab.addEventListener(
        "SSTabRestoring",
        () => tab.linkedBrowser.browsingContext.reload(reloadFlags),
        {
          once: true,
      });
        }
      );
      gBrowser._insertBrowser(tab);
    }
  }
@@ -3510,13 +3522,6 @@ function BrowserReloadWithFlags(reloadFlags) {
    });
  }

  function sendReloadMessage(tab) {
    tab.linkedBrowser.sendMessageToActor(
      "Browser:Reload",
      { flags: reloadFlags, handlingUserInput },
      "BrowserTab"
    );
  }
}

// TODO: can we pull getPEMString in from pippki.js instead of
+1 −2
Original line number Diff line number Diff line
@@ -268,8 +268,7 @@ interface nsISHistory: nsISupports
  [noscript, notxpcom]
  void RemoveFrameEntries(in nsISHEntry aEntry);

  [noscript]
  void Reload(in unsigned long aReloadFlags);
  void reload(in unsigned long aReloadFlags);

  [notxpcom] void EnsureCorrectEntryAtCurrIndex(in nsISHEntry aEntry);