diff --git a/jscomps/EmbedliteDownloadManager.js b/jscomps/EmbedliteDownloadManager.js index 4c6c289..87d9dcb 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"); @@ -51,10 +52,13 @@ let DownloadView = { stopped: download.stopped }; + let isPrivate = PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false; + Services.obs.notifyObservers(null, "embed:download", JSON.stringify({ msg: "dl-start", id: this.counter, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, displayName: download.target.path.split('/').slice(-1)[0], sourceUrl: download.source.url, @@ -68,6 +72,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-progress", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, percent: download.progress })); @@ -78,6 +83,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-done", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, targetPath: download.target.path })); @@ -89,6 +95,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-fail", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false })); } @@ -98,17 +105,20 @@ let DownloadView = { JSON.stringify({ msg: "dl-cancel", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false })); } }, onDownloadChanged: function(download) { + let isPrivate = PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false; if (download.prevState.progress !== download.progress) { Services.obs.notifyObservers(null, "embed:download", JSON.stringify({ msg: "dl-progress", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, percent: download.progress })); @@ -120,6 +130,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-done", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, targetPath: download.target.path })); @@ -132,6 +143,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-fail", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false })); } @@ -142,6 +154,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-cancel", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false })); } @@ -152,6 +165,7 @@ let DownloadView = { JSON.stringify({ msg: "dl-start", id: download.id, + privateMode: isPrivate, saveAsPdf: download.saveAsPdf || false, displayName: download.target.path.split('/').slice(-1)[0], sourceUrl: download.source.url,