thegooddata / extension

GNU General Public License v3.0
0 stars 0 forks source link

A few errors in version 1.0.33 #37

Closed JuanMenendezBuitrago closed 9 years ago

JuanMenendezBuitrago commented 9 years ago

I've installed version 1.0.33 and I get the following errors in the popup console. I also find that the logout action in the extension is not working as it should. When I click on the logout button nothing happens right away. I log out eventually but only after clicking on the extension button to close the popup (and sometimes not even then).

extension_error

marcosmenendez commented 9 years ago

Has this been solved @atrandafir ?

JuanMenendezBuitrago commented 9 years ago

I am looking into the extension's source code and realized that when we load some pages the getLoggedUser request is sent twice. I believe this happens because chrome.tabs.onUpdated() event is triggered once for every tab's property that gets updated.

Usually the only property that gets updated is the status, but sometimes the favIconUrl is also updated which triggers the event sending a redundant request to the server. I think this has something to do with caching because once I have visited a page it doesn't happen again.

probably changing the condition in background.js from

if ( tab.status=="complete" ){

to

if ( changeInfo.status=="complete" ){

fixs it.

I'll do it myself. I am just saying it here in case anyone has any objection about this.

2015-05-05 1:13 GMT+02:00 Marcos Menendez notifications@github.com:

Has this been solved @atrandafir https://github.com/atrandafir ?

— Reply to this email directly or view it on GitHub https://github.com/thegooddata/extension/issues/37#issuecomment-98882098 .

marcosmenendez commented 9 years ago

Is this related to this issue? https://github.com/thegooddata/webapp/issues/151

JuanMenendezBuitrago commented 9 years ago

It could be, because the event listener that is called twice hosts also the call for the function lookforQuery().

I can't be 100% sure but I'll look into it unless @atrandafir already has.

JuanMenendezBuitrago commented 9 years ago

I changed the "if" condition so now the code is executed only when the status has changed to "complete" which is the one that matters. A set of changes in the tab produced a set of calls that produced redundant requests for both login and query requests.