#53205: fix: reject non-integer worldId in executeJavaScriptInIsolatedWorld
Merged
Description of Change
webContents.executeJavaScriptInIsolatedWorld forwarded worldId to the renderer with no integer check.
- Integer
worldId(e.g.1234) evaluates the script and resolves with the result. - String
worldId(e.g.'1234') resolved the promise withundefinedand did not reject.
The docs describe worldId as an Integer. This change throws TypeError: worldId must be an integer for non-integer values, matching other Electron APIs that reject bad argument types instead of succeeding silently.
Checklist
- PR description included
- I have built and tested this PR
-
npm testpasses - PR release notes describe the change in a way relevant to app developers, and are capitalized, punctuated, and past tense
Test plan
- Official:
yarn test -match=executeJavaScriptInIsolatedWorld - Existing isolated-world result test still passes with integer
999 - New test: string
'1234'is rejected withTypeError
Release Notes
Notes: Fixed webContents.executeJavaScriptInIsolatedWorld resolving with undefined when worldId was not an integer.
Backports
Semver Impact
Major
Breaking changes
Minor
New features
Patch
Bug fixes
None
Docs, tests, etc.
Semantic Versioning helps users understand the impact of updates:
- Major (X.y.z): Breaking changes that may require code modifications
- Minor (x.Y.z): New features that maintain backward compatibility
- Patch (x.y.Z): Bug fixes that don't change the API
- None: Changes that don't affect using facing parts of Electron