Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions jscomps/EmbedliteDownloadManager.js
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Comment thread
ilpianista marked this conversation as resolved.
Outdated

XPCOMUtils.defineLazyModuleGetter(this, "Downloads",
"resource://gre/modules/Downloads.jsm");
Expand Down Expand Up @@ -78,6 +79,7 @@ let DownloadView = {
JSON.stringify({
msg: "dl-done",
id: download.id,
privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false,
Comment thread
ilpianista marked this conversation as resolved.
Outdated
saveAsPdf: download.saveAsPdf || false,
targetPath: download.target.path
}));
Expand All @@ -89,6 +91,7 @@ let DownloadView = {
JSON.stringify({
msg: "dl-fail",
id: download.id,
privateMode: PrivateBrowsingUtils.isContentWindowPrivate(Services.ww.activeWindow) || false,
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When downloading normally without pausing / cancelling and continuing download these "embed:download" notifies inside onDownloadAdded should not trigger.

In normal scenario onDownloadAdded gets called only once per download (first thing that happens). To report status changes you need to stringify download.source.isPrivate for each "embed:download" notifies of the onDownloadChanged (and onDownloadAdded). Simpler just to have it foreach "embed:download" message.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure I understood this, please have a look to my changes. Thanks!

saveAsPdf: download.saveAsPdf || false
}));
}
Expand All @@ -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
}));
}
Expand Down