Commit graph

136 commits

Author SHA1 Message Date
Charles Kerr
d663b4eaee
fix: fix gn cpplint warnings (#14583)
* chore: fix cpplint 'include_what_you_use' warnings

Typically by including <memory>, <utility> etc.

* chore: fix 'static/global string constant' warning

Use C style strings instead of std::string.

Style guide forbids non-trivial static / global variables. https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables

/home/charles/electron/electron-gn/src/electron/script/cpplint.js

* refactor: remove global string variables.

Fix 'global string variables are not permitted' linter warnings
by using the base::NoDestructor<> wrapper to make it explicit that
these variables are never destroyed.

The style guide's take on globals with nontrivial destructors:
https://google.github.io/styleguide/cppguide.html#Static_and_Global_Variables

* fix: initializer error introduced in last commit

* fix: remove WIP file that was included by accident

* fix: include order

* fix: include order

* fix: include order

* fix: include order, again
2018-09-12 19:25:56 -05:00
Samuel Attard
a43a292d18 fix: dont parse arguments after a -- in the inspector (#14297) 2018-08-27 10:50:23 -07:00
Milan Burda
fc85d02786 feat: expose missing process APIs in sandboxed renderers (#13505) 2018-08-21 11:05:45 -07:00
Zhuo Lu
ab24a1e36d feat: netLog API for dynamic logging control (#13068)
* Introduce `net.{start|stop}Logging()`

- Slight regression right now as Electron won't automatically start logging net-logs at launch, will soon be fixed
- To implement callback for async controls

* Add `net.isLogging` & optional callback param for `net.stopLogging()`

* Fix small regression on --log-net-log

--log-net-log should work again

* Error on empty file path

* Only start with valid file path

* Remove unused var

* Allow setting log file path before URLRequestContextGetter starts logging

* Add net log tests

* Remove redundant checks

* Use brightray::NetLog

* Clean up code

* Should automatically stop listening

* 🎨 Attempt to fix styles

* Only run non-null callback

* Dump file to tmpdir

* Simplify net log spec

Spawned Electron process on Linux CI can fail to launch

* Separate netLog module

* Remove net logging test from net spec

* Add tests for netLog

* Fix header guard

* Clean up code

* Add netLog.currentlyLoggingPath

* Callback with filepath

* Add test for case when only .stopLogging() is called

* Add docs

* Reintroduce error on invalid arg

* Update copyright

* Update error message

* Juggle file path string types
2018-06-19 11:45:58 +10:00
Cheng Zhao
70e17b5f8f feat: add LabelButton API 2018-06-18 16:51:36 +09:00
Cheng Zhao
c8e8cb86ce feat: add Button API 2018-06-18 16:51:36 +09:00
Cheng Zhao
ba3700141f feat: add TextField API 2018-06-18 16:51:36 +09:00
Alexey Kuzmin
dee9aef975 Add "enable_desktop_capturer" build flag (#13133)
* Make it possible to disable a module for a renderer

* Put DesktopCapturer API under a build flag

The name is "enable_desktop_capturer".
Enabled by default.
2018-06-13 11:15:34 -05:00
Thiago de Arruda
6ff111a141 perf: don't use JSON to send the result of ipcRenderer.sendSync. (#8953)
* Don't use JSON to send the result of `ipcRenderer.sendSync`.

- Change the return type of AtomViewHostMsg_Message_Sync from `base::string16`
  to `base::ListValue`
- Adjust lib/browser/api/web-contents.js and /lib/renderer/api/ipc-renderer.js
  to wrap/unwrap return values to/from array, instead of
  serializing/deserializing JSON.

This change can greatly improve `ipcRenderer.sendSync` calls where the return
value contains Buffer instances, because those are converted to Array before
being serialized to JSON(which has no efficient way of representing byte
arrays).

A simple benchmark where remote.require('fs') was used to read a 16mb file got
at least 5x faster, not to mention it used a lot less memory.  This difference
tends increases with larger buffers.

* Don't base64 encode Buffers

* Don't allocate V8ValueConverter on the heap

* Replace hidden global.sandbox with NodeBindings::IsInitialized()

* Refactoring: check NodeBindings::IsInitialized() in V8ValueConverter

* Refactor problematic test to make it more reliable

* Add tests for NaN and Infinity
2018-06-13 17:38:31 +10:00
Cheng Zhao
0f7c25fc63 Put View APIs under a build flag 2018-05-24 15:44:07 +09:00
Cheng Zhao
322bde526c Add LayoutManager/BoxLayout APIs 2018-05-24 15:36:29 +09:00
Milan Burda
2337237d58 Refactoring: use C++11 class member variable initialization 2018-05-22 00:18:38 +02:00
Cheng Zhao
5a320222e2 feat: add WebContentsView API 2018-05-15 14:03:21 +09:00
Cheng Zhao
e058d11657 feat: add View API 2018-05-15 14:03:21 +09:00
Robo
ff571f3b5d Part I: Move from base::Bind to base::BindOnce and remove unneeded base::Passed (#12661) 2018-04-20 19:55:05 +09:00
Jeremy Apthorp
a635f078c6 [chromium-style] auto variable type must not deduce to a raw pointer type 2018-04-19 11:10:52 -07:00
Shelley Vohr
c6f4bbd143
also format missing .cc files 2018-04-18 20:48:45 -04:00
Cheng Zhao
858828d343
Refactor NativeWindow (Part 6): Move NativeWindow bindings to api::TopLevelWindow (#12596)
* Add atom::api::TopLevelWindow

* Make BrowserWindow inherit TopLevelWindow

* Fix reading from wrong weak map

* Read options after setting content view

* OnWindowClosed is not guarenteed to run now

* Fix the offscreen hack in BrowserWindow

* Fix building on Linux

* Fix tests on Linux

* Fix building on Windows
2018-04-14 11:04:23 +09:00
deepak1556
e24c0dda5d add features module to detect availability of build time features at runtime 2018-03-20 10:13:17 +03:00
Cheng Zhao
39e0433570 Fix build error after rebasing 2018-02-23 10:22:00 +09:00
shelley vohr
0e5b6f9300 Upgrade to node v9.3.0 (#11507)
* update submodule refs for node v9.3.0

* Define "llvm_version" for Node.js build

* NODE_MODULE_CONTEXT_AWARE_BUILTIN -> NODE_BUILTIN_MODULE_CONTEXT_AWARE

* update NodePlatform to MultiIsolatePlatform

* fix linting error

* update node ref

* REVIEW: Explicitly register builtin modules

https://github.com/nodejs/node/pull/16565

* update libcc ref

* switch libcc to c62

* REVIEW: Address node api changes

- Always start the inspector agent for https://github.com/nodejs/node/pull/17085
- Set the tracing controller for node https://github.com/nodejs/node/pull/15538
- Isolate data creation now requires plaform https://github.com/nodejs/node/pull/16700
2018-02-23 10:22:00 +09:00
Aleš Pergl
c49cb29ddf Disallow launching unknown apps via browser client.
CVE-2018-1000006
2018-01-22 16:49:30 -06:00
Adrien Fery
f3ae566164 Add in-app purchase for MacOS 2018-01-10 13:14:18 +09:00
Charles Kerr
435c9c1486 Force uv loop cleanup (#11465)
* ensure all uv handles are closed before ending worker's loop

* add DCHECK to test that the Worker loop is finished

* don't call deprecated uv_loop_new(), uv_loop_delete()

* make cpplint happy

* fix comment error

* empty commit for CI

* tweak DCHECK expression

* extract-method: stop_and_close_uv_loop()

* fix DCHECK oops
2018-01-04 11:16:06 -08:00
Samuel Attard
5dd4d6a961
macOS implementation of notifications in the main process 2017-05-23 02:05:13 +10:00
Kevin Sawicki
d8aca08da7 Set _debugWaitConnect on --inspect-brk 2017-05-16 14:50:49 -07:00
Birunthan Mohanathas
8b9f7e5b00 Implement initial, experimental BrowserView API
Right now, `<webview>` is the only way to embed additional content in a
`BrowserWindow`. Unfortunately `<webview>` suffers from a [number of
problems](https://github.com/electron/electron/issues?utf8=%E2%9C%93&q=is%3Aissue%20is%3Aopen%20label%3Awebview%20).
To make matters worse, many of these are upstream Chromium bugs instead
of Electron-specific bugs.

For us at [Figma](https://www.figma.com), the main issue is very slow
performance.

Despite the upstream improvements to `<webview>` through the OOPIF work, it is
probable that there will continue to be `<webview>`-specific bugs in the
future.

Therefore, this introduces a `<webview>` alternative to called `BrowserView`,
which...

- is a thin wrapper around `api::WebContents` (so bugs in `BrowserView` will
  likely also be bugs in `BrowserWindow` web contents)

- is instantiated in the main process like `BrowserWindow` (and unlike
  `<webview>`, which lives in the DOM of a `BrowserWindow` web contents)

- needs to be added to a `BrowserWindow` to display something on the screen

This implements the most basic API. The API is expected to evolve and change in
the near future and has consequently been marked as experimental. Please do not
use this API in production unless you are prepared to deal with breaking
changes.

In the future, we will want to change the API to support multiple
`BrowserView`s per window. We will also want to consider z-ordering
auto-resizing, and possibly even nested views.
2017-04-13 01:27:27 +03:00
Cheng Zhao
2ef1b70897 Fix crash happened in UvRunOnce 2017-03-28 17:19:14 +09:00
Cheng Zhao
c068285ff8 AtomBindings should not use default uv loop 2017-03-20 12:52:46 -07:00
Cheng Zhao
d2f185bea5 Create new uv loop in each worker 2017-03-20 12:52:46 -07:00
Cheng Zhao
69df934710 Converter for base::Callback is not thread safe 2017-03-20 12:52:45 -07:00
Cheng Zhao
b467c3939e Add a new type of NodeBindings 2017-03-20 12:52:45 -07:00
Cheng Zhao
d379b05890 async handles should be closed on exit 2017-03-02 17:19:00 +09:00
Kevin Sawicki
ff718b19db Upgrade node for new 7.4 patches and changes 2017-01-26 14:46:50 -08:00
Kevin Sawicki
c374e37cc4 Leak IsolateData since Environment is also leaked 2017-01-19 09:05:59 +02:00
Kevin Sawicki
54e2c480cb Upgrade to node 7.4 2017-01-19 09:05:59 +02:00
Cheng Zhao
497f5a1199 Update files for Chrome 54 API changes 2017-01-19 09:05:59 +02:00
Ales Pergl
5b3d0f86f7 Adjustments after migrating libchromiumcontent to GN 2017-01-19 09:05:44 +02:00
Kevin Sawicki
3796d7a6a1 Use trace event with zero args 2016-12-12 13:49:58 -08:00
Ryohei Ikegami
a7a06a483e Record JavaScript calls in DevTools timeline on Node/ipc callback 2016-12-07 20:22:13 +09:00
ali.ibrahim
e8d4abe78f Adding net module and URLRequest class. 2016-10-12 14:54:15 +02:00
Milan Burda
5bfa898a02 Always drop SEM_NOGPFAULTERRORBOX flag from error mode (enables WER if crashReporter is not started) 2016-09-29 13:57:41 -07:00
Milan Burda
12a2b144f3 Only drop the SEM_NOGPFAULTERRORBOX flag when calling SetErrorMode (ELECTRON_DEFAULT_ERROR_MODE) 2016-09-16 14:01:33 -07:00
Cheng Zhao
4e800e7fef Merge pull request #7002 from electron/include-alpha
Enable alphabetical include order cpplint rule
2016-08-29 15:19:05 +09:00
Kevin Sawicki
6285500cdc Sort includes alphabetically 2016-08-26 15:30:02 -07:00
Kevin Sawicki
7dd1a7e6f4 Only set _debugWaitConnect in main process 2016-08-26 12:30:27 -07:00
Kevin Sawicki
056e5b951b Set process._debugWaitConnect with --debug-brk is specified 2016-08-26 12:06:15 -07:00
Cheng Zhao
103fea5cdf Use scoped policy for micro tasks 2016-08-22 19:34:59 +09:00
Saúl Ibarra Corretgé
d6ff804b9a Remove unneeded flag check
stop_flag is only set if uv_stop was called, which is never the case, so
skipping the test should be harmless.
2016-08-03 12:52:17 +01:00
Saúl Ibarra Corretgé
0da72be8a9 Remove unneeded libuv callback 2016-08-03 12:48:58 +01:00