fix: crash on invalid zoomFactor (#22673)
This commit is contained in:
parent
9c5874306d
commit
a4c4c86b9d
6 changed files with 37 additions and 5 deletions
|
@ -2,6 +2,7 @@
|
|||
// Use of this source code is governed by the MIT license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
|
@ -275,7 +276,14 @@ double GetZoomLevel(v8::Local<v8::Value> window) {
|
|||
return result;
|
||||
}
|
||||
|
||||
void SetZoomFactor(v8::Local<v8::Value> window, double factor) {
|
||||
void SetZoomFactor(gin_helper::ErrorThrower thrower,
|
||||
v8::Local<v8::Value> window,
|
||||
double factor) {
|
||||
if (factor < std::numeric_limits<double>::epsilon()) {
|
||||
thrower.ThrowError("'zoomFactor' must be a double greater than 0.0");
|
||||
return;
|
||||
}
|
||||
|
||||
SetZoomLevel(window, blink::PageZoomFactorToZoomLevel(factor));
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue