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 6 commits into from Nov 4, 2019


Copy link

MarshallOfSound commented Oct 28, 2019

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

* 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
@trop trop bot mentioned this pull request Oct 28, 2019
13 of 13 tasks complete
@MarshallOfSound MarshallOfSound changed the title Context bridge 7 0 x feat: add a new contextBridge module Oct 28, 2019
@electron-cation electron-cation bot removed the new-pr 🌱 label Oct 29, 2019
zcbenz approved these changes Oct 30, 2019
Copy link

jkleinsc left a comment

Blocking until 7-1-x

@MarshallOfSound MarshallOfSound changed the base branch from 7-0-x to 7-1-x Nov 4, 2019
@trop trop bot added the 7-1-x label Nov 4, 2019
@MarshallOfSound MarshallOfSound removed the 7-0-x label Nov 4, 2019
@MarshallOfSound MarshallOfSound dismissed jkleinsc’s stale review Nov 4, 2019

7-1-x is here

@MarshallOfSound MarshallOfSound merged commit 976c7d1 into 7-1-x Nov 4, 2019
15 of 16 checks passed
15 of 16 checks passed
electron-woa-testing Build #20191030.3 had test failures
Artifact Comparison Changes Detected
Semantic Pull Request ready to be squashed
Valid Backport Valid Backport
WIP Ready for review
appveyor: win-ia32-testing AppVeyor build succeeded
appveyor: win-ia32-testing-pr AppVeyor build succeeded
appveyor: win-woa-testing AppVeyor build succeeded
appveyor: win-x64-testing AppVeyor build succeeded
appveyor: win-x64-testing-pr AppVeyor build succeeded
build-linux Workflow: build-linux
build-mac Workflow: build-mac
electron-arm-testing Build #20191030.4 succeeded
electron-arm64-testing Build #20191030.4 succeeded
lint Workflow: lint
release-notes Release notes found

This comment has been minimized.

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 Nov 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
4 participants
You can’t perform that action at this time.