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

feat: add a new contextBridge module #20789

Merged
merged 6 commits into from Nov 4, 2019
Merged

Conversation

MarshallOfSound
Copy link
Member

Backport of #20307 see that PR for details.

Notes: Added new contextBridge module to make it easier to communicate between an isolated context and the main world

* feat: add a new contextBridge module

* chore: fix docs linting

* feat: add support for function arguments being proxied

* chore: ensure that contextBridge can only be used when contextIsolation is enabled

* docs: getReverseBinding can be null

* docs: fix broken links in md file

* feat: add support for promises in function parameters

* fix: linting failure for explicit constructor

* Update atom_api_context_bridge.cc

* chore: update docs and API design as per feedback

* refactor: remove reverse bindings and handle GC'able functions across the bridge

* chore: only expose debugGC in testing builds

* fix: do not proxy promises as objects

* spec: add complete spec coverage for contextBridge

* spec: add tests for null/undefined and the anti-overwrite logic

* chore: fix linting

* spec: add complex nested back-and-forth function calling

* fix: expose contextBridge in sandboxed renderers

* refactor: improve security of default_app using the new contextBridge module

* s/bindAPIInMainWorld/exposeInMainWorld

* chore: sorry for this commit, its a big one, I fixed like everything and refactored a lot

* chore: remove PassedValueCache as it is unused now

Values transferred from context A to context B are now cachde in the RenderFramePersistenceStore

* chore: move to anonymous namespace

* refactor: remove PassValueToOtherContextWithCache

* chore: remove commented unused code blocks

* chore: remove .only

* chore: remote commented code

* refactor: extract RenderFramePersistenceStore

* spec: ensure it works with numbered keys

* fix: handle number keys correctly

* fix: sort out the linter

* spec: update default_app asar spec for removed file

* refactor: change signatures to return v8 objects directly rather than the mate dictionary handle

* refactor: use the v8 serializer to support cloneable buffers and other object types

* chore: fix linting

* fix: handle hash collisions with a linked list in the map

* fix: enforce a recursion limit on the context bridge

* chore: fix linting

* chore: remove TODO

* chore: adapt for PR feedback

* chore: remove .only

* chore: clean up docs and clean up the proxy map when objects are released

* chore: ensure we cache object values that are cloned through the V8 serializer
* docs: mark contextBridge as experimental

This commit didn't make it to the original PR, quick addition here

* Update context-bridge.md
@MarshallOfSound MarshallOfSound added backport This is a backport PR semver/minor backwards-compatible functionality 7-0-x labels Oct 28, 2019
@trop trop bot mentioned this pull request Oct 28, 2019
13 tasks
@MarshallOfSound MarshallOfSound changed the title Context bridge 7 0 x feat: add a new contextBridge module Oct 28, 2019
@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Oct 28, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Oct 29, 2019
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.

Blocking until 7-1-x

@MarshallOfSound MarshallOfSound changed the base branch from 7-0-x to 7-1-x November 4, 2019 22:54
@trop trop bot added the 7-1-x label Nov 4, 2019
@MarshallOfSound MarshallOfSound merged commit 976c7d1 into 7-1-x Nov 4, 2019
@release-clerk
Copy link

release-clerk bot commented Nov 4, 2019

Release Notes Persisted

Added new contextBridge module to make it easier to communicate between an isolated context and the main world

@MarshallOfSound MarshallOfSound deleted the context-bridge-7-0-x branch November 4, 2019 22:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
7-1-x backport This is a backport PR semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants