Closed samitolvanen closed 12 years ago
What Chrome version do you use?
18.0.1025.7 dev
Although I have seen this before, but never actually looked at why the rating symbol is missing. If it helps, here's what I did:
After I restarted the browser, the rating symbol shows up again. Can't get it to disappear. This could have something to do with rating the site.
I've reproduced it on chrome 16.
The same steps: search (in google), go, rate, go back.
The problem is near the code:
background.js (86):
var result = wot.getlevel(wot.reputationlevels, cached.value[wot.default_component] ? cached.value[wot.default_component].r : -1).name;
when user rate with "trusworthy" app, it affects cached values.
I'll fix it.
Yes, rating affects the cache, but how is the problem in that function? This geticon function only sets the toolbar icon, the one that wot.search.getcss uses is in wot.js.
oh, right. stupid me.
aha,
the reason is that geticon is called with "r" == undefined.
The path for the data from the background page's cache to the content script is a bit complicated, so I'm not sure at which point the reputation becomes undefined. Considering that the reputation is shown correctly on the rating window, I think the cache itself is probably fine. There's probably something wrong with wot.search.getreputation.
At least it should use wot.default_component instead of 0 on line 302. This doesn't cause the bug though, just something I noticed. Clearly r is set to null somewhere there...
fixed.
Wait a minute. If there's no reputation for a site, there are no
A simple fix would be to either:
Good, that works. We should make sure we don't assume the r attribute exists elsewhere. And also, fix the bug in the Safari and Opera add-ons too.
OK, I'll file this issue for other browsers and replace 0 to wot.default_component.
And will check if we assume presence of "r"...
Btw, there's a problem with the fix. If the reputation is zero, it will be considered unknown. Test if the attribute is null instead:
var r = (data[wot.default_component] && data[wot.default_component].r != null) ?
data[wot_default_component].r : -1;
The same elsewhere in the function too.
OK
fixed again.
When a site doesn't have a reputation, wot.geticon called from wot.search.getcss sometimes returns this URL:
chrome-extension://bhmmomiinigofkjcapegjjndpbikblnp/skin/fusion/16_16/plain/undefined.png
Apparently the r parameter is undefined, which results in an invalid URL and no rating icon next to the search result. How does this happen...?
Edit: Good news, I can't reproduce it. Seems to happen randomly.