[tor-commits] [Git][tpo/applications/tor-browser][tor-browser-102.9.0esr-12.5-1] fixup! Bug 40926: Implemented the New Identity feature
Pier Angelo Vendrame (@pierov)
git at gitlab.torproject.org
Tue Apr 4 06:48:54 UTC 2023
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:
- browser/components/newidentity/content/newidentity.js
Changes:
=====================================
browser/components/newidentity/content/newidentity.js
=====================================
@@ -57,6 +57,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
);
const consoleOptions = {
maxLogLevel: "info",
+ maxLogLevelPref: "browser.new_identity.log_level",
prefix: "NewIdentity",
};
return new ConsoleAPI(consoleOptions);
@@ -68,12 +69,11 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
class NewIdentityImpl {
async run() {
- logger.debug("Disabling JS");
this.disableAllJS();
await this.clearState();
- this.broadcast();
- this.openNewWindow();
+ await this.openNewWindow();
this.closeOldWindow();
+ this.broadcast();
}
// Disable JS (as a defense-in-depth measure)
@@ -389,7 +389,7 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
logger.info("Calling the clearDataService");
const flags =
Services.clearData.CLEAR_ALL ^ Services.clearData.CLEAR_PASSWORDS;
- return new Promise((resolve, reject) => {
+ return new Promise(resolve => {
Services.clearData.deleteData(flags, {
onDataDeleted(code) {
if (code !== Cr.NS_OK) {
@@ -425,11 +425,16 @@ XPCOMUtils.defineLazyGetter(this, "NewIdentityButton", () => {
openNewWindow() {
logger.info("Opening a new window");
- // Open a new window with the default homepage
- // We could pass {private: true} but we do not because we enforce
- // browser.privatebrowsing.autostart = true.
- // What about users that change settings?
- OpenBrowserWindow();
+ return new Promise(resolve => {
+ // Open a new window with the default homepage
+ // We could pass {private: true} but we do not because we enforce
+ // browser.privatebrowsing.autostart = true.
+ // What about users that change settings?
+ const win = OpenBrowserWindow();
+ // This mechanism to know when the new window is ready is used by
+ // OpenBrowserWindow itself (see its definition in browser.js).
+ win.addEventListener("MozAfterPaint", () => resolve(), { once: true });
+ });
}
closeOldWindow() {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d23d3f2cf3cc5cb1d9895108b67489314501dd20
--
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/d23d3f2cf3cc5cb1d9895108b67489314501dd20
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/tor-commits/attachments/20230404/2457342d/attachment-0001.htm>
More information about the tor-commits
mailing list