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: correctly track receiver for methods called via ctx bridge #39978

Merged
merged 2 commits into from Oct 18, 2023

Conversation

MarshallOfSound
Copy link
Member

@MarshallOfSound MarshallOfSound commented Sep 26, 2023

Closes #39891

Corrects an issue where functions called over the contextBridge were not being called with the expected receiver (this), leading to errors like the following:

"Uncaught (in promise) Error: Illegal invocation: Function must be called on an object of type NativeImage"

Notes: Functions called over the contextBridge are now called with the expected receiver (this)

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Sep 26, 2023
@MarshallOfSound MarshallOfSound added target/27-x-y PR should also be added to the "27-x-y" branch. semver/patch backwards-compatible bug fixes labels Sep 26, 2023
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Sep 27, 2023
@github-actions github-actions bot added the target/28-x-y PR should also be added to the "28-x-y" branch. label Oct 11, 2023
Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

Can we add a test that verifies the issue in #39891?

@jkleinsc
Copy link
Contributor

@codebytere specifically calling image.getSize() from the renderer, not the main process.

@codebytere
Copy link
Member

@jkleinsc done!

@jkleinsc jkleinsc merged commit fd28611 into main Oct 18, 2023
16 checks passed
@jkleinsc jkleinsc deleted the ctx-bridge-recv branch October 18, 2023 14:21
@release-clerk
Copy link

release-clerk bot commented Oct 18, 2023

Release Notes Persisted

Functions called over the contextBridge are now called with the expected receiver (this)

@trop
Copy link
Contributor

trop bot commented Oct 18, 2023

I have automatically backported this PR to "27-x-y", please check out #40262

@trop trop bot added in-flight/27-x-y and removed target/27-x-y PR should also be added to the "27-x-y" branch. labels Oct 18, 2023
@trop
Copy link
Contributor

trop bot commented Oct 18, 2023

I have automatically backported this PR to "28-x-y", please check out #40263

@trop trop bot added in-flight/28-x-y merged/28-x-y PR was merged to the "28-x-y" branch. merged/27-x-y PR was merged to the "27-x-y" branch. and removed target/28-x-y PR should also be added to the "28-x-y" branch. in-flight/28-x-y in-flight/27-x-y labels Oct 18, 2023
felixrieseberg pushed a commit to felixrieseberg/electron that referenced this pull request Oct 25, 2023
…tron#39978)

* fix: correctly track receiver for methods called via ctx bridge

* spec: test for correct contextBridge passage

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
MrHuangJser pushed a commit to MrHuangJser/electron that referenced this pull request Dec 11, 2023
…tron#39978)

* fix: correctly track receiver for methods called via ctx bridge

* spec: test for correct contextBridge passage

---------

Co-authored-by: Shelley Vohr <shelley.vohr@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merged/27-x-y PR was merged to the "27-x-y" branch. merged/28-x-y PR was merged to the "28-x-y" branch. semver/patch backwards-compatible bug fixes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug]: NativeImage methods returned by capturePage fail with "Error: Illegal invocation"
3 participants