Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: crash on invalid zoomFactor #22673

Merged
merged 1 commit into from Mar 13, 2020
Merged

fix: crash on invalid zoomFactor #22673

merged 1 commit into from Mar 13, 2020

Conversation

codebytere
Copy link
Member

@codebytere codebytere commented Mar 12, 2020

Description of Change

This PR fixes a crash caused by passing a value of 0.0 to webContents.setZoomFactor(), seen below:

[38965:0312/111238.132477:FATAL:values.cc(211)] Check failed: false. Non-finite (i.e. NaN or positive/negative infinity) values cannot be represented in JSON
0   Electron Framework                  0x0000000117ce2839 base::debug::CollectStackTrace(void**, unsigned long) + 9
1   Electron Framework                  0x0000000117badb13 base::debug::StackTrace::StackTrace() + 19
2   Electron Framework                  0x0000000117bcc639 logging::LogMessage::~LogMessage() + 249
3   Electron Framework                  0x0000000117cd11c9 base::Value::Value(double) + 153
4   Electron Framework                  0x0000000112b2f420 electron::ZoomLevelDelegate::OnZoomLevelChanged(content::HostZoomMap::ZoomLevelChange const&) + 768
5   Electron Framework                  0x0000000116e79548 void base::CallbackList<void (content::HostZoomMap::ZoomLevelChange const&)>::Notify<content::HostZoomMap::ZoomLevelChange&>(content::HostZoomMap::ZoomLevelChange&) + 56

It will now throw a descriptive error informing the user that values must be greater than 0.0. Also corrects docs which incorrectly stated that the zoomFactor was a Number and not a Double.

cc @MarshallOfSound @jkleinsc @zcbenz

Checklist

Release Notes

Notes: Fixed a potential crash on invalid zoomFactor values when setting the zoom factor of a webpage.

shell/browser/api/electron_api_web_contents.cc Outdated Show resolved Hide resolved
shell/renderer/api/electron_api_web_frame.cc Outdated Show resolved Hide resolved
spec-main/api-web-contents-spec.ts Show resolved Hide resolved
@codebytere codebytere requested a review from ckerr March 12, 2020 21:58
Copy link
Member

@ckerr ckerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😎

@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Mar 13, 2020
@codebytere codebytere merged commit a4c4c86 into master Mar 13, 2020
@release-clerk
Copy link

release-clerk bot commented Mar 13, 2020

Release Notes Persisted

Fixed a potential crash on invalid zoomFactor values when setting the zoom factor of a webpage.

@trop
Copy link
Contributor

trop bot commented Mar 13, 2020

I was unable to backport this PR to "7-1-x" cleanly;
you will need to perform this backport manually.

@trop trop bot removed the target/7-1-x label Mar 13, 2020
@trop
Copy link
Contributor

trop bot commented Mar 13, 2020

I was unable to backport this PR to "8-x-y" cleanly;
you will need to perform this backport manually.

@trop
Copy link
Contributor

trop bot commented Mar 13, 2020

I was unable to backport this PR to "9-x-y" cleanly;
you will need to perform this backport manually.

@codebytere codebytere deleted the catch-bad-zoom-factor branch March 13, 2020 23:13
codebytere added a commit that referenced this pull request Mar 16, 2020
@trop
Copy link
Contributor

trop bot commented Mar 16, 2020

@codebytere has manually backported this PR to "9-x-y", please check out #22708

@trop
Copy link
Contributor

trop bot commented Mar 16, 2020

@codebytere has manually backported this PR to "8-x-y", please check out #22709

@trop
Copy link
Contributor

trop bot commented Mar 16, 2020

@codebytere has manually backported this PR to "7-1-x", please check out #22710

@trop
Copy link
Contributor

trop bot commented Mar 23, 2020

@codebytere has manually backported this PR to "7-2-x", please check out #22710

@trop trop bot added the in-flight/7-2-x label Mar 23, 2020
@sofianguy sofianguy added this to Fixed in 8.2.0 in 8.2.x Apr 3, 2020
@sofianguy sofianguy added this to Fixed in 9.0.0-beta.10 in 9-x-y Apr 3, 2020
sentialx pushed a commit to sentialx/electron that referenced this pull request Apr 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
8.2.x
Fixed in 8.2.0
9-x-y
Fixed in 9.0.0-beta.10
Development

Successfully merging this pull request may close these issues.

None yet

4 participants