From 0517636d52bcbe3de70f0da678dfdaf95c8d185f Mon Sep 17 00:00:00 2001 From: Andrea Scarpino Date: Mon, 8 Apr 2024 22:33:59 +0200 Subject: [PATCH 1/2] Tell the observer if the download is coming from a private tab --- jscomps/EmbedliteDownloadManager.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/jscomps/EmbedliteDownloadManager.js b/jscomps/EmbedliteDownloadManager.js index 4c6c289..828730a 100644 --- a/jscomps/EmbedliteDownloadManager.js +++ b/jscomps/EmbedliteDownloadManager.js @@ -15,6 +15,7 @@ const Cu = Components.utils; const Cr = Components.results; const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); +const { PrivateBrowsingUtils } = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Downloads", "resource://gre/modules/Downloads.jsm"); @@ -78,6 +79,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-done", id: download.id, + privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, saveAsPdf: download.saveAsPdf || false, targetPath: download.target.path })); @@ -89,6 +91,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-fail", id: download.id, + privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, saveAsPdf: download.saveAsPdf || false })); } @@ -98,6 +101,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-cancel", id: download.id, + privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, saveAsPdf: download.saveAsPdf || false })); } From 8a17fd0de8e7d55d87e6c6152af64357cde546ae Mon Sep 17 00:00:00 2001 From: Andrea Scarpino Date: Tue, 14 May 2024 22:36:57 +0200 Subject: [PATCH 2/2] Suggestions --- jscomps/EmbedliteDownloadManager.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/jscomps/EmbedliteDownloadManager.js b/jscomps/EmbedliteDownloadManager.js index 828730a..9e0fa67 100644 --- a/jscomps/EmbedliteDownloadManager.js +++ b/jscomps/EmbedliteDownloadManager.js @@ -15,7 +15,6 @@ const Cu = Components.utils; const Cr = Components.results; const { XPCOMUtils } = ChromeUtils.import("resource://gre/modules/XPCOMUtils.jsm"); -const { PrivateBrowsingUtils } = ChromeUtils.import("resource://gre/modules/PrivateBrowsingUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Downloads", "resource://gre/modules/Downloads.jsm"); @@ -56,6 +55,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-start", id: this.counter, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, displayName: download.target.path.split('/').slice(-1)[0], sourceUrl: download.source.url, @@ -69,6 +69,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-progress", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, percent: download.progress })); @@ -79,7 +80,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-done", id: download.id, - privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, targetPath: download.target.path })); @@ -91,7 +92,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-fail", id: download.id, - privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false })); } @@ -101,7 +102,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-cancel", id: download.id, - privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false })); } @@ -113,6 +114,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-progress", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, percent: download.progress })); @@ -124,6 +126,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-done", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, targetPath: download.target.path })); @@ -136,6 +139,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-fail", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false })); } @@ -146,6 +150,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-cancel", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false })); } @@ -156,6 +161,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-start", id: download.id, + privateMode: download.source.isPrivate || false, saveAsPdf: download.saveAsPdf || false, displayName: download.target.path.split('/').slice(-1)[0], sourceUrl: download.source.url,