Skip to content

Commit

Permalink
Fixing screenshooter in Firefox and Selenium RC, limiting the size of…
Browse files Browse the repository at this point in the history
… the screenshot to pevent failures. Fixes issue 5103
  • Loading branch information
barancev committed Oct 25, 2013
1 parent 8bbba75 commit 48e9f54
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions javascript/selenium-core/scripts/selenium-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -3004,6 +3004,21 @@ Selenium.prototype.doCaptureEntirePageScreenshot = function(filename, kwargs) {
width: doc.scrollWidth,
height: doc.scrollHeight
};

// CanvasRenderingContext2D::DrawWindow limits width and height up to 65535
// > 65535 leads to NS_ERROR_FAILURE
//
// HTMLCanvasElement::ToDataURLImpl limits width and height up to 32767
// >= 32769 leads to NS_ERROR_FAILURE
// >= 32767 leads to transparent image (moz issue?).
//
var limit = 32766;
if (box.width > limit) {
box.width = limit;
}
if (box.height > limit) {
box.height = limit;
}
LOG.debug('computed dimensions');

var originalBackground = doc.style.background;
Expand Down

0 comments on commit 48e9f54

Please sign in to comment.