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

[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-102.9.0esr-12.5-1] fixup! Bug 40926: Implemented the New Identity feature



Title: GitLab

Pier Angelo Vendrame pushed to branch tor-browser-102.9.0esr-12.5-1 at The Tor Project / Applications / Tor Browser

Commits:

  • d23d3f2c
    by Pier Angelo Vendrame at 2023-04-03T16:41:24+02:00
    fixup! Bug 40926: Implemented the New Identity feature
    
    Bug 41711: Wait for the new window when doing new identity
    

1 changed file:

Changes:

  • browser/components/newidentity/content/newidentity.js
    ... ... @@ -57,6 +57,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    57 57
         );
    
    58 58
         const consoleOptions = {
    
    59 59
           maxLogLevel: "info",
    
    60
    +      maxLogLevelPref: "browser.new_identity.log_level",
    
    60 61
           prefix: "NewIdentity",
    
    61 62
         };
    
    62 63
         return new ConsoleAPI(consoleOptions);
    
    ... ... @@ -68,12 +69,11 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    68 69
     
    
    69 70
       class NewIdentityImpl {
    
    70 71
         async run() {
    
    71
    -      logger.debug("Disabling JS");
    
    72 72
           this.disableAllJS();
    
    73 73
           await this.clearState();
    
    74
    -      this.broadcast();
    
    75
    -      this.openNewWindow();
    
    74
    +      await this.openNewWindow();
    
    76 75
           this.closeOldWindow();
    
    76
    +      this.broadcast();
    
    77 77
         }
    
    78 78
     
    
    79 79
         // Disable JS (as a defense-in-depth measure)
    
    ... ... @@ -389,7 +389,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    389 389
           logger.info("Calling the clearDataService");
    
    390 390
           const flags =
    
    391 391
             Services.clearData.CLEAR_ALL ^ Services.clearData.CLEAR_PASSWORDS;
    
    392
    -      return new Promise((resolve, reject) => {
    
    392
    +      return new Promise(resolve => {
    
    393 393
             Services.clearData.deleteData(flags, {
    
    394 394
               onDataDeleted(code) {
    
    395 395
                 if (code !== Cr.NS_OK) {
    
    ... ... @@ -425,11 +425,16 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
    425 425
     
    
    426 426
         openNewWindow() {
    
    427 427
           logger.info("Opening a new window");
    
    428
    -      // Open a new window with the default homepage
    
    429
    -      // We could pass {private: true} but we do not because we enforce
    
    430
    -      // browser.privatebrowsing.autostart = true.
    
    431
    -      // What about users that change settings?
    
    432
    -      OpenBrowserWindow();
    
    428
    +      return new Promise(resolve => {
    
    429
    +        // Open a new window with the default homepage
    
    430
    +        // We could pass {private: true} but we do not because we enforce
    
    431
    +        // browser.privatebrowsing.autostart = true.
    
    432
    +        // What about users that change settings?
    
    433
    +        const win = OpenBrowserWindow();
    
    434
    +        // This mechanism to know when the new window is ready is used by
    
    435
    +        // OpenBrowserWindow itself (see its definition in browser.js).
    
    436
    +        win.addEventListener("MozAfterPaint", () => resolve(), { once: true });
    
    437
    +      });
    
    433 438
         }
    
    434 439
     
    
    435 440
         closeOldWindow() {
    

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