... |
... |
@@ -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() {
|