Commit graph

105 commits

Author SHA1 Message Date
Cheng Zhao
478360f317 chore: use dummy WebRequestNS when NetworkService is enabled (#19300) 2019-07-17 11:55:55 -07:00
Cheng Zhao
2a3793485f
feat: implement net module with NetworkService (#19094)
* Stub class for NetworkService-based URLRequest

* Create SimpleURLLoader

* Implement downloading

* Implement response event

* Only write data afte previous one finished

* Use DataPipeGetter for uploading data

* Support chunked upload data

* Call size callback at last

* Simplify UploadDataPipeGetter

* Implement cancelling and closing

* Handle redirection

* Fix uploading large data

* Emit error when request fails

* Emit error for redirection error

* Simplify emitting error

* "follow" should also emit "redirect" event

* SetLoadFlags is not really used

* Implement GetUploadProgress

* Implement FollowRedirect

* Fix exception with multiple redirections

* Reduce number of EmitEvent methods

* Emit response errors

* FetchRedirectMode => RedirectMode
2019-07-04 10:56:19 +09:00
Shelley Vohr
5154b95447 chore: update @types/node and @primer/octicons (#19025) 2019-07-01 11:25:45 -07:00
Samuel Attard
2160c1fcc9 refactor: replace includes for atom with shell 2019-06-19 17:33:28 -07:00
Shelley Vohr
a0b2810640 chore: add ability to log native deprecation warnings (#18681)
* chore: add ability to log native deprecation warnings

* take std::string, handle conversion later

* address feedback from @ckerr's review

* simplify with feedback from zcbenz
2019-06-19 08:46:36 +09:00
Milan Burda
d9215dd4ce feat: add creationTime / sandboxed / integrityLevel to app.getAppMetrics() (#18718)
This is useful for checking which processes are sandboxed on OS level.

Regarding creationTime, since the pid can be reused after a process dies, it is useful to use both the pid and the creationTime to uniquely identify a process.
2019-06-14 12:39:55 -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
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
ba96cdb7dc
refactor: mojofy autofill (#18723) 2019-06-12 15:08:22 -07:00
Cheng Zhao
3a1d6d2ce1
feat: migrate protocol module to NetworkService (Part 11) (#18706)
* Pipe data into HTTP protocol handlers

* Remove unused parameters

* Remove "sending request of http protocol urls" test

Sending request to "http://" in "file://" violates CORS rules and always
fail, before NetworkService somehow Chromium still sent a request even
though the request failed with CORS error, so the test passes while the
test is not valid. With NetworkService no request is sent at all and the
test jsut fails.

So this is an ancient invalid test, as sending http requests have been
fully covered in other tests, I am removing this test.
2019-06-11 14:07:58 +09:00
Robo
7d326f6bc5
chore: Remove AtomResourceDispatcherHostDelegate (#18623)
It is no longer used, follow up for
https://chromium-review.googlesource.com/c/chromium/src/+/1610892
2019-06-05 12:49:05 -07:00
Jeremy Apthorp
ed5fb4a720
refactor: simplify content script injection (#18532) 2019-06-04 16:07:34 -07:00
Jeremy Apthorp
0b25176893
refactor: mojofy draggable regions (#18536) 2019-06-03 10:43:04 -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
Electron Bot
96b32a814c chore: bump chromium to 964c4bca8de5c320534d95606c861 (master) (#18440)
* chore: bump chromium in DEPS to 2930eb12d56988c2c80bad2797ab036fe493d4e1

* chore: update patches

* Revert "disable robotjs-based tests"

This reverts commit e56adafc1f.

* Revert "skip dbus tests (#18409)"

This reverts commit aea042cc83.

* Revert "skip more dbus tests"

This reverts commit 68dbef48da.

* chore: bump chromium in DEPS to fd62da5601399b92effaa32a943fcd96143c8605

* chore: bump chromium in DEPS to 99f87ca22ee6e7ec953defe694771cb68f47a596

* chore: bump chromium in DEPS to d88778435b4cd9a510a63385b6d4ba24674b9774

* chore: update patches

* chore: update ssl_security_state_tab_helper.patch

* Remove content_packaged_services

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

* chore: fix false positive lint error

* views: wireup widget name to crash data

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

* chore: bump chromium in DEPS to ab588d36191964c4bca8de5c320534d95606c861

* roll patches
2019-05-28 13:18:10 -07:00
Jeremy Apthorp
53954494a9
chore: bump chromium to 54af93edd956a53c786668bc0e253 (master) 2019-05-23 13:35:41 -07:00
Cheng Zhao
e1a2cc7f36
feat: migrate protocol module to NetworkService (Part 8) (#18361)
* Add ProxyingURLLoaderFactory

* Intercept file:// protocol to support asar archives
2019-05-22 10:43:37 +09:00
Jeremy Apthorp
ca283c74c9 Merge remote-tracking branch 'origin/master' into roller/chromium-ad1b791122c04bd91b825fbfbdf1ff4da82a0edb-1558011686736 2019-05-21 10:07:17 -07:00
Milan Burda
c1cccfc082 chore: remove duplicate internal deprecations module (just use deprecate) (#18352) 2019-05-21 00:40:49 +02:00
Nitish Sakhawalkar
cf5224140b Chrome changed the devtools url
chrome-devtools:// to devtools://
28b21a67f0
2019-05-17 16:16:25 -07:00
Cheng Zhao
2ad62cedc3
feat: migrate protocol module to NetworkService (Part 7) (#18290)
* fix: make IsProtocolHandled return true for builtin schemes

* fix: return ERR_NOT_IMPLEMENTED for wrong arg

* Initial work of AsarURLLoader

* Put normal file logics in AsarURLLoader

* Implement asar file reading

* Don't change URL for unpacked file

* Fix cpplint warning
2019-05-15 08:29:58 +09:00
Cheng Zhao
0a6eb8afca
feat: migrate protocol module to NetworkService (Part 4) (#18084)
* Parse stream protocol handler

* Pipe node stream to mojo

* Merge the parser for headers

* Add ToDict helper to simplify code

* Simplify dispatching logic

* Add an experimental API for returning any type of response

* Fix subscribing event

* URL loaders' lifetime is independent of the factory

* HandleError helper is no longer needed

* Rename "SendResponse" => "StartLoading" to follow naming conventions

* Delete when connection error happens

* Fix cpplint warning
2019-05-03 09:48:51 +09:00
Jeremy Apthorp
3949f0bd50
refactor: convert crash reporter to gin (#17952) 2019-05-01 15:19:11 -07:00
Milan Burda
fcf0af15de feat: support ELECTRON_DEFAULT_ERROR_MODE in the GPU process (#17728) 2019-04-30 12:45:48 -04:00
Shelley Vohr
7b55ee9d36 refactor: allow requiring modules with no side effects (#17496) 2019-04-30 09:46:08 +09: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
3142d5ca00
chore: support converting OnceCallback to V8 (#17941) 2019-04-25 09:40:27 +09:00
Jeremy Apthorp
53c453567f
refactor: initialize feature list earlier (#17922) 2019-04-23 15:18:12 -07:00
Cheng Zhao
132137081a feat: migrate protocol module to NetworkService (Part 1) (#17899) 2019-04-23 14:39:20 -07:00
Jeremy Apthorp
ab009bba26 refactor: turn OnOffscreen message into a command-line flag (#17687)
This turns the AtomViewMsg_Offscreen message, which only called the global setter blink::WebView::SetUseExternalPopupMenus(false) to get Chrome to render popup menus in the renderer instead of externally on macOS, into a command-line renderer flag --offscreen which does the same thing, except at render thread startup time, which is where Chromium sets the flag: https://chromium.googlesource.com/chromium/src/+/refs/tags/75.0.3755.3/content/renderer/render_thread_impl.cc#728.

This was the last usage of RenderViewObserver in our codebase, so this PR also removes that class.
2019-04-19 12:55:20 -07:00
Shelley Vohr
0749dc4cc1
refactor: make app logs dir creation opt-in (#17841)
Previously, we were creating the app logs folder at a predefined location during initial electron startup, which meant that it had to be manually removed and prevented clean app portability. This refactors that implementation such that it's now an opt-in feature and developers must call app.setAppLogsPath(path) with an optional custom path in order to set this directory.
2019-04-18 22:04:58 -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
Milan Burda
8cf15cc931 feat: only allow bundled preload scripts (#17308) 2019-03-28 11:38:51 +01:00
Robo
6c20c6e668 refactor: Enable network service (Part 1) (#17431)
* Convert InspectableWebContentsImpl::LoadNetworkResource to SimpleURLLoader

https://bugs.chromium.org/p/chromium/issues/detail?id=721408

* Plumb creation of network context with the service
2019-03-26 10:10:48 +09:00
Shelley Vohr
38d75010c7
chore: rename atomBinding to electronBinding (#17419) 2019-03-18 12:37:06 -07:00
Milan Burda
3a091cdea4 refactor: implement clipboard APIs without the remote module (#17200) 2019-03-15 17:32:04 -07:00
Milan Burda
a8698d092b chore: increase security of default_app (#17318) 2019-03-11 16:13:46 -07:00
Felix Rieseberg
f3fc4023cf refactor: Port renderer/web-view to TypeScript (#17250) 2019-03-07 15:26:23 -08:00
Felix Rieseberg
59a7fa6927 refactor: Port api/web-frame to TypeScript (#17053) 2019-03-01 08:39:04 +00:00
Felix Rieseberg
7f007109c3 refactor: Port inspector to TypeScript (#16943)
* refactor: Port inspector to TypeScript

* refactor: Add another type to inspector

* refactor: Use correct paths

* Update lib/renderer/inspector.ts

Co-Authored-By: felixrieseberg <felix@felixrieseberg.com>

* refactor: Implement feedback <3

* refactor: Don't define blob at all

* fix: Correct type
2019-02-25 18:10:25 -08:00
Felix Rieseberg
91f81b4b72 refactor: Port renderer/init to TypeScript (#17027)
* refactor: Port renderer/init to TypeScript

* Update lib/renderer/init.ts

Co-Authored-By: felixrieseberg <felix@felixrieseberg.com>

* refactor: Type this a bit more loosely

* refactor: Type parseOption strictly
2019-02-19 17:05:14 +00:00
Felix Rieseberg
2223114f20 refactor: Port chrome-api to TypeScript (#17014) 2019-02-19 13:09:44 +00:00
Felix Rieseberg
eaa0e28396 refactor: Port content-scripts-injector to TypeScript (#17012) 2019-02-18 12:47:07 +00:00
Felix Rieseberg
596acdcb91 refactor: Port web-frame-init to TypeScript (#16934)
* refactor: Port web-frame-init to TypeScript

* refactor: Use ipcRendererInternal
2019-02-18 00:24:18 +00:00
Felix Rieseberg
6b3ff4f1f7 refactor: Port security warnings to TypeScript (#16937)
* refactor: Port security-warnings to TypeScript

* chore: make aliasify work on .ts files as well

* refactor: Implement feedback <3

* refactor: Correctly call executeJavaScript
2019-02-16 17:06:30 -08:00
Felix Rieseberg
2498e8d1c2 refactor: Port renderer-internal to TypeScript (#16939)
* chore: make aliasify work on .ts files as well

* refactor: Port ipc-renderer-internal to TypeScript

* refactor: Correctly import internal ipcRenderer

* refactor: One more rename

* refactor: Fix one more lint issue

* refactor: Correctly reference ipcRendererInternal
2019-02-14 17:24:25 -08:00
Samuel Attard
5790869a3f
chore: refactor browser IPC into TS and app API into TS (#16921)
* chore: refactor browser IPC into typescript

* chore: refactor app.ts into Typescript

* Refactors app.dock into cpp
* Removes app.launcher which has not existed for 3 years
* Removes 2 deprecated APIs (that have been deprecated for more than one
major)
* Refactors deprecate.ts as well
2019-02-14 14:29:20 -08:00
deepak1556
9439ac108d content: Fix WebContentsUserData for usage across components.
https://chromium-review.googlesource.com/c/chromium/src/+/1354402
2019-02-14 23:59:21 +05:30
Felix Rieseberg
31494dfade refactor: Port getRemote to TypeScript (#16938)
* chore: make aliasify work on .ts files as well

* refactor: Port getRemote to TypeScript

* refactor: Implement feedback <3
2019-02-14 04:04:53 -10:00
Felix Rieseberg
6cd75744ef refactor: Port window-setup to TS (#16894)
* refactor: Port window-setup to TS

* refactor: Make the linter happy

* refactor: Sneaky little TS error

* refactor: Correctly import window-setup

* refactor: Implement feedback <3

* refactor: Allow decorators in TS

* refactor: Use named windowSetup in isolatedRenderer

* refactor: Help TS understand

* refactor: Welp, use createEvent again

* refactor: Use the correct target in the decorator
2019-02-14 03:52:38 -10:00