fix: preserve zoom level on navigation (#104268)

This commit is contained in:
Robo 2020-08-07 13:06:01 -07:00 committed by GitHub
parent 4d7ee02205
commit 836fbb1b5d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,6 +23,7 @@
}(this, function () {
const preloadGlobals = globals();
const sandbox = preloadGlobals.context.sandbox;
const webFrame = preloadGlobals.webFrame;
const safeProcess = sandbox ? preloadGlobals.process : process;
/**
@ -35,6 +36,7 @@
/**
* // configuration: INativeWindowConfiguration
* @type {{
* zoomLevel?: number,
* extensionDevelopmentPath?: string[],
* extensionTestsPath?: string,
* userEnv?: { [key: string]: string | undefined },
@ -43,6 +45,12 @@
* }} */
const configuration = JSON.parse(args['config'] || '{}') || {};
// Apply zoom level early to avoid glitches
const zoomLevel = configuration.zoomLevel;
if (typeof zoomLevel === 'number' && zoomLevel !== 0) {
webFrame.setZoomLevel(zoomLevel);
}
// Error handler
safeProcess.on('uncaughtException', function (error) {
onUnexpectedError(error, enableDeveloperTools);