Index: third_party/WebKit/Source/core/testing/Internals.cpp |
diff --git a/third_party/WebKit/Source/core/testing/Internals.cpp b/third_party/WebKit/Source/core/testing/Internals.cpp |
index fa9e10694eb5b6b4a97c70c45e3be9c870d0b68b..e790d9a3f1bd895213f6d1e52ce30f9d39b59689 100644 |
--- a/third_party/WebKit/Source/core/testing/Internals.cpp |
+++ b/third_party/WebKit/Source/core/testing/Internals.cpp |
@@ -1736,11 +1736,16 @@ String Internals::counterValue(Element* element) |
return counterValueForElement(element); |
} |
-int Internals::pageNumber(Element* element, float pageWidth, float pageHeight) |
+int Internals::pageNumber(Element* element, float pageWidth, float pageHeight, ExceptionState& exceptionState) |
{ |
if (!element) |
return 0; |
+ if (pageWidth <= 0 || pageHeight <= 0) { |
+ exceptionState.throwDOMException(V8TypeError, "Page width and height must be larger than 0."); |
+ return 0; |
+ } |
+ |
return PrintContext::pageNumberForElement(element, FloatSize(pageWidth, pageHeight)); |
} |
@@ -1765,11 +1770,16 @@ Vector<String> Internals::allIconURLs(Document* document) const |
return iconURLs(document, Favicon | TouchIcon | TouchPrecomposedIcon); |
} |
-int Internals::numberOfPages(float pageWidth, float pageHeight) |
+int Internals::numberOfPages(float pageWidth, float pageHeight, ExceptionState& exceptionState) |
{ |
if (!frame()) |
return -1; |
+ if (pageWidth <= 0 || pageHeight <= 0) { |
+ exceptionState.throwDOMException(V8TypeError, "Page width and height must be larger than 0."); |
+ return -1; |
+ } |
+ |
return PrintContext::numberOfPages(frame(), FloatSize(pageWidth, pageHeight)); |
} |