Commit graph

65 commits

Author SHA1 Message Date
Cheng Zhao
e2029435c4 fix: use context counter as contextId
For sandboxed renderer it may not have a node::Environment in the context,
using a increasing counter as contextId works for all cases.
2018-07-19 11:00:10 -07:00
Cheng Zhao
4cdb1b8fc3 fix double-freeing remote references
After the page does navigations, garbage collection can still happen in
the old context. This commit changes to store references to remote objects
by _pages_, instead of by _WebContents_.
2018-07-12 10:44:26 +09:00
Milan Burda
4cfe5ecaa4 add proper support for typed arrays in remote (#13055) 2018-05-24 21:05:46 +09:00
Thiago de Arruda
6f076f7433 Refactor sandbox preload initialization. (#12877)
Use a single synchronous IPC call to retrieve data required by early
sandbox scripts. This has two purposes:

- Optimize preload script initialization by:
  - Using one synchronous IPC call to retrieve preload script,
  webContentsId (more on that later), process.{platform,execPath,env}
  - Lazy loading as many modules as possible.
- Fix #12316 for sandbox. @MarshallOfSound addressed the issue in
  #12342, but it was still present in sandbox mode. By loading
  webContentsId very early and skipping remote module at early
  startup, we fix it for sandbox.
2018-05-21 22:56:05 +10:00
Tatsuya Hiroishi
9c65abd746 handle remote exception (#12694)
* add cause property to exception in callFunction

* update exceptionToMeta function

* add sender argument
* and cause property to return value

* update exception convert in metaToValue function

* add from and cause properties to the exception error

* unit test for remote exception
2018-04-24 08:40:19 -04:00
Samuel Attard
0ac883c6d4
Remove the race condition between new process creation and context release (#12342)
* Remove the race condition between new process creation and old process releasing remote context

Previously there was a race condition where the getId() method would return the new context ID even
though the release was for the old context.  This changes it to send the "initial" context ID with
the release message to ensure there is no race.

* fetch context ID from remote in sandbox mode
2018-03-20 15:54:47 +11:00
Shelley Vohr
803fa35484
fix null value check 2017-11-03 08:47:21 -04:00
Shelley Vohr
2b2c7d7f9f
fix object serialization test issue 2017-11-02 21:29:17 -04:00
Shelley Vohr
5c318932c2
add some structural changes 2017-11-02 21:07:40 -04:00
Shelley Vohr
5f6f117bad
changes from review 2017-10-25 23:41:11 -04:00
Shelley Vohr
d4880b135a
revert ipc lookup table 2017-10-25 15:36:16 -04:00
Shelley Vohr
c0f2a7b44a
fix standard issues 2017-10-25 09:56:02 -04:00
Shelley Vohr
f129622446
clean up remote 2017-10-25 09:51:21 -04:00
Thiago de Arruda
6b5bd3b6ce Fix how rpc-server releases references after page reload
In addition to listening for "render-view-deleted", listen for
"ELECTRON_BROWSER_CONTEXT_RELEASE" synchronous message, which is sent by the
remote module when the page is about to be navigated.

This is required to allow child windows running in the same renderer to
correctly manage remote object references, since `render-view-deleted` is only
called when the renderer exits.

Close #9387
2017-05-16 09:05:52 -03:00
Kevin Sawicki
7065123266 Wrap remote value being set as an arg 2017-04-04 11:18:16 -07:00
Kevin Sawicki
e85e483c71 Parse setting response to surface thrown errors 2017-04-03 12:16:51 -07:00
Kevin Sawicki
286f529968 Merge pull request #8890 from twolfson/dev/proxy.to.string.sqwished
🐛 Add toString support to remote functions
2017-03-20 09:35:51 -07:00
Kevin Sawicki
c50b518493 Check toString after loading remote properties 2017-03-17 10:29:07 -07:00
Todd Wolfson
818738ce84 🐛 Add toString support to remote functions 2017-03-17 08:21:37 -07:00
Thiago de Arruda
f6befbe764 Expose lib/renderer/api/remote.js to sandboxed renderer 2017-03-16 14:21:23 -03:00
Thiago de Arruda
44bd93589a Refactor electron exports to keep module list in separate files 2017-03-09 19:08:01 -03:00
Kevin Sawicki
dbe9893d29 Assign Promise.resolve to constant 2017-03-07 12:10:09 -08:00
Kevin Sawicki
79b17c2cd9 Expose TouchBar on remote module 2017-03-03 14:00:39 -08:00
Kevin Sawicki
e8a79cb88d Don't require browser process module from renderer
This can cause issues when it is accessed from the
require cache or module tree since the getters throw
errors when called.
2017-02-28 08:45:39 -08:00
Greg Nolle
e29b64a18a modify CertVerifier Class
* respond to multiple similar verification requests.
* accept net error result as callback response.
2017-02-08 11:59:43 -08:00
Kevin Sawicki
f894da13b0 Pass args array instead of arguments object 2016-12-02 13:40:31 -08:00
Kevin Sawicki
5167ccd147 Guard against missing members in setObjectMembers 2016-11-16 07:45:34 -08:00
Kevin Sawicki
eef42770c6 Don't load remote properties until they are accessed 2016-09-14 13:29:49 -07:00
Kevin Sawicki
359ab2f9b3 Only set members when members exist 2016-09-14 10:54:23 -07:00
Kevin Sawicki
902bd0564e Require Buffer explicitly instead of relying on global 2016-09-08 10:17:06 -07:00
Cheng Zhao
f854b27bfb Merge pull request #6867 from electron/remote-function-properties
Allow accessing remote function properties
2016-08-31 17:28:09 +09:00
Kevin Sawicki
01e69353d5 Don't serialize ArrayBuffer as Array 2016-08-24 15:18:42 -07:00
Kevin Sawicki
ec44a5d198 Add tests for setting remote function properties 2016-08-22 17:07:18 -07:00
Kevin Sawicki
666a668d91 Support remote function keys and property descriptors 2016-08-22 17:07:18 -07:00
Kevin Sawicki
d226b7bc6c Use Proxy for accessing properties of remote function 2016-08-22 17:07:18 -07:00
Kevin Sawicki
8b38018ab4 Add helper for including function properties 2016-08-22 17:07:17 -07:00
Kevin Sawicki
d333cc5e38 Support remote function properties 2016-08-22 17:07:17 -07:00
Cheng Zhao
9ddb62c42a Use Buffer.from instead of deprecated new Buffer 2016-07-25 16:40:22 +09:00
Cheng Zhao
1c9421bc89 Use ArrayBuffer.isView to detect Buffer and ArrayBuffer 2016-07-25 16:39:09 +09:00
haad
fac330fb50 Fix TypedArray check, add check when instanceof doesn't work for TypedArrays. 2016-07-23 12:43:49 +01:00
haad
c717cd9192 🐛 Add support for TypedArrays in IPC.
Fixes https://github.com/electron/electron/issues/2104.
2016-07-22 19:44:19 +01:00
Kevin Sawicki
00f82aaffe Only check arrays and objects for cycles 2016-07-11 10:39:45 -07:00
Kevin Sawicki
564b0cace5 Maintain visted objects as a stack for cycle detection 2016-07-11 10:33:13 -07:00
Kevin Sawicki
5da0b856f9 Call includes directly on visited array 2016-07-11 10:33:13 -07:00
Kevin Sawicki
2cc2b8a146 Return empty array for circular references 2016-07-11 10:33:04 -07:00
Kevin Sawicki
a9b43a0fc9 Use empty string constructor name when missing 2016-07-06 13:06:48 -07:00
Kevin Sawicki
d67dfd09fd Pass through empty constructor names 2016-07-06 09:18:20 -07:00
Maksim
b444b35215 Update remote.js 2016-07-06 09:11:04 -07:00
cdaringe
32073fa079
🎨 Support non-native promises 2016-05-25 10:11:18 -06:00
Kevin Sawicki
7929daa48c Pass both callback values to then 2016-05-23 15:07:01 -07:00