Commit graph

137 commits

Author SHA1 Message Date
Milan Burda
dac29f9949
refactor: type-safe module imports / requires (#41192) 2024-02-05 16:36:28 +09:00
Samuel Attard
d6bb9b40b0
feat: add webUtils module with getPathForFile method (#38776)
* feat: add blinkUtils module with getPathForFile method

This is designed to replace the File.path augmentation
we currently have in place to allow apps to get the filesystem
path for a file that blink has a representation of.

File.path is non-standard and messes with certain websites, using
a method like this is effectively 0-cost and removes one of the final
deviations we have with web standards.

* add error

* refactor: update per PR feedback

* chore: update patches

* oops

* chore: update patches

* chore: update patches

* feat: add blinkUtils module with getPathForFile method

This is designed to replace the File.path augmentation
we currently have in place to allow apps to get the filesystem
path for a file that blink has a representation of.

File.path is non-standard and messes with certain websites, using
a method like this is effectively 0-cost and removes one of the final
deviations we have with web standards.

* add error

* refactor: update per PR feedback

* chore: update patches

* oops

* chore: update patches

* chore: update patches

* chore: update patches

* fix: provide isolate to WebBlob::FromV8Value

* chore: add tests

* build: fix depshash mismatch on arm64 macOS

---------

Co-authored-by: PatchUp <73610968+patchup[bot]@users.noreply.github.com>
2023-11-20 15:59:36 -08:00
Milan Burda
2c88626b51
chore: revert deprecate as an internal module (#40146)
Revert "chore: restore deprecate as an internal module (#40124)"

This reverts commit 737e3de3fa.
2023-10-10 11:50:47 -04:00
Milan Burda
737e3de3fa
chore: restore deprecate as an internal module (#40124)
* Revert "refactor: don't expose deprecate as an internal module (#35311)"

This reverts commit 8424779906.

* check crashed event warnings
2023-10-09 08:55:16 +09:00
Milan Burda
3102a257af
feat: expose dummy module.exports to the sandboxed preload scripts (#39484) 2023-08-22 13:43:08 +09:00
Milan Burda
607e71d563
refactor: replace Object.prototype.hasOwnProperty() with Object.hasOwn() (#38929) 2023-06-27 16:57:33 -04:00
Shelley Vohr
f7c0a29d89
build: update to latest TypeScript (#38763) 2023-06-14 11:06:46 -07:00
Milan Burda
5d123765d9
feat: support node: prefixed requires in sandboxed renderer preloads (#38567)
feat: support node: prefixed requires in sandboxed renderer preloads
2023-06-10 14:36:16 -04:00
Milan Burda
a043a60b89
refactor: cleanup global variable declarations (#38410)
refactor: eliminate duplicate isolatedApi typing

Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-05-24 20:01:07 +02:00
Milan Burda
446c7809cc
refactor: process event emitting for sandboxed renderers (#37109)
Co-authored-by: Milan Burda <miburda@microsoft.com>
2023-02-03 11:59:57 +01:00
Milan Burda
99f4a42d41
chore: add missing .eslintrc.json files to limit imports properly (#35719) 2022-09-20 13:25:33 -05:00
Milan Burda
8424779906
refactor: don't expose deprecate as an internal module (#35311) 2022-08-15 17:09:33 +09:00
Milan Burda
dfb3b24de1
refactor: merge duplicate code from sandboxed/non-sandboxed renderer init (#31755) 2021-11-10 09:59:33 +09:00
Milan Burda
fe7f296339
refactor: remove duplicate contextIsolation from getWebPreference() (#31730) 2021-11-08 11:57:56 -05:00
Robo
2a92d8f962
refactor: only access memory coordinator interface from browser process (#31295)
Refs https://chromium-review.googlesource.com/c/chromium/src/+/3174305
2021-10-05 15:30:31 -07:00
Jeremy Rose
4fd7c2adcd
feat: make desktopCapturer main-process-only (#30720)
* feat: make desktopCapturer main-process-only

* remove --enable-api-filtering-logging

* remove test

* merge lib/browser/api/desktop-capturer.ts with lib/browser/desktop-capturer.ts

* remove desktop-capturer-get-sources event

* fix specs

* getSources needs to be async

Co-authored-by: Milan Burda <milan.burda@gmail.com>
2021-10-04 12:16:00 +09:00
Milan Burda
8b7631228f
chore: move native-image.ts back into common (#30838) 2021-09-06 11:06:27 +02:00
Milan Burda
c5ad7ed0cd
refactor: remove guestInstanceId from WebPreferences (#30280)
* refactor: remove guestInstanceId from WebPreferences

* refactor: remove WebViewManager::GetEmbedder
2021-07-28 15:32:53 -07:00
Milan Burda
8d0ed05c99
refactor: replace a few usages of V8 hidden properties (#29400) 2021-06-03 14:59:56 +09:00
Milan Burda
8fc86517fa
refactor: expose process.contextId directly (#29236) 2021-05-24 16:51:54 +09:00
Milan Burda
2c65060ec8
chore: make raw requires type-safe (#29006)
* chore: make raw requires type-safe

* refactor: no need for separate webViewImplModule

* refactor: no need for separate guestViewInternalModule
2021-05-05 18:05:01 -07:00
Samuel Attard
e5e8ab4eea
refactor: remove more dead code post render process reuse (#28983)
* Overrides for window.history.*
* Node environment cleanup / creation logic
* Options and switches that are now static values
2021-05-04 11:30:29 -07:00
Samuel Attard
6df2680cb6
refactor: clean up webFrame implementation to use gin wrappers (#28497)
* refactor: clean up webFrame implementation to use gin wrappers

The previous implementation of webFrame in the renderer process leaked
sub-frame contexts and global objects across the context boundaries thus
making it possible for apps to either maliciously or accidentally
violate the contextIsolation boundary.

This re-implementation binds all methods in native code directly to
content::RenderFrame instances instead of relying on JS to provide a
"window" with every method request.  This is much more consistent with
the rest of the Electron codebase and is substantially safer.

* chore: un-re-order for ease of review

* chore: pass isolate around instead of ErrorThrower

* chore: fix rebase typo

* chore: remove unused variables
2021-04-12 16:35:18 -07:00
Milan Burda
485fa5bea9
feat: add process.contextId used by @electron/remote (#28007) 2021-03-17 11:23:03 -07:00
Milan Burda
5b205731f6
chore: remove deprecated remote module (#25734)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2021-03-09 17:12:40 -08:00
Jeremy Rose
706d9ede9b
refactor: only allow internal messages from the main process (#27676) 2021-02-09 17:12:26 -08:00
Milan Burda
6932e02eb8
refactor: use getWebPreference() for all options (#26531) 2020-11-23 22:39:08 +03:00
loc
0b85fdf26c
feat: add webContents.setWindowOpenHandler API (#24517)
Co-authored-by: Jeremy Rose <jeremya@chromium.org>
2020-11-10 09:06:03 -08:00
Milan Burda
2c68bad631
refactor: create IPC_MESSAGES enum for IPC message channels (#25694) 2020-10-14 00:11:06 +03:00
George Xu
beaf60de0a
feat: add nativeImage.createThumbnailFromPath API (#24802)
* initial commit, mac implementation

* add documentation

* convert createThumbnailFromPath to async function

* windows impl protoype

* add tests

* added test

* fix

* fix test

* clean up

* update docs

* cleaning up code

* fix test

* retrigger CI

* retrigger CI

* refactor from app to native_image

* windows build

* lint

* lint

* add smart pointers, fix test

* change tests and update docs

* fix test, remove nolint

* add renderer-main process routing to fix tests

* lint

* thanks sam

* thanks sam
2020-08-24 09:36:13 -07:00
Samuel Attard
ad16e6c647
build: update linting deps (#24461) 2020-07-08 21:19:49 -07:00
Shelley Vohr
659e79fc08
refactor: prevent consistent early exception (#24191)
* refactor: prevent consistent early exception

* Use _linkedBinding where possible

* Remove dead electronBinding
2020-06-22 20:32:45 -07:00
Samuel Attard
969f46a48f
chore: remove IPC hiddens (#23720) 2020-06-02 02:33:06 -07:00
Samuel Attard
c6f4573a13
perf: lazily load some modules in sandbox mode (#23856) 2020-06-02 02:32:32 -07:00
Samuel Attard
066b8c5ab3
fix: expose electron/common and electron/renderer modules in sandboxed preloads (#23857) 2020-06-01 17:37:02 -07:00
Samuel Attard
236c1334e3
chore: tsify sandboxed init (#23719) 2020-05-30 02:56:54 -07:00
Samuel Attard
e3c2ec9f7c
chore: remove unused isolated-world-args (#23716) 2020-05-21 20:11:58 -07:00
Samuel Attard
9d7ba98209
refactor: remove the RenderFrameFunctionStore and use privates to memory manage (#23592) 2020-05-15 11:57:40 -07:00
Milan Burda
392ea320cf
build: allow use of BUILDFLAG directives from within JS code (#20328) 2020-05-11 01:06:07 +02:00
Milan Burda
4bbb2fbf1f
chore: remove unused ELECTRON_GET_CONTENT_SCRIPTS ipc handler (#23371) 2020-04-30 21:32:08 -07:00
Jeremy Apthorp
8d0a612265
refactor: remove code for non-native extensions shim (#23340) 2020-04-30 09:38:09 -07:00
Samuel Attard
b03bd8c45c
chore: rename atom things to electron things in our docs / scripts (#23100) 2020-04-13 14:32:29 -07:00
Samuel Attard
5d657dece4
build: enable JS semicolons (#22783) 2020-03-20 13:28:31 -07:00
Samuel Attard
b87b501161
build: update eslint + eslint plugins (#22777)
* build: run eslint --fix

* chore: manually fix all hasOwnProperty errors

* chore: manually fix all void 0 vs undefined errors

* chore: manually fix all async-in-promise errors

* chore: manually fix lexical declaration in case block
2020-03-20 11:12:18 -04:00
Jeremy Apthorp
b4d07f76d3
feat: MessagePorts in the main process (#22404) 2020-03-11 18:07:54 -07:00
Samuel Attard
360c1cad1b
chore: do not override history methods when rendererprocessreuse is enabled (#22335) 2020-02-24 12:14:11 -08:00
Milan Burda
31c93fec67 fix: load window-setup in sandboxed renderer (#21416) 2020-01-06 22:23:03 +01:00
Samuel Attard
d91cc257f9
chore: emit the document-start and document-end events in a sandboxed renderer (#20987) 2019-11-05 17:53:03 -08:00
Milan Burda
ee7ce3954a fix: don't export __esModule = true by electron.ts (#20939) 2019-11-04 14:16:42 -08:00
Samuel Attard
0090616f7b
feat: add a new contextBridge module (#20307)
* 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
2019-10-18 12:57:09 -07:00