Skip to content

Commit

Permalink
When taking screenshot check window.document.body dimensions only if …
Browse files Browse the repository at this point in the history
…it is

not null. Fixes issue 5130
  • Loading branch information
barancev committed Feb 27, 2013
1 parent 1e74123 commit ba2f5ff
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions javascript/firefox-driver/js/screenshooter.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,14 @@ fxdriver.screenshot.grab = function(window) {
canvas.style.display = 'none';
documentElement.appendChild(canvas);
}
var width =
Math.max(documentElement.scrollWidth, document.body.scrollWidth);
var height =
Math.max(documentElement.scrollHeight, document.body.scrollHeight);
var width = documentElement.scrollWidth;
if (document.body && document.body.scrollWidth > width) {
width = document.body.scrollWidth;
}
var height = documentElement.scrollHeight;
if (document.body && document.body.scrollHeight > height) {
height = document.body.scrollHeight;
}
canvas.width = width;
canvas.height = height;
var context = canvas.getContext('2d');
Expand Down

0 comments on commit ba2f5ff

Please sign in to comment.