On Nov 8, 5:30 pm, Aaron Boodman <a...@chromium.org> wrote:
> I do not think we are going to be able to fix this. If foo() is going
> to take a long time, I recommend processing it in a separate event
> from setIcon(), so that the setIcon() call can update. You can do this
> with setTimeout():
>
> chrome.browserAction.setIcon({path:"1.png"});
> window.setTimeout(function() {
>   foo();
>   chrome.browserAction.setIcon({path:"2.png"});
>
> }, 0);

Hmm that still doesn't seem to work. I suspect the problem is sth.
else, because the following does work and correctly sets the first
icon and the second icon.

chrome.browserAction.setIcon({imageData:draw()});
foo();
chrome.browserAction.setIcon({path:"2.png"});

And this did also work, but is now obsolete.

chrome.browserAction.setIcon({iconIndex:0});
foo();
chrome.browserAction.setIcon({iconIndex:1});

So the problem in the original example might be that Chrome does not
resolve the path to get the icon until the document is completely
processed. Both setIcon() are still pending and then set the correct
icons. The first icon is immediately replaced by the second icon and
thus not noticeable. That's just a guess without having a clue how
Chrome works internally, but it seems like a logical explanation.

It is certainly related to the path parameter as it works flawlessly
using the already mentioned imageData and iconIndex with the otherwise
exact same code.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Chromium-extensions" group.
To post to this group, send email to chromium-extensions@googlegroups.com
To unsubscribe from this group, send email to 
chromium-extensions+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/chromium-extensions?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to