4016: ReviewBoard pages fail to load due to Djblets.getGravatarForDisplay

kyz

What version are you running?

2.5

What's the URL of the page containing the problem?

any

What steps will reproduce the problem?

  1. Increase size of Firefox screen (so window.devicePixelRatio > 1)
  2. Modify your ReviewBoard's djblets.gravatars.get_gravatar_url_for_email() (perhaps because you don't want requests to go out to gravatar.com and you use local files instead), so the "gravatar url" does not contain any query-parameters, (e.g. it becomes "/avatars/email-address.png" instead of "https://www.gravatar.com/avatar/hash?s=32")
  3. Look at any page on ReviewBoard

What is the expected output? What do you see instead?

Expected: page renders
Actual: page fails to render due to a ReferenceError in jquery.gravy.retina.js

Djblets.getGravatarForDisplay = function(url) {
if (window.devicePixelRatio > 1) {
var parts = url.split('?', 2),
params,
param,
baseurl,
size,
i;

    if (parts.length === 2) {
        baseurl = parts[0];
        params = parts[1].split('&');

        for (i = 0; i < params.length; i++) {
            param = params[i].split('=', 2);

            if (param.length === 2 && param[0] === 's') {
                size = parseInt(param[1], 10);
                params[i] = 's=' +
                            Math.floor(size * window.devicePixelRatio);
            }
        }

        url = baseurl + '?' + params.join('&');
    } else {
        console.log('Failed to parse URL for gravatar ' + src);
    }
}

return url;

};

The console.log line fails, there is no such variable "src" -- was "url" meant?

What operating system are you using? What browser?

Linux, Firefox

Please provide any additional information below.

david
#1 david

Yes, I think that's what was meant, but that's really a case that doesn't get hit in practice unless you have, as you mentioned, modified the code.

#2 kyz

This bug was fixed in the Djblets 0.9.3 release.

https://www.reviewboard.org/docs/releasenotes/djblets/0.9.3/

Fixed a failure when logging other failures in Djblets.getGravatarForDisplay().

#3 jamie
  • -New
    +Fixed
  • -reviewboard
    +djblets
  • +Release-0.9.x