On Sun, Nov 8, 2009 at 5:24 AM, pdknsk <pdk...@googlemail.com> wrote:
>
> And not because iconIndex was removed. The problem is with the
> following code in the background.
>
> chrome.browserAction.setIcon({path:"1.png"});
> foo();
> chrome.browserAction.setIcon({path:"2.png"});
>
> The first setIcon does not change the icon, instead a blank icon (or
> default_icon if set) is shown while the function is busy. The second
> icon is then shown correctly. Worked in the dev build before.

Hm, yeah, this is a JavaScript problem in general. Visible state
doesn't usually update until the script exits the event that is being
processed.

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);

- a

--~--~---------~--~----~------------~-------~--~----~
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