[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser][base-browser-115.9.0esr-13.5-1] Bug 1886852 - Avoid registering unnecessary MessageManager listeners when SHIP is enabled, r=smaug!



Title: GitLab

ma1 pushed to branch base-browser-115.9.0esr-13.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • 8e8ac7a1
    by Nika Layzell at 2024-03-26T18:23:53+01:00
    Bug 1886852 - Avoid registering unnecessary MessageManager listeners when SHIP is enabled, r=smaug!
    
    Differential Revision: https://phabricator.services.mozilla.com/D205377

1 changed file:

Changes:

  • browser/components/sessionstore/SessionStore.sys.mjs
    ... ... @@ -1422,6 +1422,13 @@ var SessionStoreInternal = {
    1422 1422
        * and thus enables communication with OOP tabs.
    
    1423 1423
        */
    
    1424 1424
       receiveMessage(aMessage) {
    
    1425
    +    if (Services.appinfo.sessionHistoryInParent) {
    
    1426
    +      throw new Error(
    
    1427
    +        `received unexpected message '${aMessage.name}' with ` +
    
    1428
    +          `sessionHistoryInParent enabled`
    
    1429
    +      );
    
    1430
    +    }
    
    1431
    +
    
    1425 1432
         // If we got here, that means we're dealing with a frame message
    
    1426 1433
         // manager message, so the target will be a <xul:browser>.
    
    1427 1434
         var browser = aMessage.target;
    
    ... ... @@ -1600,14 +1607,14 @@ var SessionStoreInternal = {
    1600 1607
         // internal data about the window.
    
    1601 1608
         aWindow.__SSi = this._generateWindowID();
    
    1602 1609
     
    
    1603
    -    let mm = aWindow.getGroupMessageManager("browsers");
    
    1604
    -    MESSAGES.forEach(msg => {
    
    1605
    -      let listenWhenClosed = CLOSED_MESSAGES.has(msg);
    
    1606
    -      mm.addMessageListener(msg, this, listenWhenClosed);
    
    1607
    -    });
    
    1608
    -
    
    1609
    -    // Load the frame script after registering listeners.
    
    1610 1610
         if (!Services.appinfo.sessionHistoryInParent) {
    
    1611
    +      let mm = aWindow.getGroupMessageManager("browsers");
    
    1612
    +      MESSAGES.forEach(msg => {
    
    1613
    +        let listenWhenClosed = CLOSED_MESSAGES.has(msg);
    
    1614
    +        mm.addMessageListener(msg, this, listenWhenClosed);
    
    1615
    +      });
    
    1616
    +
    
    1617
    +      // Load the frame script after registering listeners.
    
    1611 1618
           mm.loadFrameScript(
    
    1612 1619
             "chrome://browser/content/content-sessionStore.js",
    
    1613 1620
             true,
    
    ... ... @@ -2083,8 +2090,10 @@ var SessionStoreInternal = {
    2083 2090
         // Cache the window state until it is completely gone.
    
    2084 2091
         DyingWindowCache.set(aWindow, winData);
    
    2085 2092
     
    
    2086
    -    let mm = aWindow.getGroupMessageManager("browsers");
    
    2087
    -    MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
    
    2093
    +    if (!Services.appinfo.sessionHistoryInParent) {
    
    2094
    +      let mm = aWindow.getGroupMessageManager("browsers");
    
    2095
    +      MESSAGES.forEach(msg => mm.removeMessageListener(msg, this));
    
    2096
    +    }
    
    2088 2097
     
    
    2089 2098
         this._saveableClosedWindowData.delete(winData);
    
    2090 2099
         delete aWindow.__SSi;
    

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits