mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
fix: crash on invalid zoomFactor (#22708)
This commit is contained in:
@@ -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));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user