Chrome extension, [removed] Why is this firing twice?

后端 未结 6 1837
南旧
南旧 2020-12-29 08:15

I have a very very simple bit of code in my (test) Chrome extension:

    function test()
    {
    alert(\"In test!\");
    }

   chrome.tabs.onUpdated.addLi         


        
6条回答
  •  渐次进展
    2020-12-29 09:11

    I know this is old but anyway... it's happening to me too and maybe this can help someone. Looking into the Tab object that the handler function is receiving, I saw that the favIconUrl property is different in both calls so I guess it has something to do with that although I have no idea about the reason behind this.

    I thought it was a bug but after a second thought and some testing I discard the bug theory.

    What I know so far is that if two properties are changed, the event is triggered twice with the changeInfo object containing one property each time. In other words if for instance the properties that change are status and favIconUrl, then

    changeInfo = {status:"complete"};
    

    and then in the next call

    changeInfo = {favIconuUrl : ".... whatever ..."};
    

提交回复
热议问题