[tbb-commits] [Git][tpo/applications/mullvad-browser][mullvad-browser-115.16.0esr-13.5-1] Bug 1886222 - Start reload by calling reload in the parent....

ma1 (@ma1) git at gitlab.torproject.org
Wed Oct 16 12:47:45 UTC 2024



ma1 pushed to branch mullvad-browser-115.16.0esr-13.5-1 at The Tor Project / Applications / Mullvad Browser


Commits:
c893bf36 by Andreas Farre at 2024-10-16T14:46:55+02:00
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

- - - - -


3 changed files:

- browser/actors/BrowserTabChild.sys.mjs
- browser/base/content/browser.js
- docshell/shistory/nsISHistory.idl


Changes:

=====================================
browser/actors/BrowserTabChild.sys.mjs
=====================================
@@ -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;


=====================================
browser/base/content/browser.js
=====================================
@@ -3509,17 +3509,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), {
-        once: true,
-      });
+      tab.addEventListener(
+        "SSTabRestoring",
+        () => tab.linkedBrowser.browsingContext.reload(reloadFlags),
+        {
+          once: true,
+        }
+      );
       gBrowser._insertBrowser(tab);
     }
   }
@@ -3531,13 +3543,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


=====================================
docshell/shistory/nsISHistory.idl
=====================================
@@ -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);
 



View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/c893bf360a7a0d7b362b45e54ce57fa5471f295b

-- 
View it on GitLab: https://gitlab.torproject.org/tpo/applications/mullvad-browser/-/commit/c893bf360a7a0d7b362b45e54ce57fa5471f295b
You're receiving this email because of your account on gitlab.torproject.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.torproject.org/pipermail/tbb-commits/attachments/20241016/834665c4/attachment-0001.htm>


More information about the tbb-commits mailing list