Commit graph

78 commits

Author SHA1 Message Date
Samuel Attard
af64140100
refactor: enforce naming of ipcMainInternal (#16689) 2019-02-04 14:49:53 -08:00
Samuel Attard
58a6fe13d6
feat: preloads and nodeIntegration in iframes (#16425)
* feat: add support for node / preloads in subframes

This feature has delibrately been built / implemented in such a way
that it has minimum impact on existing apps / code-paths.
Without enabling the new "nodeSupportInSubFrames" option basically none of this
new code will be hit.

The things that I believe need extra scrutiny are:

* Introduction of `event.reply` for IPC events and usage of `event.reply` instead of `event.sender.send()`
* Usage of `node::FreeEnvironment(env)` when the new option is enabled in order to avoid memory leaks.  I have tested this quite a bit and haven't managed to cause a crash but it is still feature flagged behind the "nodeSupportInSubFrames" flag to avoid potential impact.

Closes #10569
Closes #10401
Closes #11868
Closes #12505
Closes #14035

* feat: add support preloads in subframes for sandboxed renderers

* spec: add tests for new nodeSupportInSubFrames option

* spec: fix specs for .reply and ._replyInternal for internal messages

* chore: revert change to use flag instead of environment set size

* chore: clean up subframe impl

* chore: apply suggestions from code review

Co-Authored-By: MarshallOfSound <samuel.r.attard@gmail.com>

* chore: clean up reply usage

* chore: fix TS docs generation

* chore: cleanup after rebase

* chore: rename wrap to add in event fns
2019-01-22 11:24:46 -08:00
Pedro Pontes
d5d1fa8290 fix: use appropriate site instance for cross-site nav's (#15821)
* fix: use Chromium's determined new site instance as candidate when navigating.

When navigating to a new address, consider using Chromium's determined site instance
for the new page as it should belong to an existing browsing instance when the
navigation was triggered by window.open().

fixes 8100.

* Revert "fix: use Chromium's determined new site instance as candidate when navigating."

This reverts commit eb95f935654a2c4d4457821297670836c10fdfd5.

* fix: delegate site instance creation back to content when sandboxed.

* fix: ensure site isolation is on

* test: adapt ut for cross-site navigation

* fix: register pending processes during a navigation.

* refactor: dont call loadURL for a window constructed from an existing webContents.

* test: add sandboxed affinity UT's.

* fix: check affinity before deciding if to force a new site instance.

* chore: adapt subsequent patch.

* refactor: constify logically const methods.

* fix: do not reuse site instances when navigation redirects cross-site.

* test: ensure localStorage accessible after x-site redirect.

* test: adapt localStorage acess denied UT for site isolation.

* fix: do not send render-view-deleted for speculative frames.

* chore: amend tests after rebase.

* test: add ut for webContents' render-view-deleted emission

* fix: introduce current-render-view-deleted for current RVH's deletions.

Revert render-view-deleted to being emitted with any RVH's deletion.
current-render-view-deleted is emitted only when the RVH being deleted
is the current one.

* refactor: style and comments fixed.
2018-12-05 17:03:39 +09:00
Milan Burda
aa2b2f7c8f fix: security: don't allow arbitrary methods to be invoked on webContents via IPC (#15919) 2018-12-04 16:12:21 +01:00
Pedro Pontes
57d2ae1aec revert: "fix: window.open site instance should belong to same browsing instance (#15216)" (#15757)
This reverts commit 8f35198bfb.
2018-11-20 21:28:26 +01:00
Pedro Pontes
8f35198bfb fix: window.open site instance should belong to same browsing instance (#15216) 2018-11-12 22:01:43 +01:00
Milan Burda
d3efc52745 feat: add webPreferences.enableRemoteModule option (#13028) 2018-10-13 20:50:07 +03:00
Milan Burda
b50f86ef43 refactor: use separate ipc-renderer-internal / ipc-main-internal APIs for Electron internals (#13940) 2018-10-07 00:48:00 +13:00
Samuel Attard
54ef906832
[RFC] perf: use an internal module resolver to improve require performance (#14633)
* perf: use an internal module resolver instead of relative requires

* perf: memoize the results of getting exported Electron properties

* perf: make internal module changes consistent across sandboxed / bundled files
2018-09-20 13:43:26 +10:00
Samuel Attard
558fff69e7
chore: update to standard 12 2018-09-14 14:57:01 +10:00
Samuel Attard
7a514d26bb fix: inheritance of webPreferences sub properties 2018-08-22 11:16:46 -05:00
Milan Burda
271d582aac refactor: make methods const, cleanup (#13937) 2018-08-09 10:15:23 -07:00
Jeremy Apthorp
f0d08f4da1 Propagate referrer to new windows (#12397)
* Propagate referrer to new windows

Fixes #9205

* Rearrange -new-window event arguments for backwards-compatibility

* Plumb referrer policy through guest-window-manager

* Document the Referrer structure and its uses

* Add tests for referrer in new windows

* Docs nits
2018-04-05 18:13:24 -05:00
Charles Kerr
c2673aa970 Set appropriate defaults for webview options (#12271)
* Persist defaults to webPreferences object to JS land can read the inferred values instead of just user defined values

* Test inherited default propogation

* Refactor to remove coupling from fetching values and defaults

* Test description type

* Fix up tests
2018-03-15 13:56:46 +09:00
Charles Kerr
e400585a0e Apply further ES6 bikeshedding 2018-03-13 17:09:47 +09:00
Charles Kerr
2d90e763ad Use idiomatic ES6 when merging options 2018-03-13 16:23:39 +09:00
Charles Kerr
379bd79de4 Remove unnecessary work when merging options 2018-03-13 16:18:50 +09:00
Charles Kerr
685948bcaa Parent's visibility trumps inherited 'show' option 2018-03-13 00:28:34 +09:00
Shelley Vohr
db6d84de74
don't inherit isBrowserView for spawned child windows 2018-02-01 00:09:37 -05:00
Kevin Sawicki
fc53ac3d38 Always register closed listeners 2017-07-17 11:55:16 -07:00
Kevin Sawicki
86b1deedfa Inherit enabled-sandbox in opened windows 2017-07-17 11:55:15 -07:00
Kevin Sawicki
61167ca296 Inherit nativeWindowOpen from parent window 2017-07-17 11:55:15 -07:00
Kevin Sawicki
e735aa7dee web-preferences -> webPreferences 2017-05-26 10:10:36 -07:00
Kevin Sawicki
4e9efebf47 🎨 2017-05-26 10:10:36 -07:00
Kevin Sawicki
9e88d337ec Inherit webviewTag setting from parent window 2017-05-17 13:37:23 -07:00
Ryohei Ikegami
7ac93045b7 Merge branch 'master' into native-window-open 2017-05-11 13:51:43 +09:00
Kevin Sawicki
fa4ec11a12 Use isSameOrigin helper when posting message 2017-05-01 08:45:38 -07:00
Ryohei Ikegami
1d73e84a29 Merge branch 'master' into native-window-open 2017-04-27 12:03:55 +09:00
Kevin Sawicki
507f60e33e Don't allow webPreferences to be overrideden in features string 2017-04-26 10:56:53 -07:00
Kevin Sawicki
91a1e5cdfe Store frame to guests in map 2017-04-26 10:14:11 -07:00
Kevin Sawicki
3e2a1034af Disable JavaScript on child when disabled on parent 2017-04-25 12:57:53 -07:00
Kevin Sawicki
6ec74060b4 Enable setting javascript and contextIsolation via window.open 2017-04-25 12:57:53 -07:00
Ryohei Ikegami
9edfbab89f Add comment why defaultPrevented = false 2017-03-28 19:58:58 +09:00
Ryohei Ikegami
de2019f6b8 Change webContents -> options.webContents 2017-03-28 19:58:23 +09:00
Ryohei Ikegami
4e473897b7 Use === 2017-03-24 11:08:08 +09:00
Ryohei Ikegami
deba6553f5 Better preventDefault for ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN 2017-03-23 23:51:33 +09:00
Ryohei Ikegami
d3252e0eb1 Reuse existing event 2017-03-21 16:09:53 +09:00
Ryohei Ikegami
076427673e Fix JavaScript style 2017-03-19 18:20:10 +09:00
Ryohei Ikegami
319a7759d0 Fix ELECTRON_GUEST_WINDOW_MANAGER_INTERNAL_WINDOW_OPEN handler 2017-03-19 17:52:39 +09:00
Kevin Sawicki
3f7b3c4bd7 Implement window overrides in main context 2017-01-16 12:38:16 -08:00
Kevin Sawicki
95054f443f Enable context isolation on child windows 2017-01-16 12:38:16 -08:00
Kevin Sawicki
1944fdc962 Track visited parents and null out cycles 2017-01-06 09:58:40 -08:00
Kevin Sawicki
c8ff67ab75 Use spread syntax instead of function apply 2016-12-01 14:56:00 -08:00
Kevin Sawicki
3a29555772 Access URL through webContents directly 2016-11-28 10:56:23 -08:00
Kevin Sawicki
0134d62681 Always use guest contents for canAccessWindow check 2016-11-23 12:01:09 -08:00
Kevin Sawicki
651eaec64f Use sender.id instead of sender.webContents.id 2016-11-16 07:50:30 -08:00
Kevin Sawicki
92577c37c8 Don't log blocked messages when guestWindow is null 2016-11-16 07:50:30 -08:00
Cheng Zhao
18fca785c4 Print error messages 2016-11-16 07:50:30 -08:00
Cheng Zhao
a1066617a8 Do permission check when calling guest window methods 2016-11-16 07:50:30 -08:00
Kevin Sawicki
50019f39e9 🎨 2016-11-11 10:54:01 -08:00