Closed Bug 474060 Opened 11 years ago Closed 10 years ago

Show download progress in app icon in Windows 7 taskbar

Categories

(Toolkit :: Downloads API, defect)

x86
Windows 7
defect
Not set

Tracking

()

VERIFIED FIXED
mozilla1.9.3a4

People

(Reporter: Mardak, Assigned: rain1)

References

(Depends on 1 open bug, Blocks 2 open bugs, )

Details

Attachments

(8 files, 28 obsolete files)

23.57 KB, image/png
Details
51.38 KB, image/png
Details
40.27 KB, image/png
Details
37.68 KB, image/png
Details
33.45 KB, image/png
Details
22.75 KB, patch
jimm
: review+
rain1
: review+
Details | Diff | Splinter Review
22.75 KB, patch
Details | Diff | Splinter Review
32.83 KB, patch
Felipe
: review+
Details | Diff | Splinter Review
This might be Firefox specific depending on how APIs work. If we can just overlay over the app's icon independent of the actual icon, it could work from here.

Depending on how much space there is, we could track multiple files or just show an overall progress.
For progress, there is ITaskbarList3::SetProgressState and ITaskbarList3::SetProgressValue

If we want an overlay icon, then there ITaskbarList3::SetOverlayIcon which requires an HICON. I'm not sure if we have convenience functions to generate an HICON so this would require more work than the progress.
I hacked together an elementary extension to display the download status. It requires the Win7 SDK to build (so I'm keeping it an extension for now), but I'd like to get it in to the core code when Mozilla officially switches to the Windows 7 SDK.
Taking
Assignee: nobody → sid.bugzilla
Feel free to post a patch - I'll do what I can to help make sure this lands.
This adds a new interface and component, nsIWindowsTaskbarProgressService/nsWindowsTaskbarProgressService. I'm still open to other names -- I want to drop the Service at the end, but I'm not sure of toolkit naming policy.

The service is basially just a wrapper around the relevant functions in the ITaskbarList3 API. More functions could possibly be exposed, but I'm not convinced this is the place to do it.

GetHWND is taken mostly from <https://developer.mozilla.org/Talk:En/Code_snippets/Finding_Window_Handles> -- I don't have much of an idea about this code, and nothing else I tried worked.
Attachment #358167 - Attachment is obsolete: true
Attachment #358168 - Flags: review?(sdwilsh)
Attachment #358168 - Attachment description: Part 1: v1.01 (licenses fixed) → Part 1: v1.01 (license blocks fixed)
Oh, and there are no SDK checks here, as it isn't clear how that'll pan out.
Attached patch Part 1, v1.02: small fix (obsolete) — Splinter Review
According to the docs, HrInit() is supposed to be the first thing called.
Attachment #358168 - Attachment is obsolete: true
Attachment #358171 - Flags: review?(sdwilsh)
Attachment #358168 - Flags: review?(sdwilsh)
It almost feels like this should live in windows widget code to be honest.
Comment on attachment 358171 [details] [diff] [review]
Part 1, v1.02: small fix

And I don't know windows code at all, so let's have jimm take a look at this.
Attachment #358171 - Flags: review?(sdwilsh) → review?(jmathies)
Independent of this patch, we have some issues that need to be worked out. We haven't upgraded the build to support the new sdk (which is still in beta). I doubt we'll move to that until after the final comes out. For the vista sdk, we have a flag for stripping out vista related code, but that was implemented after we switched to the vista sdk officially. So I'm guessing we'll need some sort of temporary flag that turns code like this off. Then we can switch that out later to a flag similar to the vista flag once we embrace the newer sdk.
I need to chat with some people to figure out what we'll do. I'll split out some bugs once we figure it out and post back here. This patch will likely needs some changes to support whatever we do.
Well be waiting on the new NTDDI_VERSION selection build changes to get landed. (See bug 472093 for details.) At which point we'll need to wrap this code in an appropriate ifdef block.
I wrote an extension to display download progress in the dock icon in Mac OS X: https://addons.mozilla.org/en-US/firefox/addon/10485/ . On OS X we have to draw the progress bar ourselves, rather than just SetProgressValue and let the OS do it. Is there any functionality that's worth abstracting into a common component?
So, the listener should exist separate from the download window, and update the taskbar item for the download window if it's open, and another window (possibly activeWindow or frontmost window?) if it isn't.

I think the best option is to make the listener a JS XPCOM component in toolkit/mozapps/downloads/, and have it register with the category manager at startup.
What if multiple requests to display a progress bar? Perhaps addons update, app update, file download? Would they register with the interface instead of having each component decide if they're allowed to set a progress?
(In reply to comment #15)
> I think the best option is to make the listener a JS XPCOM component in
> toolkit/mozapps/downloads/, and have it register with the category manager at
> startup.
That'll hurt perf.  Right now in the browser we do a delayed start (15 seconds after delayed-startup if I recall correctly).
(In reply to comment #16)
> What if multiple requests to display a progress bar? Perhaps addons update, app
> update, file download? Would they register with the interface instead of having
> each component decide if they're allowed to set a progress?

Well, if we decide to handle all of it at one place, it becomes significantly more complicated. :)

What do you think of this?
- File download progress shows up in the taskbar even if the downloads window is closed.
- Addon/app update sets the taskbar progress only for its window, and only if the window's open -- so it gets handled separately.

(In reply to comment #17)
> That'll hurt perf.  Right now in the browser we do a delayed start (15 seconds
> after delayed-startup if I recall correctly).

I see. The component should really be loaded the first time a download is started or resumed, but I can't come up with a good way to do this, other than initializing it somewhere in nsDownloadManager.cpp (like what's done with the UI right now). Is that fine?
http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#6764 would be the right place to put the taskbar stuff.  It's the same code that powers the status bar download meter.
(In reply to comment #19)
> http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#6764
> would be the right place to put the taskbar stuff.  It's the same code that
> powers the status bar download meter.

That sounds great. Since this needs to be independent of browser windows, how about a module, which we Cu.import inside the function at <http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#1342> ?
The logic here is to display a "downloading" state, i.e. Normal, whenever at least one download is going on, and to display a "paused" state whenever all downloads are paused. The "downloading" state is always shown, whether the download manager UI is open or not, while other states (e.g. paused) are shown only when the download manager is open.

Tested cases:
- no downloads previously active, download is started, download manager window opens (both before and after delayed startup)
- downloads auto-resume at startup
- download manager window is manually opened (before and after delayed startup)

Still to work out:
- before delayed startup, download started, download manager UI doesn't open -- the progress doesn't show up then, but neither does the taskbar panel

Perf-wise this shouldn't be an issue, since the module is always loaded after the first time the download manager is initialized.
Depends on: 472093
Comment on attachment 358171 [details] [diff] [review]
Part 1, v1.02: small fix

Removing request, waiting on compat. with bug 472093.
Attachment #358171 - Flags: review?(jmathies)
widget/ is probably a better place for this. This code also uses MOZ_WINSDK_TARGETVER now to indicate that it needs the Windows 7 SDK to build.
Attachment #358171 - Attachment is obsolete: true
Attached patch Part 1, v1.51 -- small fix (obsolete) — Splinter Review
needed to wrap one more bit inside a MOZ_NTDDI_WIN7
Attachment #374528 - Attachment is obsolete: true
Attachment #374529 - Flags: review?(jmathies)
Attachment #374529 - Flags: superreview?(emaijala)
This is on top of the NTDDI and taskbar progress service patches.

I've tested it on both Windows 7 and XP, and it looks like it works fine in Win7, and doesn't negatively affect XP.
Attachment #359293 - Attachment is obsolete: true
Attachment #375464 - Flags: review?(jmathies)
Comment on attachment 374529 [details] [diff] [review]
Part 1, v1.51 -- small fix

Sorry, I'm not a super-reviewer.
Attachment #374529 - Flags: superreview?(emaijala) → superreview-
Comment on attachment 374529 [details] [diff] [review]
Part 1, v1.51 -- small fix

Oops, sorry, Ere.
Attachment #374529 - Flags: superreview- → superreview?(vladimir)
Attached patch Part 1, fixed bitrot (obsolete) — Splinter Review
Attachment #374529 - Attachment is obsolete: true
Attachment #375583 - Flags: superreview?(vladimir)
Attachment #375583 - Flags: review?(jmathies)
Attachment #374529 - Flags: superreview?(vladimir)
Attachment #374529 - Flags: review?(jmathies)
Comment on attachment 375583 [details] [diff] [review]
Part 1, fixed bitrot

This looks really clean. Do we really have to jump through all those hoops just to get the HWND of a dom window? That seemed pretty crazy.
Attachment #375583 - Flags: review?(jmathies) → review+
(In reply to comment #29)
> (From update of attachment 375583 [details] [diff] [review])
> Do we really have to jump through all those hoops just
> to get the HWND of a dom window? That seemed pretty crazy.

As far as I can tell, yes. :(

That code's essentially taken from <https://developer.mozilla.org/Talk:En/Code_snippets/Finding_Window_Handles>. I asked plasticmillion if he had found a better way or had written an API to do this, and he said no.
Comment on attachment 375464 [details] [diff] [review]
Part 2: taskbar progress module, v1.0

I'm not the right reviewer for this, you should choose someone from the browser module owners list.

http://www.mozilla.org/owners.html#firefox
Attachment #375464 - Flags: review?(jmathies)
Comment on attachment 375464 [details] [diff] [review]
Part 2: taskbar progress module, v1.0

Requesting review from vlad for browser changes and sdwilsh for toolkit changes.

Shawn, as mentioned in comment 21, an invariant maintained in the code is that the module is always initialized only after the download manager is.
Attachment #375464 - Flags: review?(vladimir)
Attachment #375464 - Flags: review?(sdwilsh)
Comment on attachment 375464 [details] [diff] [review]
Part 2: taskbar progress module, v1.0

Hrm.  Two comments:

1) Why do we Cu.import DownloadTaskbarProgress.js in downloads.js?  Even with the browser import, we'll have a DownloadTaskbarProgress per window -- that seems wrong, given that the code there transfers the progress to the next available window.  This seems like it really wants to be a service component.

2) Do we have to actually add load listeners on all windows?  The only two window types that make sense to care about are toplevel browser windows and the download manager.  Let's just decorate their init code -- the download manager can take the taskbar progress on open, give it away on close; the browser can check if another window has it, and if not, take the taskbar progress.
(In reply to comment #33)
> 1) Why do we Cu.import DownloadTaskbarProgress.js in downloads.js?  Even with
> the browser import, we'll have a DownloadTaskbarProgress per window -- that
> seems wrong, given that the code there transfers the progress to the next
> available window.  This seems like it really wants to be a service component.
Cu.import gets the same instance if it's already been imported somewhere else, so it is a service.  See https://developer.mozilla.org/en/Components.utils.import#Difference_from_mozIJSSubScriptLoader for more details.  (unless I misunderstand what you are asking)
(In reply to comment #33)
> 
> 2) Do we have to actually add load listeners on all windows?  The only two
> window types that make sense to care about are toplevel browser windows and the
> download manager.  Let's just decorate their init code -- the download manager
> can take the taskbar progress on open, give it away on close; the browser can
> check if another window has it, and if not, take the taskbar progress.

Yes, that makes sense.
(In reply to comment #34)
> Cu.import gets the same instance if it's already been imported somewhere else,
> so it is a service.

Ah, I didn't know that -- ok, ignore issue #1 :)
Comment on attachment 375464 [details] [diff] [review]
Part 2: taskbar progress module, v1.0

global nit: javadoc style comments on all methods you are adding please.
global nit: all pArameters should be prefixed with an a

>+++ b/toolkit/mozapps/downloads/content/downloads.js
>@@ -53,16 +53,25 @@ const nsLocalFile = Components.Construct
>                                            "nsILocalFile", "initWithPath");
> 
> var Cc = Components.classes;
> var Ci = Components.interfaces;
> let Cu = Components.utils;
> Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> Cu.import("resource://gre/modules/DownloadUtils.jsm");
> Cu.import("resource://gre/modules/PluralForm.jsm");
>+#ifdef XP_WIN
>+// Do this at load with a timeout, so that the window is drawn correctly
>+// initially
>+window.addEventListener("load", function () {
>+  window.setTimeout(function () {
>+    Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm");
>+  }, 1);
>+}, false);
>+#endif
do we really want this for both the browser window and the download window to do this?  This should get UI review.

>+++ b/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm
>+ * The Initial Developer of the Original Code is
>+ *  Siddharth Agarwal <sid.bugzilla@gmail.com>
nit: no indent for your name

>+  /// Reference to the download manager
>+  _downloadManager: null,
we usually use dm for the download manager everywhere else, so I'd like to keep with that consistency

>+  /// Initialize, register ourselves as a download progress listener
>+  _init: function download_taskbar_progress_init()
>+  {
>+    // We throw and bail out at this point if the service isn't available
>+    try {
>+      this._taskbarProgress = Cc["@mozilla.org/taskbar-progress-service;1"]
>+                                .getService(Ci.nsITaskbarProgressServiceWin);
>+    }
>+    catch (e) { return; }
new line for the return, and a comment why we are returning please

>+    let observerService = Cc["@mozilla.org/observer-service;1"]
>+                            .getService(Ci.nsIObserverService);
This isn't the right format here.  You want
let observerService = Cc["@mozilla.org/observer-service;1"].
                      getService(Ci.nsIObserverService);
This applies globally.

>+  _updateTaskbar: function download_taskbar_update_taskbar(window,
>+                                                           isDownloadManager)

>+    if (isDownloadManager || (!isDownloadManager && this._taskbarState ==
>+                              this._taskbarProgress.Normal))
>+    {
This brace should be the same line as the closing paren

>+    // CLear any state otherwise
nit: typo

>+    else
>+      this._clearTaskbar(window);
nit: if any part of the if block needs a brace, all parts should be braced please

>+      if (windows.hasMoreElements())
>+      {
nit: brace on previous line

>+      // Enumerate all active downloads
>+      let downloads = this._downloadManager.activeDownloads;
>+      while (downloads.hasMoreElements())
>+      {
>+        let download = downloads.getNext().QueryInterface(Ci.nsIDownload);
>+        // Only set values if we actually know the download size
>+        if (download.percentComplete < 100 && download.size > 0)
>+        {
>+          totalSize += download.size;
>+          totalTransferred += download.amountTransferred;
>+        }
>+        // We might need to display a paused state, so track this
>+        if (download.state == this._downloadManager.DOWNLOAD_PAUSED)
>+          numPaused++;
>+      }
>+
>+      // If all downloads are paused, show the progress as paused, unless we
>+      // don't have any information about sizes, in which case we don't
>+      // display anything
>+      if (numActive == numPaused)
>+      {
>+        if (totalSize == 0)
>+          this._taskbarState = this._taskbarProgress.NoProgress;
>+        else
>+          this._taskbarState = this._taskbarProgress.Paused;
>+      }
>+      // If at least one download is not paused, and we don't have any
>+      // information about download sizes, display an indeterminate indicator
>+      else if (totalSize == 0)
>+        this._taskbarState = this._taskbarProgress.Indeterminate;
>+      // Otherwise display a normal progress bar
>+      else
>+        this._taskbarState = this._taskbarProgress.Normal;
>+    }
>+
>+    this._totalSize = totalSize;
>+    this._totalTransferred = totalTransferred;
>+    this._updateTaskbar(this._activeWindow, this._activeWindow.__DT_isDM);
Is this the same logic in downloads.js?  If so, we should abstract that out into a JSM as well.
Attachment #375464 - Flags: review?(sdwilsh) → review-
For parity with IE, this really should land on 1.9.1 for win7. If it's not blocking, it should be wanted at least.
Flags: blocking1.9.1?
Yup, you know the drill; get it on trunk and show me a safe patch (with tests, if possible, or litmus test descriptions if not) and we'll consider it for approval when you mark the patch approval-1.9.1?
Flags: wanted1.9.1+
Flags: blocking1.9.1?
Flags: blocking1.9.1-
Updates coming per comments from Vlad and Shawn Sid? I was hoping to apply this locally and see how it works now that we're past the RC.

Also, I'm curious, how does Win7 handle the display with grouped windows on the superbar and multiple windows are downloading content?
(In reply to comment #40)
> Updates coming per comments from Vlad and Shawn Sid? I was hoping to apply this
> locally and see how it works now that we're past the RC.

Sorry, I've been very busy lately and haven't had any time at all. I'm interested in getting this in as well, and I'll see if I have time this weekend.

You can still apply both patches locally and play with it -- the comments look like they're mainly nits.

> 
> Also, I'm curious, how does Win7 handle the display with grouped windows on the
> superbar and multiple windows are downloading content?

Described at <http://msdn.microsoft.com/en-us/library/dd391697%28VS.85%29.aspx>, in "How the Taskbar Button Chooses the Progress Indicator for a Group".
(In reply to comment #33)
> 
> 2) Do we have to actually add load listeners on all windows?  The only two
> window types that make sense to care about are toplevel browser windows and the
> download manager.  Let's just decorate their init code -- the download manager
> can take the taskbar progress on open, give it away on close; the browser can
> check if another window has it, and if not, take the taskbar progress.

Done.

(In reply to comment #37)
> (From update of attachment 375464 [details] [diff] [review])

> do we really want this for both the browser window and the download window to
> do this?  This should get UI review.

OK, asking faaborg for UI review. The behaviour is described in the comments to _updateTaskbar and _updateStatus. Sorry, I can't provide try builds because the boxes don't have the Windows 7 SDK. I'll try uploading some custom builds somewhere within a few days.

> Is this the same logic in downloads.js?  If so, we should abstract that out
> into a JSM as well.

I could find two other places that enumerate through all downloads similarly: <http://mxr.mozilla.org/mozilla-central/source/browser/base/content/browser.js#6924> and <http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/content/downloads.js#383>. What they do within the loop looks like it's pretty different though. Do you think it's worth abstracting this out? I guess one way to do that would be to calculate and return everything for use as callers see fit.

I've fixed all the other nits.
Attachment #375464 - Attachment is obsolete: true
Attachment #383201 - Flags: ui-review?
Attachment #383201 - Flags: superreview?(vladimir)
Attachment #383201 - Flags: review?(sdwilsh)
Attachment #375464 - Flags: review?(vladimir)
Attachment #383201 - Flags: ui-review? → ui-review?(faaborg)
Comment on attachment 383201 [details] [diff] [review]
Part 2: taskbar progress module, v2.0

>+++ b/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm
>+  /**
>+   * Sets the active window, and whether it's the download window. This takes
>+   * care of clearing out the previous active window's taskbar item, updating
>+   * the taskbar, and setting an onunload listener.
>+   */
please describe what the parameters are for with java-doc style comments

>+  /**
>+   * Called when a browser window appears. This has an effect only when we
>+   * don't already have an active window.
>+   */
>+  onBrowserWindowLoad: function download_taskbar_on_browser_window_load(
>+                           aWindow)
ditto

>+  /**
>+   * Called when the download window appears. The download window will take
>+   * over as the active window.
>+   */
>+  onDownloadWindowLoad: function download_taskbar_on_download_window_load(
>+                             aWindow)
ditto

r=sdwilsh
Attachment #383201 - Flags: review?(sdwilsh) → review+
Comment on attachment 383201 [details] [diff] [review]
Part 2: taskbar progress module, v2.0

>--- a/toolkit/mozapps/downloads/content/downloads.js
>+++ b/toolkit/mozapps/downloads/content/downloads.js
>@@ -53,16 +53,27 @@ const nsLocalFile = Components.Construct
>                                            "nsILocalFile", "initWithPath");
> 
> var Cc = Components.classes;
> var Ci = Components.interfaces;
> let Cu = Components.utils;
> Cu.import("resource://gre/modules/XPCOMUtils.jsm");
> Cu.import("resource://gre/modules/DownloadUtils.jsm");
> Cu.import("resource://gre/modules/PluralForm.jsm");
>+#ifdef XP_WIN
>+// Do this at load with a timeout, so that the window is drawn correctly
>+// initially
>+window.addEventListener("load", function () {
>+  window.setTimeout(function () {
>+    Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm");
>+    if (DownloadTaskbarProgress)
>+      DownloadTaskbarProgress.onDownloadWindowLoad(window);
>+  }, 1);
>+}, false);
>+#endif

This is a hack. The Windows taskbar will send us a message when the button is ready and that's when we should do the initialization. As part of my Aero Peek implementation, I wrote an implementation of a taskbar interface that will listen for the event and fire an observable event when it happens (and let users query if it already happened). I will try to post a version of that to this bug so that the two existing patches can be rebased against it.
Attachment #383201 - Flags: review+ → review-
Sounds great. I was looking for such an event but couldn't find one in a cursory search.
Sid, can you mind basing your patch off of the taskbar interface in bug 501490? Jim Mathies is basing Jumplists off of that patch too.
Depends on: 501490
Would anyone object to moving this out of downloads and into a taskbar mozapps folder? The folder would serve as a general place for taskbar related code for all platforms. I've got a jumplist jsm that needs a place that fits, so I figured why not put everything related to taskbars together.
I think that for general purpose stuff, it makes sense to put it in a general spot, but I feel like specific stuff, like in this case downloads, should go with the code it is for.  The same applies to the tab preview stuff, which won't even live in toolkit because it is browser specific.
(In reply to comment #48)
> I think that for general purpose stuff, it makes sense to put it in a general
> spot, but I feel like specific stuff, like in this case downloads, should go
> with the code it is for.  The same applies to the tab preview stuff, which
> won't even live in toolkit because it is browser specific.

I really don't see it as tied to downloads really, taskbar progress can be more generic. For example I could see an email client using it to show the status of checking for new mail.
OK - fair.  We should have some generic code that helps with taskbar progress, but the download specific stuff should live with the download manager code.  Having something in toolkit that makes it easier to do the taskbar progress stuff would be a big win for the platform.
(In reply to comment #49)
> (In reply to comment #48)
> > I think that for general purpose stuff, it makes sense to put it in a general
> > spot, but I feel like specific stuff, like in this case downloads, should go
> > with the code it is for.  The same applies to the tab preview stuff, which
> > won't even live in toolkit because it is browser specific.
> 
> I really don't see it as tied to downloads really, taskbar progress can be more
> generic. For example I could see an email client using it to show the status of
> checking for new mail.

That generic code (part 1 of the fix, basically exposes the native API) is currently in widget/windows. Do you mean that I should move it out to toolkit?

I'm not sure any part of the download progress module can be generalized...
> That generic code (part 1 of the fix, basically exposes the native API) is
> currently in widget/windows. Do you mean that I should move it out to toolkit?
> 
> I'm not sure any part of the download progress module can be generalized...

No it's fine the way it is. Jump list need's for something in mozapps is diminishing anyway due to app specific strings and settings.
(In reply to comment #48)
> The same applies to the tab preview stuff, which
> won't even live in toolkit because it is browser specific.

Mail has tabs too, as well as SeaMonkey and Songbird. What makes you think it's browser-specific?
(In reply to comment #53)
> Mail has tabs too, as well as SeaMonkey and Songbird. What makes you think it's
> browser-specific?
Because they'll have to have a totally different implementation because tabbrowser.xml lives in browser, so they'll have something different as well.
I don't have a windows 7 box up and running at the moment.  To expedite the ui-review could you post screen shots of IE doing a similar notification, and the patch applied?
Alex, this is what IE looks like when it downloads a file in Windows 7. Also, for more info on taskbar usage see: http://msdn.microsoft.com/en-us/library/aa511446%28loband%29.aspx
Comment on attachment 383201 [details] [diff] [review]
Part 2: taskbar progress module, v2.0

Thanks for the details.  Approving under the assumption that we are just replicating the native platform behavior.  If that isn't the case, please post explaining the differences.

Also it will be useful to get this tested on trunk to get a sense of how it behaves.
Attachment #383201 - Flags: ui-review?(faaborg) → ui-review+
Comment on attachment 383201 [details] [diff] [review]
Part 2: taskbar progress module, v2.0

clearing review based on rob/jim's comments
Attachment #383201 - Flags: superreview?(vladimir)
Comment on attachment 375583 [details] [diff] [review]
Part 1, fixed bitrot

sr'ing this because I think it needs integration with the (bigger) aero peek patch
Attachment #375583 - Flags: superreview?(vladimir) → superreview-
I've basically followed the design of the taskbar preview patch here. Rob, Jim, Vlad, does this look fine?
Attachment #375583 - Attachment is obsolete: true
Attachment #398953 - Flags: superreview?(vladimir)
Attachment #398953 - Flags: review?(tellrob)
Attachment #398953 - Flags: review?(jmathies)
Attached patch Part 2, v3.0 (obsolete) — Splinter Review
This is on top of Part 1.

Alex: the UI here is slightly different from IE's. I'll attach screenshots in a bit.
Attachment #383201 - Attachment is obsolete: true
Attachment #398955 - Flags: ui-review?(faaborg)
Attachment #398955 - Flags: superreview?(vladimir)
Attachment #398955 - Flags: review?(sdwilsh)
oops
Attachment #398956 - Attachment is obsolete: true
Attachment #398957 - Attachment filename: b2ea5e8e1562[1].png_direct → b2ea5e8e1562[1].png
Attachment #398957 - Attachment mime type: application/octet-stream → image/png
IE doesn't have an equivalent to this, since for a download to happen there the download window must be open. So this patch shows downloads if they're in progress even if the download manager is closed...
...however, it doesn't show anything if the download window is closed and all downloads are currently paused.

Alex, what do you think?
(In the default configuration, the progress simply shows up on the icon.)
(In reply to comment #63)
> Created an attachment (id=398957) [details]
> actual screenshot for download in progress, download window open
> 
> oops

Sid, is that the console entry on the taskbar to the left of the download window, or is that the main window? Once the Jump Lists patch lands, all of these windows will be grouped together, so I'm curious how grouping will affect what you've done here based on the state of the download window.
(In reply to comment #68)
> (In reply to comment #63)
> > Created an attachment (id=398957) [details] [details]
> > actual screenshot for download in progress, download window open
> > 
> > oops
> 
> Sid, is that the console entry on the taskbar to the left of the download
> window, or is that the main window?

That's the main window.

> Once the Jump Lists patch lands, all of
> these windows will be grouped together, so I'm curious how grouping will affect
> what you've done here based on the state of the download window.

It shouldn't. The taskbar is in the "Never Combine" configuration in the screenshot. If the buttons are grouped (default configuration, "Always combine, hide labels"), the download status shows up on the icon, just like the IE screenshot posted earlier.
Comment on attachment 398955 [details] [diff] [review]
Part 2, v3.0

Looks good based on described behavior and screen shots.  I'll file follow up bugs if anything doesn't seem right after having a chance to try this out for awhile.
Attachment #398955 - Flags: ui-review?(faaborg) → ui-review+
Comment on attachment 398955 [details] [diff] [review]
Part 2, v3.0

Most nits, but I'm r- because I'd like to run through it again.  I'm also concerned that we have a lot of private methods that can easily be accessed by outside objects that import this.  I'd prefer if they were global objects/functions in the file that were not exported.  For more detailed review comments, please see http://reviews.visophyte.org/r/398955/

on file: toolkit/mozapps/downloads/content/downloads.js line 62
> #ifdef XP_WIN
> window.addEventListener("load", function () {
>   Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm");
>   if (DownloadTaskbarProgress)
>     DownloadTaskbarProgress.onDownloadWindowLoad(window);
> }, false);
> #endif

This would be better to do in the Startup method.


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 1
> /* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
> /* ***** BEGIN LICENSE BLOCK *****

/* -*- Mode: JavaScript; tab-width: 2; indent-tabs-mode: nil; c-basic-offset:
2 -*-
 * vim: sw=2 ts=2 sts=2 et filetype=javascript
 * ***** BEGIN LICENSE BLOCK *****
please


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 38
> var EXPORTED_SYMBOLS = [ "DownloadTaskbarProgress" ];

nit: format like this please:
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/NetUtil.jsm#41


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 40
> const Cc = Components.classes;
> const Ci = Components.interfaces;
> 
> const kTaskbarID = "@mozilla.org/windows-taskbar;1";

nit: add a heading for constants like this please:
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/NetUtil.jsm#49


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 45
> var DownloadTaskbarProgress =

nit: ditto on heading comment


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 47
>   /// Reference to the taskbar

global nit: only two / for inline comments like this please


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 57
>   get _observerService() {
>     let observerService = Cc["@mozilla.org/observer-service;1"].
>                           getService(Ci.nsIObserverService);
>     this.__defineGetter__("_observerService", function() observerService);
>     return this._observerService;
>   },

nit: please use XPCOMUtils.generateLazyServiceGetter like
http://mxr.mozilla.org/mozilla-central/source/netwerk/base/src/NetUtil.jsm#155


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 64
>   /// Initialize and register ourselves as a download progress listener

nit: real javadoc style comments please (globally)


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 145
>       let docShell = aWindow.QueryInterface(Ci.nsIInterfaceRequestor).
>                        getInterface(Ci.nsIWebNavigation).
>                        QueryInterface(Ci.nsIDocShellTreeItem).treeOwner.
>                        QueryInterface(Ci.nsIInterfaceRequestor).
>                        getInterface(Ci.nsIXULWindow).docShell;

It's a shame we don't have some utility method to get the docshell :/


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 279
>   /**
>    * We observe the taskbar button becoming ready to receive progress
>    * notifications
>    */
>   observe: function download_taskbar_observe(aSubject, aTopic, aData)
>   {
>     if (aTopic == "windows-taskbar") {
>       this._observerService.removeObserver(this, aTopic);
>       this._onReady();
>     }
>   },

prefix this bit with an nsIObserver heading please since it is implementing
that (goes the same for other interfaces as well)


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 291
>   /**
>    * Called when a browser window appears. This has an effect only when we
>    * don't already have an active window.
>    */
>   onBrowserWindowLoad: function download_taskbar_on_browser_window_load(
>                            aWindow)
>   {
>     if (!this._setActiveWindowArgs && !this._activeTaskbarProgress)
>       this._setActiveWindow(aWindow, false);
>   },
> 
>   /**
>    * Called when the download window appears. The download window will take
>    * over as the active window.
>    */
>   onDownloadWindowLoad: function download_taskbar_on_download_window_load(
>                              aWindow)
>   {
>     this._setActiveWindow(aWindow, true);
>   },

These are the public API methods, yes?  I'd prefer them to be up top.


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 320
>    * @param aTaskbarProgress The taskbar progress for the window that is being
>    *                         unloaded

global formatting nit:
@param aTaskbarProgress
       The taskbar progress...


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 323
>   _onActiveWindowUnload: function download_taskbar_on_active_window_unload(

in general, our format for named functions would result in this instead:
DTP_onActiveWindowUnload
this has the benefit of having the same name (when doing a search) as the
property, so the mapping is clearer.


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 341
>   onProgressChange: function()

nit: use a named function


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 348
>   onDownloadStateChange: function()

nit: use a named function


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 359
> // Initialize the module

nit: use a heading-style comment
Attachment #398955 - Flags: review?(sdwilsh) → review-
Comment on attachment 398953 [details] [diff] [review]
Part 1, now on top of the taskbar preview patch

>+  /**
>+   * Sets the taskbar progress state and value for this window. The currentValue
>+   * and maxValue parameters are optional and should be supplied when |state| is
>+   * one of kNormal, kError or kPaused.
>+   *
>+   * @throws NS_ERROR_ILLEGAL_VALUE if state is kNoProgress or kIndeterminate,
>+   *                                and currentValue and maxValue are both not 0.
>+   */
>+  void setProgressState(in nsTaskbarProgressState state,
>+                        [optional] in unsigned long long currentValue,
>+                        [optional] in unsigned long long maxValue);
>+};

Do the paused or error states need the current/max values? The underlying API doesn't seem to even use them (of course I'm just reading the docs - maybe it does). It doesn't make sense to me to have to provide the progress amounts when I pause or error.

>+
>+// Defined in dwmapi in a header that needs a higher numbered _WINNT #define
>+#define DWM_SIT_DISPLAYFRAME 0x1

Copy & paste? This doesn't belong here.

A good chunk of the rest of the patch strikes me as being very similar to my Taskbar*Preview classes. I think we would save a good chunk of code if TaskbarProgress wasn't separate since it's essentially parallel to the WindowPreviewClass in terms of data structure (weak ptr from nsWindow) and most of the behavior. I'm not sure that we need a new interface either - nsITaskbarProgress could be merged into nsITaskbarWindowPreview.
Attachment #398953 - Flags: review?(tellrob) → review-
> Do the paused or error states need the current/max values? The underlying API
> doesn't seem to even use them (of course I'm just reading the docs - maybe it
> does). It doesn't make sense to me to have to provide the progress amounts when
> I pause or error.

Pause and error show a determinate progress, so the underlying API does need a value.

> 
> >+
> >+// Defined in dwmapi in a header that needs a higher numbered _WINNT #define
> >+#define DWM_SIT_DISPLAYFRAME 0x1
> 
> Copy & paste? This doesn't belong here.

Oops. Fixed.

> 
> A good chunk of the rest of the patch strikes me as being very similar to my
> Taskbar*Preview classes. I think we would save a good chunk of code if
> TaskbarProgress wasn't separate since it's essentially parallel to the
> WindowPreviewClass in terms of data structure (weak ptr from nsWindow) and most
> of the behavior. I'm not sure that we need a new interface either -
> nsITaskbarProgress could be merged into nsITaskbarWindowPreview.

Would we call the combined interface something different then?
(In reply to comment #73)

> > 
> > A good chunk of the rest of the patch strikes me as being very similar to my
> > Taskbar*Preview classes. I think we would save a good chunk of code if
> > TaskbarProgress wasn't separate since it's essentially parallel to the
> > WindowPreviewClass in terms of data structure (weak ptr from nsWindow) and most
> > of the behavior. I'm not sure that we need a new interface either -
> > nsITaskbarProgress could be merged into nsITaskbarWindowPreview.
> 
> Would we call the combined interface something different then?

nsITaskbarWindow?
I thought about that but nsITaskbarWindowPreview still works - showing download progress on the taskbar is a preview of the window contents.
Wouldn't nsITaskbarPreview (without the Window part) do just as well?
No, there are also tab previews (nsITaskbarTabPreview) on Windows 7. See bug 501490. Tab previews cannot have progress shown on them (taskbar ui choice).
(In reply to comment #75)
> I thought about that but nsITaskbarWindowPreview still works - showing download
> progress on the taskbar is a preview of the window contents.

Could we still avoid extra code chunks and have it inherit?

nsITaskbarPreview
 - nsITaskbarTabPreview
 - nsITaskbarWindowPreview
 - nsITaskbarProgress

I think the progress is app global, so associating it with a particular window might not make sense.
The actual API is per window. What you see in the taskbar actually depends on your taskbar settings. If you have the old one-taskbar-item-per-window setting, then you can see a different progress bar on each window. The default setting (one icon per app) combines them via some formula I think.

We could have TaskbarWindowPreview implement a separate interface, sure. I'm not sure if that's valuable unless we think that some other platform might have an implementation (presumably w/o the other nsITaskbarWindowPreview bits).
Attached patch Part 2, v4.0 (obsolete) — Splinter Review
Addressed most of sdwilsh's comments except for /// on non-function properties, since they're parse-able by doxygen.
Attachment #398955 - Attachment is obsolete: true
Attachment #399988 - Flags: superreview?(vladimir)
Attachment #399988 - Flags: review?(sdwilsh)
Attachment #398955 - Flags: superreview?(vladimir)
(In reply to comment #79)
> I'm
> not sure if that's valuable unless we think that some other platform might have
> an implementation

There was talk about a mac implementation earlier in the thread, comment 14. I think I like Jim's idea of the same component implementing multiple interfaces.
Attachment #399988 - Flags: review?(sdwilsh) → review+
Comment on attachment 399988 [details] [diff] [review]
Part 2, v4.0

http://reviews.visophyte.org/r/399988/

on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 158
>    *        The window to set as active

global nit: period at end of sentence please.


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 225
>     if (this._activeWindowIsDownloadWindow || (this._taskbarState ==
>         Ci.nsITaskbarProgress.kNormal))
>       this._activeTaskbarProgress.setProgressState(this._taskbarState,
>                                                    this._totalTransferred,
>                                                    this._totalSize);
>     // Clear any state otherwise
>     else
>       this._clearTaskbar();

please use braces here and have the second condition of the or on its own line
please


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 243
>     if (this._activeTaskbarProgress)
>       this._activeTaskbarProgress.setProgressState(
>         Ci.nsITaskbarProgress.kNoProgress);

Please use braces here too. In general, even if it's only one "line" of code
but spans multiple numbered lines, please use braces.


on file: toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm line 344
>   /* nsIObserver */

nit: like this please
http://mxr.mozilla.org/mozilla-central/source/toolkit/components/downloads/src/nsDownloadManagerUI.js#58

r=sdwilsh
Flags: blocking1.9.2?
Flags: blocking1.9.2? → blocking1.9.2+
Rob's going to look a bit closer at the window preview implementation by the end of this week -- specifically, the part about controllers.
Priority: -- → P1
Attachment #398953 - Flags: superreview?(vladimir)
Attachment #398953 - Flags: review?(jmathies)
Attachment #399988 - Flags: superreview?(vladimir) → superreview+
But is this bug basically done with that patch, or is there more to do? Wondering if we can get an ETA on resolution of this bug so I can build a beta schedule.
(In reply to comment #84)
> But is this bug basically done with that patch, or is there more to do?
> Wondering if we can get an ETA on resolution of this bug so I can build a beta
> schedule.

Yes, it's done once part 1 gets reviews. Rob or Jim, could you make a call here? 

Looking at the code, I think that while there is a bit of duplication, the entire component is rather small to begin with, and that the benefit of not having to clutter up the taskbar preview code outweighs the cost of duplication.
(In reply to comment #85)
> (In reply to comment #84)
> > But is this bug basically done with that patch, or is there more to do?
> > Wondering if we can get an ETA on resolution of this bug so I can build a beta
> > schedule.
> 
> Yes, it's done once part 1 gets reviews. Rob or Jim, could you make a call
> here? 

The idea was to blend this into the nsITaskbarWindowPreview class since we have code duplicated between rob's preview class and the progress class. The remaining issue was the controller. rob was suggesting in #gfx that a solution would be to implement a default dummy controller. We need to sort that problem out still and look at getting this into nsITaskbarWindowPreview.
(In reply to comment #86)
> The idea was to blend this into the nsITaskbarWindowPreview class since we have
> code duplicated between rob's preview class and the progress class. The
> remaining issue was the controller. rob was suggesting in #gfx that a solution
> would be to implement a default dummy controller. We need to sort that problem
> out still and look at getting this into nsITaskbarWindowPreview.
Can we do that refactoring post-1.9.2?
(In reply to comment #87)
> (In reply to comment #86)
> > The idea was to blend this into the nsITaskbarWindowPreview class since we have
> > code duplicated between rob's preview class and the progress class. The
> > remaining issue was the controller. rob was suggesting in #gfx that a solution
> > would be to implement a default dummy controller. We need to sort that problem
> > out still and look at getting this into nsITaskbarWindowPreview.
> Can we do that refactoring post-1.9.2?

Anything is possible. Changes though would require changes to client code - anyone who relied on this interface (fx, songbird, thunderbird, etc.) would have to rework their code in the next release. Honestly this isn't a call I can make. Rob thinks another patch for his taskbar stuff will be out in a few days, from there I'm not sure how long it would take sid to update his code. (Although some of the work could be done now based on the current patch in bug 501490).
We are working against a beta freeze - this has to make beta if we want it in for 3.6.
(In reply to comment #88)
> Changes though would require changes to client code -
> anyone who relied on this interface (fx, songbird, thunderbird, etc.) would
> have to rework their code in the next release.

Not if we keep the interfaces separate but combine the components into one.
Comment on attachment 399988 [details] [diff] [review]
Part 2, v4.0

>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js

>+#ifdef XP_WIN
>+    // On Windows, initialize download taskbar progress
>+    Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm");
>+    if (DownloadTaskbarProgress)
>+      DownloadTaskbarProgress.onBrowserWindowLoad(window);
>+#endif

Make this local, DownloadTaskbarProgress doesn't need to be global:

let tempScope = {};
Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm", tempScope);
tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);

What's the point of 'if (DownloadTaskbarProgress)'?
(In reply to comment #91)
> What's the point of 'if (DownloadTaskbarProgress)'?

It's for builds using older SDKs, which won't have the taskbar component. DownloadTaskbarProgress is nulled out in _init.
Making onBrowserWindowLoad and onDownloadWindowLoad no-ops in that case seems more consumer-friendly to me, and would be consistent with the other win7 modules.
(In reply to comment #93)
> Making onBrowserWindowLoad and onDownloadWindowLoad no-ops in that case seems
> more consumer-friendly to me, and would be consistent with the other win7
> modules.

OK, that should be easy enough.
Comment on attachment 398953 [details] [diff] [review]
Part 1, now on top of the taskbar preview patch

>+interface nsITaskbarProgress : nsISupports
>+{
>+  /**
>+   * Stop displaying progress on the taskbar button. This should be used when
>+   * the operation is complete or cancelled.
>+   */
>+  const nsTaskbarProgressState kNoProgress    = 0;
>+
>+  /**
>+   * Display a cycling, indeterminate progress bar.
>+   */
>+  const nsTaskbarProgressState kIndeterminate = 1;
>+
>+  /**
>+   * Display a determinate, normal progress bar.
>+   */
>+  const nsTaskbarProgressState kNormal        = 2;
>+
>+  /**
>+   * Display a determinate, error progress bar.
>+   */
>+  const nsTaskbarProgressState kError         = 3;
>+
>+  /**
>+   * Display a determinate progress bar indicating that the operation has
>+   * paused.
>+   */
>+  const nsTaskbarProgressState kPaused        = 4;

The style guide dictates NO_PROGRESS, INDETERMINATE, etc.
A STATE_ prefix would probably make sense too.
Sid, any chance for an updated Part 1 based on rob's latest?
Attachment #398953 - Attachment is obsolete: true
Attachment #404732 - Flags: superreview?(roc)
Attachment #404732 - Flags: review?(tellrob)
Attachment #404732 - Flags: review?(jmathies)
Attached patch Part 2, v5.0 (obsolete) — Splinter Review
Incorporating fixes to Dao's nits. Thanks!
Attachment #399988 - Attachment is obsolete: true
Attachment #404734 - Flags: review+
Whiteboard: [has patch][needs reviews]
Attachment #404732 - Flags: superreview?(roc) → superreview+
Attached patch Part 1, revised (obsolete) — Splinter Review
Fixed several race conditions, unbitrotted patch and added some comments.
Attachment #404732 - Attachment is obsolete: true
Attachment #404765 - Flags: superreview?(roc)
Attachment #404765 - Flags: review?(jmathies)
Attachment #404732 - Flags: review?(tellrob)
Attachment #404732 - Flags: review?(jmathies)
Attachment #404765 - Flags: superreview?(roc) → superreview+
Attachment #404765 - Flags: review?(jmathies) → review+
Comment on attachment 404765 [details] [diff] [review]
Part 1, revised

no tests!
Attachment #404765 - Flags: review+ → review-
Attached patch backend tests and minor bug fix (obsolete) — Splinter Review
Here are some backend tests and a fix for a bug discovered while writing them.
Attachment #404776 - Flags: review?(sid.bugzilla)
Attachment #404776 - Flags: review?(jmathies)
Comment on attachment 404734 [details] [diff] [review]
Part 2, v5.0

This patch is out of date. In particular:
There is a new framework for windows 7 features in browser.js that we should use (added in bug 474056).
An observer is no longer needed for the taskbar interface.

Also this patch needs tests for the frontend behavior before it can be checked in.
Attachment #404734 - Attachment is obsolete: true
Whiteboard: [has patch][needs reviews] → [needs new patch][needs tests]
Target Milestone: --- → mozilla1.9.2
Attachment #404765 - Attachment is obsolete: true
Attachment #404776 - Attachment is obsolete: true
Attachment #404778 - Flags: review?(jmathies)
Attachment #404776 - Flags: review?(sid.bugzilla)
Attachment #404776 - Flags: review?(jmathies)
Attachment #404778 - Attachment is obsolete: true
Attachment #404782 - Flags: review?(jmathies)
Attachment #404778 - Flags: review?(jmathies)
Comment on attachment 404782 [details] [diff] [review]
[checked-in] Part 1

r+ for tests, conditional on the fact that the tests (both this one and taskbar preview) need to be fixed for older SDKs.
Attachment #404782 - Flags: review+
Attachment #404782 - Flags: review?(jmathies) → review+
This is a P1 blocker and today's code freeze - can we get a status update? Looks like the whiteboard might be out of date, too?
Attached patch part 2, v6.0 (obsolete) — Splinter Review
Attachment #404875 - Flags: review?(tellrob)
Whiteboard: [needs new patch][needs tests] → [needs review robarnold]
Attachment #404875 - Flags: review?(rflint)
Comment on attachment 404875 [details] [diff] [review]
part 2, v6.0

>diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js
>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js
>@@ -136,22 +136,29 @@ XPCOMUtils.defineLazyGetter(this, "Win7F
>   const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
>   let taskbar = Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar);
>   if (taskbar.available) {
>     Cu.import("resource://gre/modules/wintaskbar/preview-per-tab.jsm");
>     return {
>       onOpenWindow: function () {
>         AeroPeek.onOpenWindow(window);
>       },
>+      onDownloadManagerInit: function () {
>+        let tempScope = {};
>+        Cu.import("resource://gre/modules/wintaskbar/DownloadTaskbarProgress.jsm",
>+                  tempScope);
>+        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>+      },

Why not let tempScop = this; ?

>+#ifdef XP_WIN
>+#ifndef WINCE
>+  let tempScope = {};
>+  Cu.import("resource://gre/modules/wintaskbar/DownloadTaskbarProgress.jsm",
>+            tempScope);
>+  tempScope.DownloadTaskbarProgress.onDownloadWindowLoad(window);
>+#endif
>+#endif
> }

Actually I'm not sure why you use a temp scope.

A browser peer should review this as well.
> Actually I'm not sure why you use a temp scope.

See comment 91.
Comment on attachment 404875 [details] [diff] [review]
part 2, v6.0

Couldn't this be implemented as a service with a DOMWindowOpened listener that checked window URIs rather than hooking into the various window onloads?

>diff --git a/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm b/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm

>+  _init: function DTPU_init()

>+    this._updateStatus();

Why is this needed?

>+  _updateStatus: function DTPU_updateStatus()

Seems like most of this code should actually live in the download manager, which would probably also make it easier to keep a running total to the places that need it without having them loop through all downloads every time they want a status update. The download status bar in browser windows seems like another potential consumer. Followup bug? 

>+  onProgressChange: function DTPU_onProgressChange()
>+  {
>+    this._updateStatus();
>+    this._updateTaskbar();

>+  onDownloadStateChange: function DTPU_onDownloadStateChange()
>+  {
>+    this._updateStatus();
>+    this._updateTaskbar();

Can't you avoid calling updateStatus if updateTaskbar won't actually display it? Seems like updateStatus() should only be called from _updateTaskBar() when it calls setProgressState?
Comment on attachment 404782 [details] [diff] [review]
[checked-in] Part 1

didn't mean to obsolete this.
Attachment #404782 - Attachment description: part 1, with a fix to an idl comment → [checked-in] Part 1
Attachment #404782 - Attachment is obsolete: false
(In reply to comment #112)
> (From update of attachment 404875 [details] [diff] [review])
> Couldn't this be implemented as a service with a DOMWindowOpened listener that
> checked window URIs rather than hooking into the various window onloads?

That's how I used to do it, but I changed it because of comment 33. Although the original reasoning for comment 33 is no longer valid, it still is quite convenient to use window onload, especially for browser windows (since the module needs to be imported after we know for sure that the download manager has been initialized).

> 
> >diff --git a/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm b/toolkit/mozapps/downloads/src/DownloadTaskbarProgress.jsm
> 
> >+  _init: function DTPU_init()
> 
> >+    this._updateStatus();
> 
> Why is this needed?

To update the status, since _setActiveWindow doesn't call _updateStatus.

> 
> >+  _updateStatus: function DTPU_updateStatus()
> 
> Seems like most of this code should actually live in the download manager,
> which would probably also make it easier to keep a running total to the places
> that need it without having them loop through all downloads every time they
> want a status update. The download status bar in browser windows seems like
> another potential consumer. Followup bug?

There was already talk of doing this in comment 37 and comment 42. Maybe, yeah.

> 
> >+  onProgressChange: function DTPU_onProgressChange()
> >+  {
> >+    this._updateStatus();
> >+    this._updateTaskbar();
> 
> >+  onDownloadStateChange: function DTPU_onDownloadStateChange()
> >+  {
> >+    this._updateStatus();
> >+    this._updateTaskbar();
> 
> Can't you avoid calling updateStatus if updateTaskbar won't actually display
> it? Seems like updateStatus() should only be called from _updateTaskBar() when
> it calls setProgressState?

For the state where no download window is open, _updateStatus determines whether we're going to call setProgressState :)
Attachment #404875 - Flags: review?(rflint)
(In reply to comment #114)
> module needs to be imported after we know for sure that the download manager
> has been initialized).

Ok, I guess this makes sense.

> > >+  _init: function DTPU_init()
> > 
> > >+    this._updateStatus();
> > 
> > Why is this needed?
> 
> To update the status, since _setActiveWindow doesn't call _updateStatus.

It seemed weird to do this before _setActiveWindow is called, but I suppose it doesn't matter too much, since _setActiveWindow is always called right after the module is imported anyways, and you don't want to updateStatus() each time it's called.

> There was already talk of doing this in comment 37 and comment 42. Maybe,
> yeah.

Sorry, I hadn't read through the entire bug. Seems worth doing in a followup, for sure!
Attachment #404875 - Flags: review?(tellrob)
Attachment #404875 - Flags: review?(sdwilsh)
Attachment #404875 - Flags: review+
Comment on attachment 404875 [details] [diff] [review]
part 2, v6.0

sdwilsh says his prior review carries over.
Attachment #404875 - Flags: review?(sdwilsh)
Comment on attachment 404875 [details] [diff] [review]
part 2, v6.0

This should have tests. Shawn and I will discuss the details tomorrow.
Attachment #404875 - Flags: review-
Whiteboard: [needs review robarnold]
This doesn't block the release.
Flags: blocking1.9.2+
Priority: P1 → --
To be clear, it doesn't block the release, but remains wanted. I think Rob's right, it's predicated on having appropriate tests before we can land it on 1.9.2, though.

If completed before Firefox 3.6 RC1, we should consider landing it.
Setting flags to match comments.
Flags: wanted1.9.2+
Flags: blocking1.9.2-
Comment on attachment 404875 [details] [diff] [review]
part 2, v6.0

>--- a/browser/base/content/browser.js
>+++ b/browser/base/content/browser.js
>@@ -136,22 +136,29 @@ XPCOMUtils.defineLazyGetter(this, "Win7F
>   const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
>   let taskbar = Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar);
>   if (taskbar.available) {
>     Cu.import("resource://gre/modules/wintaskbar/preview-per-tab.jsm");
>     return {
>       onOpenWindow: function () {
>         AeroPeek.onOpenWindow(window);
>       },
>+      onDownloadManagerInit: function () {
>+        let tempScope = {};
>+        Cu.import("resource://gre/modules/wintaskbar/DownloadTaskbarProgress.jsm",
>+                  tempScope);
>+        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>+      },
>       onCloseWindow: function () {
>         AeroPeek.onCloseWindow(window);
>       }
>     };
>   } else {
>-    return { onOpenWindow: function () {}, onCloseWindow: function () {} };
>+    return { onOpenWindow: function () {}, onDownloadManagerInit: function () {},
>+             onCloseWindow: function () {} };
>   }
> });
> #endif
> #endif

>   // downloads will start right away, and getting the service again won't hurt.
>   setTimeout(function() {
>     gDownloadMgr = Cc["@mozilla.org/download-manager;1"].
>                    getService(Ci.nsIDownloadManager);
> 
>     // Initialize the downloads monitor panel listener
>     DownloadMonitorPanel.init();
>+
>+#ifdef WIN7_FEATURES
>+    Win7Features.onDownloadManagerInit();
>+#endif
>   }, 10000);

I'm trying to fix this pattern in bug 521188. When that's done, you should do something like this instead:

>      if (Win7Features) {
>        let tempScope = {};
>        Cu.import("resource://gre/modules/wintaskbar/DownloadTaskbarProgress.jsm",
>                  tempScope);
>        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>      }
Attached patch part 2, v6.01 (obsolete) — Splinter Review
Unbitrotted to trunk.
Attachment #404875 - Attachment is obsolete: true
Attached patch part 2, v6.02 (obsolete) — Splinter Review
oops, forgot to fix the module paths
Attachment #406443 - Attachment is obsolete: true
Comment on attachment 406445 [details] [diff] [review]
part 2, v6.02

>+      onDownloadManagerInit: function () {
>+        let tempScope = {};
>+        Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm",
>+                  tempScope);
>+        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>+      },

>+    if (Win7Features)
>+      Win7Features.onDownloadManagerInit();

Any reason why you're adding a onDownloadManagerInit method to Win7Features rather than executing that code right away?
(In reply to comment #124)
> (From update of attachment 406445 [details] [diff] [review])
> >+      onDownloadManagerInit: function () {
> >+        let tempScope = {};
> >+        Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm",
> >+                  tempScope);
> >+        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
> >+      },
> 
> >+    if (Win7Features)
> >+      Win7Features.onDownloadManagerInit();
> 
> Any reason why you're adding a onDownloadManagerInit method to Win7Features
> rather than executing that code right away?

I think Rob said to do so over IRC, in the interest of centralizing all the Win7 stuff in one place. I don't really have an opinion one way or the other.
I don't think this is beneficial. In fact, keeping the download manger init code together makes more sense to me.
Flags: in-litmus?
Duplicate of this bug: 529842
(In reply to comment #117)
> (From update of attachment 404875 [details] [diff] [review])
> This should have tests. Shawn and I will discuss the details tomorrow.
I don't recall the details of our conversation.  Rob, do you?
(In reply to comment #128)
> (In reply to comment #117)
> > (From update of attachment 404875 [details] [diff] [review] [details])
> > This should have tests. Shawn and I will discuss the details tomorrow.
> I don't recall the details of our conversation.  Rob, do you?

I don't recall much. We definitely did not reach a consensus on where the code should live. I also believed that it was possible to write tests for the front end (I believe this is still possible) since the behavior of the progress bar is rather minimal and well defined (versus the tab previews). In particular, there's no user interaction with the progress so we just need to verify that we are setting the progress correctly.
Is it supposed to be displayed when downloading a firefox update ?
(In reply to comment #130)
> Is it supposed to be displayed when downloading a firefox update ?

Huh, I never thought about that. I think if you have the update download dialog open, it should. I don't think the background download should have progress unless it was user-initiated since that could confuse the user. Perhaps the extension manager could use this too updating addons. I'm not sure if the frontend is written in such a way as to facilitate that.
(In reply to comment #131)
> I'm not sure if the
> frontend is written in such a way as to facilitate that.

I don't think it is -- I think that since each window has its own UI requirements, the right design is for each window to update its download progress separately. This will also mean that the right progress indicator is displayed for each window in case taskbar buttons aren't combined.
(In reply to comment #132)
> (In reply to comment #131)
> > I'm not sure if the
> > frontend is written in such a way as to facilitate that.
> 
> I don't think it is -- I think that since each window has its own UI
> requirements, the right design is for each window to update its download
> progress separately. This will also mean that the right progress indicator is
> displayed for each window in case taskbar buttons aren't combined.

I can see a problem with this solution: if a window is actually opened as a tab, what will happen? The main window will get the progress, overwriting any previous status? Nothing happens, because the "window" isn't a top-level window? Some extensions, like All-in-One Sidebar, even put the add-ons manager in the sidebar.
I hadn't considered that. I guess the right solution to this would be to always make sure that such "special" tabs are displayed in the taskbar in the Aero Peek code, and for the taskbar progress code to be aware of this. The current backend code is definitely not smart enough.
In the current implementation, opening windows inside tabs wouldn't be much of a problem, because if a window already exists, the new window (inside the tab) being opened will first verify that and won't try to take over the download progress (except if it is the Download Manager, but its progress is always the same as the other windows).

The other features that display download progress (such as add-on installation or software update) should be able to set their progress on their windows too. We could handle this at the service by using a parameter of the type of download ("regular download", "update", etc), and use that to decide when to set the window progress or not.

The trickiest part AFAICT is not setting the regular download progress in all of the windows (like they are in all of the status bars), because this would look just ugly in the never-group-windows taskbar setting, but the current code already handles that.
Attached patch part 2, v6.1 + tests (obsolete) — Splinter Review
Alright, this is my first set of tests! 
I don't know if they need to be browser-chrome, but I think so, because I use the window object here.

The tests here test the assignment of the active taskbar window. It does as follows: 
- first check if services are available
- then checks if the taskbar display was assigned to the current and only window
- opens the download manager and check if the taskbar display was passed to it
- closes the download manager and check if it was returned to the original window
- opens a second window and check if it didn't change since it isn't supposed to change when a new window is created (only closed)

The only thing that it doesn't check is to close the original window and see if it changes (because it isn't possible to do this in this test), but this situation is no different than closing the Download Manager. The case is that we just pick the first window that is enumerated by the windowatcher, which happens to always be the original one.

I'm working on some mores tests to check the state of the progress indicator after pausing/resuming downloads. I'll post them soon, but I wanted to post these already to get some feedback on the tests. In particular, the flow of the test was a bit tricky to do due to waiting for windows to open/close, so I'm not sure if I did the right thing here (went with a combination of observers and timeouts)
Attachment #406445 - Attachment is obsolete: true
(In reply to comment #136)
> The only thing that it doesn't check is to close the original window and see if
> it changes (because it isn't possible to do this in this test), but this
> situation is no different than closing the Download Manager. The case is that
> we just pick the first window that is enumerated by the windowatcher, which
> happens to always be the original one.
You could do that if you first open a new browser window then start your test with that window, right?
(In reply to comment #137)
> You could do that if you first open a new browser window then start your test
> with that window, right?

I could just because the download monitor only kicks in after 10sec, so it's possible to force the active taskbar to start in the second window before the original one takes it. This would go against the natural behavior though, so I didn't know if it should be done or not.

Are windows preserved between tests? If we don't start with a brand new one (younger than 10sec) the test would fail.
This is a very much unrelated question, but does a similar bug exists for OS X? I saw Photoshop showing progress bar in Dock when opening large files (I can even provide a screenshot). I think it would make sense to generalize this feature of Windows, OS X (and perhaps some other platforms in future) in Toolkit, no?
(In reply to comment #138)
> Are windows preserved between tests? If we don't start with a brand new one
> (younger than 10sec) the test would fail.
The main browser window is, so you should open a new one anyway.
(In reply to comment #139)
> This is a very much unrelated question, but does a similar bug exists for OS X?

Rimas, I have an extension that does something pretty similar: https://addons.mozilla.org/en-US/firefox/addon/10485

There's definitely an impedance mismatch between this patch (with one progress bar per window) and the way we'd want it to work on OS X, which has just one dock icon for multiple windows. I don't know how we'd want that resolved: Multiple progress bars in the dock icon? Just one coalesced progress bar?
Dan: in order not to spam this bug, I've spun the OS X issue off into Bug 548763.
Attached patch part 2, v6.2 (obsolete) — Splinter Review
More tests!  Now we also test the displayed state of the progress bar. The test adds two downloads to the Download Manager, pause each one, resume each one and let them finish, and in each of these steps it checks if the state displayed (nothing/downloading/paused) is correct.
Attachment #428957 - Attachment is obsolete: true
Attachment #429261 - Flags: review?(sdwilsh)
Comment on attachment 429261 [details] [diff] [review]
part 2, v6.2

>+      onDownloadManagerInit: function () {
>+        let tempScope = {};
>+        Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm",
>+                  tempScope);
>+        tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>+      },

...

>+    if (Win7Features)
>+      Win7Features.onDownloadManagerInit();

Don't add that method to Win7Features, just put the code there directly:

>if (Win7Features) {
>  let tempScope = {};
>  Cu.import("resource://gre/modules/DownloadTaskbarProgress.jsm",
            tempScope);
>  tempScope.DownloadTaskbarProgress.onBrowserWindowLoad(window);
>}
Attached patch part 2, v6.2.1 (obsolete) — Splinter Review
>Don't add that method to Win7Features, just put the code there directly.
Ok. I didn't know if it was decided on one way or the other, so I had left it as is. I've changed it now.

Also made some small clean-ups and used gavin's Services.jsm
Attachment #429261 - Attachment is obsolete: true
Attachment #429431 - Flags: review?(sdwilsh)
Attachment #429261 - Flags: review?(sdwilsh)
An extra question about this feature: do we have any private browsing concerns about it?
As I understand it, private browsing is not about hiding on-screen what's going on the browser, so it doesn't apply here; but it's worth double checking.
I don't think we have anything to worry about in this instance.
(In reply to comment #146)
> An extra question about this feature: do we have any private browsing concerns
> about it?
> As I understand it, private browsing is not about hiding on-screen what's going
> on the browser, so it doesn't apply here; but it's worth double checking.

Nope, rest assured that there are no PB concerns here.
Comment on attachment 429431 [details] [diff] [review]
part 2, v6.2.1

For more detailed review context, please see http://reviews.visophyte.org/r/429431/.

on file: toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm line 54
> var DownloadTaskbarProgress =

nit: const this please


on file: toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm line 66
>     if (!DownloadTaskbarProgressUpdater)
>       return;

global-nit:  brace even one line ifs please (I feel terrible asking for this
so far along in the review process, but our style guide has changed for new
code and I'm trying to enforce it)


on file: toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm line 83
>   /**
>    * Getters for internal DownloadTaskbarProgressUpdater values
>    */
> 
>   getActiveTaskbarProgress: function DTP_getActiveTaskbarProgress() {
>     if (!DownloadTaskbarProgressUpdater)
>       return null;
>     return DownloadTaskbarProgressUpdater._activeTaskbarProgress;
>   },
> 
>   getActiveWindowIsDownloadWindow: function DTP_getActiveWindowIsDownloadWindow() {
>     if (!DownloadTaskbarProgressUpdater)
>       return null;
>     return DownloadTaskbarProgressUpdater._activeWindowIsDownloadWindow;
>   },
> 
>   getTaskbarState: function DTP_getTaskbarState() {
>     if (!DownloadTaskbarProgressUpdater)
>       return null;
>     return DownloadTaskbarProgressUpdater._taskbarState;
>   },

nit: make these actual getters so we can just use it as a property access


on file: toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm line 236
>       this._activeTaskbarProgress.setProgressState(
>         Ci.nsITaskbarProgress.STATE_NO_PROGRESS);

nit: trailing paren on new line with no indent please.


on file: toolkit/mozapps/downloads/tests/chrome/browser_taskbarprogress_service.js line 120
>   let DMWindow = wwatch.openWindow(parent,
>                                    DOWNLOAD_MANAGER_URL,
>                                    "Download:Manager",
>                                    "chrome,dialog=no,resizable", []);

This isn't how you want to open the UI - you want to use
nsIDownloadManagerUI::show


In general, I'd like to see a generator based test for async tests instead of callback one since it's easier to read and follow along.  See http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/whatwg/test_bug500328.html?force=1 for an example.
Attachment #429431 - Flags: review?(sdwilsh) → review+
Attached patch part2, for check-in (obsolete) — Splinter Review
Patch with comments addressed

(In reply to comment #149)
> > var DownloadTaskbarProgress =
> 
> nit: const this please
done

> >     if (!DownloadTaskbarProgressUpdater)
> >       return;
> 
> global-nit:  brace even one line ifs please (I feel terrible asking for this
> so far along in the review process, but our style guide has changed for new
> code and I'm trying to enforce it)

Okay, adjusted all instances on the patch. Just so I know, is this a general style rule for JS code in all modules?

> 
> nit: make these actual getters so we can just use it as a property access
> 
done
 
> on file: toolkit/mozapps/downloads/DownloadTaskbarProgress.jsm line 236
> >       this._activeTaskbarProgress.setProgressState(
> >         Ci.nsITaskbarProgress.STATE_NO_PROGRESS);
> 
> nit: trailing paren on new line with no indent please.
>
is this what you mean? 
this._activeTaskbarProgress.setProgressState(
  Ci.nsITaskbarProgress.STATE_NO_PROGRESS
);
if yes, done

> This isn't how you want to open the UI - you want to use
> nsIDownloadManagerUI::show
> 
Using it now.

> 
> In general, I'd like to see a generator based test for async tests instead of
> callback one since it's easier to read and follow along.  See
> http://mxr.mozilla.org/mozilla-central/source/dom/tests/mochitest/whatwg/test_bug500328.html?force=1
> for an example.

Did this on both tests!
(In reply to comment #150)
> Okay, adjusted all instances on the patch. Just so I know, is this a general
> style rule for JS code in all modules?
For new code, yes.  Existing code it all depends on what the reviewer says (generally follow convention in the file, but this is one of those things were the reviewer may ask otherwise).

> is this what you mean? 
> this._activeTaskbarProgress.setProgressState(
>   Ci.nsITaskbarProgress.STATE_NO_PROGRESS
> );
> if yes, done
sure did mean that :)
(In reply to comment #151)
> (In reply to comment #150)
> > Okay, adjusted all instances on the patch. Just so I know, is this a general
> > style rule for JS code in all modules?
> For new code, yes.  Existing code it all depends on what the reviewer says
> (generally follow convention in the file, but this is one of those things were
> the reviewer may ask otherwise).

it depends on module yet, for example Places still allows no-braced ifs if all sides of it are one-line (i thought Storage was doing the same since its style code says that).
Btw platform rules say to always brace.
http://hg.mozilla.org/mozilla-central/rev/a352d0413476
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Keywords: checkin-needed
Resolution: --- → FIXED
Target Milestone: mozilla1.9.2 → mozilla1.9.3a4
Attached patch Fix tests for non win7 (obsolete) — Splinter Review
Both tests were broken if not run on win7.  I think this should solve them.
Comment on attachment 433427 [details] [diff] [review]
Fix tests for non win7

>--- a/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_downloadstates.xul
>+++ b/toolkit/mozapps/downloads/tests/chrome/test_taskbarprogress_downloadstates.xul
>@@ -190,17 +190,16 @@ function checkCorrectState() {
>     //No more downloads
>     ok(taskbarState == nsITP.STATE_NO_PROGRESS, "Correct finished downloads state");
>     testState.noDownloadsStateTested = true;
>   }
> 
> }
> 
> function test() {
>-  SimpleTest.waitForExplicitFinish();
>   testSetup();
> }
> 
> function testSetup()
> {
>   //Test setup
>   let dmui = getDMUI();
>   if (!dmui) {
>@@ -249,16 +248,17 @@ function testSetup()
> 
>   let testObs = {
>     observe: function(aSubject, aTopic, aData)
>     {
>       if (aTopic != DLMGR_UI_DONE) {
>         return;
>       }
>       os.removeObserver(testObs, DLMGR_UI_DONE);
>+      SimpleTest.waitForExplicitFinish();
>       continueTest();
>     }
>   };
> 
>   // Register with the observer service
>   os.addObserver(testObs, DLMGR_UI_DONE, false);
> 
>   // Show the Download Manager UI

This looks wrong. waitForExplicitFinish needs to be called before 'test' returns.
Attachment #433427 - Flags: review-
Attached patch Fix tests - 2nd try (obsolete) — Splinter Review
Yeah, that's true... aaah, second try
All of my downloads crash Firefox when they complete.  I was using the 18th's nightly and then decided to try this feature out using an hourly build (cset a352d0413476) and now every time a download completes I crash.  New bug or should this be backed out?
(In reply to comment #157)
> All of my downloads crash Firefox when they complete.  I was using the 18th's
> nightly and then decided to try this feature out using an hourly build (cset
> a352d0413476) and now every time a download completes I crash.  New bug or
> should this be backed out?

We will back out so I can investigate it. Kurt, can you tell me which system are you using?
Backed out: http://hg.mozilla.org/mozilla-central/rev/c906699b14db
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
(In reply to comment #158)
> (In reply to comment #157)
> > All of my downloads crash Firefox when they complete.  I was using the 18th's
> > nightly and then decided to try this feature out using an hourly build (cset
> > a352d0413476) and now every time a download completes I crash.  New bug or
> > should this be backed out?
> 
> We will back out so I can investigate it. Kurt, can you tell me which system
> are you using?

Build ID	20100318124752
Branch	1.9.3
OS	Windows NT
OS Version	6.1.7600
CPU	x86
CPU Info	AuthenticAMD family 15 model 104 stepping 2
Why is this backed out? I just used the hourly build and downloaded a bunch of files across multiple sites. Works perfectly for me. No crashes here.
(In reply to comment #161)
> Why is this backed out? I just used the hourly build and downloaded a bunch of
> files across multiple sites. Works perfectly for me. No crashes here.

Spoke too soon. Crashes on exit!
Asking just in case, did you run browser chrome tests locally on a Win7 machine with yout patch? If possible i'd like to avoid bugs like bug 545228, since we don't have win7 boxes running b-c tests automatically they should be run manually to check for leaks (actually there should be no leak reported).
Since i see a b-c test in your push i suspect answer is positive, but the leak has been fixed after your last patch.
The bug for the 'leak' fix which was causing the crash-on-close has been backed out, and I've not seen any close crashes today so far. 

bug backed out: https://bugzilla.mozilla.org/show_bug.cgi?id=545228

Any chance this could re-land to exonerate it causing the crash-on-close ?
(In reply to comment #164)
> The bug for the 'leak' fix which was causing the crash-on-close has been backed
> out, and I've not seen any close crashes today so far. 
> 
> bug backed out: https://bugzilla.mozilla.org/show_bug.cgi?id=545228
> 
> Any chance this could re-land to exonerate it causing the crash-on-close ?

I'm pretty sure this bug can help trigger the crash (it's a race condition related to the TaskbarPreview class I think).
Attached patch par 2, v6.3 (obsolete) — Splinter Review
Just posting an updated patch with the test fixes applied, and fixed a leak too. I ran the b-c tests as mak suggested (with the patch from bug 545228) and no leaks are reported now.
Attachment #429431 - Attachment is obsolete: true
Attachment #432839 - Attachment is obsolete: true
Attachment #433427 - Attachment is obsolete: true
Attachment #433432 - Attachment is obsolete: true
moved a browser-chrome test to mochitest-chrome
Attachment #434677 - Attachment is obsolete: true
Are we waiting for some other Bug to close before landing this one?
Looks like the bug is waiting on Felipe to do more work on patch part 2 or to submit the patch part 2 for review.
Comment on attachment 437117 [details] [diff] [review]
part 2, for check-in

The patch is finished and reviewed. The latest update just changed the test type, but I already cleared that with shawn on IRC. Carrying forward r+ to make this more clear.

I didn't mark checkin-needed last week because bug 557557 appeared and I wanted to avoid having this patch related to that. It's fine to land now.
Attachment #437117 - Flags: review+
I'll import this patch to my repo, make a tryserver run and take care of pushing it today if possible. Let's try to drive it out.
Tryserver said GO, thus part 2 pushed:
http://hg.mozilla.org/mozilla-central/rev/b45e2fd7ce4a
Status: REOPENED → RESOLVED
Closed: 10 years ago10 years ago
Keywords: checkin-needed
Resolution: --- → FIXED
Verifying fixed using Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.3a5pre) Gecko/20100415 Minefield/3.7a5pre
Status: RESOLVED → VERIFIED
Blocks: cuts-os
Blocks: 597155
Depends on: 716862
No longer blocks: FF2SM
Depends on: 1202181
You need to log in before you can comment on or make changes to this bug.