Open
Bug 1176448
Opened 10 years ago
Updated 2 years ago
nsITaskbarOverlayIconController.setOverlayIcon returns NS_ERROR_NOT_AVAILABLE in Thunderbird 38
Categories
(Core :: Widget: Win32, defect, P4)
Tracking
()
NEW
People
(Reporter: bstreiff, Unassigned)
References
Details
(Whiteboard: tpi:+)
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/43.0.2357.124 Safari/537.36
Steps to reproduce:
I am the developer of https://addons.mozilla.org/fr/thunderbird/addon/unread-badge/.
Source is available here: https://github.com/bstreiff/unread-badge/blob/master/bootstrap.js
I use the nsITaskbarOverlayIconController.setOverlayIcon interface that (added as part of bug #515907) to display unread message counts on the Windows 7+ taskbar.
After upgrading from Thunderbird 31.7.5605 to 38.0.1.5637, I now receive the following error:
Timestamp: 6/19/2015 7:43:46 PM
Error: NS_ERROR_NOT_AVAILABLE: Component returned failure code: 0x80040111 (NS_ERROR_NOT_AVAILABLE) [nsITaskbarOverlayIconController.setOverlayIcon]
Source File: resource://gre/modules/addons/XPIProvider.jsm -> file:///C:/Users/brandon/Documents/Code/unread-badge@streiff.net/bootstrap.js
Line: 421
Using the following code:
var getActiveWindowOverlayIconController = function () {
let docshell = gActiveWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIWebNavigation).QueryInterface(Ci.nsIDocShellTreeItem)
.treeOwner.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIXULWindow).docShell;
return xpc.taskbar.getOverlayIconController(docshell);
}
// ...
let controller = getActiveWindowOverlayIconController();
var icon = createBadgeIcon(messageCount);
controller.setOverlayIcon(icon, "Message Count");
// ...
icon is a non-null imgIContainer; I can perform operations like lockImage() and unlockImage() on it without error.
I do not get the error when the icon parameter is "null".
Actual results:
I get an NS_ERROR_NOT_AVAILABLE, as described above.
Expected results:
My icon should have been drawn as an icon overlay, without receiving an error.
Reporter | ||
Updated•10 years ago
|
Comment 1•10 years ago
|
||
Looked around in http://hg.mozilla.org/mozilla-central/filelog/c319f262ce3e/widget/windows/WinTaskbar.cpp changes?
Reporter | ||
Comment 2•10 years ago
|
||
Narrowing down the timeline a bit:
I do not see this issue in Thunderbird 34.0b1. (https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/34.0b1/win32/en-US/)
I do see it in Thunderbird 36.0b1. (https://ftp.mozilla.org/pub/mozilla.org/thunderbird/releases/36.0b1/win32/en-US/).
Firefox 38.0.5 is also affected by this bug : Siddharth Agarwal's testcase extension (https://github.com/sid0/overlay-extension) throws the same NS_ERROR_NOT_AVAILABLE error in firefox, and does not display any overlay icon anymore.
Testing with past versions of firefox (released more frequently) could help identifying the cause of this regression ?
Tested if this bug occurs in successive versions of FF : overlay icons are displayed correctly up to version 35.0.1. From FF 36.0b1, setOverlayIcon throws the exception descibed above.
WinTaskbar.cpp has not been revised between the releases of 35.0.1 and 36.0b1.
Need further debug to know where this exception is throwed..
Comment 5•9 years ago
|
||
Confirmed in Firefox. The error is here: <http://mxr.mozilla.org/comm-central/source/mozilla/widget/windows/TaskbarWindowPreview.cpp#185>. It happens because the image hasn't been decoded yet, so checking if it's animated returns NS_ERROR_NOT_AVAILABLE.
I don't know how to make sure it gets decoded, though.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Updated•9 years ago
|
Component: OS Integration → Widget: Win32
Product: Thunderbird → Core
Comment 6•9 years ago
|
||
:seth, you know a lot about images, right? (If not, sorry for the noise!) Does my comment 5 make sense? Normally, I'd just write a patch and see if it works, but this is Windows-specific, and I only have the ability to do Linux builds.
Flags: needinfo?(seth)
Comment 7•9 years ago
|
||
(In reply to Jim Porter (:squib) from comment #6)
> :seth, you know a lot about images, right? (If not, sorry for the noise!)
> Does my comment 5 make sense? Normally, I'd just write a patch and see if it
> works, but this is Windows-specific, and I only have the ability to do Linux
> builds.
To trigger decoding of an imgIContainer from JS you'd be much better off having a DOM Image object than an imgIContainer. You'd want to wait for the Image's load event, then trigger decoding by creating an ImageBitmap (preferable) or drawing the image into a canvas (less ideal). You can then get an imgIContainer from the Image; see here:
https://dxr.mozilla.org/mozilla-central/source/image/test/mochitest/test_bug614392.html#25
And from that point you can do what you need to do with the imgIContainer.
This stuff is much easier from C++, but unfortunately the methods you'd use from C++ are not exposed to script.
Flags: needinfo?(seth)
Comment 8•9 years ago
|
||
Note that we could also deal with this by calling RequestDecodeForSize() in SetOverlayIcon() and passing FLAG_SYNC_DECODE, which would at least eliminate the need to manually trigger decoding. Here's an example of how to do it (though we don't pass FLAG_SYNC_DECODE here):
https://dxr.mozilla.org/mozilla-central/source/layout/generic/nsBulletFrame.cpp#715
There is no getting around waiting for the load event, though, so you'd still want to have a DOM Image object. Images just load asynchronously and there's not much we can do about it.
Comment 9•9 years ago
|
||
Would it make sense to change the IDL[1] to accept a DOM Image instead? As far as I know, only one add-on actually tries to use this API (and nothing in m-c or c-c does), and that add-on is currently broken.
[1] https://dxr.mozilla.org/mozilla-central/source/widget/nsITaskbarOverlayIconController.idl#37
Comment 10•9 years ago
|
||
The new approach also does not work with the Windows 10 anniversary update: https://github.com/panique/thunderbird-unread-badge
![]() |
||
Updated•8 years ago
|
Priority: -- → P4
Whiteboard: tpi:+
Updated•2 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•