openlayers/ol3 — pull request #2406 by ahocevar (2014-07-21 10:19:53+00:00)
Title: Infinite loop in ol.control.ScaleLine

See the fiddle here and pan north:
http://jsfiddle.net/4ERxV/5/

Once the center latitude hits 90 degrees, the browser will hang because of an infinite while(true) loop in ol.control.ScaleLine#updateElement_.

The infinite loop happens because of this bit:
```
cosLatitude = Math.cos(goog.math.toRadians(center[1])); // this will be 0
pointResolution *= Math.PI * cosLatitude * ol.sphere.NORMAL.radius / 180; // causing this to be 0
```

Which causes:
```
while (true) {
count = ol.control.ScaleLine.LEADING_DIGITS[i % 3] * Math.pow(10, Math.floor(i / 3));
width = Math.round(count / pointResolution); // this becomes NaN
if (width >= this.minWidth_) { // and this is never true
break;
}
++i;
}
```