Bug 1003238 - Make getdimensions more robust;r=davehunt