Commit graph

1681 commits

Author SHA1 Message Date
Milan Burda
0f7ebff81e fix: pass frameId to v8Util.setRemoteCallbackFreer() (#20732) 2019-10-29 15:40:09 +09:00
Milan Burda
0c870775c4 fix: deprecation warnings in Electron code (#20793) 2019-10-29 13:16:10 +09:00
Milan Burda
bd5a5b3ae6 fix: properly generate requestID in webContents.printToPDF() (#20769) 2019-10-29 11:36:29 +09:00
Electron Bot
b6246dcf12 chore: bump chromium to f5b345dd470f14eef6e44732ccf23 (master) (#20649) 2019-10-28 15:12:35 -07:00
Milan Burda
ba8f80267c fix: send ELECTRON_BROWSER_CONTEXT_RELEASE asynchronously (#20632)
* fix: send ELECTRON_BROWSER_CONTEXT_RELEASE asynchronously

* test: remote references should be able to be cleared for all cases
2019-10-23 13:44:21 +09:00
Jeremy Apthorp
b155ebeeb3 fix: don't overwrite global constructor names in remote (#20637)
* fix: don't overwrite global constructor names in remote

* fake constructor names better, and improve error serialization
2019-10-21 15:48:03 +09: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
Alecyrus
825e67140e feat: support fitToPageEnabled and scaleFactor (#20436)
* fix: support fitToPageEnabled and scaleFactor

Support fitToPageEnabled and scaleFactor in  `WebContents.printToPDF()`

* fix: change default value of scaleFactor
2019-10-18 09:40:19 +09:00
Milan Burda
b29f0b9348 refactor: use Map for windowProxies in window-setup.ts (#20600) 2019-10-17 15:07:27 +02:00
Milan Burda
5273930f76 refactor: use Map for callbacks in CallbacksRegistry (#20565) 2019-10-15 09:14:41 -07:00
Jeremy Apthorp
8dad0c7aaa
test: move crashReporter specs to the main process (#20417) 2019-10-14 14:38:54 -07:00
Milan Burda
b92163d226 refactor: take advantage of structured clone algorithm in the remote module (#20427) 2019-10-10 09:59:08 -04:00
Jeremy Apthorp
2fad53e66b refactor: use v8 serialization for ipc (#20214)
* refactor: use v8 serialization for ipc

* cloning process.env doesn't work

* serialize host objects by enumerating key/values

* new serialization can handle NaN, Infinity, and undefined correctly

* can't allocate v8 objects during GC

* backport microtasks fix

* fix compile

* fix node_stream_loader reentrancy

* update subframe spec to expect undefined instead of null

* write undefined instead of crashing when serializing host objects

* fix webview spec

* fix download spec

* buffers are transformed into uint8arrays

* can't serialize promises

* fix chrome.i18n.getMessage

* fix devtools tests

* fix zoom test

* fix debug build

* fix lint

* update ipcRenderer tests

* fix printToPDF test

* update patch

* remove accidentally re-added remote-side spec

* wip

* don't attempt to serialize host objects

* jump through different hoops to set options.webContents sometimes

* whoops

* fix lint

* clean up error-handling logic

* fix memory leak

* fix lint

* convert host objects using old base::Value serialization

* fix lint more

* fall back to base::Value-based serialization

* remove commented-out code

* add docs to breaking-changes.md

* Update breaking-changes.md

* update ipcRenderer and WebContents docs

* lint

* use named values for format tag

* save a memcpy for ~30% speedup

* get rid of calls to ShallowClone

* extra debugging for paranoia

* d'oh, use the correct named tags

* apparently msstl doesn't like this DCHECK

* funny story about that DCHECK

* disable remote-related functions when enable_remote_module = false

* nits

* use EnableIf to disable remote methods in mojom

* fix include

* review comments
2019-10-09 13:59:08 -04:00
Shelley Vohr
c16a186de0 feat: improve TouchBarButton accessibility (#20454) 2019-10-08 11:13:57 -04:00
Milan Burda
ccff140046 feat: add --enable-api-filtering-logging commandline switch (#20335) 2019-10-04 10:49:09 -07:00
Milan Burda
bf978e09e4 fix: allow paths to asar archives to contain the .asar extension in directories (#20342) 2019-10-02 13:33:07 +09:00
Jeremy Apthorp
b7b0992768
refactor: convert some more remote stuff to typescript (#20324) 2019-09-30 15:00:22 -07:00
Milan Burda
ead8f2bbcd fix: BrowserWindow.fromWebContents() can return null (#19983) 2019-09-27 13:07:55 +02:00
Milan Burda
d090b0cd2d perf: only access remote module when <webview>.getWebContents() is called (#20272) 2019-09-20 08:54:16 -07:00
Milan Burda
11cd0db86b build: add enable_remote_module build flag (#19821) 2019-09-18 09:52:06 -07:00
loc
d2a94e6b13 fix: free screen and window capturers immediately after we're finished with them (#20156)
fix #17937, #19908
2019-09-17 09:48:31 -07:00
Samuel Attard
660e566201
fix: don't expose nativeTheme in the renderer process (#20139)
Exposing these in the renderer didn't make sense as they weren't backed
by the same instance / value store.  This API should be browser only
especially now that we have nativeTheme.themeSource.  Exposing in
//common was a mistake from the beginning.
2019-09-16 14:23:13 -07:00
Milan Burda
01fdb80f7c refactor: implement isRemoteModuleEnabled via getLastWebPreferences() (#19220) 2019-08-28 15:57:03 -07:00
Milan Burda
81e9dab52f refactor: replace ipcRendererUtils.invoke() with ipcRendererInternal.invoke() (#19574) 2019-08-23 15:45:50 -07:00
Milan Burda
7825d043f2 refactor: unify module-list format and exports/electron (#19697) 2019-08-23 11:18:58 +02:00
Shelley Vohr
6a76540cb6 fix: return type in open/save dialogs (#19781) 2019-08-16 08:55:01 -07:00
Samuel Attard
efa1818cb4
feat: add new nativeTheme API (#19656)
* feat: add new nativeTheme API

* chore: deprecate and clean up old systemPreferences theme APIs in favor of new nativeTheme module

* chore: clean up and deprecate things per feedback

* chore: add tests for deprecate and clean up invert impl

* build: when is a boolean not a boolean???
2019-08-14 13:42:55 -07:00
Cheng Zhao
49fe2604b3 Revert "fix: activate the uv_loop on incoming IPC messages (#19449)" (#19727)
This reverts commit 8028c57b42.
2019-08-13 14:03:25 -07:00
Shelley Vohr
28466a39d8
feat: add property customization to save dialogs (#19672) 2019-08-13 13:40:07 -07:00
Shelley Vohr
b5798326e8
feat: add dontAddToRecent to windows showOpenDialog (#19669) 2019-08-13 08:48:22 -07:00
Samuel Attard
33a9d898a6 fix: make child windows not crash when ipc messages are received (#19553) 2019-08-05 12:50:51 -07:00
Electron Bot
e959137a4b chore: bump chromium to 32e0bab929213da1019992bf31d29 (master) (#19488) 2019-08-02 16:56:46 -07:00
Milan Burda
3011a0f14f refactor: convert ipc-renderer.ts to TypeScript (#19556)
* refactor: convert ipc-renderer.ts to TypeScript

* Update typings/internal-ambient.d.ts

Co-Authored-By: Samuel Attard <sattard@slack-corp.com>
2019-08-02 14:35:04 -05:00
Jeremy Apthorp
c71cdce0b7
chore: disable JS impl when //extensions support is on (#19512) 2019-07-31 14:25:41 -07:00
Shelley Vohr
a5f87cee6b
doc: add missing MenuItem roles (#19329) 2019-07-31 14:13:56 -07:00
Micha Hanselmann
47a38daee2 feat: migrate custom macOS tray view to native one (#18981)
* restore stash

revert

some things work others dont

tracking area for rescue

manual popup

restore drag n drop

cleanup

* fix: make tray not block main process (#18880)

* fix: make tray not block main process

* make AtomMenuModel refcounted

* add support for ansi codes in title

add remove TODOs

* chore: use ScopedPumpMessagesInPrivateModes in tray (#18977)

* chore: use ScopedPumpMessagesInPrivateModes in tray

* revert refcounting of AtomMenuModel

* Prefer WeakPtr for posting tasks to handle unexpected destruction

* cleanup .h

* cleanup .mm

* add imports

add missing include

* fix: crash when tray popup called twice (#18999)

* remove highlightMode and TODOs

* remove unnecessary copy
2019-07-31 10:52:50 -07:00
Shelley Vohr
aaca9011ae
fix: [wc|bw]-created events do not emit an event object (#19465)
* fix: emit real Event instead of empty object in [wc|bw]

* chore: add ability to emit empty events
2019-07-29 13:54:37 -07:00
Milan Burda
8a33118e36 fix: refactoring regression in LocationProxy (#19495) 2019-07-29 11:20:19 -07:00
Samuel Attard
db3cf52add
docs: add support for readonly,deprecated and platform doc annotations (#19478) 2019-07-26 16:12:59 -07:00
Jeremy Apthorp
477661d0e4
feat: allow setting capture mode and max file size in netLog API (#19215) 2019-07-25 16:06:39 -07:00
Samuel Attard
8028c57b42
fix: activate the uv_loop on incoming IPC messages (#19449) 2019-07-25 13:10:14 -07:00
Milan Burda
103b38650f feat: add memory to app.getAppMetrics() (#18831) 2019-07-23 13:41:58 -07:00
Milan Burda
c79613b037 chore: convert more files to TypeScript (#18820) 2019-07-17 10:23:52 -07:00
Jeremy Apthorp
355b307618 test: move MenuItem spec to main process (#19235)
* test: move MenuItem spec to main process

* spec: fix errant default accel test

* Update menu-item-roles.js

* Update api-menu-item-spec.ts
2019-07-16 12:54:18 -07:00
Samuel Attard
6d5e494782 fix: serialize messages being sent over chrome message ports (#19104)
Chrome appears to serialize these messages (see #19070) so we should as
well to be consistent and to avoid bugs with Uint8/16 arrays

Fixes #19070
2019-07-15 19:05:09 +09:00
Ian Sanders
079a173a72 feat: add stack trace log to preload script error handling (#18905)
* Add console.trace to preload script error handling

* Log error directly instead of error string + trace

* Log full error object instead of error message
2019-07-14 21:54:33 -07:00
Alexandre Lacheze
e26f366405 Revert: electron/electron#14487 (#19011) 2019-07-11 17:25:26 -05:00
Milan Burda
c756b955b3 fix: revert use of IPC helpers for history due to failing test (#19189) 2019-07-11 20:25:07 +03:00
Micha Hanselmann
1f70dfbffd chore: deprecate setHighlightMode (#19202) 2019-07-11 10:11:46 -05:00
Micha Hanselmann
06d48514c6 add toolTip property for MenuItem (#19099) 2019-07-11 17:56:22 +09:00
Cheng Zhao
faa2710485 fix: do not wait on promise returned by remote APIs (#18990)
* fix: make <webview>.loadURL async

* docs: webview.loadURL returns Promise
2019-07-10 08:20:28 -05:00
Milan Burda
fdbb97e876 chore: update to latest TypeScript 3.5.2 (#19133) 2019-07-09 14:44:46 +03:00
Micha Hanselmann
d79e6bbffe refactor: improve function deprecation module (#19012)
* add removeFunction to deprecation module

* clarify deprecate api

* throw error

* change error msg
2019-07-09 10:01:35 +09:00
Milan Burda
419ce494e9 refactor: use IPC helpers in window-setup (#17948) 2019-07-09 02:43:49 +03:00
Milan Burda
69369cf365 refactor: don't expose isPromise as an internal module (#19139) 2019-07-08 15:17:50 +09:00
Milan Burda
87b1dab497 fix: check parent-child relationship in canAccessWindow (#19077) 2019-07-04 18:22:08 +02:00
Samuel Attard
5a1b661f42
fix: use bidning.ipc instead of binding.sendTo which is undefined (#19103) 2019-07-03 16:36:44 -07:00
Jeremy Apthorp
d1292833e9 chore: remove unused BrowserWindow.fromDevToolsWebContents (#19090) 2019-07-03 12:07:47 -07:00
Shelley Vohr
8782d06ed6
feat: convert webContents primitives to properties (#18998)
* feat: convert webContents primitives to properties

* address feedback from review
2019-07-03 08:57:10 -07:00
Milan Burda
69ea0b4ebf fix: ignore non-absolute session preload script paths when sandboxed (#19066) 2019-07-03 08:05:45 -07:00
Electron Bot
50b9c7051e chore: bump chromium to f1d9522c04ca8fa0a906f88ababe9 (master) (#18648)
* chore: bump chromium in DEPS to 675d7dc9f3334b15c3ec28c27db3dc19b26bd12e

* chore: update patches

* chore: bump chromium in DEPS to dce3562696f165a324273fcb6893f0e1fef42ab1

* chore: const interfaces are being removed from //content

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1631749
Bug: https://bugs.chromium.org/p/chromium/issues/detail?id=908139

* chore: update patches

* chore: blink::MediaStreamType is now consistent and deduplicated

* chore: update patches and printing code for ref -> uniq

* chore: bridge_impl() --> GetInProcessNSWindowBridge

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1642988

* fixme: TotalMarkedObjectSize has been removed

* chore: fix linting

* chore: bump chromium in DEPS to 9503e1a2fcbf17db08094d8caae3e1407e918af3

* chore: fix slightly broken printing patch

* chore: update patches for SiteInstanceImpl changes

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1612025

* chore: update patches for SiteInstanceImpl changes

* chore: bump chromium in DEPS to 6801e6c1ddd1b7b73e594e97157ddd539ca335d7

* chore: update patches

* chore: bump chromium in DEPS to 27e198912d7c1767052ec785c22e2e88b2cb4d8b

* chore: remove system_request_context

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1647172

* chore: creation of FtpProtocolHandler needs an auth cache

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1639683

* fixme: disable marked spec

* chore: bump chromium in DEPS to 3dcd7fe453ad13a22b114b95f05590eba74c5471

* chore: bump chromium in DEPS to bdc24128b75008743d819e298557a53205706e7c

* chore: bump chromium in DEPS to 7da330b58fbe0ba94b9b94abbb8085bead220228

* update patches

* remove TotalMarkedObjectSize

https://chromium-review.googlesource.com/c/chromium/src/+/1631708

* add libvulkan.so to dist zip manifest on linux

* chore: bump chromium in DEPS to 1e85d0f45b52649efd0010cc9dab6d2804f24443

* update patches

* add angle features to gpuinfo

https://chromium-review.googlesource.com/c/chromium/src/+/1638658

* mark 'marked' property as deprecated

* disable webview resize test

* FIXME: disable vulkan on 32-bit arm

* chore: bump chromium in DEPS to cd0297c6a83fdd2b1f6bc312e7d5acca736a3c56

* Revert "FIXME: disable vulkan on 32-bit arm"

This reverts commit 5c1e0ef302a6db1e72231d4e823f91bb08e281af.

* backport from upstream: fix swiftshader build on arm

https://swiftshader-review.googlesource.com/c/SwiftShader/+/32768/

* update patches

* viz: update OutputDeviceWin to new shared memory api

https://chromium-review.googlesource.com/c/chromium/src/+/1649574

* base::Contains{Key,Value} => base::Contains

https://chromium-review.googlesource.com/c/chromium/src/+/1649478

* fixup! viz: update OutputDeviceWin to new shared memory api

* stub out StatusIconLinuxDbus-related delegate methods

https://chromium-review.googlesource.com/c/chromium/src/+/1638180

* chore: bump chromium in DEPS to 964ea3fd4bdc006d62533f5755043076220181f1

* Remove the BrowserContext methods to create URLRequestContexts for main/media partitions when a partition_domain is specified

https://chromium-review.googlesource.com/c/chromium/src/+/1655087

* fixup! stub out StatusIconLinuxDbus-related delegate methods

* add remote_cocoa to chromium_src deps

https://chromium-review.googlesource.com/c/chromium/src/+/1657068

* fixup! stub out StatusIconLinuxDbus-related delegate methods

* attempt at fix linux-debug build

* add swiftshader/libvulkan.so to arm manifest

* chore: bump chromium in DEPS to 28688f76afef27c36631aa274691e333ddecdc22

* update patches

* chore: bump chromium in DEPS to fe7450e1578a9584189f87d59d0d1a8548bf6b90

* chore: bump chromium in DEPS to f304dfd682dc86a755a6c49a16ee6876e0db45fb

* chore: bump chromium in DEPS to f0fd4d6c365aad9edd83bdfff9954c47d271b75c

* Update patches

* Remove no longer needed WOA patch

* Put back IOThread in BrowserProcess

We need this until we enable the network service.

* move atom.ico to inputs

* Update to latest LKGR to fix no template named 'bitset' in namespace 'std'

* fixup! Put back IOThread in BrowserProcess

* chore: bump chromium in DEPS to dcf9662dc9a896a175d791001350324167b1cad3

* Update patches

content_allow_embedder_to_prevent_locking_scheme_registry.patch is no longer necessary as it was upstreamed via https://chromium-review.googlesource.com/c/chromium/src/+/1637040

* Fix renamed enum

* Use newer docker container

Contains updated dependencies

* Try to track down arm test failures

* Fix arm tests

* chore: bump chromium in DEPS to 8cbceef57b37ee14b9c4c3405a3f7663922c5b5d

* Update patches

* Add needed dependencies for testing 32-bit linux

* Remove arm debugging.

* Remove additional debugging

* Fix compiler errors

* Handle new macOS helper

* Fix compile error on Linux

* chore: bump chromium in DEPS to 66a93991ddaff6a9f1b13d110959947cb03a1860

* Add new helper files to manifests

* fix BUILD.gn for macOS

* Fix compile errors

* Add patch to put back colors needed for autofill/datalist

* chore: bump chromium in DEPS to e89617079f11e33f33cdb3924f719a579c73704b

* Updated patches

* Remove no longer needed patch

* Remove no longer needed patch

* Fix compile error with patch

* Really fix the patch

* chore: bump chromium in DEPS to c70f12476a45840408f1d5ff5968e7f7ceaad9d4

* chore: bump chromium in DEPS to 06d2dd7a8933b41545a7c26349c802f570563fd5

* chore: bump chromium in DEPS to b0b9ff8f727deb519ccbec7cf1c8d9ed543d88ab

* Update patches

* Fix compiler errors

* Fix removed ChromeNetLog

* Revert "Fix removed ChromeNetLog"

This reverts commit 426dfd90b5ab0a9c1df415d71c88e8aed2bd5bbe.

* Remove ChromeNetLog.

https://chromium-review.googlesource.com/c/chromium/src/+/1663846

* chore: bump chromium in DEPS to fefcc4926d58dccd59ac95be65eab3a4ebfe2f29

* Update patches

* Update v8 patches

* Fix lint error

* Fix compile errors

* chore: bump chromium in DEPS to 4de815ef92ef2eef515506fe09bdc466526a8fd9

* Use custom protocol to test baseURLForDataURL

* Use newer SDK (10.0.18362) for Windows

* Update patches

* Update arm manifest since swiftshader reenabled.

* Don't delete dir that isn't ever there.

* Fix compile errors.

* Need src dir created

* Update for removed InspectorFrontendAPI.addExtensions

* Revert "Use newer SDK (10.0.18362) for Windows"

This reverts commit 68763a0c88cdc44b971462e49662aecc167d3d99.

* Revert "Need src dir created"

This reverts commit 7daedc29d0844316d4097648dde7f40f1a3848fb.

* Revert "Don't delete dir that isn't ever there."

This reverts commit bf424bc30ffcb23b1d9a634d4df410342536640e.

* chore: bump chromium in DEPS to 97dab6b0124ea53244caf123921b5d14893bcca7

* chore: bump chromium in DEPS to c87d16d49a85dc7122781f6c979d354c20f7f78b

* chore: bump chromium in DEPS to 004bcee2ea336687cedfda8f8a151806ac757d15

* chore: bump chromium in DEPS to 24428b26a9d15a013b2a253e1084ec3cb54b660b

* chore: bump chromium in DEPS to fd25914e875237df88035a6abf89a70bf1360b57

* Update patches

* Update node to fix build error

* Fix compile errors

* chore: bump chromium in DEPS to 3062b7cf090f1d9522c04ca8fa0a906f88ababe9

* chore: update node ref for pushed tags

* chore: update patches for new chromium

* chore: fix printing patches

* Use new (10.0.18362) Windows SDK

* roll node to fix v8 build issues in debug build

* Add support for plugin helper

* fix: add patch to fix gpu info enumeration

Can be removed once CL lands upstream.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1685993

* spec: navigator.requestMIDIAccess now requires a secure origin

This test requires a secure origin so we fake one.

Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1657952

* FIXME: temporarily disable SharedWorker tests

* use released version of node-abstractsocket

* fix abstract-socket
2019-07-02 18:22:09 -07:00
Jerry Wu
dee331519c fix: disable nodeIntegration & insecure resource warnings for localhost (#18814)
* fix: disable remote host nodeIntegration warning for localhost

In warnAboutNodeWithRemoteContent(), add a check to see if the hostname
is "localhost" and prevent the warning message if it is.

* fix: disable loading insecure resources warning for localhost

In warnAboutInsecureResources(), filter out resources from localhost
since they are most likely not a threat.

* test: add tests for ignoring security warnings when using localhost

Add tests for ignoring warning messages for the following scenarios:
  1. node integration with remote content from localhost
  2. loading insecure resources from localhost

* test: fix insecure resource test

* test: pass nodeIntegration with remote test on did-finish-load

* test: maybe fix node integration test (error w/ conv circular struct)

* test: update test description

* test: use "load" event to check when nodeIntegration test has finished

Instead of relying on the "did-finish-load" event, which may result in
a race condition, add an "onload" handler that logs "loaded" to the
console. This will execute _after_ the nodeIntegration check, so it
can be safely used as a signal to indicate that the test is done.

* test: rename base-page-security-load-message.html

* fix: ignore enabled remote module warning for localhost

* refactor: add isLocalhost()
2019-07-02 19:36:50 +09:00
Samuel Attard
6eed4a98ce fix: do not remove node globals when context isolation is enabled (#18967) 2019-06-28 14:37:00 -07:00
Samuel Attard
764be844ec
fix: override the timers module impls to activate the uv loop (#18948) 2019-06-24 10:18:29 -07:00
David Sanders
6251a6d307 fix: typo in comment (#18899) 2019-06-20 10:11:38 -05:00
Milan Burda
4575a4aae3 Revert "feat: only allow bundled preload scripts (#17308)" (#18091)
This reverts commit 8cf15cc931.
2019-06-20 08:39:12 +09:00
Milan Burda
edb56500c7 refactor: piggy-back on ELECTRON_BROWSER_SANDBOX_LOAD to get content scripts (#18823) 2019-06-19 17:23:44 +02:00
Jerry Wu
d5811607eb fix: extra space in security warning message causing list misalignment (#18815) 2019-06-18 09:59:02 -07:00
Milan Burda
0af3548b55 feat: add security warning for remote module with remote content (#18822) 2019-06-17 14:21:30 -07:00
Milan Burda
c9bca78a7a refactor: use async invoke to get webPreferences in security-warnings.ts (#18821) 2019-06-17 10:57:09 -07:00
Heilig Benedek
5a08522b98 feat: add removeInsertedCSS (#16579) 2019-06-17 11:39:35 -04:00
Milan Burda
deebde66f9 feat: make async webContents / <webview> methods return a Promise (#18792) 2019-06-17 12:10:02 +03:00
Milan Burda
370e9522b4 refactor: re-implement desktop-capturer in TypeScript (#18580) 2019-06-15 19:44:18 +09:00
Shelley Vohr
3309005325 chore: convert callbacks-registry to ts (#18682)
* chore: convert callbacks-registry to ts

* fix class import syntax

* move cb reg specs to spec-main
2019-06-15 17:18:25 +09:00
Jeremy Apthorp
7b26048d9e
test: unflake some net specs (#18782) 2019-06-14 16:26:07 -07:00
Shelley Vohr
bfcce8aa27
refactor: pass MessageBox params as a struct (#18732)
Historically, we've been passing in all MessageBox parameters individually, which makes augmenting or improving MessageBox functionality challenging because to change or add even one argument requires a huge cascade of argument changes that leaves room for errors.

For other file dialog related APIs, we use a struct (DialogSettings), and so this PR takes a similar approach and refactors MessageBox parameters into a struct (MessageBoxSettings) which we then use to simplify argument passing and which will enable us to more quickly iterate and improve upon functionality in the future.
2019-06-14 08:26:25 -07:00
Shelley Vohr
ffb53405fb
chore: convert extension apis to TypeScript (#18688)
Converts extensions-related files to TS
2019-06-14 07:52:24 -07:00
Milan Burda
da58ac7c20 refactor: use app.commandLine.getSwitchValue() for parsing user-data-dir (#18764) 2019-06-13 16:03:02 -07:00
Nitish Sakhawalkar
f98454e5dd fix: use crashpad on Windows (#18483)
* Initial changes to use crashpad for windows

* Remove crashpad patch

* Report error when failed to connect pipe

* Allow crashpad to communicate with named pipe

* Add patch to make crashpad named pipe work

* Windows also needs crashReporter on main process

* Call SetUnhandledExceptionFilter in node process

Node can also use crash reporter.

* Do not treat node process as browser process

* No more need to manually start crash service

* Use base::StringPrintf for better readbility

* Print error when pipe name not available

* Make sure pipe name is updated

Note that the crashpad may be started after renderer process gets
created.

* Fix some tests

* Update node

* Exclude crashpad files on Linux and MAS

* Fix lint warning

* Remove unused checks

* kCrashpadPipeName is only available on Windows

* Fix uploadToServer tests

* Fix extra params tests

* Fix getCrashesDirectory tests

* Run crashReporter tests on CI

* Style fixes

* Update crashreporter docs

* Rename InitBreakpad to Init

* Add comment for process_type_.empty() and UTF16ToASCII to UTF16ToUTF8.

* Update build.gn include crashpad headers

* Address comment https://github.com/electron/electron/pull/18483#discussion_r290887898

* Avoid using api::WebContents

* Put kRunAsNode in atom_constants

* Remove duplicate settings on upload params

* Fix building on macOS

* Update description for crashpad_pid_check.patch
2019-06-13 15:42:21 +09:00
Jeremy Apthorp
291ee2dafc
refactor: use the URL api to resolve urls in window setup (#18611) 2019-06-05 10:21:06 -07:00
Shelley Vohr
a0b1f4fe0b
refactor: convert browser window state fns to props (#18618) 2019-06-04 22:44:16 -07:00
Jeremy Apthorp
ed5fb4a720
refactor: simplify content script injection (#18532) 2019-06-04 16:07:34 -07:00
Samuel Attard
24b3d66767
refactor: remove electron.asar and embed JS in binary (#18577)
* refactor: remove electron.asar and embed JS in binary

* chore: update DEPS to merged node sha

* chore: remove unneeded eslint ignore
2019-06-03 17:03:59 -07:00
Milan Burda
cf628d9287 refactor: remove menu-will-close / setTimeout workaround (#18582) 2019-06-03 16:48:01 -05:00
Samuel Attard
cec61d010b
refactor: lazily hook into child_process in asar_init (#18576)
Previously we loaded both fs and child_process and then hooked into
the returned value, relying on the module cache to keep our modifications
and give them to everyone.

Loading child_process took in excess of 20ms though so instead of loading
it and then hooking in.  We intercept all Module load requests, and when
the first one for `child_process` comes in, we wrap the appropriate methods
and then never touch it again.
2019-06-03 13:19:52 -07:00
Samuel Attard
0ee2f8a64a
refactor: lazy load child_process in the crash-reporter module (#18574)
This module is on the hot load path and we don't need cp till later
2019-06-03 11:48:23 -07:00
Shelley Vohr
52c76d737a
refactor: make autoHideMenuBar a property on BrowserWindows (#18555) 2019-06-03 09:09:47 -07:00
Samuel Attard
18acda7888
perf: lazily create the anchor tag used for URL resolving (#18571) 2019-06-03 01:04:21 -07:00
Samuel Attard
449d2752f2
refactor: lazy load V8 module in browser/init (#18575) 2019-06-03 01:03:33 -07:00
Samuel Attard
bc527f6b51
refactor: bundle the browser and renderer process electron code (#18553)
* refactor: bundle the browser and renderer process electron code

* Bundles browser/init and renderer/init
  * Improves load performance of main process by ~40%
  * Improves load performance of renderer process by ~30%
* Prevents users from importing our "requiring" our internal logic such
as ipc-main-internal.  This makes those message buses safer as they are
less accessible, there is still some more work to be done though to lock
down those buses completely.
* The electron.asar file now only contains 2 files, as a future
improvement maybe we can use atom_natives to ship these two files
embedded in the binary
* This also removes our dependency on browserify which had some strange
edge cases that caused us to have to hack around require-order and
stopped us using certain ES6/7 features we should have been able to use
(async / await in some files in the sandboxed renderer init script)

TLDR: Things are faster and better :)

* fix: I really do not want to talk about it

* chore: add performance improvements from debugging

* fix: resolve the provided path so webpack thinks it is absolute

* chore: fixup per PR review

* fix: use webpacks ProvidePlugin to keep global, process and Buffer alive after deletion from global scope for use in internal code

* fix: bundle worker/init as well to make node-in-workers work

* chore: update wording as per feedback

* chore: make the timers hack work when yarn is not used
2019-06-02 13:03:03 -07:00
Jeremy Apthorp
c436997840
feat: add ipcRenderer.invoke() (#18449) 2019-05-31 10:25:19 -07:00
Shelley Vohr
1e3e5a6619
refactor: set appLevelAppearance prop on systemPreferences (#18477)
* refactor: set appLevelAppearance prop on systemPreferences

* ensure backwards compat is tested
2019-05-30 17:12:46 -07:00
Samuel Attard
93b8dc2362 fix: ensure the webContents is not destroyed before communicating (#18467) 2019-05-28 14:22:35 -07:00
Jeremy Apthorp
815b9d7707
feat: [contentTracing] allow calling stopTracing() with no arguments (#18411) 2019-05-28 14:15:42 -07:00
Milan Burda
ac002b3c3c fix: set nativeWindowOpen when sandboxed (#18273) 2019-05-27 02:44:54 +02:00
Jeremy Apthorp
646f572b77
refactor: netLog directly uses network service (#18289) 2019-05-23 15:31:38 -07:00
Jeremy Apthorp
ca283c74c9 Merge remote-tracking branch 'origin/master' into roller/chromium-ad1b791122c04bd91b825fbfbdf1ff4da82a0edb-1558011686736 2019-05-21 10:07:17 -07:00
Shelley Vohr
1a2ab11c90 fix: set window to null when no window is passed (#18240)
* fix: set window to null when no window is passed

* add new specs for dialog

* fix process blocking for showMessageBox
2019-05-21 09:08:22 -05:00
Milan Burda
e81afed66d chore: remove dead code (#18370) 2019-05-21 15:36:22 +09:00
Milan Burda
c1cccfc082 chore: remove duplicate internal deprecations module (just use deprecate) (#18352) 2019-05-21 00:40:49 +02:00
Milan Burda
89105e7e57 refactor: address TODO for WebContents type parsing (#18158) 2019-05-20 12:55:46 +02:00
Milan Burda
af0ad4454e refactor: add invoke helpers in window-setup (#18233) 2019-05-18 20:52:29 +02:00
Nitish Sakhawalkar
cf5224140b Chrome changed the devtools url
chrome-devtools:// to devtools://
28b21a67f0
2019-05-17 16:16:25 -07:00
Milan Burda
76783e2a90 fix: 'page-title-updated' event forwarding + documentation (#18270) 2019-05-16 12:33:16 +03:00
Milan Burda
019b31d084 chore: remove deprecated APIs (#18159) 2019-05-09 14:48:10 -04:00
Milan Burda
d79dc056bc refactor: eliminate duplicate code in asar.js (#18146) 2019-05-07 06:54:35 -07:00
Shelley Vohr
02710ef574 refactor: make templateImage a property on nativeImage (#18124)
* refactor: make templateImage a property on nativeImage

* Update docs/api/native-image.md

Co-Authored-By: codebytere <codebytere@github.com>

* fix nativeImage prototype deprecation

* update for new property name

* Update docs/api/native-image.md

Co-Authored-By: codebytere <codebytere@github.com>
2019-05-07 06:52:07 -07:00
Shelley Vohr
cfb6e847a0 refactor: allow embedder overriding of internal FS calls (#17906) (#18183) 2019-05-07 06:44:32 -07:00
Samuel Attard
a96b6e2c96 build: move to the new docs parser (#18103)
* build: move to the new docs parser

* chore: remove the bad getTitle param doc

* build: update parser/ts gen deps + fix some docs issues highlighted by GH desktop

* chore: apply suggestions from code review

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

* chore: update docs for accidentally removed things

* chore: update docs/api/command-line.md

Co-Authored-By: MarshallOfSound <samuel.r.attard@gmail.com>
2019-05-06 08:29:01 -07:00
Samuel Attard
636273b6cb
fix: do not mark navigations interupted with same-document navigations as aborted (#18109)
* fix: do not mark navigations interupted with same-document navigations as aborted

* spec: add tests for the loadURL promise
2019-05-03 16:19:50 -07:00
Shelley Vohr
6d96f30ed3
refactor: make shell.OpenExternal async (#17135) 2019-05-03 13:53:45 -07:00
Milan Burda
2dd108e9c9 fix: fs.promises does not work with asar paths (#18092) 2019-05-02 21:06:01 +09:00
Stewart Lord
d507ba68a7 fix: honor extensionId arg in chrome.runtime.connect (#16998)
The first argument to chrome.runtime.connect is extensionId, not connectInfo.
2019-05-02 11:42:04 +09:00
Milan Burda
6f5c850d60 refactor: add emitCustomEvent() helper (#17960) 2019-05-01 09:07:57 -04:00
Shelley Vohr
8d83518f9a
refactor: make name a prop on app (#17701)
Update app.name to be a property on app.
2019-04-30 13:55:33 -07:00
Shelley Vohr
d87b3ead76 chore: remove promisification deprecation callbacks (#17907)
* chore: remove promisification deprecation callbacks

* update docs

* fix smoke test

* fix executejs issue

* cleanup leftovers

* fix webContents.executeJavaScript tests

* cleanup WebContents.prototype.takeHeapSnapshot

* fix "sets arbitrary webContents as devtools" test

* fix executeJavaScriptInFrame related tests
2019-04-30 07:08:32 -07:00
Shelley Vohr
7b55ee9d36 refactor: allow requiring modules with no side effects (#17496) 2019-04-30 09:46:08 +09:00
Samuel Attard
77a4946069
refactor: rewire the desktop capturer API to remove race conditions (#18029)
We now create a new instance of atom::api::DesktopCapturer for every
request instead of weirdly re-using the same instance and queuing
requests.  This means there is now a 1:1 relationship between request
and DesktopCapturer so there isn't a race condition between the observer
for one request calling back before the observer of another.  This is an
issue ever since the backing APIs moved to worker threads.

This also does a few things to ensure memory management
* Only ever listen to one event per-request, after that we wipe the emit
function to ignore all future events
* Ensures we clean up the window_capturer_, screen_capturer_ and
captured_sources_ in native land once the request is over.

This _in theory_ fixes a flake we've been seeing on CI where we try to
resolve the promise for a request that no longerr exists.
2019-04-29 13:21:28 -07:00
Milan Burda
9714a91392 refactor: use fs.promises API, which is stable since Node 12 (#17999) 2019-04-29 11:18:03 -07:00
Milan Burda
7574f91f31 refactor: natively promisify WebContents.prototype.takeHeapSnapshot (#18000) 2019-04-29 10:11:11 -07:00
Milan Burda
18b77a4de6 chore: rename atom-binding-setup.ts to electron-binding-setup.ts (#17949) 2019-04-29 10:57:32 -04:00
Cheng Zhao
a4fcc32799
feat: upgrade to Node 12 (#17838)
* fix: add boringssl backport to support node upgrade

* fix: Update node_includes.h, add DCHECK macros

* fix: Update node Debug Options parser usage

* fix: Fix asar setup

* fix: using v8Util in isolated context

* fix: make "process" available in preload scripts

* fix: use proper options parser and remove setting of _breakFirstLine

_breakFirstLine was being set on the process, but that has changed in node 12 and so is no longer needed. Node will handle it properly when --inspect-brk is provided

* chore: update node dep sha

* fix: process.binding => _linkedBinding in sandboxed isolated preload

* fix: make original-fs work with streams

* build: override node module version

* fix: use _linkedBinding in content_script/init.js

* chore: update node ref in DEPS

* build: node_module_version should be 73
2019-04-26 18:55:12 +09:00
Shelley Vohr
075b818a8e
fixes (#17363) 2019-04-25 15:44:54 -07:00
Shelley Vohr
c2c3a04628
fix: crash when failed to get devices in desktopCapturer (#17557)
* fix: crash when failed to get devices in desktopCapturer

* return after emit
2019-04-25 15:12:38 -07:00
Milan Burda
253d049ac9 chore: remove deprecated app.enableMixedSandbox() (#17894) 2019-04-23 21:07:40 -07:00
Jeremy Apthorp
841e31b7e6 feat: show underlying stack in errors in remote module (#17851) 2019-04-18 17:38:19 -07:00
Samuel Attard
78411db4b5
fix: maintain a ref count for objects sent over remote (#17464)
* spec: clean up after a failed window count assertion

Previously when this assertion failed all tests that ran after the
failed assertion also failed.  This ensure that the assertion fails for
the test that actually caused the issue but cleans up the left-over
windows so that future tests do not fail.

* fix: maintain a ref count for objects sent over remote

Previously there was a race condition where a GC could occur in the
renderer process between the main process sending a meta.id and the
renderer pulling the proxy out its weakmap to stop it being GC'ed.

This fixes that race condition by maintaining a "sent" ref count in the
object registry and a "received" ref count in the object cache on the
renderer side.  The deref request now sends the number of refs the
renderer thinks it owns, if the number does not match the value in the
object registry it is assumed that there is an IPC message containing a
new reference in flight and this race condition was hit.

The browser side ref count is then reduced and we wait for the new deref
message.  This guaruntees that an object will only be removed from the
registry if every reference we sent has been guarunteed to be unreffed.
2019-04-16 16:08:11 -04:00
Samuel Attard
b7b9efa875
fix: handle remote-debugging-port=0 correctly (#17800)
By default the Chromedriver will send remote-debugging-port=0 to let the
browser choose a free port to listen on.  The chosen port is written to
a known file in the user data dir that is passed to the app through the
CLI.

This PR does two things.

1. Correctly passes the USER_DATA_DIR to the remote debugging server so
it knows where to write the file
2. Adds support for --user-data-dir as we did not support that CLI
argument and Chromedriver relies on being able to tell the "browser"
where to write this file.

Fixes #17354
2019-04-16 14:22:51 -04:00
Shelley Vohr
9c3cb55ef2
refactor: make accessibilitySupportEnabled a property on app (#17362)
* refactor: make accessibilitySupport a prop on app

* fix docs

* update spec
2019-04-04 19:49:04 -07:00
Milan Burda
77d59e99b6 feat: emit process 'loaded' event in sandboxed renderers (#17680) 2019-04-04 11:35:06 -07:00
Jeremy Apthorp
127b87c713
refactor: mojofy MessageTo and MessageHost (#17613) 2019-04-03 14:22:23 -07:00
Jeremy Apthorp
53f6cbccbf
refactor: use mojo for electron internal IPC (#17406)
* refactor: use mojo for electron internal IPC

* add sender_id, drop MessageSync

* remove usages of AtomFrameMsg_Message

* iwyu

* first draft of renderer->browser direction

* refactor to reuse a single ipc interface

* implement TakeHeapSnapshot through mojo

* the rest of the owl^WtakeHeapSnapshot mojofication

* remove no-op overrides in AtomRendererClient

* delete renderer-side ElectronApiServiceImpl when its pipe is destroyed

* looks like we don't need to overlay the renderer manifest after all

* don't try to send 2 replies to a sync rpc

* undo changes to manifests.cc

* unify sandboxed + unsandboxed ipc events

* lint

* register ElectronBrowser mojo service on devtools WebContents

* fix takeHeapSnapshopt failure paths

* {electron_api => atom}::mojom

* add send_to_all to ElectronRenderer::Message

* keep interface alive until callback is called

* review comments

* use GetContext from RendererClientBase

* robustify a test that uses window.open

* MessageSync posts a task to put sync messages in the same queue as async ones

* add v8::MicrotasksScope and node::CallbackScope

* iwyu

* use weakptr to api::WebContents instead of Unretained

* make MessageSync an asynchronous message & use non-associated interface

* iwyu + comments

* remove unused WeakPtrFactory

* inline OnRendererMessage[Sync]

* cleanups & comments

* use helper methods instead of inline lambdas

* remove unneeded async in test

* add mojo to manifests deps

* add gn check for //electron/manifests and mojo

* don't register renderer side service until preload has been run

* update gn check targets list

* move interface registration back to RenderFrameCreated
2019-04-02 15:38:16 -07:00
Shelley Vohr
0431997c8d
refactor: make applicationMenu a property on app (#17361) 2019-04-02 13:36:57 -07:00
Shelley Vohr
8ea33d69ac
fix: match net module headers & http.IncomingMessage headers (#17517)
* fix: match net module headers & http.IncomingMessage headers

* update net doc for cleanliness

* address feedback from review

* Update spec/api-net-spec.js

Co-Authored-By: codebytere <codebytere@github.com>

* add special cookie case
2019-04-02 07:41:19 -07:00
Samuel Attard
75442b794f
fix: make devtools extensions load correctly (#17614) 2019-03-30 17:36:13 -07:00
Milan Burda
d597a0e8b0 refactor: expose ipcRendererInternal to the main world for window-setup using the content script world pattern (#17591) 2019-03-29 18:10:21 -07:00
Samuel Attard
953d1ea635
fix: ensure dots in content script patterns aren't used as wildcards (#17593)
* fix: ensure dots in content script patterns aren't used as wildcards

* chore: sanitise all regexp special chars

* chore: extract to helper

* chore: fixup helper
2019-03-28 14:03:37 -07:00
Shelley Vohr
808783a5e4
fix: crashReporter.getParameters() takes no params (#17459) 2019-03-28 15:04:16 -04:00
Milan Burda
8cf15cc931 feat: only allow bundled preload scripts (#17308) 2019-03-28 11:38:51 +01:00
Shelley Vohr
34eb5d0815
fix: correctly return properties on the netLog module (#17525) 2019-03-25 22:40:38 -04:00
Milan Burda
336db33d18 refactor: use ipcMainUtils.invokeInWebContents / ipcRendererUtils.handle helpers for Chrome APIs (#17417) 2019-03-26 11:38:35 +09:00
Milan Burda
546466b209 feat: add <webview>.getWebContentsId() (#17407) 2019-03-26 10:57:27 +09:00
Milan Burda
cbd884060e fix: validate sender for replies in ipcMainInternalUtils.invokeInWebContents() (#17416) 2019-03-26 10:15:51 +09:00
Milan Burda
7389dfca59 fix: report module name when require fails in sandboxed renderers (#17413) 2019-03-19 12:00:41 -07:00
Milan Burda
06a4594435 chore: remove special handling for dialog methods in remote module (#17412)
* chore: remove special handling for dialog methods in remote module

* refactor: remove callFunction helper
2019-03-19 11:59:33 -07:00
Milan Burda
ddd51525f1 refactor: make ELECTRON_INSPECTOR_CONTEXT_MENU handler async (#17411) 2019-03-19 10:37:43 -07:00
Milan Burda
53f4af7722 fix: regressions introduced by adding world isolation to Chrome extension content scripts (#17422) 2019-03-19 14:45:48 +01:00
Shelley Vohr
38d75010c7
chore: rename atomBinding to electronBinding (#17419) 2019-03-18 12:37:06 -07:00
Shelley Vohr
db29978fe0
fix: throw error when inserting menu items out-of-range (#17401)
* fix: throw error when inserting menu items out-of-range

* also check pos < 0
2019-03-18 07:58:42 -07:00
Shelley Vohr
f09f43a4a9
chore: remove unused arg parsing code in dialog (#17420) 2019-03-18 07:58:03 -07:00