Compare commits

...

379 Commits

Author SHA1 Message Date
Electron Bot
4c25b619a6 Bump v6.1.3 2019-11-01 08:58:29 -07:00
trop[bot]
c2c25f1ee3 build: do not try to run non existent VSTS release builds (#20876) 2019-10-31 10:55:28 -04:00
John Kleinschmidt
8cf8c8fe63 docs: Update the sccache name (#20462) (#20862)
(cherry picked from commit b3e7657159)
2019-10-31 09:55:39 +09:00
Birunthan Mohanathas
61fdda3e8f fix: Disable compositor recycling only for attached views (6-1-x) (#20834)
Backport of #20829

Notes: Fix flicker when switching between `BrowserView`s
2019-10-30 16:55:30 -04:00
Milan Burda
4a5f89d5c7 fix: properly generate requestID in webContents.printToPDF() (#20769) (#20811) 2019-10-30 14:38:09 +09:00
Milan Burda
36fd0e9b37 fix: pass frameId to v8Util.setRemoteCallbackFreer() (#20732) (#20815) 2019-10-30 14:36:06 +09:00
Milan Burda
512736542b fix: send ELECTRON_BROWSER_CONTEXT_RELEASE asynchronously (#20632) (#20716) 2019-10-29 11:34:11 +09:00
Shelley Vohr
b144900c00 fix: prevent menu gc during popup (#20786) 2019-10-28 18:35:58 -07:00
Electron Bot
dabaa7557a Bump v6.1.2 2019-10-24 12:06:16 -07:00
trop[bot]
c6a794d738 chore: update build_bring_back_node_with_ltcg_configuration.patch (#20709)
* chore: update build_bring_back_node_with_ltcg_configuration.patch

set default value for node_with_ltcg=true

* fix: move ltcg definition to Release configuration
2019-10-23 16:33:38 -07:00
Electron Bot
aa863bc323 Bump v6.1.1 2019-10-23 11:13:59 -07:00
Jeremy Apthorp
e3a79d6c52 fix: properly free remote objects (6-1-x) (#20694) 2019-10-23 10:31:59 -07:00
loc
14ba3ac63e chore: remove unused member variable (#20690) 2019-10-23 09:12:18 +09:00
loc
6a07825c47 fix: don't hang on SendSync if ElectronBrowser receiver is destroyed (6-0-x) (#20547) 2019-10-22 14:29:10 -07:00
Electron Bot
70b5e673bb Bump v6.1.0 2019-10-21 15:45:49 -07:00
trop[bot]
6359db712a fix: backport libuv patch for fs.mkdir/mkdirSync on invlaid names (#20665)
Backports https://github.com/libuv/libuv/pull/2375
2019-10-21 15:44:05 -07:00
Samuel Attard
268cd3939c feat: add a new contextBridge module (#20639)
* 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

* docs: mark contextBridge as experimental (#20638)

* docs: mark contextBridge as experimental

This commit didn't make it to the original PR, quick addition here

* Update context-bridge.md

* chore: touch up the differences between master and 6-0-x

* chore: add v8 serializer converter, cherry picked from 2fad53e66b

* chore: support converting OnceCallback to V8 (#17941)

* chore: fixup tests

* chore: fix linting

* chore: add patch for mojo message constructor
2019-10-21 13:58:03 -07:00
Samuel Attard
3ca62d9432 chore: manually bump version to 6.1.0-beta.0 in prep for 6.1.0 2019-10-21 13:01:18 -07:00
Milan Burda
9901700a91 test: skip desktopCapturer / remote module tests when the features are disabled (#20566) (#20577) 2019-10-21 15:40:21 -04:00
Robo
d5b088bc26 fix: add patch to node for native module size issue on windows (#20614) (#20627) 2019-10-18 12:57:08 -04:00
trop[bot]
a12de693b0 ci: add macOS debug builds (#20572)
* ci: add macOS debug builds

* Fix mac debug builds

* Remove ninja status as it is not available in 6-0-x
2019-10-15 09:14:25 -07:00
trop[bot]
e257981a6d spec: allow "Yu Gothic" as a Japanese sans-serif font on Windows (#20569) 2019-10-14 12:38:01 -07:00
Milan Burda
ffb96acab0 fix: when building with enable_plugins=false (#20354) (#20508) 2019-10-10 14:12:28 +02:00
Robo
fd0b57f219 fix: backport chromium patches to fix touchpad scrolling on windows (#20488)
Backports https://chromium-review.googlesource.com/c/chromium/src/+/1689922
and https://chromium-review.googlesource.com/c/chromium/src/+/1753661
2019-10-09 13:41:06 -07:00
Electron Bot
1e50380fab Bump v6.0.12 2019-10-08 12:43:31 -07:00
trop[bot]
31ba6c203e fix: properly free IsolateData in node_main (#20475) 2019-10-08 15:33:32 -04:00
Shelley Vohr
03d16f37d2 fix: enable worker threads in ELECTRON_RUN_AS_NODE (#20457) 2019-10-08 11:59:28 -04:00
Robo
e501930d38 fix: fs.watch() behavior change in node >= 10.16.0 (#20429)
This reverts the patch from https://github.com/electron/node/pull/100
which never got merged due to reasons outlined in https://github.com/libuv/libuv/pull/2313

* Adds new patches that backports https://github.com/libuv/libuv/pull/2459
  and https://github.com/libuv/libuv/pull/2460

Based on https://github.com/nodejs/node/issues/29460
2019-10-07 13:05:14 -07:00
Joshua Westerheide
28eb7b0532 feat: add env variable to skip binary download on npm install (backport) (#20438)
* feat: add env variable to skip binary download on npm install

* docs: add "Skip binary download" section to install tutorial
2019-10-07 13:04:00 -04:00
Shelley Vohr
15e611a0ff docs: clarify dock.bounce usage (#20458) 2019-10-07 17:15:48 +02:00
trop[bot]
3176e323e4 fix: recentDocuments menu role on macOS (#20409) 2019-10-03 08:59:09 +02:00
Milan Burda
99a0581d0d fix: allow paths to asar archives to contain the .asar extension in directories (#20342) (#20402) 2019-10-02 18:03:18 +09:00
Electron Bot
4e417e21b8 Bump v6.0.11 2019-10-01 12:08:35 -07:00
trop[bot]
e472efbea2 fix: correctly crash when there is no crashReporter (#20396)
* fix: correctly crash when there is no crashReporter

* test: correctly crash when there is crashReporter
2019-10-01 15:06:23 -04:00
Birunthan Mohanathas
886e636b13 fix: Make the --disable-color-correct-rendering switch work again (backport) (#20358) 2019-09-30 10:46:41 -07:00
trop[bot]
0450ee9524 fix: correct 'Entire screen' to ' Entire Screen' (#20301) 2019-09-20 07:44:21 -07:00
trop[bot]
ce31dc3591 ci: actually kill leftover processes on WOA testing (#20292)
* ci: only kill WOA processes if they are running

(cherry picked from commit 844752cd97)

* ci: actually kill leftover processes on WOA testing

(cherry picked from commit a76d2d8e53)
2019-09-20 10:20:19 -04:00
Shelley Vohr
15c89c8262 fix: crash when exiting simple fullscreen on macOS (#20144) (#20282) 2019-09-19 14:29:35 -04:00
Shelley Vohr
dbd72b2265 docs: improve and add examples for clipboard (#20224) (#20283)
* docs: improve and add examples for clipboard

* address feedback from jkleinsc review
2019-09-19 09:57:09 -04:00
Electron Bot
10a9e9c043 Bump v6.0.10 2019-09-18 12:48:43 -07:00
trop[bot]
690271e38c build: add WOA node headers to checksum file (#20260) 2019-09-18 10:21:46 -07:00
trop[bot]
fc7ef4cc1c fix: strip chrome-sandbox typo (#20257) 2019-09-18 09:43:52 -07:00
Samuel Attard
f2d1abd0e3 fix: Add more checks in MojoCdmService. (#20219)
Applies b7b305f338%5E%21/
2019-09-17 13:53:04 -04:00
Samuel Attard
e3be323962 docs: remove dash that broke the return type parser (#20246) 2019-09-17 10:49:07 -04:00
Electron Bot
407747b48c Bump v6.0.9 2019-09-11 10:30:11 -07:00
trop[bot]
17b8b551ac build: handle arm64 node headers (#20194)
* build: handle arm64 node headers

(cherry picked from commit ff1f224d96)

* node.lib for arm64 needs to go to specific dir
2019-09-10 21:56:07 -04:00
Electron Bot
4bcbe55828 Bump v6.0.8 2019-09-09 09:12:33 -07:00
trop[bot]
8f84626531 build: get all the release assets when looking for one to delete (#20165)
* build: get all the release assets when looking for one to delete

yeah we totally have more than 30....

* Update upload-to-github.js
2019-09-09 09:10:04 -07:00
Electron Bot
69d3a694f4 chore: bump chromium in DEPS to 76.0.3809.146 (#20149) 2019-09-06 09:11:54 -07:00
trop[bot]
3925c098fb fix: ensure modeL_ exists before calling delegate methods (#20115)
This is a speculative fix for a crash we are seeing in `menuDidClose`.  We
can't repro the crash but the traces have it happening in this method
and just by reading through the impl the only part that jumps out as
Might Crash is this `model_` call.  Other methods in the menu controller
check `model_` before using it so it probably makes sense to do that here
as well.
2019-09-06 07:54:38 -07:00
trop[bot]
75dd6e5a71 build: don't wait until job requests return in case some jobs fail to return (#20135) 2019-09-05 14:01:25 -04:00
Electron Bot
204c111da1 chore: bump chromium in DEPS to 76.0.3809.145 (#20130) 2019-09-05 10:30:17 -07:00
John Kleinschmidt
ed9b96ce9e ci: test on woa hardware (6-0-x) (#20092)
* ci: test on woa hardware

* ci: run tests on WOA hardware (#20031)

* ci: run tests on WOA hardware

* Temporarily disable test until #20008 is resolved

* deterministically run tests in sorted order

(cherry picked from commit bedc5f7da9)

* Disable test on WOA until #20008 is resolved

* use request instead of blur to detect openExternal success

* use blur event on mac, sigh

* oh, right, still gotta open an actual url

* Try to track down GPUinfo failure

* Make function async

* Check exitCode

* Try to resolve bad exit code on GPUInfo test

* Add logging to figure out failures on BrowserWindow.moveTop()

* Revert "Add logging to figure out failures on BrowserWindow.moveTop()"

This reverts commit e21ace30dc.

* Disable test until #20110 is resolved

* fix lint issue
2019-09-04 19:22:38 -04:00
Eugene
0f27712e8f fix: allow unsandboxed renderers to request new privileges (6-0-x) (#20023) 2019-09-04 14:53:19 -07:00
trop[bot]
b2da0b883d build: add WOA release to list of releases (#20113)
* build: add WOA release to list of releases

* Add job count info for sudowoodo

* Add verification of all assets

* Fix linting and add logic to wait before printing out results
2019-09-04 14:32:50 -07:00
Robo
4662ab9b63 fix: crash with --inspect-brk when running under ELECTRON_RUN_AS_NODE (#20098)
* fix: ensure that the node env is not bootstrapped before running inspector

* fix: ensure we wait for the inspect to disconnect

This re-orders our node clean up so that we free the environment before
the task runner is cleaned up as node uses the task runner during clean
up.  It also calls WaitForDisconnect() to ensure that inspector agents
are notified that the context is going down.

* chore: update spec to catch SIGABRT
2019-09-04 12:45:50 -07:00
Electron Bot
e070bd7bdb chore: bump chromium in DEPS to 76.0.3809.144 (#20108) 2019-09-04 08:24:33 -07:00
trop[bot]
a8ec0de153 Revert "fix: make sure that menu bar gets focus even when you click an item to focus it first (#19710)" (#20035)
This reverts commit 27b2747b61.
2019-09-03 23:19:26 -07:00
Electron Bot
34c6e05a82 chore: bump chromium to 76.0.3809.143 (6-0-x) (#20061)
* chore: bump chromium in DEPS to 76.0.3809.140

* chore: bump chromium in DEPS to 76.0.3809.141

* chore: bump chromium in DEPS to 76.0.3809.142

* chore: bump chromium in DEPS to 76.0.3809.143
2019-09-03 17:01:43 -07:00
trop[bot]
97798a4aad fix: strip chrome_sandbox executable (#20081) 2019-09-03 09:49:07 -07:00
trop[bot]
837948759f fix: honor cursor blink rate (#20046)
* fix: honor cursor blink rate on macOS

* fix: honor cursor blink rate on Linux

* fix: honor cursor blink rate on Windows

* refactor: clean up os_win cursor blink logic

* remove unneeded include
2019-09-03 16:22:25 +09:00
Electron Bot
8b6fa783f4 Bump v6.0.7 2019-08-30 16:48:26 -07:00
trop[bot]
ed7ae42c10 fix: ensure that the "top" coordinate of the inner frame is correct (#20052)
On multi-monitor setups where the monitors are not all origined at 0 on
the Y coordinate (E.g. vertical stacked monitors) the maximize
calculation was incorrect as it assumed top was "0".  This instead
adjusts the math to calculate the correct top value.
2019-08-30 16:44:51 -07:00
Electron Bot
828038d5f6 chore: bump chromium in DEPS to 76.0.3809.139 (#20042) 2019-08-30 15:15:54 -07:00
Electron Bot
f1a914c0ba Bump v6.0.6 2019-08-29 13:38:36 -07:00
Electron Bot
5eff97c890 chore: bump chromium in DEPS to 76.0.3809.138 (#20024) 2019-08-29 08:59:51 -07:00
Charles Kerr
0039e604a2 fix: i18n of gtk msgbox buttons (#20007)
* fix: i18n of gtk msgbox buttons

Manually backport #19904. See that PR for details.

* fix: make linter happy

* fix: make linter happy
2019-08-29 15:54:31 +09:00
Electron Bot
26176eb108 chore: bump chromium in DEPS to 76.0.3809.137 (#20004) 2019-08-28 08:11:47 -07:00
Heilig Benedek
fb82bfa707 fix: handle WM_GETMINMAXINFO instead of letting chromium do it (#19928) (#20001)
* fix: remove WM_GETMINMAXINFO workaround since it's no longer needed

* fix: handle WM_GETMINMAXINFO ourselves

* fix: remove part of the chromium WM_GETMINMAXINFO handler
2019-08-28 09:32:26 -05:00
Electron Bot
9b724dca49 Bump v6.0.5 2019-08-27 11:39:08 -07:00
Shelley Vohr
b52a2aedf1 fix: add default media usage strings to info.plist (#19949) 2019-08-27 11:37:04 -07:00
Electron Bot
8e671dafc1 chore: bump chromium in DEPS to 76.0.3809.136 (#19981) 2019-08-27 08:33:46 -07:00
Richard Townsend
0491abf4cc fix: work around a null scoped_ptr dereference (#19366)
This happens occasionally when running the test suite and indicates
that the callback's been reset or the underlying reference has been
released. To workaround, print a warning.
2019-08-27 10:57:18 -04:00
Jaime Bernardo
1655976841 fix: extern Parse impl for Windows debug builds (#19958)
Applies a patch to node.
Externs node::options_parser::Parse implementation for
node::DebugOptions to fix the Windows Debug build.
2019-08-27 07:53:52 -07:00
trop[bot]
0b5a7379f2 fix: don't call SetBounds on restore (#19956) 2019-08-27 07:51:59 -07:00
trop[bot]
a5ed8fb65e fix: ensure that reloads retain modified window background colors (#19973) 2019-08-27 07:50:39 -07:00
Richard Townsend
bb631892b2 fix: crash reporting on Windows on Arm (#19391)
* feat: cherry-pick V8 unwinding support

This commit backports [1] (originally written by @ThomsonTan) into V8
7.6. With this patch in place, calls made from JS into the atom core
which crash electron.exe will now generate crash dumps on Windows on
Arm rather than silently dying.

[1] https://chromium-review.googlesource.com/c/v8/v8/+/1701133/11

* feat: backport crashpad cpu capture context

Backport of [1] (originally written by @kaadam) to Chromium 76's
crashpad. This lets you see the register values within the crash dump.

[1]
https://chromium-review.googlesource.com/c/crashpad/crashpad/+/1632749

* build: make win on arm patches only apply for win on arm builds

* Update .patches

* Update .patches

* Update DEPS

* fix: update the patch to the as-landed version

* fix: remove accidental revert of crashpad_pid_check.patch
2019-08-27 10:43:27 -04:00
Heilig Benedek
64026ded95 fix: adjust window size in NCCALCSIZE instead of adding insets (#19944) 2019-08-26 10:07:35 -07:00
Electron Bot
e6178f83fe chore: bump chromium to 76.0.3809.135 (6-0-x) (#19935)
* chore: bump chromium in DEPS to 76.0.3809.134

* chore: bump chromium in DEPS to 76.0.3809.135
2019-08-26 12:54:19 -04:00
John Kleinschmidt
ee5403d3ec build: start building Windows on Arm builds (#19910)
* build: start building Windows on Arm builds (#19780)

(cherry picked from commit 4bc7b3b1a4)

* Update manifest to include 6-0-x file
2019-08-26 09:54:32 -04:00
trop[bot]
6b77e2ee14 fix: command-line scheme switch values' spillover (#19940) 2019-08-25 23:03:19 -07:00
Electron Bot
075b085cb4 chore: bump chromium in DEPS to 76.0.3809.133 (#19922) 2019-08-25 00:30:02 -07:00
Electron Bot
cbd017572a Bump v6.0.4 2019-08-23 14:06:09 -07:00
Samuel Attard
3f0c863225 Revert "Bump v6.0.4"
This reverts commit 783614a94c.
2019-08-23 14:04:46 -07:00
trop[bot]
a459cee938 build: use a lower process count for publish builds with no sccache (#19915) 2019-08-23 14:01:55 -07:00
Electron Bot
783614a94c Bump v6.0.4 2019-08-23 12:05:24 -07:00
Cheng Zhao
db1395628a fix: notify views of content view size change (#19888) 2019-08-23 12:02:54 -07:00
Shelley Vohr
5e33a5e778 fix: ensure child_process.fork() doesn't modify main process env (#19845) 2019-08-23 12:01:46 -07:00
Electron Bot
ce502b19ba chore: bump chromium in DEPS to 76.0.3809.131 (#19909) 2019-08-23 12:41:29 -04:00
Samuel Attard
1cfd7160dc fix: remove white screen flicker by disabling compositor recycling (#19900) 2019-08-23 01:14:39 -07:00
Electron Bot
339174dca0 chore: bump chromium in DEPS to 76.0.3809.130 (#19885) 2019-08-22 10:54:35 -07:00
Electron Bot
6964a8cd72 chore: bump chromium in DEPS to 76.0.3809.129 (#19864) 2019-08-21 11:18:27 -07:00
trop[bot]
51a97917e0 build: ninja count should be 2*cores + 2 (#19867) 2019-08-21 08:53:03 -07:00
trop[bot]
3ca1cd4dd4 fix: trim branch name before comparing to master (#19856) 2019-08-20 20:11:52 -07:00
trop[bot]
c2c0ee7a73 docs: update documentation under tutorials (#19843) 2019-08-20 11:08:51 -07:00
Electron Bot
739f620152 chore: bump chromium in DEPS to 76.0.3809.128 (#19840) 2019-08-20 08:28:04 -07:00
Electron Bot
fb379c3b6a Bump v6.0.3 2019-08-19 14:23:16 -07:00
Electron Bot
237688abb3 chore: bump chromium to 76.0.3809.126 (6-0-x) (#19791)
* chore: bump chromium in DEPS to 76.0.3809.123

* chore: bump chromium in DEPS to 76.0.3809.124

* chore: bump chromium in DEPS to 76.0.3809.125

* chore: bump chromium in DEPS to 76.0.3809.126
2019-08-19 14:20:15 -07:00
Shelley Vohr
94070cec53 ci: upgrades-wg owns DEPS (#19834) 2019-08-19 14:12:33 -07:00
Pedro Pontes
e8ef52bc1d fix: always use new site instance for a new navigation (backport). (#19826) 2019-08-19 13:20:22 -07:00
Micha Hanselmann
2f9876a3f9 docs: add exemplary fiddle for launch in fiddle feat (#19759) (#19786)
* add fit-screen

* new url format

* nit
2019-08-19 13:10:29 -07:00
Samuel Attard
5ca94a8715 fix: disable LayoutNG to prevent random crashes in selection calcuations (#19808)
* fix: disable LayoutNG to prevent random crashes in selection calcuations

* Update atom_browser_main_parts.cc
2019-08-16 17:01:29 -07:00
trop[bot]
ffd1d6d8ad docs: add missing return desc (#19799) 2019-08-16 13:26:19 -07:00
trop[bot]
33c86527e8 MessageBoxOptions.icon should allow string (#19798) 2019-08-16 13:25:41 -07:00
Charles Kerr
871f123080 fix: i18n gtk dialog buttons (#19760)
manual backport of https://github.com/electron/electron/pull/19756
2019-08-16 08:57:54 -07:00
trop[bot]
3dcf66839e fix: make sure that menu bar gets focus even when you click an item to focus it first (#19764) 2019-08-15 10:30:05 -07:00
Electron Bot
78a2237add chore: bump chromium in DEPS to 76.0.3809.120 (#19774) 2019-08-15 10:03:19 -07:00
Richard Townsend
be68c062d7 chore: update the compiler again (#19383)
This WoA-specific change updates the compiler to one that produces
CodeView debug symbols, which means that Visual Studio can display the
values of variables whilst debugging.
2019-08-15 10:08:37 -04:00
Erick Zhao
dbf8872817 fix: normalize behavior of win.setOpacity() for invalid number values across operating systems (#19723)
* fix: normalize behavior of `win.setOpacity()` for invalid number values across operating systems

* expect -> assert

* assert 2

* fix `this` scoping

* fix equality

* tests
2019-08-14 18:10:06 -07:00
Electron Bot
a50e3b3f5f chore: bump chromium in DEPS to 76.0.3809.119 (#19754) 2019-08-14 18:01:18 -07:00
Cheng Zhao
063bcb68f2 chore: revert activation if the uv_loop on incoming IPC messages (#19739)
This reverts commit c0e9761b4b.
2019-08-14 07:55:39 -07:00
Electron Bot
364e8b1a1d chore: bump chromium to 76.0.3809.118 (6-0-x) (#19696)
* chore: bump chromium in DEPS to 76.0.3809.113

* chore: bump chromium in DEPS to 76.0.3809.114

* chore: bump chromium in DEPS to 76.0.3809.115

* chore: bump chromium in DEPS to 76.0.3809.116

* chore: bump chromium in DEPS to 76.0.3809.118
2019-08-13 20:23:28 -07:00
trop[bot]
779f285777 fix: avoid losing focus on inputs when opening menu (Windows/Linux) (#19708)
* remove cause of issue

* remove comment
2019-08-12 20:58:10 -07:00
Electron Bot
4e1a5a210a Bump v6.0.2 2019-08-12 12:53:48 -07:00
Cheng Zhao
98d78f2fb5 fix: don't handle browser messages before document element is created (6-0-x) (#19719)
* fix: don't handle browser messages before document element is created

* fix: bind ElectronApiServiceImpl later

DidCreateDocumentElement is called before the ElectronApiServiceImpl
gets bound.

* chore: add comment
2019-08-12 10:45:36 -07:00
Shelley Vohr
a8e70a8546 docs: update hasShadow for win and linux (#19675) (#19692) 2019-08-12 09:46:02 -07:00
Micha Hanselmann
1ca76e8e74 fix: return correct bounds on will-resize (#19639) (#19704) 2019-08-09 14:51:09 -07:00
Electron Bot
16757d16e7 chore: bump chromium to 76.0.3809.110 (6-0-x) (#19684)
* chore: bump chromium in DEPS to 76.0.3809.110

* Update patches
2019-08-08 13:50:24 -07:00
Shelley Vohr
d2b2b97c29 fix: crash on window.print() (#19677) 2019-08-08 07:52:06 -07:00
Electron Bot
6bc7bc11d8 chore: bump chromium in DEPS to 76.0.3809.108 (#19665) 2019-08-07 13:24:24 -04:00
Electron Bot
f3d4daa9e5 Bump v6.0.1 2019-08-06 14:10:50 -07:00
Erick Zhao
6c0157aa29 fix: handle edge behavior for about panel on Linux (#19635) 2019-08-06 12:45:16 -07:00
Electron Bot
a9e0aa22a4 chore: bump chromium in DEPS to 76.0.3809.102 (#19649) 2019-08-06 11:53:41 -07:00
trop[bot]
56160e990e fix: clearRecentDocuments role on Windows (#19637)
* fix: clear recent documents on windows

* chore: don't check for version < win 7
2019-08-05 20:56:23 -07:00
trop[bot]
ab83309c7a fix: make child windows not crash when ipc messages are received (#19633)
* fix: make child windows not crash when ipc messages are received

This also adds a path forward for apps using child windows with
nodeIntegration to migrate into a non-leaky way of doing it.

1. Ensure that if ipcNative is missing we don't crash rather log that it
is missing
2. Add a hidden option `--enable-node-leakage-in-renderers` (temporary
measure) to allow app devs to opt in to leaking node in child windows
3. Bypasses the Opener() check if renderer process reuse is enabled
(which would prevent the leak anyway)

So the path forward is: it no longer crashes --> folks use the hidden
option --> folks opt in to renderer process reuse.

* Apply suggestions from code review

Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>

* Update shell/renderer/atom_renderer_client.cc

Co-Authored-By: Jeremy Apthorp <jeremya@chromium.org>
2019-08-05 15:10:52 -07:00
Electron Bot
c474ff101c chore: bump chromium to 76.0.3809.98 (6-0-x) (#19593)
* chore: bump chromium in DEPS to 76.0.3809.95

* chore: bump chromium in DEPS to 76.0.3809.96

* chore: bump chromium in DEPS to 76.0.3809.97

* chore: bump chromium in DEPS to 76.0.3809.98
2019-08-05 12:55:34 -04:00
trop[bot]
54902e848f fix zoom button when alwaysOnTop set (#19351) 2019-08-05 09:06:23 -07:00
Shelley Vohr
7bec7e6cee doc: add missing MenuItem roles (#19329) (#19573) 2019-08-01 14:05:32 -07:00
Shelley Vohr
55224e385e fix: set size of GTK about panel icon (#18957) (#19572) 2019-08-01 14:04:02 -07:00
Shelley Vohr
75fecf4e4f fix: throw on invalid webRequest filters (#19337) (#19570)
Closes #11371.

Previously, we didn't consider the return value of the webRequest URLPattern mate converter, which meant that when the pattern wasn't correctly parsed owing to invalid filter specification users would not be made aware of that fact and would just think that the filtering itself had failed. This corrects that error by moving the business logic of url pattern parsing out of the converter and into the function itself so that granular and specific errors can be thrown.

There's also no real reason that i'm aware of not to allow wider breadth of filters by letting users use a wildcard for effective TLD, so I also overrode that (default for the 1-arg Parse is not to allow that).

Finally, I added some examples of url filter types for users to reference.
2019-08-01 14:03:27 -07:00
Micha Hanselmann
f2f483fedb test: add test for invalid cookie url (#19568) 2019-08-01 14:02:41 -07:00
Micha Hanselmann
5614ae4241 fix: make process.uptime() return the correct time (#19567) 2019-08-01 14:02:24 -07:00
Electron Bot
55abf1f3a1 chore: bump chromium in DEPS to 76.0.3809.94 (#19564) 2019-08-01 12:17:38 -04:00
John Kleinschmidt
0f78f8a66c fix: use WeakPtr to detect deletion (#19560)
(cherry picked from commit 77c24d8b66)
2019-08-01 08:05:45 -07:00
Shelley Vohr
fa4a26a1db fix: throw better error on getPath('logs') (#19514) (#19545) 2019-07-31 15:52:47 -07:00
trop[bot]
7ba29f1fa8 fix: set default dock bounce type (#19546) 2019-07-31 09:42:07 -07:00
Electron Bot
2f148fdaf4 chore: bump chromium in DEPS to 76.0.3809.91 (#19540) 2019-07-31 12:11:11 -04:00
Erick Zhao
19c31c684a docs: update badges (#18955) (#19537) 2019-07-31 08:07:04 -04:00
Electron Bot
c61a20c390 chore: bump chromium in DEPS to 76.0.3809.90 (#19531) 2019-07-30 13:24:55 -07:00
trop[bot]
4ae3031faf fix: remove TLS destruction (#19428)
Building with dchecks_always_on=true in release configuration seems to
introduce flakiness because the TLS is double-freed. Amending the check
seems to fix the flakiness.
2019-07-30 13:12:13 -07:00
Shelley Vohr
72fee2ed78 fix: correctly emit BrowserWindow alwaysOnTop status (#19534) 2019-07-30 11:24:35 -07:00
trop[bot]
cba1a946d5 fix: tray.displayBalloon() does not work with custom icon on Windows (#19528) 2019-07-30 09:22:10 -07:00
trop[bot]
c55bc8106f chore: omit superceded Chromium updates from notes (#19406)
* feat: omit superceded Chromium updates from notes

* chore: simplify changed code
2019-07-29 19:42:06 -07:00
Micha Hanselmann
261f7fd3be i really wanna do this (#19517) 2019-07-29 16:57:14 -07:00
trop[bot]
53894d5ac2 add desc (#19508) 2019-07-29 14:51:36 -07:00
trop[bot]
c006a6db66 fix: clearing of the backgroundColor property on TouchBarButton (#19471) 2019-07-29 14:51:13 -07:00
trop[bot]
a306fdf512 fix: emit swipe event on macOS (#19354) 2019-07-29 14:50:03 -07:00
Electron Bot
825bd6d45e Bump v6.0.0 2019-07-29 11:15:07 -07:00
Milan Burda
922a4d9ba6 fix: refactoring regression in LocationProxy (#19494) 2019-07-29 11:13:00 -07:00
Electron Bot
f20d497f1c chore: bump chromium to 76.0.3809.88 (6-0-x) (#19487)
* chore: bump chromium in DEPS to 76.0.3809.85

* chore: bump chromium in DEPS to 76.0.3809.87

* chore: bump chromium in DEPS to 76.0.3809.88
2019-07-29 10:09:43 -07:00
trop[bot]
855bd92f6e fix: use GetAuraColor to get theme dependant menu bg color (#19505) 2019-07-29 12:52:57 -04:00
trop[bot]
60d36e1b74 fix: remove .pdb from symbol file names (#19504)
* fix: remove .pdb from symbol file names

* Update dump_syms.py
2019-07-29 09:36:48 -07:00
Electron Bot
9788089efb chore: bump chromium to 76.0.3809.83 (6-0-x) (#19450)
* chore: bump chromium in DEPS to 76.0.3809.82

* chore: bump chromium in DEPS to 76.0.3809.83
2019-07-26 16:12:41 -07:00
trop[bot]
c0e9761b4b fix: activate the uv_loop on incoming IPC messages (#19467)
* fix: activate the uv_loop on incoming IPC messages

* chore: guess at a fix for process not being defined
2019-07-26 15:28:49 -07:00
trop[bot]
7e6617be18 spec: don't run codesigning spec on forks (#19433) 2019-07-26 09:33:31 -04:00
John Kleinschmidt
38b6a7bf4f build: unify YARN_VERSION variable usage and ensure CI uses yarn not npm (#19404)
* ci: Use yarn instead of npm for lint

* build: unify YARN_VERSION variable usage and ensure CI uses yarn not npm (#18607)

* build: unify YARN_VERSION variable usage and ensure CI uses yarn not npm

* chore: use a JS helper so that it can work on windows

* chore: make script/yarn without node_modules installed

(cherry picked from commit a45afddb75)
2019-07-24 14:00:43 -04:00
Electron Bot
0aec64960b chore: bump chromium to 76.0.3809.80 (6-0-x) (#19381)
* chore: bump chromium in DEPS to 76.0.3809.78

* chore: update patches

* [Mac] Create a new helper process variant for the GPU.

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

* chore: bump chromium in DEPS to 76.0.3809.80
2019-07-24 10:49:37 -07:00
Electron Bot
eab462f7cf chore: bump chromium to 76.0.3809.77 (6-0-x) (#19357)
* chore: bump chromium in DEPS to 76.0.3809.75

* chore: bump chromium in DEPS to 76.0.3809.76

* chore: bump chromium in DEPS to 76.0.3809.77
2019-07-22 13:09:29 -07:00
Electron Bot
5ccdb8c7cd Bump v6.0.0-beta.15 2019-07-19 13:42:43 -07:00
Electron Bot
dc38746b24 chore: bump chromium in DEPS to 76.0.3809.74 (#19343) 2019-07-19 13:41:16 -07:00
Electron Bot
66c2bd2a02 chore: bump chromium to 76.0.3809.73 (6-0-x) (#19324)
* chore: bump chromium in DEPS to 76.0.3809.73

* build: handle new helper apps for renderer and plugin bundles

* build: update symbol generation logic for all helpers
2019-07-18 21:43:56 -07:00
Samuel Attard
cbfd276917 fix: bootstrap the node environment after we setup the InspectorAgent (#19317) (#19332) 2019-07-18 18:12:28 -07:00
Micha Hanselmann
450a83d0f7 refactor: use NativeTheme dark mode detection on macOS 10.14+ (#19309) 2019-07-17 14:32:11 -07:00
Electron Bot
b7408e61d2 chore: bump chromium in DEPS to 76.0.3809.70 (#19304) 2019-07-17 08:21:23 -07:00
Electron Bot
9d333a72e1 Bump v6.0.0-beta.14 2019-07-17 08:19:14 -07:00
Milan Burda
c5f4fe09aa fix: don't execute preload scripts for internal <iframe> in <webview> (#19260) (#19298) 2019-07-17 08:17:57 -07:00
Samuel Attard
38f2d11c39 feat: update to node 12.4 (#19270) (#19281)
* feat: update to node 12.4 (#19270)

This points our node repo at upstream (nodejs/node) and uses the base node tag as the target ref.  We then use our existing patch system and patch files to apply our changes on top of node.  This unifies how we patch upstream repos and makes our node patches easier to reason, view, understand and most importantly reduce.

This also upgrades Electron 6 to Node 12.4

Notes: Upgraded to Node 12.4

* chore: cherry pick changes required for node 12.4 from #18924
2019-07-16 12:46:12 -07:00
Electron Bot
3c852e79e6 chore: bump chromium in DEPS to 76.0.3809.68 (#19278) 2019-07-16 07:54:42 -07:00
trop[bot]
019e60517f fix: serialize messages being sent over chrome message ports (#19252)
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 22:15:31 -07:00
trop[bot]
fb51509153 fix: <webview> not working in scriptable popups (#19218) 2019-07-16 11:40:51 +09:00
Electron Bot
f3b9f58b7f chore: bump chromium to 76.0.3809.67 (6-0-x) (#19225)
* chore: bump chromium in DEPS to 76.0.3809.64

* chore: bump chromium in DEPS to 76.0.3809.65

* chore: bump chromium in DEPS to 76.0.3809.66

* chore: bump chromium in DEPS to 76.0.3809.67
2019-07-15 14:39:48 -07:00
trop[bot]
a49307bc55 fix: exit non-silently when running as root on Linux (#19255)
* check for sandbox param on root

* add IsSandboxEnabled
2019-07-15 14:26:56 -05:00
Cheng Zhao
742292f082 fix: do not wait on promise returned by remote APIs (6-0-x) (#19190)
* fix: make <webview>.loadURL async

* docs: webview.loadURL returns Promise
2019-07-15 13:15:17 -05:00
trop[bot]
bb0f4fdbdf fix: add support for prefers-color-scheme CSS query (#19250)
The wiring to update prefs when you toggle between dark mode and light mode exists in the content layer but the actual value setting is done in either //chrome or in shell.  We need to set the preferred_color_scheme pref value in order for the CSS query to work correctly.  The DarkModeObserver in content will automatically regenerate prefs when dark mode is toggled.

Fixes #15540
2019-07-15 07:58:51 -07:00
trop[bot]
5e2ca967c9 chore: revert key -> main change in window delegate listener (#19221)
* chore: revert key -> main

* chore: comment out test that will fail

* more context on commented out test

* remove commented test
2019-07-14 10:55:36 +09:00
trop[bot]
c8029d1696 docs: specify possible values for ProcessMetric.type (#19224) 2019-07-12 17:46:41 -05:00
Electron Bot
08aa86e55e chore: bump chromium to 76.0.3809.63 (6-0-x) (#19195)
* chore: bump chromium in DEPS to 76.0.3809.62

* chore: bump chromium in DEPS to 76.0.3809.63
2019-07-11 14:05:13 -05:00
Micha Hanselmann
825c082535 chore: deprecate setHighlightMode (#19211) 2019-07-11 13:48:39 -05:00
Micha Hanselmann
4a073e4f7e refactor: improve function deprecation module (#19012) (#19199)
* add removeFunction to deprecation module

* clarify deprecate api

* throw error

* change error msg
2019-07-11 17:10:52 +09:00
Electron Bot
adffa99e05 Bump v6.0.0-beta.13 2019-07-10 11:04:56 -07:00
Alexandre Lacheze
51f03033a4 docs: precise that node integration is enabled in natively opened window if nodeIntegrationInSubFrames is true (#19142) 2019-07-10 10:37:28 -05:00
trop[bot]
733251866c fix: use binding.ipc instead of binding.sendTo which is undefined (#19106) 2019-07-10 10:35:55 -05:00
trop[bot]
41a7d9e42b ci: do not use the MOCHA_FILE env variable (#19180)
It is not used in a expected way anyway.
2019-07-10 10:35:35 -05:00
trop[bot]
ddbbf34433 remove non-existent event (#19169) 2019-07-10 10:34:27 -05:00
Milan Burda
6f65dec6a2 ci: add check for dist zip file changes (#19172) 2019-07-09 16:01:16 -05:00
Electron Bot
a66657112c chore: bump chromium in DEPS to 76.0.3809.60 (#19165) 2019-07-09 12:54:07 -07:00
Jeremy Apthorp
f5c3394930 fix: dump correct breakpad symbols on macOS (#19155) 2019-07-09 09:47:11 +09:00
Electron Bot
84bae64def chore: bump chromium to 76.0.3809.59 (6-0-x) (#19134) 2019-07-08 16:03:40 -07:00
Milan Burda
4185b93abb Revert "feat: only allow bundled preload scripts (#17308)" (#19132)
This reverts commit 8cf15cc931.
2019-07-08 11:33:54 +09:00
trop[bot]
b1e9f50fad fix: check parent-child relationship in canAccessWindow (#19118) 2019-07-05 11:20:08 -07:00
Electron Bot
6bd901d9ca chore: bump chromium to 76.0.3809.56 (6-0-x) (#19111)
* chore: bump chromium in DEPS to 76.0.3809.55

* chore: bump chromium in DEPS to 76.0.3809.56
2019-07-05 11:13:16 -07:00
trop[bot]
1c2b8f8d9a fix: handle no env in externsion world set up (#19105)
Previously when GetEnvironment returned null this extension setup
crashed.
2019-07-03 16:36:30 -07:00
Electron Bot
cb9b288d8b Bump v6.0.0-beta.12 2019-07-03 14:08:45 -07:00
Shelley Vohr
69fe33a2b1 Revert "Bump v6.0.0-beta.12"
This reverts commit 8a285f29ed.
2019-07-03 14:06:12 -07:00
Electron Bot
52b42546ed chore: bump chromium in DEPS to 76.0.3809.54 (#19095) 2019-07-03 08:36:42 -07:00
Electron Bot
8a285f29ed Bump v6.0.0-beta.12 2019-07-02 11:25:31 -07:00
Shelley Vohr
92df6cc36c fix: only check darkMode effectiveAppearance in 10.15 (#19013) 2019-07-02 11:04:30 -07:00
Electron Bot
ab91656148 chore: bump chromium in DEPS to 76.0.3809.52 (#19079) 2019-07-02 10:44:16 -07:00
Electron Bot
1fb1e5b2b2 Revert "Bump v6.0.0-beta.12"
This reverts commit 54908b56e5.
2019-07-02 10:17:31 -07:00
Electron Bot
54908b56e5 Bump v6.0.0-beta.12 2019-07-02 10:11:38 -07:00
Shelley Vohr
48bc247ef7 fix: silent printing mode (#19037) 2019-07-02 10:03:00 -07:00
trop[bot]
19d9955125 fix: Correct modal focus behavior on macOS (#19062)
* wip: wish i could hack the main window focus away

* main -> key

* remove useless code

* test: Add focus event spec

* test: more robust spec

* test: simplify test

* duplicate non-firing macOS event listener 😳

* destroy 🚨
2019-07-01 16:39:45 -07:00
Electron Bot
24d79d9e5c chore: bump chromium in DEPS to 76.0.3809.51 (#19057) 2019-07-01 12:14:15 -07:00
Electron Bot
27d0a4d33d chore: bump chromium in DEPS to 76.0.3809.50 (#19054) 2019-06-30 21:38:51 -07:00
Electron Bot
48226f71ad chore: bump chromium to 76.0.3809.49 (6-0-x) (#19030)
* chore: bump chromium in DEPS to 76.0.3809.48

* chore: bump chromium in DEPS to 76.0.3809.49
2019-06-29 18:46:41 -07:00
Shelley Vohr
a4acc16e10 fix: make tray not block main process (#18880) (#18969)
* fix: make tray not block main process

* make AtomMenuModel refcounted
2019-06-28 14:10:45 -05:00
trop[bot]
d8dd94e3a3 fix: delay emitting screen events by a tick to avoid re-entrancy crash (#19022) 2019-06-28 16:23:19 +09:00
Electron Bot
eb48dcf0a3 chore: bump chromium in DEPS to 76.0.3809.47 (#19010) 2019-06-27 16:34:00 -07:00
Samuel Attard
adfe537e32 docs: fix heading level for power-monitor docs (#19015) 2019-06-27 13:21:09 -07:00
Electron Bot
0d5d54cbae chore: bump chromium in DEPS to 76.0.3809.45 (#18991) 2019-06-26 08:47:25 -07:00
Electron Bot
988ad92415 chore: bump chromium in DEPS to 76.0.3809.43 (#18974) 2019-06-25 23:57:02 -07:00
Electron Bot
5dbcdbc3d8 Bump v6.0.0-beta.11 2019-06-25 14:13:13 -07:00
trop[bot]
212c6b1266 fix: override the timers module impls to activate the uv loop (#18961) 2019-06-24 14:22:57 -07:00
trop[bot]
74b06ab677 fix: make isDarkMode correctly detect dark mode in the auto setting on catalina (#18958) 2019-06-24 13:27:35 -07:00
Electron Bot
9a1c952ab6 chore: bump chromium to 76.0.3809.42 (6-0-x) (#18919)
* chore: bump chromium in DEPS to 76.0.3809.38

* chore: bump chromium in DEPS to 76.0.3809.39

* chore: bump chromium in DEPS to 76.0.3809.40

* chore: bump chromium in DEPS to 76.0.3809.42
2019-06-24 15:15:27 -04:00
Electron Bot
f36f90b60f Bump v6.0.0-beta.10 2019-06-21 15:05:57 -07:00
Micha Hanselmann
a603a4dde8 fix: sanitize invalid custom protocol headers (#18927)
* fix: sanitize invalid custom protocol headers (#18854)

* lint fix
2019-06-21 15:00:05 -07:00
trop[bot]
3e033b4f27 chore: account for remotes in branch parsing (#18931) 2019-06-21 14:03:40 -07:00
trop[bot]
03be4c67d5 fix: delay handling occlusion events to avoid flicker on macOS (#18885)
* chore: add debounce on the updateWebContentsVisibility method to ensure quick changes in occlusion do not result in flickering

* chore: update old patch headers

* chore: update patches for E6 without host refactor
2019-06-21 09:20:08 -07:00
John Kleinschmidt
b20fe76db7 chore: use manual invocation of npx yarn (#18902)
* chore: Revert "build: use yarn to install arm modules (#18802)"

This reverts commit 97bec607fe.
script/yarn.js doesn't exist in 5-0-x or 6-0-x

* chore: use manual invocation of npx yarn
2019-06-21 08:57:05 -07:00
trop[bot]
503da640f7 fix: app.getAppPath() returning default-app path for files or directories without package.json (#18888) 2019-06-21 08:54:21 -07:00
trop[bot]
bd48dfe3cc chore: fix branch trimming for blast-off releases (#18909) 2019-06-21 01:02:54 -07:00
Jeremy Apthorp
9b47f587a6 fix: bundle swiftshader and ANGLE libraries on mac (#18904) 2019-06-20 11:12:02 -07:00
trop[bot]
3a186dad5d refactor: session.{clearCache,getCacheSize} nws13n (#18897) 2019-06-20 10:11:13 -07:00
Electron Bot
7959f2e887 chore: bump chromium to 76.0.3809.37 (6-0-x) (#18828)
* chore: bump chromium in DEPS to 76.0.3809.32

* chore: bump chromium in DEPS to 76.0.3809.33

* chore: update patches

* chore: bump chromium in DEPS to 76.0.3809.37

* chore: fix render_view_host_view_base.patch
2019-06-20 09:58:56 -07:00
trop[bot]
4868c95425 fix: building with enable_run_as_node disabled (#18892) 2019-06-19 23:48:04 -07:00
Samuel Attard
7fa41e3302 chore: roll node to fix http2 memory leak (#18882) 2019-06-19 12:33:05 -07:00
Electron Bot
f3346437be Bump v6.0.0-beta.9 2019-06-18 13:21:18 -07:00
Shelley Vohr
6de6d7f6c0 docs: add example on handling the webPrefs change (#18856)
* docs: add example on handling the webPrefs change

Fixes #17967

* Update breaking-changes.md
2019-06-18 10:35:27 -07:00
Shelley Vohr
eb15be06e3 fix: use is_valid for cookie url validation (#18770) (#18843)
Use is_valid instead of is_empty to validate url on cookies.set().
2019-06-18 09:53:10 -07:00
trop[bot]
7748decc60 chore: fix current branch fetch on master (#18862) 2019-06-18 08:34:50 -07:00
Shelley Vohr
d75750ab01 fix: use effectiveAppearance to check dark mode on mojave and above (#18666) (#18845)
* fix: use effectiveAppearance to check dark mode on mojave and above

* chore: add forward declarations for dark appearance
2019-06-17 15:54:31 -07:00
Shelley Vohr
152781226e fix: callback values for printing cancellation and success (#18803) 2019-06-17 11:33:30 -07:00
trop[bot]
7e3bbb6ace build: get current release branch from commit (#18833)
* chore: get current release branch from commit

* love too lint
2019-06-17 07:54:17 -07:00
Shelley Vohr
3c3eb2f65d docs: better explain supported release line levels (#18800) (#18838) 2019-06-17 07:53:24 -07:00
trop[bot]
5a83d9e64d feat: provide the frame URL with permission requests and checks (#18772)
* feat: provide the frame URL with permission requests and checks

Also provides a handy isMainFrame property to determine if it is an
iframe making the request

* chore: refactor to use base::Value

* chore: use Set<Type>Key over SetPath

* chore: fix lint
2019-06-15 16:26:21 +09:00
trop[bot]
97bec607fe build: use yarn to install arm modules (#18802) 2019-06-15 16:16:13 +09:00
trop[bot]
b56ca98b72 docs: add specific options for MenuItem.role (#18807) 2019-06-14 23:29:34 -07:00
Electron Bot
eeccdc2d5c Bump v6.0.0-beta.8 2019-06-14 09:22:25 -07:00
Milan Burda
47827ed45c fix: crash in BrowserWindow destructor after win.webContents.destroy() (#18686) (#18793) 2019-06-14 09:18:38 -07:00
Cheng Zhao
d3f7bdd0b3 fix: use crashpad on Windows (#18483) (#18766) 2019-06-13 18:51:56 -07:00
trop[bot]
438c50bf14 docs: fully document MenuItem instance properties (#18784)
* document menuItem instance properties

* correct some types

* add correct click documentation
2019-06-13 18:45:05 -07:00
trop[bot]
33d860bcea fix: reject the executeJavaScript promise when it fails to execute the script (#18714)
* fix: reject the executeJavaScript promise when it fails to execute the script

Closes #9102

* Update atom/renderer/api/atom_api_web_frame.cc

Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>

* Update atom/renderer/api/atom_api_web_frame.cc

Co-Authored-By: Jeremy Apthorp <nornagon@nornagon.net>

* fix: missing semicolon
2019-06-13 16:13:06 -07:00
trop[bot]
2401a2afe9 fix: HTML fullscreen request for sub frames (#18775)
Don't re-enter fullscreen if there is a pending operation,
for subframe fullscreen request `EnterFullScreenModeForTab`
will be called for both the frame in question as well as
the outer webContents hosting it.
2019-06-13 15:23:43 -07:00
Electron Bot
852f0be0b2 chore: bump chromium in DEPS to 76.0.3809.26 (#18768) 2019-06-13 13:47:13 -07:00
Samuel Attard
18ec438eaf feat: Add option to conditionally disable site instance patches (#18554)
* feat: Add option to conditionally disable site instance patches (#18396)

* chore: allow conditional disable of the site instance override patches at runtime

* feat: add app.allowRendererProcessReuse property to allow runtime disable of site instance overrides

spec: add tests for the new allowRendererProcessReuse property

feat: add console warnings / errors for loading non context-aware native modules
  * Only error if the patch is disabled
  * Warn all the time, this will ship in Electron 7

* chore: do not warn in about context aware in v6

* chore: update patches
2019-06-13 10:23:02 -07:00
trop[bot]
f7042c8d1b fix: correct isDownloadable docs to match impl (#18747) 2019-06-12 14:16:50 -07:00
Electron Bot
bc73f93e6c chore: bump chromium in DEPS to 76.0.3809.23 (#18742) 2019-06-12 13:21:35 -07:00
trop[bot]
7091508678 fix: remove lingering data when notifications autodismiss on Windows 7 (#18740) 2019-06-12 21:43:30 +09:00
Alexandre Lacheze
6d9d66b88a fix: lost window.opener after cross-origin navigation (#18624)
* SiteInstance::CreateRelatedSiteInstance and use it

* Introduce and use a NetworkSandbox and introduce a test for window.opener on x-site navigation
2019-06-11 14:34:52 -07:00
Electron Bot
fc35b0f1be Bump v6.0.0-beta.7 2019-06-11 12:59:05 -07:00
Electron Bot
17f86b1223 chore: bump chromium in DEPS to 76.0.3809.22 (#18730) 2019-06-11 10:25:24 -07:00
Samuel Attard
271531f5ff fix: modify new promise object for dialog methods to match old callback api (#18724)
This was an unexpected and undocumented breaking change, the deprecated
callback method should have the same signature it used to have.
2019-06-11 10:24:36 -07:00
Jeremy Spiegel
9ef83cd8a0 fix: properly pass openExternal activate option (#18722)
A reference to an OpenExternalOptions structure was being captured by an Objective-C block that
outlived the object that was being referenced.
2019-06-11 10:23:48 -07:00
trop[bot]
f33517dfa7 chore: fix logging to stderr (#18717) 2019-06-10 15:34:18 -07:00
Electron Bot
c69f5d9366 chore: bump chromium to 76.0.3809.20 (6-0-x) (#18684) 2019-06-10 11:42:32 -07:00
Milan Burda
7902c3ced4 fix: set nativeWindowOpen when sandboxed (#18273) (#18556) 2019-06-07 19:08:16 -07:00
trop[bot]
21f033474d fix: use isEqual instead of pointer equality to convert NSAppearance (#18690) 2019-06-07 11:32:25 -07:00
Electron Bot
549ac1ed48 chore: bump chromium in DEPS to 76.0.3809.13 (#18669) 2019-06-06 12:57:19 -07:00
Electron Bot
2dd8d1f150 chore: bump chromium in DEPS to 76.0.3809.12 (#18662) 2019-06-05 19:33:58 -07:00
Electron Bot
26ee461c32 chore: bump chromium in DEPS to 76.0.3809.10 (#18647) 2019-06-05 15:40:41 -07:00
trop[bot]
9905a4c328 ci: fix issues downloading from CircleCI (#18654)
Make sure we pass along token to download from CircleCI
Also, add back off period for retries on downloads.
2019-06-05 10:54:58 -07:00
Richard Townsend
09a22143d6 build: bring in a later compiler for Windows on Arm (#18625)
* build: allow pulling in a later version of Clang

Due to a code-generation defect related to virtual method thunks in the
official compiler used for Chromium M76, it's necessary to build for WoA
with a later version of Clang. When running gclient sync, setting
ELECTRON_BUILD_WOA=1 in the environment will download a corrected
compiler which doesn't have this defect.

* docs: add a note about building for Windows on Arm
2019-06-05 11:18:44 -04:00
Electron Bot
81e8f5c6c2 chore: bump chromium to 76.0.3809.6 (6-0-x) (#18573)
* chore: bump chromium in DEPS to 76.0.3809.4

* chore: bump chromium in DEPS to 76.0.3809.5

* chore: bump chromium in DEPS to 76.0.3809.6
2019-06-04 15:52:34 -07:00
Electron Bot
3c322b7349 Bump v6.0.0-beta.6 2019-06-04 14:52:22 -07:00
Milan Burda
b2ea1bc517 fix: don't export private V8 symbols that can cause native node modules to crash (#18281) (#18619) 2019-06-04 10:09:07 -05:00
trop[bot]
16250493b8 build: move Windows release builds to AppVeyor cloud (#18603)
* build: move Windows release builds to AppVeyor cloud

* Use new env variable for AppVeyor cloud server
2019-06-04 10:30:31 -04:00
trop[bot]
08887e016c doc: change pyobjc link in macos build instruction (#18616) 2019-06-03 22:03:06 -07:00
trop[bot]
aadcce0907 docs: Fix incorrect dialog docs (#18606)
* docs: Fix incorrect dialog docs

We had multiple definitions for `showSaveDialog`.

* docs: Update, take two
2019-06-03 15:04:26 -07:00
trop[bot]
9b5353309d build: strip swiftshader binaries (#18600) 2019-06-03 14:32:18 -07:00
trop[bot]
76303502a6 build: install python-dbusmock via pip for a Docker container (#18597)
* build: use python-dbusmock v0.18.1 on Linux

To prevent timeout errors with some other python-dbusmock versions.

* Don't use a fixed version of python-dbusmock

Co-Authored-By: John Kleinschmidt <jkleinsc@github.com>
2019-06-03 17:20:55 -04:00
Milan Burda
cf07904338 build: remove Vulkan mock ICD (#18596) 2019-06-03 17:18:33 -04:00
trop[bot]
8f1e28b59c fix: don't package mojom{,-lite}.js files in dist.zip (#18486) 2019-06-03 11:44:30 -07:00
Electron Bot
10d0268070 chore: bump chromium to 76.0.3809.3 (6-0-x) (#18504)
* chore: bump chromium in DEPS to 76.0.3807.2

* chore: update patches

* fix: Don't leak system network context when nw service is disabled

https://chromium-review.googlesource.com/c/chromium/src/+/1632494
NetworkService is now deleted by using SequnceLocalStorageSlot
on the IO thread when the service is disabled, which expects
all associated NetworkContexts on that sequence to be destroyed.

* chore: bump chromium in DEPS to 76.0.3808.1

* fix: Destroy all network contexts before primary network context

* chore: update patches

* Simplify out-of-process service registration

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

* [ThreadPool] Rename base::ThreadPool to base::ThreadPoolInstance

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

* fix: -Winconsistent-missing-override warnings

* chore: bump chromium in DEPS to 76.0.3809.1

* chore: update patches

* Change CreateBrowserMainParts to return unique_ptrs

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

* chore: bump chromium in DEPS to 76.0.3809.3
2019-06-01 13:19:00 -04:00
trop[bot]
7871e18232 fix: handle gzipped chrome WebUI resources (#18552)
Fixes: #18503
Refs: https://chromium-review.googlesource.com/c/chromium/src/+/1576232

For whatever reason Chromium made this change and then made the default
//content behavior to return false for all IsDataResourceGzipped
requests.  This PR updates our ContentClient impl to return the correct
values.

Notes: Fixed issues where some `chrome://*` URLs would not render
correctly
2019-05-31 15:47:42 -07:00
trop[bot]
ceb3792f3c fix: contractions handling in spellchecker (#18538) 2019-05-31 10:52:18 -07:00
trop[bot]
65a4bdd87a ci: add retries to downloads for arm testing (#18535) 2019-05-30 21:08:44 -07:00
trop[bot]
7094870a44 docs: specify use case for the 'services' role (#18528)
* docs: specify use case for the 'services' role

* update based on @caesar's recommendation

Co-Authored-By: Caesar Schinas <caesar@caesarschinas.com>
2019-05-30 15:15:16 -07:00
trop[bot]
cee99b5f2d fix: reverse dialog cancel bool for openDialog (#18509) 2019-05-30 15:32:08 -04:00
Electron Bot
ac86d362ba Bump v6.0.0-beta.5 2019-05-29 08:10:59 -07:00
Shelley Vohr
2233a9eb5a Revert "Bump v6.0.0-beta.5"
This reverts commit 80fa2449a1.
2019-05-28 20:18:02 -07:00
Shelley Vohr
af24a4f364 build: fix breakpad symbol generation on linux arm (#18491) 2019-05-28 20:17:37 -07:00
trop[bot]
a78692f5b8 fix: create missing directories with app.setPath (#18480) 2019-05-28 19:30:49 -07:00
trop[bot]
335178098d fix: ensure the webContents is not destroyed before communicating (#18487) 2019-05-28 19:30:32 -07:00
trop[bot]
ddc0e8f7ba chore: remove leftover docs/api/structures/memory-info.md (#18430) 2019-05-28 14:20:46 -07:00
Electron Bot
80fa2449a1 Bump v6.0.0-beta.5 2019-05-28 13:31:35 -07:00
Shelley Vohr
476abafefe fix: respect minimizable/closable for customButtonsOnHover (#18478) 2019-05-28 13:29:43 -07:00
Felix Rieseberg
f7d4d51261 feat: Backport setting of global fallback user agent (#18473) 2019-05-28 12:25:07 -07:00
Electron Bot
7b08510075 chore: bump chromium to 76.0.3805.4 (6-0-x) (#18439)
* chore: bump chromium in DEPS to 76.0.3804.1

* chore: update patches

* chore: update v8 patches

* chore: bump chromium in DEPS to 76.0.3805.1

* chore: bump chromium in DEPS to 76.0.3805.2

* chore: bump chromium in DEPS to 76.0.3805.3

* chore: update patches

* 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 76.0.3805.4
2019-05-28 11:29:10 -07:00
Jeremy Apthorp
14b62b28ce Merge pull request #18327 from electron/roller/chromium/6-0-x
chore: bump chromium to 76.0.3803.1 (6-0-x)
2019-05-23 17:08:56 -07:00
Jeremy Apthorp
1c44ed0912 Replace views_bridge_mac with remote_cocoa
https://chromium-review.googlesource.com/c/chromium/src/+/1623573
2019-05-23 15:00:02 -07:00
Jeremy Apthorp
de1edf3f4d Update function signatures for focused element change notifications
https://chromium-review.googlesource.com/c/chromium/src/+/1609749
2019-05-23 13:47:49 -07:00
deepak1556
a21ffa027a chore: update patches 2019-05-23 12:46:44 -07:00
Nitish Sakhawalkar
899d42563c Chrome changed the devtools url
chrome-devtools:// to devtools://
28b21a67f0
2019-05-23 12:36:16 -07:00
Electron Bot
6eecbb5edd chore: bump chromium in DEPS to 76.0.3803.1 2019-05-23 12:36:16 -07:00
Nitish Sakhawalkar
6a8e7a10ea Update views visible API
visible() -> GetVisible() as per c9ecec130e
2019-05-23 12:36:16 -07:00
Nitish Sakhawalkar
85bb488732 Update linux/win menu_bar.h
Chromium Commit 6a2f2686a9
2019-05-23 12:36:16 -07:00
Jeremy Apthorp
c957215854 pin user32 on startup
https://chromium-review.googlesource.com/c/chromium/src/+/1551709

Loading it later causes a blocking call where blocking calls aren't allowed.
2019-05-23 12:36:16 -07:00
Nitish Sakhawalkar
2ba3a26785 Disable custom libcxx patch 2019-05-23 12:36:16 -07:00
Jeremy Apthorp
f0dc3bc79f Manual follow-up rename in comments and variable names.
https://chromium-review.googlesource.com/c/chromium/src/+/1591429
2019-05-23 12:36:16 -07:00
Nitish Sakhawalkar
28d3edcd92 Update gpuinfo enumerator api
Related chromium change is here => 4178e190e9
2019-05-23 12:36:16 -07:00
Jeremy Apthorp
8026dee591 storage::IsolatedContext API changed
https://chromium-review.googlesource.com/c/chromium/src/+/1603486
2019-05-23 12:36:16 -07:00
Jeremy Apthorp
197cda9e45 GetNetCaptureModeFromCommandLine moved to net
https://chromium-review.googlesource.com/c/chromium/src/+/1614697
2019-05-23 12:36:16 -07:00
Jeremy Apthorp
903fd4e5e9 use base::Owned instead of base::Passed for repeating handler 2019-05-23 12:36:16 -07:00
Jeremy Apthorp
621c86b4cf Convert Callbacks to OnceCallbacks in permissions APIs.
https://chromium-review.googlesource.com/c/chromium/src/+/1592356
2019-05-23 12:36:16 -07:00
Nitish Sakhawalkar
deda7c700f Update for changed APIs
Update AllowCertificateError API (c5b8df91d1)
2019-05-23 12:36:15 -07:00
Jeremy Apthorp
d225304370 use unique_ptr instead of shared_ptr for SpellcheckRequest 2019-05-23 12:36:15 -07:00
Nitish Sakhawalkar
fd22b7ec2a Update Spellcheck API
Update WebTexhCheckingCompletion as per chromium 0e8c828e02
2019-05-23 12:36:15 -07:00
Nitish Sakhawalkar
a2b1d394b5 Update changed APIs/deps
Use brotli by default (36d58dd325)

Update Mac ui headers (897636c9f8)

Update AtomBrowserClient::HandleExternalProtocol API (cb656e1fd1)
2019-05-23 12:36:15 -07:00
Jeremy Apthorp
7d4c78e73e DelegatedFrameHost API changed
https://chromium-review.googlesource.com/c/chromium/src/+/1594924
2019-05-23 12:36:15 -07:00
Jeremy Apthorp
b37ff2b822 //ui/views_bridge_mac => //components/remote_cocoa/app_shim
https://chromium-review.googlesource.com/c/chromium/src/+/1590958
2019-05-23 12:36:15 -07:00
deepak1556
5887f5aa4f Move snapshot_toolchain.gni to gni/
https://chromium-review.googlesource.com/c/v8/v8/+/1612903
2019-05-23 12:36:15 -07:00
deepak1556
a9176a2ac8 chore: update patches 2019-05-23 12:36:15 -07:00
Electron Bot
6ceb431942 chore: bump chromium in DEPS to 76.0.3802.1 2019-05-23 12:36:15 -07:00
Electron Bot
508d131c95 chore: bump chromium in DEPS to 76.0.3801.1 2019-05-23 12:36:15 -07:00
Electron Bot
ae36659f7a chore: bump chromium in DEPS to 76.0.3800.1 2019-05-23 12:36:15 -07:00
Electron Bot
f970660766 chore: bump chromium in DEPS to 76.0.3799.1 2019-05-23 12:36:15 -07:00
Electron Bot
43c5837cda chore: bump chromium in DEPS to 76.0.3798.1 2019-05-23 12:36:15 -07:00
Electron Bot
a87e88df20 chore: bump chromium in DEPS to 76.0.3797.1 2019-05-23 12:36:15 -07:00
Electron Bot
5a5d4b06b3 chore: bump chromium in DEPS to 76.0.3796.1 2019-05-23 12:36:15 -07:00
trop[bot]
28ba88ba70 docs: rename 'API Contract' as 'Breaking Changes' (#18399)
* Use "Breaking Changes" as the changes doc's title.

Multiple people have commented that this important page is difficult
to find, in part because people search for "Breaking" or "Changes" or
"Breaking Changes" rather than "API Contract".

This PR changes the name to "Breaking Changes" so that it'll show up
on electronjs.org/docs/.

It also adds a backwards-friendly link so people still searching for
"API Contract" will get a redirect. I'm not sure if this is necessary --
the actual URL of https://electronjs.org/docs/api/breaking-changes is
unchanged -- would especially welcome feedback on this part.

* fixup! Use "Breaking Changes" as the changes doc's title.

* fixup! Use "Breaking Changes" as the changes doc's title.
2019-05-23 15:02:16 -04:00
trop[bot]
4f8ffe934e docs: clarify that 'second-instance' is only emitted when the second instance calls app.requestSingleInstanceLock() (#18385) 2019-05-21 16:25:50 -05:00
Electron Bot
c5c0a7abc5 Bump v6.0.0-beta.4 2019-05-21 11:28:46 -07:00
trop[bot]
84b762f0b3 fix: reverse saveDialog cancellation bool (#18383) 2019-05-21 13:09:35 -05:00
trop[bot]
043838f9b6 fix: set window to null when no window is passed (#18381)
Fixes #18236.

Our options parsing for dialogs correctly set options if no window was passed, but then did not correctly set the window back to null and it was then left as an object equal to options. This caused a crash when passed to native code as there is no valid circumstance where the window would be an object.
2019-05-21 08:34:40 -07:00
trop[bot]
a824e92628 fix: 'page-title-updated' event forwarding + documentation (#18319) 2019-05-21 16:21:50 +09:00
Samuel Attard
1843411e79 fix: update the FileSelectHelper to support the new promise API (#18288) (#18341)
* fix: update the FileSelectHelper to support the new promise API

Fixes #18254

So it turns out we've successfully introduced a way to write
non-typesafe C++.

This fixes two things:
* Uses the object the promise resolves
* Ensures we attach the Then handler before moving the promise

* fix: also fix misuse of Promise::Then in the download manager
2019-05-21 15:52:48 +09:00
trop[bot]
da76c4d7c5 fix: leave space for autohide taskbar for frameless maximized window (#18373) 2019-05-21 15:35:39 +09:00
trop[bot]
4468b86a81 feat: allow setting working directory in app.setUserTasks() / app.setJumpList() (#18291) 2019-05-16 09:13:30 -04:00
Electron Bot
8acbb9a3ad Bump v6.0.0-beta.3 2019-05-14 12:10:18 -07:00
trop[bot]
f5e28bc999 fix: default enable_negotiate_port to false (#18285) 2019-05-14 12:51:41 -05:00
trop[bot]
b45ad7f74e fix: destroy tray on current tick (#18218)
* fix: destroy tray on current tick

* test: add tray destroy specs

* use more idiomatic destructor syntax
2019-05-09 14:42:34 -04:00
trop[bot]
9e9238454e build: linux needs java on GN (#18217) 2019-05-09 11:05:33 -04:00
Electron Bot
3f2aba69ee Bump v6.0.0-beta.2 2019-05-07 19:51:34 -07:00
Shelley Vohr
371e804c6b Revert "Bump v6.0.0-beta.2"
This reverts commit c54b67300e.
2019-05-07 19:49:30 -07:00
trop[bot]
6131e89aa9 build: remove deprecated octokit auth calls (#18206) 2019-05-07 19:48:34 -07:00
Electron Bot
c54b67300e Bump v6.0.0-beta.2 2019-05-07 15:41:03 -07:00
John Kleinschmidt
e847f048d7 build: only delete .git directory on Mac builds (#18200) 2019-05-07 15:39:43 -07:00
Shelley Vohr
b5955fa663 Revert "Bump v6.0.0-beta.2"
This reverts commit a648e6c06d.
2019-05-07 15:00:14 -07:00
Electron Bot
a648e6c06d Bump v6.0.0-beta.2 2019-05-07 12:43:19 -07:00
Nitish Sakhawalkar
e6216da031 chore: Add patch to partially revert chromium crashpad change (#18198)
This adds a patch to support functionality that we were using but chromium changed it. Electron uses breakpad on windows, chromium uses crashpad (which is newer). So this patch is needed until we update electron to use crashpad for windows.
2019-05-07 12:35:10 -07:00
Jeremy Apthorp
5b7bd56367 chore: deprecate the 'options' argument to clearAuthCache (#18131)
The network service APIs do not support the fine-grained clearing of the auth cache. In preparation for switching to the network service in 7.x, log a warning that the options argument is deprecated. Ref #17970.

This might not be quite right as we could also potentially expose the new options that are available: namely, start and end time. #17970 does not expose those options, but it would in theory be possible to support them with the existing network service APIs. The current options object does not offer time-based cache clearing.
2019-05-07 09:55:15 -07:00
trop[bot]
01b1c0ca8b fix: crash on systemPreferences.getAccentColor() (#18195) 2019-05-07 09:51:36 -07:00
Shelley Vohr
05ced19f9f chore: deprecate shell.openExternalSync (#18179) 2019-05-07 08:19:52 -07:00
trop[bot]
b8ef669905 refactor: allow embedder overriding of internal FS calls (#17906) (#18192) 2019-05-07 08:00:40 -07:00
trop[bot]
212ce1840f docs: clarify clipboard type options (#18175) 2019-05-06 09:29:42 -07:00
trop[bot]
e090fa94d0 fix: do not mark navigations interupted with same-document navigations as aborted (#18143)
* fix: do not mark navigations interupted with same-document navigations as aborted

* spec: add tests for the loadURL promise
2019-05-03 23:08:57 -07:00
trop[bot]
a431f1a663 fix: correctly parse default_app path on windows (#18102) 2019-05-03 08:16:57 -07:00
trop[bot]
ea6815c0f7 fix: fs.promises does not work with asar paths (#18114) 2019-05-02 22:34:19 -07:00
Electron Bot
40e05eef23 chore: bump chromium to 76.0.3783.1 (6-0-x) (#18116) 2019-05-02 16:31:29 -07:00
trop[bot]
a790e702f5 build: free up space before running macos ci (#18099)
* build: free up space before running macos ci

* build: also delete 14GB of src/.git for bonus space
2019-05-01 13:48:25 -07:00
trop[bot]
be16a195fb fix: ensure the inspector agent is shutdown before cleaning up the node env (#18077)
* fix: ensure the inspector agent is shutdown before cleaning up the node env

* spec: add tests to ensure clean shutdown with connected inspector agent

* Update node_debugger.cc
2019-05-01 13:47:22 -07:00
trop[bot]
2f10c0fd6d docs: fix webContents 'new-window' event handler sample (#18098) 2019-05-01 13:44:47 -07:00
trop[bot]
276c07d3d7 docs: remove incorrectly added let for the win variable (#18095) 2019-05-01 12:41:59 -07:00
Samuel Attard
57f7c8b6b9 build: ensure consistent lock files across multiple machines (#17955) (#18071)
* build: ensure consistent package-lock across multiple machines

* build: fix linting errors and use npm ci instead of npm install

* build: use a yarn.lock and yarn instead of package-lock and npm

* chore: replace package-lock.json files with yarn.lock

* chore: replace last instance of `npm install`
2019-05-01 11:11:52 -07:00
trop[bot]
2ce22ba0e9 fix: explicitly focus window on win.show() (#18081) 2019-05-01 10:44:30 -07:00
Electron Bot
7186c62a27 Bump v6.0.0-beta.1 2019-04-30 14:46:01 -07:00
Electron Bot
bf88a13f1e Revert "Bump v6.0.0-beta.1"
This reverts commit 6e9c540baf.
2019-04-30 13:16:51 -07:00
Electron Bot
6e9c540baf Bump v6.0.0-beta.1 2019-04-30 13:11:22 -07:00
Electron Bot
24b14d55ef Revert "Bump v6.0.0-beta.1"
This reverts commit 3b8eb6c061.
2019-04-30 13:09:29 -07:00
Electron Bot
3b8eb6c061 Bump v6.0.0-beta.1 2019-04-30 13:04:14 -07:00
Electron Bot
f9b7f6389e Revert "Bump v6.0.0-beta.1"
This reverts commit 8f30faacf8.
2019-04-30 13:02:36 -07:00
Electron Bot
8f30faacf8 Bump v6.0.0-beta.1 2019-04-30 12:59:08 -07:00
trop[bot]
f631890237 chore: disable Vulkan validation layers (#18062) 2019-04-30 12:49:43 -07:00
trop[bot]
8982889a8d build: fix issues for stable release we fixed in 5-0-x (#18068)
* build: fix release notes generation

* build: fix bump-version script for stable releases
2019-04-30 12:49:25 -07:00
trop[bot]
cd3539aaf8 refactor: rewire the desktop capturer API to remove race conditions (#18042)
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-30 07:07:56 -07:00
Samuel Attard
275e277721 feat: upgrade to Node 12 (#17838) (#18044)
* 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-29 15:52:31 -07:00
trop[bot]
283b1241d5 docs: Correct doc for registerFileProtocol (#18050)
In the registerFileProtocol docs the "headers" argument of the callback was described as being a list.
In fact is has to be an Object mapping header-entries to values. This can be seen in Line 326 of `/spec/api-protocol-spec.js` [fe618631f1/spec/api-protocol-spec.js (L326)].
2019-04-29 15:30:34 -07:00
trop[bot]
7bdea26085 docs: update nodeIntegration section for new defaults (#18047)
* docs: update nodeIntegration section for new defaults

* docs: update docs/tutorial/first-app.md

* Update docs/tutorial/security.md

Co-Authored-By: miniak <milan.burda@gmail.com>
2019-04-29 15:18:23 -07:00
Samuel Attard
f1fa589779 chore: upgrade chromium to 76 (#17921) 2019-04-29 12:48:28 -07:00
trop[bot]
7226ad1eba fix: crash when failed to get devices in desktopCapturer (#17973)
* fix: crash when failed to get devices in desktopCapturer

* return after emit
2019-04-26 08:05:12 -07:00
trop[bot]
d92743f0f3 docs: remove outdated refs to protocol.registerStandardSchemes (#17977) 2019-04-26 08:05:03 -07:00
trop[bot]
2c309efef4 docs: add azure vm spinup tutorial (#17975) 2019-04-25 15:49:21 -07:00
trop[bot]
0b418315a3 docs: clean up the native module tutorial (#17951) 2019-04-24 11:25:34 -07:00
trop[bot]
2f474867c7 fix: permission handler regression in default app (#17950) 2019-04-24 11:25:17 -07:00
trop[bot]
0b5acd9569 refactor: add missing constants for options (#17919) 2019-04-24 10:16:53 -07:00
Jeremy Apthorp
3419c3c730 chore: bump chromium to 75.0.3770.3 (#17883) 2019-04-23 14:29:16 -07:00
trop[bot]
754200f1b1 fix: crash when run from SMB network share (#17909) 2019-04-23 09:03:51 -07:00
Samuel Attard
37f4bd4dd0 build: reset version to 6.0.0-beta.0 in prep for 6.0.0-beta.1 2019-04-19 15:35:46 -07:00
559 changed files with 28945 additions and 19640 deletions

View File

@@ -35,6 +35,7 @@ env-debug-build: &env-debug-build
env-testing-build: &env-testing-build
GN_CONFIG: //electron/build/args/testing.gn
CHECK_DIST_MANIFEST: '1'
env-release-build: &env-release-build
GN_CONFIG: //electron/build/args/release.gn
@@ -90,13 +91,19 @@ env-linux-medium: &env-linux-medium
NUMBER_OF_NINJA_PROCESSES: 3
env-linux-2xlarge: &env-linux-2xlarge
NUMBER_OF_NINJA_PROCESSES: 18
NUMBER_OF_NINJA_PROCESSES: 34
env-linux-2xlarge-release: &env-linux-2xlarge-release
NUMBER_OF_NINJA_PROCESSES: 16
env-machine-mac: &env-machine-mac
NUMBER_OF_NINJA_PROCESSES: 6
env-mac-large: &env-mac-large
NUMBER_OF_NINJA_PROCESSES: 10
NUMBER_OF_NINJA_PROCESSES: 18
env-mac-large-release: &env-mac-large-release
NUMBER_OF_NINJA_PROCESSES: 8
env-disable-crash-reporter-tests: &env-disable-crash-reporter-tests
DISABLE_CRASH_REPORTER_TESTS: true
@@ -164,7 +171,7 @@ step-setup-env-for-build: &step-setup-env-for-build
echo 'export SCCACHE_PATH="'"$SCCACHE_PATH"'"' >> $BASH_ENV
if [ "$CIRCLE_PR_NUMBER" != "" ]; then
#if building a fork set readonly access to sccache
echo 'export SCCACHE_BUCKET="electronjs-sccache"' >> $BASH_ENV
echo 'export SCCACHE_BUCKET="electronjs-sccache-ci"' >> $BASH_ENV
echo 'export SCCACHE_TWO_TIER=true' >> $BASH_ENV
fi
fi
@@ -176,17 +183,33 @@ step-restore-brew-cache: &step-restore-brew-cache
keys:
- v1-brew-cache-{{ arch }}
# On macOS the npm install command during gclient sync was run on a linux
step-get-more-space-on-mac: &step-get-more-space-on-mac
run:
name: Free up space on MacOS
command: |
if [ "`uname`" == "Darwin" ]; then
sudo rm -rf /Library/Developer/CoreSimulator
fi
step-delete-git-directories: &step-delete-git-directories
run:
name: Delete src/.git directory on MacOS to free space
command: |
if [ "`uname`" == "Darwin" ]; then
sudo rm -rf src/.git
fi
# On macOS the yarn install command during gclient sync was run on a linux
# machine and therefore installed a slightly different set of dependencies
# Notably "fsevents" is a macOS only dependency, we rerun npm install once
# Notably "fsevents" is a macOS only dependency, we rerun yarn install once
# we are on a macOS machine to get the correct state
step-install-npm-deps-on-mac: &step-install-npm-deps-on-mac
run:
name: Install NPM Dependencies on MacOS
name: Install node_modules on MacOS
command: |
if [ "`uname`" == "Darwin" ]; then
cd src/electron
npm install
node script/yarn install
fi
# This step handles the differences between the linux "gclient sync"
@@ -263,6 +286,28 @@ step-electron-dist-build: &step-electron-dist-build
command: |
cd src
ninja -C out/Default electron:electron_dist_zip
if [ "$CHECK_DIST_MANIFEST" == "1" ]; then
if [ "`uname`" == "Darwin" ]; then
target_os=mac
target_cpu=x64
if [ x"$MAS_BUILD" == x"true" ]; then
target_os=mac_mas
fi
elif [ "`uname`" == "Linux" ]; then
target_os=linux
if [ x"$TARGET_ARCH" == x ]; then
target_cpu=x64
elif [ "$TARGET_ARCH" == "ia32" ]; then
target_cpu=x86
else
target_cpu="$TARGET_ARCH"
fi
else
echo "Unknown system: `uname`"
exit 1
fi
electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.$target_os.$target_cpu.manifest
fi
step-electron-dist-store: &step-electron-dist-store
store_artifacts:
@@ -411,25 +456,13 @@ step-mksnapshot-store: &step-mksnapshot-store
path: src/out/Default/mksnapshot.zip
destination: mksnapshot.zip
step-maybe-build-dump-syms: &step-maybe-build-dump-syms
run:
name: Build dump_syms binary
command: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then
cd src
# Build needed dump_syms executable
ninja -C out/Default third_party/breakpad:dump_syms
fi
step-maybe-generate-breakpad-symbols: &step-maybe-generate-breakpad-symbols
run:
name: Generate breakpad symbols
command: |
if [ "$GENERATE_SYMBOLS" == "true" ]; then
cd src
export BUILD_PATH="$PWD/out/Default"
export DEST_PATH="$BUILD_PATH/breakpad_symbols"
electron/script/dump-symbols.py -b $BUILD_PATH -d $DEST_PATH -v
ninja -C out/Default electron:electron_symbols
fi
step-maybe-zip-symbols: &step-maybe-zip-symbols
@@ -482,7 +515,7 @@ step-maybe-generate-typescript-defs: &step-maybe-generate-typescript-defs
command: |
if [ "`uname`" == "Darwin" ]; then
cd src/electron
npm run create-typescript-definitions
node script/yarn create-typescript-definitions
fi
step-fix-known-hosts-linux: &step-fix-known-hosts-linux
@@ -526,8 +559,8 @@ steps-lint: &steps-lint
# but then we would lint its contents (at least gn format), and it doesn't pass it.
cd src/electron
npm install
npm run lint
node script/yarn install
node script/yarn lint
steps-checkout: &steps-checkout
steps:
@@ -535,6 +568,7 @@ steps-checkout: &steps-checkout
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-install-gnutar-on-mac
- restore_cache:
@@ -606,9 +640,11 @@ steps-electron-build-for-tests: &steps-electron-build-for-tests
- *step-depot-tools-add-to-path
- *step-setup-env-for-build
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-install-npm-deps-on-mac
- *step-fix-sync-on-mac
- *step-gn-gen-default
- *step-delete-git-directories
# Electron app
- *step-electron-build
@@ -636,7 +672,6 @@ steps-electron-build-for-tests: &steps-electron-build-for-tests
# Save all data needed for a further tests run.
- *step-persist-data-for-tests
- *step-maybe-build-dump-syms
- *step-maybe-generate-breakpad-symbols
- *step-maybe-zip-symbols
@@ -651,16 +686,17 @@ steps-electron-build-for-publish: &steps-electron-build-for-publish
- *step-depot-tools-get
- *step-depot-tools-add-to-path
- *step-restore-brew-cache
- *step-get-more-space-on-mac
- *step-gclient-sync
- *step-setup-env-for-build
- *step-gn-gen-default
- *step-delete-git-directories
# Electron app
- *step-electron-build
- *step-maybe-electron-dist-strip
- *step-electron-dist-build
- *step-electron-dist-store
- *step-maybe-build-dump-syms
- *step-maybe-generate-breakpad-symbols
- *step-maybe-zip-symbols
@@ -773,25 +809,23 @@ steps-tests: &steps-tests
name: Run Electron tests
environment:
MOCHA_REPORTER: mocha-multi-reporters
MOCHA_FILE: junit/test-results.xml
ELECTRON_TEST_RESULTS_DIR: junit
MOCHA_MULTI_REPORTERS: mocha-junit-reporter, tap
ELECTRON_DISABLE_SECURITY_WARNINGS: 1
command: |
cd src
export ELECTRON_OUT_DIR=Default
(cd electron && npm run test -- --ci --enable-logging)
(cd electron && node script/yarn test -- --ci --enable-logging)
- run:
name: Check test results existence
command: |
MOCHA_FILE='src/junit/test-results-remote.xml'
# Check if it exists and not empty.
if [ ! -s "$MOCHA_FILE" ]; then
cd src
# Check if test results exist and are not empty.
if [ ! -s "junit/test-results-remote.xml" ]; then
exit 1
fi
MOCHA_FILE='src/junit/test-results-main.xml'
# Check if it exists and not empty.
if [ ! -s "$MOCHA_FILE" ]; then
if [ ! -s "junit/test-results-main.xml" ]; then
exit 1
fi
- store_test_results:
@@ -895,7 +929,7 @@ jobs:
linux-x64-publish:
<<: *machine-linux-2xlarge
environment:
<<: *env-linux-2xlarge
<<: *env-linux-2xlarge-release
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
<<: *env-release-build
<<: *steps-electron-build-for-publish
@@ -941,7 +975,7 @@ jobs:
linux-ia32-publish:
<<: *machine-linux-2xlarge
environment:
<<: *env-linux-2xlarge
<<: *env-linux-2xlarge-release
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
<<: *env-ia32
<<: *env-release-build
@@ -989,7 +1023,7 @@ jobs:
linux-arm-publish:
<<: *machine-linux-2xlarge
environment:
<<: *env-linux-2xlarge
<<: *env-linux-2xlarge-release
<<: *env-arm
<<: *env-release-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
@@ -1053,7 +1087,7 @@ jobs:
linux-arm64-publish:
<<: *machine-linux-2xlarge
environment:
<<: *env-linux-2xlarge
<<: *env-linux-2xlarge-release
<<: *env-arm64
<<: *env-release-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_arm64=True --custom-var=checkout_boto=True --custom-var=checkout_requests=True'
@@ -1067,6 +1101,14 @@ jobs:
<<: *env-enable-sccache
<<: *steps-electron-build-for-tests
osx-debug:
<<: *machine-mac-large
environment:
<<: *env-mac-large
<<: *env-debug-build
<<: *env-enable-sccache
<<: *steps-electron-build-for-tests
osx-debug-gn-check:
<<: *machine-mac
environment:
@@ -1101,7 +1143,7 @@ jobs:
osx-publish:
<<: *machine-mac-large
environment:
<<: *env-mac-large
<<: *env-mac-large-release
<<: *env-release-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
<<: *steps-electron-build-for-publish
@@ -1115,6 +1157,15 @@ jobs:
<<: *env-enable-sccache
<<: *steps-electron-build-for-tests
mas-debug:
<<: *machine-mac-large
environment:
<<: *env-mac-large
<<: *env-mas
<<: *env-debug-build
<<: *env-enable-sccache
<<: *steps-electron-build-for-tests
mas-debug-gn-check:
<<: *machine-mac
environment:
@@ -1152,7 +1203,7 @@ jobs:
mas-publish:
<<: *machine-mac-large
environment:
<<: *env-mac-large
<<: *env-mac-large-release
<<: *env-mas
<<: *env-release-build
GCLIENT_EXTRA_ARGS: '--custom-var=checkout_boto=True --custom-var=checkout_requests=True'
@@ -1438,9 +1489,14 @@ workflows:
requires:
- mac-checkout
- osx-debug:
requires:
- mac-checkout
- osx-debug-gn-check:
requires:
- mac-checkout
- osx-testing-gn-check:
requires:
- mac-checkout
@@ -1453,9 +1509,14 @@ workflows:
requires:
- mac-checkout
- mas-debug:
requires:
- mac-checkout
- mas-debug-gn-check:
requires:
- mac-checkout
- mas-testing-gn-check:
requires:
- mac-checkout

View File

@@ -1,7 +1,7 @@
# These env vars are only necessary for creating Electron releases.
# See docs/development/releasing.md
APPVEYOR_TOKEN=
APPVEYOR_CLOUD_TOKEN=
CIRCLE_TOKEN=
ELECTRON_GITHUB_TOKEN=
VSTS_TOKEN=

View File

@@ -16,7 +16,8 @@
}],
"prefer-const": ["error", {
"destructuring": "all"
}]
}],
"node/no-deprecated-api": 0
},
"parserOptions": {
"ecmaVersion": 6,

14
.github/CODEOWNERS vendored
View File

@@ -4,17 +4,19 @@
# https://git-scm.com/docs/gitignore
# Most stuff in here is owned by the Community & Safety WG...
/.github/* @electron/wg-community
/.github/* @electron/wg-community
# ...except the Admin WG maintains this file.
/.github/CODEOWNERS @electron/wg-admin
/.github/CODEOWNERS @electron/wg-admin
# Upgrades WG
/patches/ @electron/wg-upgrades
/patches/ @electron/wg-upgrades
DEPS @electron/wg-upgrades
# Docs & Tooling WG
/default_app/ @electron/wg-docs-tools
/docs/ @electron/wg-docs-tools
/default_app/ @electron/wg-docs-tools
/docs/ @electron/wg-docs-tools
# Releases WG
/npm/ @electron/wg-releases
/npm/ @electron/wg-releases

2
.gitignore vendored
View File

@@ -37,7 +37,7 @@
/vendor/pyyaml
node_modules/
SHASUMS256.txt
**/yarn.lock
**/package-lock.json
compile_commands.json
.envrc

293
BUILD.gn
View File

@@ -1,6 +1,7 @@
import("//build/config/locales.gni")
import("//build/config/ui.gni")
import("//build/config/win/manifest.gni")
import("//content/public/app/mac_helpers.gni")
import("//pdf/features.gni")
import("//printing/buildflags/buildflags.gni")
import("//third_party/ffmpeg/ffmpeg_options.gni")
@@ -8,8 +9,9 @@ import("//tools/generate_library_loader/generate_library_loader.gni")
import("//tools/grit/grit_rule.gni")
import("//tools/grit/repack.gni")
import("//tools/v8_context_snapshot/v8_context_snapshot.gni")
import("//v8/snapshot_toolchain.gni")
import("//v8/gni/snapshot_toolchain.gni")
import("build/asar.gni")
import("build/extract_symbols.gni")
import("build/js_wrap.gni")
import("build/npm.gni")
import("build/tsc.gni")
@@ -21,6 +23,7 @@ import("filenames.gni")
if (is_mac) {
import("//build/config/mac/rules.gni")
import("//third_party/icu/config.gni")
import("//ui/gl/features.gni")
import("//v8/gni/v8.gni")
}
@@ -64,7 +67,7 @@ config("branding") {
npm_action("build_electron_definitions") {
script = "gn-typescript-definitions"
args = [ rebase_path("$target_gen_dir/tsc/typings/electron.d.ts") ]
inputs = auto_filenames.api_docs + [ "package-lock.json" ]
inputs = auto_filenames.api_docs + [ "yarn.lock" ]
outputs = [
"$target_gen_dir/tsc/typings/electron.d.ts",
@@ -231,7 +234,7 @@ action("atom_js2c") {
"$target_gen_dir/js2c/asar_init.js",
]
inputs = sources
inputs = sources + [ "//third_party/electron_node/tools/js2c.py" ]
outputs = [
"$root_gen_dir/atom_natives.cc",
]
@@ -545,21 +548,15 @@ static_library("electron_lib") {
if (is_mac) {
deps += [
"//third_party/crashpad/crashpad/client",
"//components/remote_cocoa/app_shim",
"//content/common:mac_helpers",
"//ui/accelerated_widget_mac",
]
sources += [
"atom/browser/ui/views/autofill_popup_view.cc",
"atom/browser/ui/views/autofill_popup_view.h",
]
include_dirs += [
# NOTE(nornagon): other chromium files use the full path to include
# crashpad; this is just here for compatibility between GN and GYP, so that
# the #includes can be agnostic about where crashpad is vendored.
"//third_party/crashpad",
]
if (is_mas_build) {
deps -= [ "//third_party/crashpad/crashpad/client" ]
sources += [ "atom/browser/api/atom_api_app_mas.mm" ]
sources -= [
"atom/browser/auto_updater_mac.mm",
@@ -589,10 +586,14 @@ static_library("electron_lib") {
"//chrome/browser/ui/libgtkui",
"//dbus",
"//device/bluetooth",
"//third_party/breakpad:client",
"//ui/events/devices/x11",
"//ui/events/platform/x11",
"//ui/views/controls/webview",
"//ui/wm",
]
configs += [ ":gio_unix" ]
include_dirs += [ "//third_party/breakpad" ]
defines += [
# Disable warnings for g_settings_list_schemas.
"GLIB_DISABLE_DEPRECATION_WARNINGS",
@@ -603,20 +604,23 @@ static_library("electron_lib") {
if (is_win) {
libs += [ "dwmapi.lib" ]
deps += [
"//third_party/breakpad:breakpad_handler",
"//third_party/breakpad:breakpad_sender",
"//ui/native_theme:native_theme_browser",
"//ui/wm/public",
]
public_deps += [ "//sandbox/win:sandbox" ]
}
if (is_linux || is_win) {
deps += [
"//third_party/breakpad:client",
"//ui/views/controls/webview",
"//ui/wm",
"//ui/wm/public",
]
include_dirs += [ "//third_party/breakpad" ]
public_deps += [
"//sandbox/win:sandbox",
"//third_party/crashpad/crashpad/handler",
]
}
if ((is_mac && !is_mas_build) || is_win) {
sources += [
"atom/common/crash_reporter/crash_reporter_crashpad.cc",
"atom/common/crash_reporter/crash_reporter_crashpad.h",
]
deps += [ "//third_party/crashpad/crashpad/client" ]
}
if (enable_pdf) {
@@ -653,9 +657,7 @@ static_library("electron_lib") {
}
if (enable_desktop_capturer) {
if (is_component_build && is_win) {
# On windows the implementation relies on unexported
# DxgiDuplicatorController class.
if (is_component_build && !is_linux) {
deps += [ "//third_party/webrtc/modules/desktop_capture" ]
}
sources += [
@@ -711,6 +713,7 @@ if (is_mac) {
electron_helper_name = "$electron_product_name Helper"
electron_login_helper_name = "$electron_product_name Login Helper"
electron_framework_version = "A"
electron_version = read_file("ELECTRON_VERSION", "trim string")
mac_xib_bundle_data("electron_xibs") {
sources = [
@@ -758,6 +761,50 @@ if (is_mac) {
group("electron_framework_libraries") {
}
}
if (use_egl) {
# Add the ANGLE .dylibs in the Libraries directory of the Framework.
bundle_data("electron_angle_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libEGL.dylib",
"$root_out_dir/egl_intermediates/libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:angle_library_copy",
]
}
# Add the SwiftShader .dylibs in the Libraries directory of the Framework.
bundle_data("electron_swiftshader_binaries") {
sources = [
"$root_out_dir/egl_intermediates/libswiftshader_libEGL.dylib",
"$root_out_dir/egl_intermediates/libswiftshader_libGLESv2.dylib",
]
outputs = [
"{{bundle_contents_dir}}/Libraries/{{source_file_part}}",
]
public_deps = [
"//ui/gl:swiftshader_library_copy",
]
}
}
group("electron_angle_library") {
if (use_egl) {
deps = [
":electron_angle_binaries",
]
}
}
group("electron_swiftshader_library") {
if (use_egl) {
deps = [
":electron_swiftshader_binaries",
]
}
}
bundle_data("electron_crashpad_helper") {
sources = [
@@ -784,8 +831,10 @@ if (is_mac) {
":electron_lib",
]
deps = [
":electron_angle_library",
":electron_framework_libraries",
":electron_framework_resources",
":electron_swiftshader_library",
":electron_xibs",
]
if (!is_mas_build) {
@@ -793,7 +842,6 @@ if (is_mac) {
}
info_plist = "atom/common/resources/mac/Info.plist"
electron_version = read_file("ELECTRON_VERSION", "trim string")
extra_substitutions = [
"ATOM_BUNDLE_ID=$electron_mac_bundle_id.framework",
"ELECTRON_VERSION=$electron_version",
@@ -833,35 +881,48 @@ if (is_mac) {
}
}
mac_app_bundle("electron_helper_app") {
output_name = electron_helper_name
deps = [
":electron_framework+link",
]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
defines = [ "HELPER_EXECUTABLE" ]
sources = filenames.app_sources
include_dirs = [ "." ]
info_plist = "atom/renderer/resources/mac/Info.plist"
extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
ldflags = [
"-rpath",
"@executable_path/../../..",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@executable_path/../../../../../..",
template("electron_helper_app") {
mac_app_bundle(target_name) {
assert(defined(invoker.helper_name_suffix))
output_name = electron_helper_name + invoker.helper_name_suffix
deps = [
":electron_framework+link",
]
if (!is_mas_build) {
deps += [ "//sandbox/mac:seatbelt" ]
}
defines = [ "HELPER_EXECUTABLE" ]
sources = filenames.app_sources
sources += [ "atom/common/atom_constants.cc" ]
include_dirs = [ "." ]
info_plist = "atom/renderer/resources/mac/Info.plist"
extra_substitutions = [ "ATOM_BUNDLE_ID=$electron_mac_bundle_id.helper" ]
ldflags = [
"-rpath",
"@executable_path/../../..",
]
if (is_component_build) {
ldflags += [
"-rpath",
"@executable_path/../../../../../..",
]
}
}
}
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
_helper_bundle_id = helper_params[1]
_helper_suffix = helper_params[2]
electron_helper_app("electron_helper_app_${_helper_target}") {
helper_name_suffix = _helper_suffix
}
}
bundle_data("electron_app_framework_bundle_data") {
sources = [
"$root_out_dir/$electron_framework_name.framework",
"$root_out_dir/$electron_helper_name.app",
]
if (!is_mas_build) {
sources += [
@@ -875,8 +936,13 @@ if (is_mac) {
]
public_deps = [
":electron_framework+link",
":electron_helper_app",
]
foreach(helper_params, content_mac_helpers) {
sources +=
[ "$root_out_dir/${electron_helper_name}${helper_params[2]}.app" ]
public_deps += [ ":electron_helper_app_${helper_params[0]}" ]
}
}
mac_app_bundle("electron_login_helper") {
@@ -950,6 +1016,7 @@ if (is_mac) {
mac_app_bundle("electron_app") {
output_name = electron_product_name
sources = filenames.app_sources
sources += [ "atom/common/atom_constants.cc" ]
include_dirs = [ "." ]
deps = [
":electron_app_framework_bundle_data",
@@ -965,6 +1032,85 @@ if (is_mac) {
"@executable_path/../Frameworks",
]
}
if (enable_dsyms) {
extract_symbols("electron_framework_syms") {
binary = "$root_out_dir/$electron_framework_name.framework/Versions/$electron_framework_version/$electron_framework_name"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_framework_name.dSYM/Contents/Resources/DWARF/$electron_framework_name"
deps = [
":electron_framework",
]
}
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
_helper_bundle_id = helper_params[1]
_helper_suffix = helper_params[2]
extract_symbols("electron_helper_syms_${_helper_target}") {
binary = "$root_out_dir/$electron_helper_name${_helper_suffix}.app/Contents/MacOS/$electron_helper_name${_helper_suffix}"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_helper_name${_helper_suffix}.dSYM/Contents/Resources/DWARF/$electron_helper_name${_helper_suffix}"
deps = [
":electron_helper_app_${_helper_target}",
]
}
}
extract_symbols("electron_app_syms") {
binary = "$root_out_dir/$electron_product_name.app/Contents/MacOS/$electron_product_name"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/$electron_product_name.dSYM/Contents/Resources/DWARF/$electron_product_name"
deps = [
":electron_app",
]
}
extract_symbols("swiftshader_egl_syms") {
binary = "$root_out_dir/libswiftshader_libEGL.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libswiftshader_libEGL.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libEGL.dylib"
deps = [
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
]
}
extract_symbols("swiftshader_gles_syms") {
binary = "$root_out_dir/libswiftshader_libGLESv2.dylib"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/libswiftshader_libGLESv2.dylib.dSYM/Contents/Resources/DWARF/libswiftshader_libGLESv2.dylib"
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
extract_symbols("crashpad_handler_syms") {
binary = "$root_out_dir/crashpad_handler"
symbol_dir = "$root_out_dir/breakpad_symbols"
dsym_file = "$root_out_dir/crashpad_handler.dSYM/Contents/Resources/DWARF/crashpad_handler"
deps = [
"//third_party/crashpad/crashpad/handler:crashpad_handler",
]
}
group("electron_symbols") {
deps = [
":crashpad_handler_syms",
":electron_app_syms",
":electron_framework_syms",
":swiftshader_egl_syms",
":swiftshader_gles_syms",
]
foreach(helper_params, content_mac_helpers) {
_helper_target = helper_params[0]
deps += [ ":electron_helper_syms_${_helper_target}" ]
}
}
} else {
group("electron_symbols") {
}
}
} else {
windows_manifest("electron_app_manifest") {
sources = [
@@ -1053,6 +1199,49 @@ if (is_mac) {
}
}
}
if (is_official_build) {
if (is_linux) {
_target_executable_suffix = ""
_target_shared_library_suffix = ".so"
} else if (is_win) {
_target_executable_suffix = ".exe"
_target_shared_library_suffix = ".dll"
}
extract_symbols("electron_app_symbols") {
binary = "$root_out_dir/$electron_project_name$_target_executable_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [
":electron_app",
]
}
extract_symbols("swiftshader_egl_symbols") {
binary = "$root_out_dir/swiftshader/libEGL$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [
"//third_party/swiftshader/src/OpenGL/libEGL:swiftshader_libEGL",
]
}
extract_symbols("swiftshader_gles_symbols") {
binary =
"$root_out_dir/swiftshader/libGLESv2$_target_shared_library_suffix"
symbol_dir = "$root_out_dir/breakpad_symbols"
deps = [
"//third_party/swiftshader/src/OpenGL/libGLESv2:swiftshader_libGLESv2",
]
}
group("electron_symbols") {
deps = [
":electron_app_symbols",
":swiftshader_egl_symbols",
":swiftshader_gles_symbols",
]
}
}
}
template("dist_zip") {
@@ -1067,6 +1256,7 @@ template("dist_zip") {
"deps",
"data_deps",
"data",
"testonly",
])
write_runtime_deps = _runtime_deps_file
}
@@ -1076,7 +1266,11 @@ template("dist_zip") {
deps = [
":$_runtime_deps_target",
]
forward_variables_from(invoker, [ "outputs" ])
forward_variables_from(invoker,
[
"outputs",
"testonly",
])
args = rebase_path(outputs + [ _runtime_deps_file ], root_build_dir) + [
target_cpu,
target_os,
@@ -1144,6 +1338,7 @@ dist_zip("electron_ffmpeg_zip") {
}
dist_zip("electron_chromedriver_zip") {
testonly = true
data_deps = [
"//chrome/test/chromedriver",
":licenses",

25
DEPS
View File

@@ -10,9 +10,9 @@ gclient_gn_args = [
vars = {
'chromium_version':
'75.0.3740.3',
'76.0.3809.146',
'node_version':
'2dc0f8811b2b295c08d797b8a11b030234c98502',
'v12.4.0',
'boto_version': 'f7574aa6cc2c819430c1f05e9a1a1a666ef8169b',
'pyyaml_version': '3.12',
@@ -21,12 +21,19 @@ vars = {
'boto_git': 'https://github.com/boto',
'chromium_git': 'https://chromium.googlesource.com',
'electron_git': 'https://github.com/electron',
'nodejs_git': 'https://github.com/nodejs',
'requests_git': 'https://github.com/kennethreitz',
'yaml_git': 'https://github.com/yaml',
# KEEP IN SYNC WITH spec-runner FILE
'yarn_version': '1.15.2',
# To be able to build clean Chromium from sources.
'apply_patches': True,
# Apply the patches specific to windows on arm64
'apply_win_arm64_patches': False,
# Python interface to Amazon Web Services. Is used for releases only.
'checkout_boto': False,
@@ -64,7 +71,7 @@ deps = {
'condition': 'checkout_chromium',
},
'src/third_party/electron_node': {
'url': (Var("electron_git")) + '/node.git@' + (Var("node_version")),
'url': (Var("nodejs_git")) + '/node.git@' + (Var("node_version")),
'condition': 'checkout_node',
},
'src/electron/vendor/pyyaml': {
@@ -92,6 +99,16 @@ hooks = [
'src/electron/patches/common/config.json',
],
},
{
'name': 'patch_chromium',
'condition': '(checkout_chromium and apply_patches) and apply_win_arm64_patches',
'pattern': 'src/electron',
'action': [
'python',
'src/electron/script/apply_all_patches.py',
'src/electron/patches/win_arm64/config.json',
],
},
{
'name': 'electron_external_binaries',
'pattern': 'src/electron/script/update-external-binaries.py',
@@ -107,7 +124,7 @@ hooks = [
'action': [
'python',
'-c',
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npm.py", "install"]);',
'import os, subprocess; os.chdir(os.path.join("src", "electron")); subprocess.check_call(["python", "script/lib/npx.py", "yarn@' + (Var("yarn_version")) + '", "install", "--frozen-lockfile"]);',
],
},
{

View File

@@ -16,7 +16,7 @@ RUN apt-get update && DEBIAN_FRONTEND=noninteractive apt-get install -y \
locales \
lsb-release \
nano \
python-dbusmock \
python-dbus \
python-pip \
python-setuptools \
sudo \
@@ -33,6 +33,9 @@ RUN curl -sL https://deb.nodesource.com/setup_10.x | bash - \
# crcmod is required by gsutil, which is used for filling the gclient git cache
RUN pip install -U crcmod
# dbusmock is needed for Electron tests
RUN pip install python-dbusmock
RUN mkdir /tmp/workspace
RUN chown builduser:builduser /tmp/workspace

View File

@@ -1 +1 @@
6.0.0-nightly.20190404
6.1.3

View File

@@ -2,10 +2,8 @@
[![CircleCI Build Status](https://circleci.com/gh/electron/electron/tree/master.svg?style=shield)](https://circleci.com/gh/electron/electron/tree/master)
[![AppVeyor Build Status](https://windows-ci.electronjs.org/api/projects/status/nilyf07hcef14dvj/branch/master?svg=true)](https://windows-ci.electronjs.org/project/AppVeyor/electron/branch/master)
[![Azure Pipelines Build Status](https://github.visualstudio.com/electron/_apis/build/status/electron-builds/electron-osx-testing?branchName=master)](https://github.visualstudio.com/electron/_build/latest?definitionId=36)
[![AppVeyor Build Status](https://ci.appveyor.com/api/projects/status/4lggi9dpjc1qob7k/branch/master?svg=true)](https://ci.appveyor.com/project/electron-bot/electron-ljo26/branch/master)
[![devDependency Status](https://david-dm.org/electron/electron/dev-status.svg)](https://david-dm.org/electron/electron?type=dev)
[![Join the Electron Community on Slack](https://atom-slack.herokuapp.com/badge.svg)](https://atom-slack.herokuapp.com/)
:memo: Available Translations: 🇨🇳 🇹🇼 🇧🇷 🇪🇸 🇰🇷 🇯🇵 🇷🇺 🇫🇷 🇹🇭 🇳🇱 🇹🇷 🇮🇩 🇺🇦 🇨🇿 🇮🇹 🇵🇱.
View these docs in other languages at [electron/i18n](https://github.com/electron/i18n/tree/master/content/).

View File

@@ -25,11 +25,11 @@
version: 1.0.{build}
build_cloud: libcc-20
image: libcc-20-vs2017-15.7.4
image: libcc-20-vs2017-15.9
environment:
GIT_CACHE_PATH: C:\Users\electron\libcc_cache
DISABLE_CRASH_REPORTER_TESTS: true
ELECTRON_OUT_DIR: Default
ELECTRON_ENABLE_STACK_DUMPING: 1
build_script:
- ps: >-
if(($env:APPVEYOR_PULL_REQUEST_HEAD_REPO_NAME -split "/")[0] -eq ($env:APPVEYOR_REPO_NAME -split "/")[0]) {
@@ -38,13 +38,13 @@ build_script:
- echo "Building $env:GN_CONFIG build"
- git config --global core.longpaths true
- cd ..
- md src
- ps: if (Test-Path src\electron) { Remove-Item src\electron -Recurse }
- ps: Move-Item $env:APPVEYOR_BUILD_FOLDER -Destination src\electron
- ps: $env:CHROMIUM_BUILDTOOLS_PATH="$pwd\src\buildtools"
- ps: $env:SCCACHE_PATH="$pwd\src\electron\external_binaries\sccache.exe"
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
$env:GCLIENT_EXTRA_ARGS="--custom-var=checkout_boto=True --custom-var=checkout_requests=True"
$env:GCLIENT_EXTRA_ARGS="$env:GCLIENT_EXTRA_ARGS --custom-var=checkout_boto=True --custom-var=checkout_requests=True"
}
- >-
gclient config
@@ -52,7 +52,7 @@ build_script:
--unmanaged
%GCLIENT_EXTRA_ARGS%
"https://github.com/electron/electron"
- gclient sync --with_branch_heads --with_tags
- gclient sync --with_branch_heads --with_tags --reset
- cd src
- ps: $env:BUILD_CONFIG_PATH="//electron/build/args/%GN_CONFIG%.gn"
- gn gen out/Default "--args=import(\"%BUILD_CONFIG_PATH%\") %GN_EXTRA_ARGS%"
@@ -70,21 +70,27 @@ build_script:
- appveyor PushArtifact out/Default/dist.zip
- appveyor PushArtifact out/Default/chromedriver.zip
- appveyor PushArtifact out/ffmpeg/ffmpeg.zip
- 7z a node_headers.zip out\Default\gen\node_headers
- appveyor PushArtifact node_headers.zip
- appveyor PushArtifact out/Default/mksnapshot.zip
- appveyor PushArtifact out/Default/electron.lib
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
ninja -C out/Default third_party/breakpad:dump_syms
# Needed for msdia140.dll on 64-bit windows
$env:Path += ";$pwd\third_party\llvm-build\Release+Asserts\bin"
ninja -C out/Default electron:electron_symbols
}
- if "%GN_CONFIG%"=="release" ( python electron\script\dump-symbols.py -d %cd%\out\Default\breakpad_symbols -v)
- ps: >-
if ($env:GN_CONFIG -eq 'release') {
python electron\script\zip-symbols.py
appveyor PushArtifact out/Default/symbols.zip
}
- python electron/script/zip_manifests/check-zip-manifest.py out/Default/dist.zip electron/script/zip_manifests/dist_zip.win.%TARGET_ARCH%.manifest
test_script:
# Workaround for https://github.com/appveyor/ci/issues/2420
- set "PATH=%PATH%;C:\Program Files\Git\mingw64\libexec\git-core"
- ps: >-
if ((-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
if ((-Not (Test-Path Env:\TEST_WOA)) -And (-Not (Test-Path Env:\ELECTRON_RELEASE)) -And ($env:GN_CONFIG -in "testing", "release")) {
$env:RUN_TESTS="true"
}
- ps: >-
@@ -95,7 +101,7 @@ test_script:
echo "Skipping tests for $env:GN_CONFIG build"
}
- cd electron
- if "%RUN_TESTS%"=="true" ( echo Running test suite & npm run test -- --ci --enable-logging)
- if "%RUN_TESTS%"=="true" ( echo Running test suite & node script/yarn test -- --ci --enable-logging)
- cd ..
- if "%RUN_TESTS%"=="true" ( echo Verifying non proprietary ffmpeg & python electron\script\verify-ffmpeg.py --build-dir out\Default --source-root %cd% --ffmpeg-path out\ffmpeg )
- echo "About to verify mksnapshot"
@@ -112,4 +118,6 @@ deploy_script:
Write-Output "Uploading Electron release distribution to github releases"
& python script\upload.py
}
} elseif (Test-Path Env:\TEST_WOA) {
node script/ci-release-build.js --job=electron-woa-testing --ci=VSTS --armTest --appveyorJobId=$env:APPVEYOR_JOB_ID $env:APPVEYOR_REPO_BRANCH
}

View File

@@ -5,6 +5,7 @@
#include "atom/app/atom_content_client.h"
#include <string>
#include <utility>
#include <vector>
#include "atom/common/options_switches.h"
@@ -14,9 +15,8 @@
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/common/content_constants.h"
#include "content/public/common/pepper_plugin_info.h"
#include "electron/buildflags/buildflags.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#include "ppapi/buildflags/buildflags.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "url/url_constants.h"
@@ -34,6 +34,11 @@
#include "pdf/pdf.h"
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
#if BUILDFLAG(ENABLE_PLUGINS)
#include "content/public/common/pepper_plugin_info.h"
#include "ppapi/shared_impl/ppapi_permissions.h"
#endif // BUILDFLAG(ENABLE_PLUGINS)
namespace atom {
namespace {
@@ -140,6 +145,7 @@ void AddPepperFlashFromCommandLine(
}
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
#if BUILDFLAG(ENABLE_PLUGINS)
void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
#if BUILDFLAG(ENABLE_PDF_VIEWER)
content::PepperPluginInfo pdf_info;
@@ -160,15 +166,21 @@ void ComputeBuiltInPlugins(std::vector<content::PepperPluginInfo>* plugins) {
plugins->push_back(pdf_info);
#endif // BUILDFLAG(ENABLE_PDF_VIEWER)
}
#endif // BUILDFLAG(ENABLE_PLUGINS)
void ConvertStringWithSeparatorToVector(std::vector<std::string>* vec,
const char* separator,
const char* cmd_switch) {
void AppendDelimitedSwitchToVector(const base::StringPiece cmd_switch,
std::vector<std::string>* append_me) {
auto* command_line = base::CommandLine::ForCurrentProcess();
auto string_with_separator = command_line->GetSwitchValueASCII(cmd_switch);
if (!string_with_separator.empty())
*vec = base::SplitString(string_with_separator, separator,
base::TRIM_WHITESPACE, base::SPLIT_WANT_NONEMPTY);
auto switch_value = command_line->GetSwitchValueASCII(cmd_switch);
if (!switch_value.empty()) {
constexpr base::StringPiece delimiter(",", 1);
auto tokens =
base::SplitString(switch_value, delimiter, base::TRIM_WHITESPACE,
base::SPLIT_WANT_NONEMPTY);
append_me->reserve(append_me->size() + tokens.size());
std::move(std::begin(tokens), std::end(tokens),
std::back_inserter(*append_me));
}
}
} // namespace
@@ -200,30 +212,19 @@ base::RefCountedMemory* AtomContentClient::GetDataResourceBytes(
}
void AtomContentClient::AddAdditionalSchemes(Schemes* schemes) {
std::vector<std::string> splited;
ConvertStringWithSeparatorToVector(&splited, ",",
switches::kServiceWorkerSchemes);
for (const std::string& scheme : splited)
schemes->service_worker_schemes.push_back(scheme);
AppendDelimitedSwitchToVector(switches::kServiceWorkerSchemes,
&schemes->service_worker_schemes);
AppendDelimitedSwitchToVector(switches::kStandardSchemes,
&schemes->standard_schemes);
AppendDelimitedSwitchToVector(switches::kSecureSchemes,
&schemes->secure_schemes);
AppendDelimitedSwitchToVector(switches::kBypassCSPSchemes,
&schemes->csp_bypassing_schemes);
AppendDelimitedSwitchToVector(switches::kCORSSchemes,
&schemes->cors_enabled_schemes);
schemes->service_worker_schemes.push_back(url::kFileScheme);
ConvertStringWithSeparatorToVector(&splited, ",", switches::kStandardSchemes);
for (const std::string& scheme : splited)
schemes->standard_schemes.push_back(scheme);
schemes->standard_schemes.push_back("chrome-extension");
ConvertStringWithSeparatorToVector(&splited, ",", switches::kSecureSchemes);
for (const std::string& scheme : splited)
schemes->secure_schemes.push_back(scheme);
ConvertStringWithSeparatorToVector(&splited, ",",
switches::kBypassCSPSchemes);
for (const std::string& scheme : splited)
schemes->csp_bypassing_schemes.push_back(scheme);
ConvertStringWithSeparatorToVector(&splited, ",", switches::kCORSSchemes);
for (const std::string& scheme : splited)
schemes->cors_enabled_schemes.push_back(scheme);
}
void AtomContentClient::AddPepperPlugins(
@@ -232,7 +233,9 @@ void AtomContentClient::AddPepperPlugins(
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
AddPepperFlashFromCommandLine(command_line, plugins);
#endif // BUILDFLAG(ENABLE_PEPPER_FLASH)
#if BUILDFLAG(ENABLE_PLUGINS)
ComputeBuiltInPlugins(plugins);
#endif // BUILDFLAG(ENABLE_PLUGINS)
}
void AtomContentClient::AddContentDecryptionModules(
@@ -268,4 +271,8 @@ void AtomContentClient::AddContentDecryptionModules(
}
}
bool AtomContentClient::IsDataResourceGzipped(int resource_id) const {
return ui::ResourceBundle::GetSharedInstance().IsGzipped(resource_id);
}
} // namespace atom

View File

@@ -31,6 +31,7 @@ class AtomContentClient : public content::ContentClient {
void AddContentDecryptionModules(
std::vector<content::CdmInfo>* cdms,
std::vector<media::CdmHostFilePath>* cdm_host_file_paths) override;
bool IsDataResourceGzipped(int resource_id) const override;
private:
DISALLOW_COPY_AND_ASSIGN(AtomContentClient);

View File

@@ -4,6 +4,7 @@
#include "atom/app/atom_main.h"
#include <algorithm>
#include <cstdlib>
#include <memory>
#include <vector>
@@ -39,6 +40,7 @@
#include "atom/app/node_main.h"
#include "atom/common/atom_command_line.h"
#include "atom/common/atom_constants.h"
#include "base/at_exit.h"
#include "base/i18n/icu_util.h"
#include "electron/buildflags/buildflags.h"
@@ -49,10 +51,6 @@
namespace {
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
const char kRunAsNode[] = "ELECTRON_RUN_AS_NODE";
#endif
ALLOW_UNUSED_TYPE bool IsEnvSet(const char* name) {
#if defined(OS_WIN)
size_t required_size;
@@ -86,6 +84,11 @@ void FixStdioStreams() {
} // namespace
#if defined(OS_WIN)
namespace crash_reporter {
extern const char kCrashpadProcess[];
}
int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
struct Arguments {
int argc = 0;
@@ -122,7 +125,7 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
#endif
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
bool run_as_node = IsEnvSet(kRunAsNode);
bool run_as_node = IsEnvSet(atom::kRunAsNode);
#else
bool run_as_node = false;
#endif
@@ -131,30 +134,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
if (run_as_node || !IsEnvSet("ELECTRON_NO_ATTACH_CONSOLE"))
base::RouteStdioToConsole(false);
#ifndef DEBUG
// Chromium has its own TLS subsystem which supports automatic destruction
// of thread-local data, and also depends on memory allocation routines
// provided by the CRT. The problem is that the auto-destruction mechanism
// uses a hidden feature of the OS loader which calls a callback on thread
// exit, but only after all loaded DLLs have been detached. Since the CRT is
// also a DLL, it happens that by the time Chromium's `OnThreadExit` function
// is called, the heap functions, though still in memory, no longer perform
// their duties, and when Chromium calls `free` on its buffer, it triggers
// an access violation error.
// We work around this problem by invoking Chromium's `OnThreadExit` in time
// from within the CRT's atexit facility, ensuring the heap functions are
// still active. The second invocation from the OS loader will be a no-op.
extern void NTAPI OnThreadExit(PVOID module, DWORD reason, PVOID reserved);
atexit([]() { OnThreadExit(nullptr, DLL_THREAD_DETACH, nullptr); });
#endif
std::vector<char*> argv(arguments.argc);
std::transform(arguments.argv, arguments.argv + arguments.argc, argv.begin(),
[](auto& a) { return _strdup(base::WideToUTF8(a).c_str()); });
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (run_as_node) {
std::vector<char*> argv(arguments.argc);
std::transform(
arguments.argv, arguments.argv + arguments.argc, argv.begin(),
[](auto& a) { return _strdup(base::WideToUTF8(a).c_str()); });
base::AtExitManager atexit_manager;
base::i18n::InitializeICU();
auto ret = atom::NodeMain(argv.size(), argv.data());
@@ -163,8 +147,11 @@ int APIENTRY wWinMain(HINSTANCE instance, HINSTANCE, wchar_t* cmd, int) {
}
#endif
if (IsEnvSet("ELECTRON_INTERNAL_CRASH_SERVICE")) {
return crash_service::Main(cmd);
base::CommandLine::Init(argv.size(), argv.data());
const base::CommandLine& cmd_line = *base::CommandLine::ForCurrentProcess();
if (cmd_line.GetSwitchValueASCII("type") ==
crash_reporter::kCrashpadProcess) {
return crash_service::Main(&argv);
}
if (!atom::CheckCommandLineArguments(arguments.argc, arguments.argv))
@@ -187,7 +174,7 @@ int main(int argc, char* argv[]) {
FixStdioStreams();
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (IsEnvSet(kRunAsNode)) {
if (IsEnvSet(atom::kRunAsNode)) {
base::i18n::InitializeICU();
base::AtExitManager atexit_manager;
return atom::NodeMain(argc, argv);
@@ -208,7 +195,7 @@ int main(int argc, char* argv[]) {
FixStdioStreams();
#if BUILDFLAG(ENABLE_RUN_AS_NODE)
if (IsEnvSet(kRunAsNode)) {
if (IsEnvSet(atom::kRunAsNode)) {
return AtomInitializeICUandStartNode(argc, argv);
}
#endif

View File

@@ -47,6 +47,13 @@
#include "atom/app/atom_main_delegate_mac.h"
#endif
#if defined(OS_WIN)
#include "base/win/win_util.h"
#if defined(_WIN64)
#include "atom/common/crash_reporter/crash_reporter_win.h"
#endif
#endif
namespace atom {
namespace {
@@ -58,6 +65,11 @@ bool IsBrowserProcess(base::CommandLine* cmd) {
return process_type.empty();
}
bool IsSandboxEnabled(base::CommandLine* command_line) {
return command_line->HasSwitch(switches::kEnableSandbox) ||
!command_line->HasSwitch(service_manager::switches::kNoSandbox);
}
// Returns true if this subprocess type needs the ResourceBundle initialized
// and resources loaded.
bool SubprocessNeedsResourceBundle(const std::string& process_type) {
@@ -129,6 +141,10 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
logging::LoggingSettings settings;
#if defined(OS_WIN)
#if defined(_WIN64)
crash_reporter::CrashReporterWin::SetUnhandledExceptionFilter();
#endif
// On Windows the terminal returns immediately, so we add a new line to
// prevent output in the same line as the prompt.
if (IsBrowserProcess(command_line))
@@ -140,10 +156,12 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
settings.lock_log = logging::LOCK_LOG_FILE;
settings.delete_old = logging::DELETE_OLD_LOG_FILE;
#else
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
settings.logging_dest =
logging::LOG_TO_SYSTEM_DEBUG_LOG | logging::LOG_TO_STDERR;
#endif // defined(DEBUG)
#else // defined(OS_WIN)
settings.logging_dest = logging::LOG_TO_SYSTEM_DEBUG_LOG;
settings.logging_dest =
logging::LOG_TO_SYSTEM_DEBUG_LOG | logging::LOG_TO_STDERR;
#endif // !defined(OS_WIN)
// Only enable logging when --enable-logging is specified.
@@ -181,6 +199,17 @@ bool AtomMainDelegate::BasicStartupComplete(int* exit_code) {
// Disable the ActiveVerifier, which is used by Chrome to track possible
// bugs, but no use in Electron.
base::win::DisableHandleVerifier();
if (IsBrowserProcess(command_line))
base::win::PinUser32();
#endif
#if defined(OS_LINUX)
// Check for --no-sandbox parameter when running as root.
if (getuid() == 0 && IsSandboxEnabled(command_line))
LOG(FATAL) << "Running as root without --"
<< service_manager::switches::kNoSandbox
<< " is not supported. See https://crbug.com/638180.";
#endif
content_client_ = std::make_unique<AtomContentClient>();
@@ -259,10 +288,9 @@ content::ContentBrowserClient* AtomMainDelegate::CreateContentBrowserClient() {
content::ContentRendererClient*
AtomMainDelegate::CreateContentRendererClient() {
if (base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableSandbox) ||
!base::CommandLine::ForCurrentProcess()->HasSwitch(
service_manager::switches::kNoSandbox)) {
auto* command_line = base::CommandLine::ForCurrentProcess();
if (IsSandboxEnabled(command_line)) {
renderer_client_.reset(new AtomSandboxedRendererClient);
} else {
renderer_client_.reset(new AtomRendererClient);

View File

@@ -14,6 +14,7 @@
#include "base/mac/scoped_nsautorelease_pool.h"
#include "base/path_service.h"
#include "base/strings/sys_string_conversions.h"
#include "content/common/mac_helpers.h"
#include "content/public/common/content_paths.h"
namespace atom {
@@ -26,10 +27,26 @@ base::FilePath GetFrameworksPath() {
base::FilePath GetHelperAppPath(const base::FilePath& frameworks_path,
const std::string& name) {
return frameworks_path.Append(name + " Helper.app")
// Figure out what helper we are running
base::FilePath path;
base::PathService::Get(base::FILE_EXE, &path);
std::string helper_name = "Helper";
if (base::EndsWith(path.value(), content::kMacHelperSuffix_renderer,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_renderer;
} else if (base::EndsWith(path.value(), content::kMacHelperSuffix_gpu,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_gpu;
} else if (base::EndsWith(path.value(), content::kMacHelperSuffix_plugin,
base::CompareCase::SENSITIVE)) {
helper_name += content::kMacHelperSuffix_plugin;
}
return frameworks_path.Append(name + " " + helper_name + ".app")
.Append("Contents")
.Append("MacOS")
.Append(name + " Helper");
.Append(name + " " + helper_name);
}
} // namespace

View File

@@ -18,6 +18,22 @@
#include "chrome/services/printing/public/cpp/manifest.h"
#endif
namespace {
// TODO(https://crbug.com/781334): Remove these helpers and just update the
// manifest definitions to be marked out-of-process. This is here only to avoid
// extra churn when transitioning away from content_packaged_services.
service_manager::Manifest MakeOutOfProcess(
const service_manager::Manifest& manifest) {
// cpplint.py emits a false positive [build/include_what_you_use]
service_manager::Manifest copy(manifest); // NOLINT
copy.options.execution_mode =
service_manager::Manifest::ExecutionMode::kOutOfProcessBuiltin;
return copy;
}
} // namespace
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
static base::NoDestructor<service_manager::Manifest> manifest{
service_manager::ManifestBuilder()
@@ -35,14 +51,14 @@ const service_manager::Manifest& GetElectronContentBrowserOverlayManifest() {
}
const std::vector<service_manager::Manifest>&
GetElectronPackagedServicesOverlayManifest() {
GetElectronBuiltinServiceManifests() {
static base::NoDestructor<std::vector<service_manager::Manifest>> manifests{{
proxy_resolver::GetManifest(),
MakeOutOfProcess(proxy_resolver::GetManifest()),
#if BUILDFLAG(ENABLE_PRINTING)
printing::GetPdfCompositorManifest(),
MakeOutOfProcess(printing::GetPdfCompositorManifest()),
#endif
#if BUILDFLAG(ENABLE_PRINT_PREVIEW)
GetChromePrintingManifest(),
MakeOutOfProcess(GetChromePrintingManifest()),
#endif
}};
return *manifests;

View File

@@ -11,6 +11,6 @@
const service_manager::Manifest& GetElectronContentBrowserOverlayManifest();
const std::vector<service_manager::Manifest>&
GetElectronPackagedServicesOverlayManifest();
GetElectronBuiltinServiceManifests();
#endif // ATOM_APP_MANIFESTS_H_

View File

@@ -18,13 +18,17 @@
#include "atom/common/node_includes.h"
#include "base/command_line.h"
#include "base/feature_list.h"
#include "base/task/task_scheduler/task_scheduler.h"
#include "base/task/thread_pool/thread_pool.h"
#include "base/threading/thread_task_runner_handle.h"
#include "gin/array_buffer.h"
#include "gin/public/isolate_holder.h"
#include "gin/v8_initializer.h"
#include "native_mate/dictionary.h"
#if defined(_WIN64)
#include "atom/common/crash_reporter/crash_reporter_win.h"
#endif
namespace atom {
int NodeMain(int argc, char* argv[]) {
@@ -43,15 +47,9 @@ int NodeMain(int argc, char* argv[]) {
feature_list->InitializeFromCommandLine("", "");
base::FeatureList::SetInstance(std::move(feature_list));
gin::V8Initializer::LoadV8Snapshot(
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
gin::V8Initializer::LoadV8Natives();
// V8 requires a task scheduler apparently
base::TaskScheduler::CreateAndStartWithDefaultParams("Electron");
// Initialize gin::IsolateHolder.
JavascriptEnvironment gin_env(loop);
#if defined(_WIN64)
crash_reporter::CrashReporterWin::SetUnhandledExceptionFilter();
#endif
// Explicitly register electron's builtin modules.
NodeBindings::RegisterBuiltinModules();
@@ -60,14 +58,31 @@ int NodeMain(int argc, char* argv[]) {
const char** exec_argv;
node::Init(&argc, const_cast<const char**>(argv), &exec_argc, &exec_argv);
node::Environment* env = node::CreateEnvironment(
node::CreateIsolateData(gin_env.isolate(), loop, gin_env.platform()),
gin_env.context(), argc, argv, exec_argc, exec_argv);
gin::V8Initializer::LoadV8Snapshot(
gin::V8Initializer::V8SnapshotFileType::kWithAdditionalContext);
gin::V8Initializer::LoadV8Natives();
// V8 requires a task scheduler apparently
base::ThreadPoolInstance::CreateAndStartWithDefaultParams("Electron");
// Initialize gin::IsolateHolder.
JavascriptEnvironment gin_env(loop);
node::IsolateData* isolate_data =
node::CreateIsolateData(gin_env.isolate(), loop, gin_env.platform());
CHECK_NE(nullptr, isolate_data);
node::Environment* env =
node::CreateEnvironment(isolate_data, gin_env.context(), argc, argv,
exec_argc, exec_argv, false);
CHECK_NE(nullptr, env);
// Enable support for v8 inspector.
NodeDebugger node_debugger(env);
node_debugger.Start();
node::BootstrapEnvironment(env);
mate::Dictionary process(gin_env.isolate(), env->process_object());
#if defined(OS_WIN)
process.SetMethod("log", &ElectronBindings::Log);
@@ -101,21 +116,26 @@ int NodeMain(int argc, char* argv[]) {
}
} while (more == true);
node_debugger.Stop();
exit_code = node::EmitExit(env);
env->set_can_call_into_js(false);
node::RunAtExit(env);
gin_env.platform()->DrainTasks(env->isolate());
gin_env.platform()->CancelPendingDelayedTasks(env->isolate());
gin_env.platform()->UnregisterIsolate(env->isolate());
v8::Isolate* isolate = env->isolate();
node::FreeEnvironment(env);
node::FreeIsolateData(isolate_data);
gin_env.platform()->DrainTasks(isolate);
gin_env.platform()->CancelPendingDelayedTasks(isolate);
gin_env.platform()->UnregisterIsolate(isolate);
}
// According to "src/gin/shell/gin_main.cc":
//
// gin::IsolateHolder waits for tasks running in TaskScheduler in its
// destructor and thus must be destroyed before TaskScheduler starts skipping
// gin::IsolateHolder waits for tasks running in ThreadPool in its
// destructor and thus must be destroyed before ThreadPool starts skipping
// CONTINUE_ON_SHUTDOWN tasks.
base::TaskScheduler::GetInstance()->Shutdown();
base::ThreadPoolInstance::Get()->Shutdown();
v8::V8::Dispose();

View File

@@ -84,6 +84,7 @@ struct Converter<Browser::UserTask> {
return false;
dict.Get("arguments", &(out->arguments));
dict.Get("description", &(out->description));
dict.Get("workingDirectory", &(out->working_dir));
return true;
}
};
@@ -157,6 +158,7 @@ struct Converter<JumpListItem> {
dict.Get("args", &(out->arguments));
dict.Get("description", &(out->description));
dict.Get("workingDirectory", &(out->working_dir));
return true;
case JumpListItem::Type::SEPARATOR:
@@ -183,6 +185,7 @@ struct Converter<JumpListItem> {
dict.Set("iconPath", val.icon_path);
dict.Set("iconIndex", val.icon_index);
dict.Set("description", val.description);
dict.Set("workingDirectory", val.working_dir);
break;
case JumpListItem::Type::SEPARATOR:
@@ -529,9 +532,9 @@ int ImportIntoCertStore(CertificateManagerModel* model,
}
#endif
void OnIconDataAvailable(util::Promise promise, gfx::Image* icon) {
if (icon && !icon->IsEmpty()) {
promise.Resolve(*icon);
void OnIconDataAvailable(util::Promise promise, gfx::Image icon) {
if (!icon.IsEmpty()) {
promise.Resolve(icon);
} else {
promise.RejectWithErrorMessage("Failed to get file icon.");
}
@@ -672,7 +675,7 @@ void App::OnLogin(scoped_refptr<LoginHandler> login_handler,
if (web_contents) {
prevent_default = Emit(
"login", WebContents::FromOrCreate(isolate(), web_contents),
request_details, login_handler->auth_info(),
request_details, *login_handler->auth_info(),
base::Bind(&PassLoginInformation, base::RetainedRef(login_handler)));
}
@@ -718,7 +721,7 @@ void App::AllowCertificateError(
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
content::ResourceType resource_type,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
@@ -857,8 +860,15 @@ base::FilePath App::GetPath(mate::Arguments* args, const std::string& name) {
int key = GetPathConstant(name);
if (key >= 0)
succeed = base::PathService::Get(key, &path);
if (!succeed)
args->ThrowError("Failed to get '" + name + "' path");
if (!succeed) {
if (name == "logs") {
args->ThrowError("Failed to get '" + name +
"' path: setAppLogsPath() must be called first.");
} else {
args->ThrowError("Failed to get '" + name + "' path");
}
}
return path;
}
@@ -1056,7 +1066,7 @@ Browser::LoginItemSettings App::GetLoginItemSettings(mate::Arguments* args) {
#if defined(USE_NSS_CERTS)
void App::ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback) {
net::CompletionRepeatingCallback callback) {
auto browser_context = AtomBrowserContext::From("", false);
if (!certificate_manager_model_) {
auto copy = base::DictionaryValue::From(
@@ -1069,17 +1079,17 @@ void App::ImportCertificate(const base::DictionaryValue& options,
}
int rv = ImportIntoCertStore(certificate_manager_model_.get(), options);
callback.Run(rv);
std::move(callback).Run(rv);
}
void App::OnCertificateManagerModelCreated(
std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
std::unique_ptr<CertificateManagerModel> model) {
certificate_manager_model_ = std::move(model);
int rv =
ImportIntoCertStore(certificate_manager_model_.get(), *(options.get()));
callback.Run(rv);
std::move(callback).Run(rv);
}
#endif
@@ -1268,6 +1278,21 @@ void App::EnableSandbox(mate::Arguments* args) {
command_line->AppendSwitch(switches::kEnableSandbox);
}
void App::SetUserAgentFallback(const std::string& user_agent) {
AtomBrowserClient::Get()->SetUserAgent(user_agent);
}
std::string App::GetUserAgentFallback() {
return AtomBrowserClient::Get()->GetUserAgent();
}
void App::SetBrowserClientCanUseCustomSiteInstance(bool should_disable) {
AtomBrowserClient::Get()->SetCanUseCustomSiteInstance(should_disable);
}
bool App::CanBrowserClientUseCustomSiteInstance() {
return AtomBrowserClient::Get()->CanUseCustomSiteInstance();
}
#if defined(OS_MACOSX)
bool App::MoveToApplicationsFolder(mate::Arguments* args) {
return ui::cocoa::AtomBundleMover::Move(args);
@@ -1277,8 +1302,11 @@ bool App::IsInApplicationsFolder() {
return ui::cocoa::AtomBundleMover::IsCurrentAppInApplicationsFolder();
}
int DockBounce(const std::string& type) {
int DockBounce(mate::Arguments* args) {
int request_id = -1;
std::string type = "informational";
args->GetNext(&type);
if (type == "critical")
request_id = Browser::Get()->DockBounce(Browser::BOUNCE_CRITICAL);
else if (type == "informational")
@@ -1428,7 +1456,12 @@ void App::BuildPrototype(v8::Isolate* isolate,
#if defined(OS_MACOSX)
.SetProperty("dock", &App::GetDockAPI)
#endif
.SetMethod("enableSandbox", &App::EnableSandbox);
.SetProperty("userAgentFallback", &App::GetUserAgentFallback,
&App::SetUserAgentFallback)
.SetMethod("enableSandbox", &App::EnableSandbox)
.SetProperty("allowRendererProcessReuse",
&App::CanBrowserClientUseCustomSiteInstance,
&App::SetBrowserClientCanUseCustomSiteInstance);
}
} // namespace api

View File

@@ -27,7 +27,8 @@
#include "content/public/browser/render_process_host.h"
#include "native_mate/dictionary.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
#include "net/base/completion_once_callback.h"
#include "net/base/completion_repeating_callback.h"
#include "net/ssl/client_cert_identity.h"
#if defined(USE_NSS_CERTS)
@@ -78,7 +79,7 @@ class App : public AtomBrowserClient::Delegate,
#if defined(USE_NSS_CERTS)
void OnCertificateManagerModelCreated(
std::unique_ptr<base::DictionaryValue> options,
const net::CompletionCallback& callback,
net::CompletionOnceCallback callback,
std::unique_ptr<CertificateManagerModel> model);
#endif
@@ -129,7 +130,7 @@ class App : public AtomBrowserClient::Delegate,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
content::ResourceType resource_type,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
@@ -199,7 +200,7 @@ class App : public AtomBrowserClient::Delegate,
Browser::LoginItemSettings GetLoginItemSettings(mate::Arguments* args);
#if defined(USE_NSS_CERTS)
void ImportCertificate(const base::DictionaryValue& options,
const net::CompletionCallback& callback);
net::CompletionRepeatingCallback callback);
#endif
v8::Local<v8::Promise> GetFileIcon(const base::FilePath& path,
mate::Arguments* args);
@@ -209,6 +210,10 @@ class App : public AtomBrowserClient::Delegate,
v8::Local<v8::Promise> GetGPUInfo(v8::Isolate* isolate,
const std::string& info_type);
void EnableSandbox(mate::Arguments* args);
void SetUserAgentFallback(const std::string& user_agent);
std::string GetUserAgentFallback();
void SetBrowserClientCanUseCustomSiteInstance(bool should_disable);
bool CanBrowserClientUseCustomSiteInstance();
#if defined(OS_MACOSX)
bool MoveToApplicationsFolder(mate::Arguments* args);

View File

@@ -64,11 +64,17 @@ void AutoUpdater::OnError(const std::string& message,
auto errorObject =
error->ToObject(isolate()->GetCurrentContext()).ToLocalChecked();
auto context = isolate()->GetCurrentContext();
// add two new params for better error handling
errorObject->Set(mate::StringToV8(isolate(), "code"),
v8::Integer::New(isolate(), code));
errorObject->Set(mate::StringToV8(isolate(), "domain"),
mate::StringToV8(isolate(), domain));
errorObject
->Set(context, mate::StringToV8(isolate(), "code"),
v8::Integer::New(isolate(), code))
.Check();
errorObject
->Set(context, mate::StringToV8(isolate(), "domain"),
mate::StringToV8(isolate(), domain))
.Check();
mate::EmitEvent(isolate(), GetWrapper(), "error", errorObject, message);
}

View File

@@ -67,7 +67,7 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate,
}
web_contents_.Reset(isolate, web_contents.ToV8());
api_web_contents_ = web_contents.get();
api_web_contents_ = web_contents->GetWeakPtr();
api_web_contents_->AddObserver(this);
Observe(api_web_contents_->web_contents());
@@ -85,8 +85,7 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate,
InitWith(isolate, wrapper);
#if defined(OS_MACOSX)
if (!window()->has_frame())
OverrideNSWindowContentView(web_contents->managed_web_contents());
OverrideNSWindowContentView(web_contents->managed_web_contents());
#endif
// Init window after everything has been setup.
@@ -94,7 +93,9 @@ BrowserWindow::BrowserWindow(v8::Isolate* isolate,
}
BrowserWindow::~BrowserWindow() {
api_web_contents_->RemoveObserver(this);
// FIXME This is a hack rather than a proper fix preventing shutdown crashes.
if (api_web_contents_)
api_web_contents_->RemoveObserver(this);
// Note that the OnWindowClosed will not be called after the destructor runs,
// since the window object is managed by the TopLevelWindow class.
if (web_contents())
@@ -308,6 +309,16 @@ void BrowserWindow::SetBackgroundColor(const std::string& color_name) {
auto* view = web_contents()->GetRenderWidgetHostView();
if (view)
view->SetBackgroundColor(ParseHexColor(color_name));
// Also update the web preferences object otherwise the view will be reset on
// the next load URL call
if (api_web_contents_) {
auto* web_preferences =
WebContentsPreferences::From(api_web_contents_->web_contents());
if (web_preferences) {
web_preferences->preference()->SetStringKey(options::kBackgroundColor,
color_name);
}
}
}
void BrowserWindow::SetBrowserView(v8::Local<v8::Value> value) {

View File

@@ -116,7 +116,7 @@ class BrowserWindow : public TopLevelWindow,
#endif
v8::Global<v8::Value> web_contents_;
api::WebContents* api_web_contents_;
base::WeakPtr<api::WebContents> api_web_contents_;
base::WeakPtrFactory<BrowserWindow> weak_factory_;

View File

@@ -283,7 +283,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
net::CanonicalCookie::CreateSanitizedCookie(
url, name, value, domain, path, creation_time, expiration_time,
last_access_time, secure, http_only,
net::CookieSameSite::DEFAULT_MODE, net::COOKIE_PRIORITY_DEFAULT));
net::CookieSameSite::NO_RESTRICTION, net::COOKIE_PRIORITY_DEFAULT));
auto completion_callback = base::BindOnce(OnSetCookie, std::move(promise));
if (!canonical_cookie || !canonical_cookie->IsCanonical()) {
std::move(completion_callback)
@@ -291,7 +291,7 @@ void SetCookieOnIO(scoped_refptr<net::URLRequestContextGetter> getter,
EXCLUDE_FAILURE_TO_STORE);
return;
}
if (url.is_empty()) {
if (!url.is_valid()) {
std::move(completion_callback)
.Run(net::CanonicalCookie::CookieInclusionStatus::
EXCLUDE_INVALID_DOMAIN);

View File

@@ -165,8 +165,12 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
std::vector<std::string> device_names;
// Crucially, this list of device names will be in the same order as
// |media_list_sources|.
webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names);
if (!webrtc::DxgiDuplicatorController::Instance()->GetDeviceNames(
&device_names)) {
Emit("error", "Failed to get sources.");
return;
}
int device_name_index = 0;
for (auto& source : screen_sources) {
const auto& device_name = device_names[device_name_index++];
@@ -176,13 +180,13 @@ void DesktopCapturer::UpdateSourcesList(DesktopMediaList* list) {
const int64_t device_id =
display::win::DisplayInfo::DeviceIdFromDeviceName(
wide_device_name.c_str());
source.display_id = base::Int64ToString(device_id);
source.display_id = base::NumberToString(device_id);
}
}
#elif defined(OS_MACOSX)
// On Mac, the IDs across the APIs match.
for (auto& source : screen_sources) {
source.display_id = base::Int64ToString(source.media_list_source.id.id);
source.display_id = base::NumberToString(source.media_list_source.id.id);
}
#endif // defined(OS_WIN)
// TODO(ajmacd): Add Linux support. The IDs across APIs differ but Chrome
@@ -222,7 +226,7 @@ void Initialize(v8::Local<v8::Object> exports,
void* priv) {
v8::Isolate* isolate = context->GetIsolate();
mate::Dictionary dict(isolate, exports);
dict.Set("desktopCapturer", atom::api::DesktopCapturer::Create(isolate));
dict.SetMethod("createDesktopCapturer", &atom::api::DesktopCapturer::Create);
}
} // namespace

View File

@@ -61,7 +61,7 @@ struct Converter<in_app_purchase::Product> {
dict.Set("formattedPrice", val.formattedPrice);
// Downloadable Content Information
dict.Set("isDownloadable", val.downloadable);
dict.Set("isDownloadable", val.isDownloadable);
return dict.GetHandle();
}

View File

@@ -11,6 +11,7 @@
#include "atom/browser/api/atom_api_top_level_window.h"
#include "atom/browser/api/trackable_object.h"
#include "atom/browser/ui/atom_menu_model.h"
#include "atom/common/api/locker.h"
#include "base/callback.h"
namespace atom {

View File

@@ -53,15 +53,18 @@ void MenuMac::PopupOnUI(const base::WeakPtr<NativeWindow>& native_window,
int y,
int positioning_item,
base::Closure callback) {
mate::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
if (!native_window)
return;
NSWindow* nswindow = native_window->GetNativeWindow().GetNativeNSWindow();
auto close_callback = base::Bind(
&MenuMac::OnClosed, weak_factory_.GetWeakPtr(), window_id, callback);
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>([
[AtomMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
popup_controllers_[window_id] = base::scoped_nsobject<AtomMenuController>(
[[AtomMenuController alloc] initWithModel:model()
useDefaultAccelerator:NO]);
NSMenu* menu = [popup_controllers_[window_id] menu];
NSView* view = [nswindow contentView];
@@ -135,9 +138,9 @@ void MenuMac::OnClosed(int32_t window_id, base::Closure callback) {
// static
void Menu::SetApplicationMenu(Menu* base_menu) {
MenuMac* menu = static_cast<MenuMac*>(base_menu);
base::scoped_nsobject<AtomMenuController> menu_controller([
[AtomMenuController alloc] initWithModel:menu->model_.get()
useDefaultAccelerator:YES]);
base::scoped_nsobject<AtomMenuController> menu_controller(
[[AtomMenuController alloc] initWithModel:menu->model_.get()
useDefaultAccelerator:YES]);
NSRunLoop* currentRunLoop = [NSRunLoop currentRunLoop];
[currentRunLoop cancelPerformSelector:@selector(setMainMenu:)

View File

@@ -26,6 +26,9 @@ void MenuViews::PopupAt(TopLevelWindow* window,
int y,
int positioning_item,
const base::Closure& callback) {
mate::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
auto* native_window = static_cast<NativeWindowViews*>(window->window());
if (!native_window)
return;
@@ -52,7 +55,7 @@ void MenuViews::PopupAt(TopLevelWindow* window,
std::make_unique<MenuRunner>(model(), flags, close_callback);
menu_runners_[window_id]->RunMenuAt(
native_window->widget(), NULL, gfx::Rect(location, gfx::Size()),
views::MENU_ANCHOR_TOPLEFT, ui::MENU_SOURCE_MOUSE);
views::MenuAnchorPosition::kTopLeft, ui::MENU_SOURCE_MOUSE);
}
void MenuViews::ClosePopupAt(int32_t window_id) {

View File

@@ -51,6 +51,19 @@ std::vector<std::string> MetricsToArray(uint32_t metrics) {
return array;
}
void DelayEmit(Screen* screen,
const base::StringPiece& name,
const display::Display& display) {
screen->Emit(name, display);
}
void DelayEmitWithMetrics(Screen* screen,
const base::StringPiece& name,
const display::Display& display,
const std::vector<std::string>& metrics) {
screen->Emit(name, display, metrics);
}
} // namespace
Screen::Screen(v8::Isolate* isolate, display::Screen* screen)
@@ -100,16 +113,23 @@ static gfx::Rect DIPToScreenRect(atom::NativeWindow* window,
#endif
void Screen::OnDisplayAdded(const display::Display& new_display) {
Emit("display-added", new_display);
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
FROM_HERE, base::Bind(&DelayEmit, base::Unretained(this), "display-added",
new_display));
}
void Screen::OnDisplayRemoved(const display::Display& old_display) {
Emit("display-removed", old_display);
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
FROM_HERE, base::Bind(&DelayEmit, base::Unretained(this),
"display-removed", old_display));
}
void Screen::OnDisplayMetricsChanged(const display::Display& display,
uint32_t changed_metrics) {
Emit("display-metrics-changed", display, MetricsToArray(changed_metrics));
base::ThreadTaskRunnerHandle::Get()->PostNonNestableTask(
FROM_HERE, base::Bind(&DelayEmitWithMetrics, base::Unretained(this),
"display-metrics-changed", display,
MetricsToArray(changed_metrics)));
}
// static

View File

@@ -48,9 +48,8 @@
#include "content/public/browser/storage_partition.h"
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/base/completion_repeating_callback.h"
#include "net/base/load_flags.h"
#include "net/disk_cache/disk_cache.h"
#include "net/dns/host_cache.h" // nogncheck
#include "net/http/http_auth_handler_factory.h"
#include "net/http/http_auth_preferences.h"
#include "net/http/http_cache.h"
@@ -209,73 +208,6 @@ const char kPersistPrefix[] = "persist:";
// Referenced session objects.
std::map<uint32_t, v8::Global<v8::Object>> g_sessions;
void ResolveOrRejectPromiseInUI(util::Promise promise, int net_error) {
if (net_error != net::OK) {
std::string err_msg = net::ErrorToString(net_error);
util::Promise::RejectPromise(std::move(promise), std::move(err_msg));
} else {
util::Promise::ResolveEmptyPromise(std::move(promise));
}
}
// Callback of HttpCache::GetBackend.
void OnGetBackend(disk_cache::Backend** backend_ptr,
Session::CacheAction action,
const util::CopyablePromise& promise,
int result) {
if (result != net::OK) {
std::string err_msg =
"Failed to retrieve cache backend: " + net::ErrorToString(result);
util::Promise::RejectPromise(promise.GetPromise(), std::move(err_msg));
} else if (backend_ptr && *backend_ptr) {
if (action == Session::CacheAction::CLEAR) {
auto success =
(*backend_ptr)
->DoomAllEntries(base::BindOnce(&ResolveOrRejectPromiseInUI,
promise.GetPromise()));
if (success != net::ERR_IO_PENDING)
ResolveOrRejectPromiseInUI(promise.GetPromise(), success);
} else if (action == Session::CacheAction::STATS) {
base::StringPairs stats;
(*backend_ptr)->GetStats(&stats);
for (const auto& stat : stats) {
if (stat.first == "Current size") {
int current_size;
base::StringToInt(stat.second, &current_size);
util::Promise::ResolvePromise<int>(promise.GetPromise(),
current_size);
break;
}
}
}
}
}
void DoCacheActionInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
Session::CacheAction action,
util::Promise promise) {
auto* request_context = context_getter->GetURLRequestContext();
auto* http_cache = request_context->http_transaction_factory()->GetCache();
if (!http_cache) {
std::string err_msg =
"Failed to retrieve cache: " + net::ErrorToString(net::ERR_FAILED);
util::Promise::RejectPromise(std::move(promise), std::move(err_msg));
return;
}
// Call GetBackend and make the backend's ptr accessable in OnGetBackend.
using BackendPtr = disk_cache::Backend*;
auto** backend_ptr = new BackendPtr(nullptr);
net::CompletionCallback on_get_backend =
base::Bind(&OnGetBackend, base::Owned(backend_ptr), action,
util::CopyablePromise(promise));
int rv = http_cache->GetBackend(backend_ptr, on_get_backend);
if (rv != net::ERR_IO_PENDING)
on_get_backend.Run(net::OK);
}
void SetCertVerifyProcInIO(
const scoped_refptr<net::URLRequestContextGetter>& context_getter,
const AtomCertVerifier::VerifyProc& proc) {
@@ -351,8 +283,8 @@ void DownloadIdCallback(content::DownloadManager* download_manager,
uint32_t id) {
download_manager->CreateDownloadItem(
base::GenerateGUID(), id, path, path, url_chain, GURL(), GURL(), GURL(),
GURL(), mime_type, mime_type, start_time, base::Time(), etag,
last_modified, offset, length, std::string(),
GURL(), base::nullopt, mime_type, mime_type, start_time, base::Time(),
etag, last_modified, offset, length, std::string(),
download::DownloadItem::INTERRUPTED,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download::DOWNLOAD_INTERRUPT_REASON_NETWORK_TIMEOUT, false, base::Time(),
@@ -365,8 +297,9 @@ void DestroyGlobalHandle(v8::Isolate* isolate,
v8::HandleScope handle_scope(isolate);
if (!global_handle.IsEmpty()) {
v8::Local<v8::Value> local_handle = global_handle.Get(isolate);
if (local_handle->IsObject()) {
v8::Local<v8::Object> object = local_handle->ToObject(isolate);
v8::Local<v8::Object> object;
if (local_handle->IsObject() &&
local_handle->ToObject(isolate->GetCurrentContext()).ToLocal(&object)) {
void* ptr = object->GetAlignedPointerFromInternalField(0);
if (!ptr)
return;
@@ -436,17 +369,39 @@ v8::Local<v8::Promise> Session::ResolveProxy(mate::Arguments* args) {
return handle;
}
template <Session::CacheAction action>
v8::Local<v8::Promise> Session::DoCacheAction() {
v8::Isolate* isolate = v8::Isolate::GetCurrent();
util::Promise promise(isolate);
v8::Local<v8::Promise> handle = promise.GetHandle();
v8::Local<v8::Promise> Session::GetCacheSize() {
auto* isolate = v8::Isolate::GetCurrent();
auto promise = util::Promise(isolate);
auto handle = promise.GetHandle();
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&DoCacheActionInIO,
WrapRefCounted(browser_context_->GetRequestContext()),
action, std::move(promise)));
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
->GetNetworkContext()
->ComputeHttpCacheSize(base::Time(), base::Time::Max(),
base::BindOnce(
[](util::Promise promise, bool is_upper_bound,
int64_t size_or_error) {
if (size_or_error < 0) {
promise.RejectWithErrorMessage(
net::ErrorToString(size_or_error));
} else {
promise.Resolve(size_or_error);
}
},
std::move(promise)));
return handle;
}
v8::Local<v8::Promise> Session::ClearCache() {
auto* isolate = v8::Isolate::GetCurrent();
auto promise = util::Promise(isolate);
auto handle = promise.GetHandle();
content::BrowserContext::GetDefaultStoragePartition(browser_context_.get())
->GetNetworkContext()
->ClearHttpCache(base::Time(), base::Time::Max(), nullptr,
base::BindOnce(util::Promise::ResolveEmptyPromise,
std::move(promise)));
return handle;
}
@@ -557,6 +512,10 @@ void WrapVerifyProc(base::Callback<void(const VerifyRequestParams& request,
base::Callback<void(int)>)> proc,
const VerifyRequestParams& request,
base::OnceCallback<void(int)> cb) {
if (proc.is_null()) {
LOG(ERROR) << "WrapVerifyProc (proc=null)";
return;
}
proc.Run(request, base::AdaptCallbackForRepeating(std::move(cb)));
}
@@ -579,14 +538,33 @@ void Session::SetCertVerifyProc(v8::Local<v8::Value> val,
void Session::SetPermissionRequestHandler(v8::Local<v8::Value> val,
mate::Arguments* args) {
AtomPermissionManager::RequestHandler handler;
if (!(val->IsNull() || mate::ConvertFromV8(args->isolate(), val, &handler))) {
auto* permission_manager = static_cast<AtomPermissionManager*>(
browser_context()->GetPermissionControllerDelegate());
if (val->IsNull()) {
permission_manager->SetPermissionRequestHandler(
AtomPermissionManager::RequestHandler());
return;
}
using StatusCallback =
base::RepeatingCallback<void(blink::mojom::PermissionStatus)>;
using RequestHandler =
base::Callback<void(content::WebContents*, content::PermissionType,
StatusCallback, const base::Value&)>;
auto handler = std::make_unique<RequestHandler>();
if (!mate::ConvertFromV8(args->isolate(), val, handler.get())) {
args->ThrowError("Must pass null or function");
return;
}
auto* permission_manager = static_cast<AtomPermissionManager*>(
browser_context()->GetPermissionControllerDelegate());
permission_manager->SetPermissionRequestHandler(handler);
permission_manager->SetPermissionRequestHandler(base::BindRepeating(
[](RequestHandler* handler, content::WebContents* web_contents,
content::PermissionType permission_type,
AtomPermissionManager::StatusCallback callback,
const base::Value& details) {
handler->Run(web_contents, permission_type,
base::AdaptCallbackForRepeating(std::move(callback)),
details);
},
base::Owned(std::move(handler))));
}
void Session::SetPermissionCheckHandler(v8::Local<v8::Value> val,
@@ -791,8 +769,8 @@ void Session::BuildPrototype(v8::Isolate* isolate,
mate::ObjectTemplateBuilder(isolate, prototype->PrototypeTemplate())
.MakeDestroyable()
.SetMethod("resolveProxy", &Session::ResolveProxy)
.SetMethod("getCacheSize", &Session::DoCacheAction<CacheAction::STATS>)
.SetMethod("clearCache", &Session::DoCacheAction<CacheAction::CLEAR>)
.SetMethod("getCacheSize", &Session::GetCacheSize)
.SetMethod("clearCache", &Session::ClearCache)
.SetMethod("clearStorageData", &Session::ClearStorageData)
.SetMethod("flushStorageData", &Session::FlushStorageData)
.SetMethod("setProxy", &Session::SetProxy)

View File

@@ -15,7 +15,6 @@
#include "base/values.h"
#include "content/public/browser/download_manager.h"
#include "native_mate/handle.h"
#include "net/base/completion_callback.h"
class GURL;
@@ -64,8 +63,8 @@ class Session : public mate::TrackableObject<Session>,
// Methods.
v8::Local<v8::Promise> ResolveProxy(mate::Arguments* args);
template <CacheAction action>
v8::Local<v8::Promise> DoCacheAction();
v8::Local<v8::Promise> GetCacheSize();
v8::Local<v8::Promise> ClearCache();
v8::Local<v8::Promise> ClearStorageData(mate::Arguments* args);
void FlushStorageData();
v8::Local<v8::Promise> SetProxy(mate::Arguments* args);

View File

@@ -13,6 +13,7 @@
#include "atom/browser/mac/atom_application.h"
#include "atom/browser/mac/dict_util.h"
#include "atom/browser/ui/cocoa/NSColor+Hex.h"
#include "atom/common/native_mate_converters/gurl_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "base/mac/scoped_cftyperef.h"
@@ -24,6 +25,7 @@
#include "base/values.h"
#include "native_mate/object_template_builder.h"
#include "net/base/mac/url_conversions.h"
#include "ui/native_theme/native_theme.h"
namespace mate {
template <>
@@ -61,11 +63,11 @@ struct Converter<NSAppearance*> {
return v8::Null(isolate);
}
if (val.name == NSAppearanceNameAqua) {
if ([val.name isEqualToString:NSAppearanceNameAqua]) {
return mate::ConvertToV8(isolate, "light");
}
if (@available(macOS 10.14, *)) {
if (val.name == NSAppearanceNameDarkAqua) {
if ([val.name isEqualToString:NSAppearanceNameDarkAqua]) {
return mate::ConvertToV8(isolate, "dark");
}
}
@@ -111,21 +113,6 @@ std::string ConvertAuthorizationStatus(AVAuthorizationStatusMac status) {
}
}
// Convert color to RGBA value like "aabbccdd"
std::string ToRGBA(NSColor* color) {
return base::StringPrintf(
"%02X%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF), (int)(color.blueComponent * 0xFF),
(int)(color.alphaComponent * 0xFF));
}
// Convert color to RGB hex value like "#ABCDEF"
std::string ToRGBHex(NSColor* color) {
return base::StringPrintf("#%02X%02X%02X", (int)(color.redComponent * 0xFF),
(int)(color.greenComponent * 0xFF),
(int)(color.blueComponent * 0xFF));
}
} // namespace
void SystemPreferences::PostNotification(const std::string& name,
@@ -405,7 +392,7 @@ std::string SystemPreferences::GetAccentColor() {
if (@available(macOS 10.14, *))
sysColor = [NSColor controlAccentColor];
return ToRGBA(sysColor);
return base::SysNSStringToUTF8([sysColor RGBAValue]);
}
std::string SystemPreferences::GetSystemColor(const std::string& color,
@@ -434,7 +421,7 @@ std::string SystemPreferences::GetSystemColor(const std::string& color,
return "";
}
return ToRGBHex(sysColor);
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
}
bool SystemPreferences::CanPromptTouchID() {
@@ -587,7 +574,7 @@ std::string SystemPreferences::GetColor(const std::string& color,
return "";
}
return ToRGBHex(sysColor);
return base::SysNSStringToUTF8([sysColor hexadecimalValue]);
}
std::string SystemPreferences::GetMediaAccessStatus(
@@ -639,6 +626,9 @@ void SystemPreferences::RemoveUserDefault(const std::string& name) {
}
bool SystemPreferences::IsDarkMode() {
if (@available(macOS 10.15, *)) {
return ui::NativeTheme::GetInstanceForNativeUi()->SystemDarkModeEnabled();
}
NSString* mode = [[NSUserDefaults standardUserDefaults]
stringForKey:@"AppleInterfaceStyle"];
return [mode isEqualToString:@"Dark"];

View File

@@ -648,10 +648,11 @@ void TopLevelWindow::SetFocusable(bool focusable) {
}
void TopLevelWindow::SetMenu(v8::Isolate* isolate, v8::Local<v8::Value> value) {
auto context = isolate->GetCurrentContext();
mate::Handle<Menu> menu;
if (value->IsObject() &&
gin::V8ToString(
isolate, value->ToObject(isolate)->GetConstructorName()) == "Menu" &&
v8::Local<v8::Object> object;
if (value->IsObject() && value->ToObject(context).ToLocal(&object) &&
gin::V8ToString(isolate, object->GetConstructorName()) == "Menu" &&
mate::ConvertFromV8(isolate, value, &menu) && !menu.IsEmpty()) {
menu_.Reset(isolate, menu.ToV8());
window_->SetMenu(menu->model());

View File

@@ -59,11 +59,7 @@ Tray::Tray(v8::Isolate* isolate,
InitWith(isolate, wrapper);
}
Tray::~Tray() {
// Destroy the native tray in next tick.
base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE,
tray_icon_.release());
}
Tray::~Tray() = default;
// static
mate::WrappableBase* Tray::New(mate::Handle<NativeImage> image,
@@ -202,7 +198,7 @@ void Tray::DisplayBalloon(mate::Arguments* args,
#if defined(OS_WIN)
tray_icon_->DisplayBalloon(
icon.IsEmpty() ? NULL : icon->GetHICON(GetSystemMetrics(SM_CXSMICON)),
icon.IsEmpty() ? NULL : icon->GetHICON(GetSystemMetrics(SM_CXICON)),
title, content);
#else
tray_icon_->DisplayBalloon(icon.IsEmpty() ? gfx::Image() : icon->image(),

View File

@@ -354,7 +354,7 @@ void URLRequest::OnReceivedRedirect(
}
void URLRequest::OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info) {
const net::AuthChallengeInfo& auth_info) {
if (request_state_.Canceled() || request_state_.Closed()) {
return;
}
@@ -364,7 +364,7 @@ void URLRequest::OnAuthenticationRequired(
return;
}
Emit("login", auth_info.get(),
Emit("login", auth_info,
base::Bind(&AtomURLRequest::PassLoginInformation, atom_request_));
}

View File

@@ -105,8 +105,7 @@ class URLRequest : public mate::EventEmitter<URLRequest> {
const std::string& method,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers);
void OnAuthenticationRequired(
scoped_refptr<const net::AuthChallengeInfo> auth_info);
void OnAuthenticationRequired(const net::AuthChallengeInfo& auth_info);
void OnResponseStarted(
scoped_refptr<net::HttpResponseHeaders> response_headers);
void OnResponseData(scoped_refptr<const net::IOBufferWithSize> data);

View File

@@ -35,7 +35,6 @@
#include "atom/common/color_util.h"
#include "atom/common/mouse_util.h"
#include "atom/common/native_mate_converters/blink_converter.h"
#include "atom/common/native_mate_converters/callback.h"
#include "atom/common/native_mate_converters/content_converter.h"
#include "atom/common/native_mate_converters/file_path_converter.h"
#include "atom/common/native_mate_converters/gfx_converter.h"
@@ -43,12 +42,14 @@
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/native_mate_converters/net_converter.h"
#include "atom/common/native_mate_converters/network_converter.h"
#include "atom/common/native_mate_converters/once_callback.h"
#include "atom/common/native_mate_converters/string16_converter.h"
#include "atom/common/native_mate_converters/value_converter.h"
#include "atom/common/node_includes.h"
#include "atom/common/options_switches.h"
#include "base/message_loop/message_loop.h"
#include "base/no_destructor.h"
#include "base/optional.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -84,8 +85,10 @@
#include "native_mate/dictionary.h"
#include "native_mate/object_template_builder.h"
#include "net/url_request/url_request_context.h"
#include "ppapi/buildflags/buildflags.h"
#include "third_party/blink/public/common/associated_interfaces/associated_interface_provider.h"
#include "third_party/blink/public/mojom/frame/find_in_page.mojom.h"
#include "third_party/blink/public/platform/web_cursor_info.h"
#include "third_party/blink/public/platform/web_input_event.h"
#include "ui/display/screen.h"
#include "ui/events/base_event_utils.h"
@@ -97,6 +100,12 @@
#if !defined(OS_MACOSX)
#include "ui/aura/window.h"
#else
#include "ui/base/cocoa/defaults_utils.h"
#endif
#if defined(OS_LINUX)
#include "ui/views/linux_ui/linux_ui.h"
#endif
#if defined(OS_LINUX) || defined(OS_WIN)
@@ -266,7 +275,9 @@ struct WebContents::FrameDispatchHelper {
WebContents::WebContents(v8::Isolate* isolate,
content::WebContents* web_contents)
: content::WebContentsObserver(web_contents), type_(REMOTE) {
: content::WebContentsObserver(web_contents),
type_(REMOTE),
weak_factory_(this) {
web_contents->SetUserAgentOverride(GetBrowserContext()->GetUserAgent(),
false);
Init(isolate);
@@ -281,7 +292,9 @@ WebContents::WebContents(v8::Isolate* isolate,
WebContents::WebContents(v8::Isolate* isolate,
std::unique_ptr<content::WebContents> web_contents,
Type type)
: content::WebContentsObserver(web_contents.get()), type_(type) {
: content::WebContentsObserver(web_contents.get()),
type_(type),
weak_factory_(this) {
DCHECK(type != REMOTE) << "Can't take ownership of a remote WebContents";
auto session = Session::CreateFrom(isolate, GetBrowserContext());
session_.Reset(isolate, session.ToV8());
@@ -289,8 +302,8 @@ WebContents::WebContents(v8::Isolate* isolate,
mate::Dictionary::CreateEmpty(isolate));
}
WebContents::WebContents(v8::Isolate* isolate,
const mate::Dictionary& options) {
WebContents::WebContents(v8::Isolate* isolate, const mate::Dictionary& options)
: weak_factory_(this) {
// Read options.
options.Get("backgroundThrottling", &background_throttling_);
@@ -413,6 +426,25 @@ void WebContents::InitWithSessionAndOptions(
prefs->subpixel_rendering = params->subpixel_rendering;
#endif
// Honor the system's cursor blink rate settings
#if defined(OS_MACOSX)
base::TimeDelta interval;
if (ui::TextInsertionCaretBlinkPeriod(&interval))
prefs->caret_blink_interval = interval;
#elif defined(OS_LINUX)
views::LinuxUI* linux_ui = views::LinuxUI::instance();
if (linux_ui)
prefs->caret_blink_interval = linux_ui->GetCursorBlinkInterval();
#elif defined(OS_WIN)
const auto system_msec = ::GetCaretBlinkTime();
if (system_msec != 0) {
prefs->caret_blink_interval =
(system_msec == INFINITE)
? base::TimeDelta()
: base::TimeDelta::FromMilliseconds(system_msec);
}
#endif
// Save the preferences in C++.
new WebContentsPreferences(web_contents(), options);
@@ -490,12 +522,14 @@ void WebContents::DestroyWebContents(bool async) {
ResetManagedWebContents(async);
}
bool WebContents::DidAddMessageToConsole(content::WebContents* source,
int32_t level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
return Emit("console-message", level, message, line_no, source_id);
bool WebContents::DidAddMessageToConsole(
content::WebContents* source,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) {
return Emit("console-message", static_cast<int32_t>(level), message, line_no,
source_id);
}
void WebContents::OnCreateWindow(
@@ -800,27 +834,29 @@ void WebContents::RenderProcessGone(base::TerminationStatus status) {
void WebContents::PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) {
#if BUILDFLAG(ENABLE_PLUGINS)
content::WebPluginInfo info;
auto* plugin_service = content::PluginService::GetInstance();
plugin_service->GetPluginInfoByPath(plugin_path, &info);
Emit("plugin-crashed", info.name, info.version);
#endif // BUILDFLAG(ENABLE_PLUIGNS)
}
void WebContents::MediaStartedPlaying(const MediaPlayerInfo& video_type,
const MediaPlayerId& id) {
const content::MediaPlayerId& id) {
Emit("media-started-playing");
}
void WebContents::MediaStoppedPlaying(
const MediaPlayerInfo& video_type,
const MediaPlayerId& id,
const content::MediaPlayerId& id,
content::WebContentsObserver::MediaStoppedReason reason) {
Emit("media-paused");
}
void WebContents::DidChangeThemeColor(SkColor theme_color) {
if (theme_color != SK_ColorTRANSPARENT) {
Emit("did-change-theme-color", atom::ToRGBHex(theme_color));
void WebContents::DidChangeThemeColor(base::Optional<SkColor> theme_color) {
if (theme_color) {
Emit("did-change-theme-color", atom::ToRGBHex(theme_color.value()));
} else {
Emit("did-change-theme-color", nullptr);
}
@@ -833,6 +869,10 @@ void WebContents::OnInterfaceRequestFromFrame(
registry_.TryBindInterface(interface_name, interface_pipe, render_frame_host);
}
void WebContents::DidAcquireFullscreen(content::RenderFrameHost* rfh) {
set_fullscreen_frame(rfh);
}
void WebContents::DocumentLoadedInFrame(
content::RenderFrameHost* render_frame_host) {
if (!render_frame_host->GetParent())
@@ -1192,7 +1232,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
return;
}
const auto* render_view_host = contents->GetRenderViewHost();
auto* render_view_host = contents->GetRenderViewHost();
if (!render_view_host) {
return;
}
@@ -1211,7 +1251,7 @@ void WebContents::SetBackgroundThrottling(bool allowed) {
render_widget_host_impl->disable_hidden_ = !background_throttling_;
if (render_widget_host_impl->is_hidden()) {
render_widget_host_impl->WasShown(false);
render_widget_host_impl->WasShown(base::nullopt);
}
}
@@ -1915,10 +1955,9 @@ v8::Local<v8::Promise> WebContents::CapturePage(mate::Arguments* args) {
}
void WebContents::OnCursorChange(const content::WebCursor& cursor) {
content::CursorInfo info;
cursor.GetCursorInfo(&info);
const content::CursorInfo& info = cursor.info();
if (cursor.IsCustom()) {
if (info.type == blink::WebCursorInfo::kTypeCustom) {
Emit("cursor-changed", CursorTypeToString(info),
gfx::Image::CreateFrom1xBitmap(info.custom_image),
info.image_scale_factor,
@@ -2068,7 +2107,7 @@ v8::Local<v8::Value> WebContents::GetLastWebPreferences(
}
bool WebContents::IsRemoteModuleEnabled() const {
if (web_contents()->GetVisibleURL().SchemeIs("chrome-devtools")) {
if (web_contents()->GetVisibleURL().SchemeIs("devtools")) {
return false;
}
if (auto* web_preferences = WebContentsPreferences::From(web_contents())) {

View File

@@ -116,6 +116,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
base::WeakPtr<WebContents> GetWeakPtr() { return weak_factory_.GetWeakPtr(); }
// Destroy the managed content::WebContents instance.
//
// Note: The |async| should only be |true| when users are expecting to use the
@@ -337,7 +339,7 @@ class WebContents : public mate::TrackableObject<WebContents>,
// content::WebContentsDelegate:
bool DidAddMessageToConsole(content::WebContents* source,
int32_t level,
blink::mojom::ConsoleMessageLevel level,
const base::string16& message,
int32_t line_no,
const base::string16& source_id) override;
@@ -445,16 +447,17 @@ class WebContents : public mate::TrackableObject<WebContents>,
void PluginCrashed(const base::FilePath& plugin_path,
base::ProcessId plugin_pid) override;
void MediaStartedPlaying(const MediaPlayerInfo& video_type,
const MediaPlayerId& id) override;
const content::MediaPlayerId& id) override;
void MediaStoppedPlaying(
const MediaPlayerInfo& video_type,
const MediaPlayerId& id,
const content::MediaPlayerId& id,
content::WebContentsObserver::MediaStoppedReason reason) override;
void DidChangeThemeColor(SkColor theme_color) override;
void DidChangeThemeColor(base::Optional<SkColor> theme_color) override;
void OnInterfaceRequestFromFrame(
content::RenderFrameHost* render_frame_host,
const std::string& interface_name,
mojo::ScopedMessagePipeHandle* interface_pipe) override;
void DidAcquireFullscreen(content::RenderFrameHost* rfh) override;
// InspectableWebContentsDelegate:
void DevToolsReloadPage() override;
@@ -558,6 +561,8 @@ class WebContents : public mate::TrackableObject<WebContents>,
std::map<content::RenderFrameHost*, std::vector<mojo::BindingId>>
frame_to_bindings_map_;
base::WeakPtrFactory<WebContents> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(WebContents);
};

View File

@@ -4,6 +4,7 @@
#include "atom/browser/api/atom_api_web_request.h"
#include <set>
#include <string>
#include <utility>
@@ -20,23 +21,6 @@
using content::BrowserThread;
namespace mate {
template <>
struct Converter<URLPattern> {
static bool FromV8(v8::Isolate* isolate,
v8::Local<v8::Value> val,
URLPattern* out) {
std::string pattern;
if (!ConvertFromV8(isolate, val, &pattern))
return false;
*out = URLPattern(URLPattern::SCHEME_ALL);
return out->Parse(pattern) == URLPattern::ParseResult::kSuccess;
}
};
} // namespace mate
namespace atom {
namespace api {
@@ -84,7 +68,25 @@ void WebRequest::SetListener(Method method, Event type, mate::Arguments* args) {
// { urls }.
URLPatterns patterns;
mate::Dictionary dict;
args->GetNext(&dict) && dict.Get("urls", &patterns);
std::set<std::string> filter_patterns;
if (args->GetNext(&dict) && !dict.Get("urls", &filter_patterns)) {
args->ThrowError(
"onBeforeRequest parameter 'filter' must have property 'urls'.");
return;
}
URLPattern pattern(URLPattern::SCHEME_ALL);
for (const std::string& filter_pattern : filter_patterns) {
const URLPattern::ParseResult result = pattern.Parse(filter_pattern);
if (result == URLPattern::ParseResult::kSuccess) {
patterns.insert(pattern);
} else {
const char* error_type = URLPattern::GetParseResultString(result);
args->ThrowError("Invalid url pattern " + filter_pattern + ": " +
error_type);
}
}
// Function or null.
v8::Local<v8::Value> value;

View File

@@ -52,7 +52,10 @@ void Event::FrameDeleted(content::RenderFrameHost* rfh) {
}
void Event::PreventDefault(v8::Isolate* isolate) {
GetWrapper()->Set(StringToV8(isolate, "defaultPrevented"), v8::True(isolate));
GetWrapper()
->Set(isolate->GetCurrentContext(),
StringToV8(isolate, "defaultPrevented"), v8::True(isolate))
.Check();
}
bool Event::SendReply(const base::ListValue& result) {

View File

@@ -104,8 +104,13 @@ class EventEmitter : public Wrappable<T> {
v8::Locker locker(isolate());
v8::HandleScope handle_scope(isolate());
EmitEvent(isolate(), GetWrapper(), name, event, args...);
return event->Get(StringToV8(isolate(), "defaultPrevented"))
->BooleanValue(isolate());
auto context = isolate()->GetCurrentContext();
v8::Local<v8::Value> defaultPrevented;
if (event->Get(context, StringToV8(isolate(), "defaultPrevented"))
.ToLocal(&defaultPrevented)) {
return defaultPrevented->BooleanValue(isolate());
}
return false;
}
DISALLOW_COPY_AND_ASSIGN(EventEmitter);

View File

@@ -108,18 +108,6 @@ void GPUInfoEnumerator::EndAuxAttributes() {
value_stack.pop();
}
void GPUInfoEnumerator::BeginOverlayCapability() {
value_stack.push(std::move(current));
current = std::make_unique<base::DictionaryValue>();
}
void GPUInfoEnumerator::EndOverlayCapability() {
auto& top_value = value_stack.top();
top_value->SetDictionary(kOverlayCapabilityKey, std::move(current));
current = std::move(top_value);
value_stack.pop();
}
void GPUInfoEnumerator::BeginDx12VulkanVersionInfo() {
value_stack.push(std::move(current));
current = std::make_unique<base::DictionaryValue>();

View File

@@ -25,7 +25,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
const char* kImageDecodeAcceleratorSupportedProfileKey =
"imageDecodeAcceleratorSupportedProfile";
const char* kAuxAttributesKey = "auxAttributes";
const char* kOverlayCapabilityKey = "overlayCapability";
const char* kDx12VulkanVersionInfoKey = "dx12VulkanVersionInfo";
public:
@@ -47,8 +46,6 @@ class GPUInfoEnumerator final : public gpu::GPUInfo::Enumerator {
void EndImageDecodeAcceleratorSupportedProfile() override;
void BeginAuxAttributes() override;
void EndAuxAttributes() override;
void BeginOverlayCapability() override;
void EndOverlayCapability() override;
void BeginDx12VulkanVersionInfo() override;
void EndDx12VulkanVersionInfo() override;
std::unique_ptr<base::DictionaryValue> GetDictionary();

View File

@@ -76,11 +76,15 @@
#include "services/device/public/cpp/geolocation/location_provider.h"
#include "services/network/public/cpp/features.h"
#include "services/network/public/cpp/resource_request_body.h"
#include "services/proxy_resolver/public/mojom/proxy_resolver.mojom.h"
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/resource/resource_bundle.h"
#include "ui/native_theme/native_theme.h"
#include "v8/include/v8.h"
#if defined(OS_WIN)
#include "sandbox/win/src/sandbox_policy.h"
#endif
#if defined(USE_NSS_CERTS)
#include "net/ssl/client_cert_store_nss.h"
#elif defined(OS_WIN)
@@ -108,10 +112,13 @@
#if BUILDFLAG(ENABLE_PRINTING)
#include "chrome/browser/printing/printing_message_filter.h"
#include "chrome/services/printing/public/mojom/constants.mojom.h"
#include "components/services/pdf_compositor/public/interfaces/pdf_compositor.mojom.h"
#endif // BUILDFLAG(ENABLE_PRINTING)
#if defined(OS_MACOSX)
#include "content/common/mac_helpers.h"
#include "content/public/common/child_process_host.h"
#endif
using content::BrowserThread;
namespace atom {
@@ -391,6 +398,11 @@ void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host,
prefs->default_maximum_page_scale_factor = 1.f;
prefs->navigate_on_drag_drop = false;
ui::NativeTheme* native_theme = ui::NativeTheme::GetInstanceForNativeUi();
prefs->preferred_color_scheme = native_theme->SystemDarkModeEnabled()
? blink::PreferredColorScheme::kDark
: blink::PreferredColorScheme::kLight;
SetFontDefaults(prefs);
// Custom preferences of guest page.
@@ -400,12 +412,21 @@ void AtomBrowserClient::OverrideWebkitPrefs(content::RenderViewHost* host,
web_preferences->OverrideWebkitPrefs(prefs);
}
void AtomBrowserClient::SetCanUseCustomSiteInstance(bool should_disable) {
disable_process_restart_tricks_ = should_disable;
}
bool AtomBrowserClient::CanUseCustomSiteInstance() {
return disable_process_restart_tricks_;
}
content::ContentBrowserClient::SiteInstanceForNavigationType
AtomBrowserClient::ShouldOverrideSiteInstanceForNavigation(
content::RenderFrameHost* current_rfh,
content::RenderFrameHost* speculative_rfh,
content::BrowserContext* browser_context,
const GURL& url,
bool has_navigation_started,
bool has_response_started,
content::SiteInstance** affinity_site_instance) const {
if (g_suppress_renderer_process_restart) {
@@ -440,6 +461,13 @@ AtomBrowserClient::ShouldOverrideSiteInstanceForNavigation(
return SiteInstanceForNavigationType::FORCE_CURRENT;
}
if (!has_navigation_started) {
// If the navigation didn't start yet, ignore any candidate site instance.
// If such instance exists, it belongs to a previous navigation still
// taking place. Fixes https://github.com/electron/electron/issues/17576.
return SiteInstanceForNavigationType::FORCE_NEW;
}
return SiteInstanceForNavigationType::FORCE_CANDIDATE_OR_NEW;
}
@@ -460,11 +488,28 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
int process_id) {
// Make sure we're about to launch a known executable
{
base::FilePath child_path;
base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
base::ThreadRestrictions::ScopedAllowIO allow_io;
CHECK(base::MakeAbsoluteFilePath(command_line->GetProgram()) == child_path);
base::FilePath child_path;
base::FilePath program =
base::MakeAbsoluteFilePath(command_line->GetProgram());
#if defined(OS_MACOSX)
auto renderer_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_RENDERER);
auto gpu_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_GPU);
auto plugin_child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_PLUGIN);
if (program != renderer_child_path && program != gpu_child_path &&
program != plugin_child_path) {
child_path = content::ChildProcessHost::GetChildPath(
content::ChildProcessHost::CHILD_NORMAL);
CHECK_EQ(program, child_path)
<< "Aborted from launching unexpected helper executable";
}
#else
base::PathService::Get(content::CHILD_PROCESS_EXE, &child_path);
CHECK_EQ(program, child_path);
#endif
}
std::string process_type =
@@ -498,7 +543,7 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
content::WebContents* web_contents = GetWebContentsFromProcessID(process_id);
if (web_contents) {
if (web_contents->GetVisibleURL().SchemeIs("chrome-devtools")) {
if (web_contents->GetVisibleURL().SchemeIs("devtools")) {
command_line->AppendSwitch(switches::kDisableRemoteModule);
}
auto* web_preferences = WebContentsPreferences::From(web_contents);
@@ -506,6 +551,10 @@ void AtomBrowserClient::AppendExtraCommandLineSwitches(
web_preferences->AppendCommandLineSwitches(command_line);
SessionPreferences::AppendExtraCommandLineSwitches(
web_contents->GetBrowserContext(), command_line);
if (CanUseCustomSiteInstance()) {
command_line->AppendSwitch(
switches::kDisableElectronSiteInstanceOverrides);
}
}
}
@@ -534,7 +583,7 @@ std::string AtomBrowserClient::GetGeolocationApiKey() {
return api_key;
}
content::QuotaPermissionContext*
scoped_refptr<content::QuotaPermissionContext>
AtomBrowserClient::CreateQuotaPermissionContext() {
return new AtomQuotaPermissionContext;
}
@@ -555,14 +604,14 @@ void AtomBrowserClient::AllowCertificateError(
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
content::ResourceType resource_type,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
callback) {
if (delegate_) {
delegate_->AllowCertificateError(
web_contents, cert_error, ssl_info, request_url, resource_type,
web_contents, cert_error, ssl_info, request_url, is_main_frame_request,
strict_enforcement, expired_previous_decision, callback);
}
}
@@ -606,11 +655,6 @@ bool AtomBrowserClient::CanCreateWindow(
int opener_render_process_id = opener->GetProcess()->GetID();
if (IsRendererSandboxed(opener_render_process_id)) {
*no_javascript_access = false;
return true;
}
if (RendererUsesNativeWindowOpen(opener_render_process_id)) {
if (RendererDisablesPopups(opener_render_process_id)) {
// <webview> without allowpopups attribute should return
@@ -705,43 +749,26 @@ network::mojom::NetworkContext* AtomBrowserClient::GetSystemNetworkContext() {
return g_browser_process->system_network_context_manager()->GetContext();
}
void AtomBrowserClient::RegisterOutOfProcessServices(
OutOfProcessServiceMap* services) {
(*services)[proxy_resolver::mojom::kProxyResolverServiceName] =
base::BindRepeating(&l10n_util::GetStringUTF16,
IDS_UTILITY_PROCESS_PROXY_RESOLVER_NAME);
#if BUILDFLAG(ENABLE_PRINTING)
(*services)[printing::mojom::kServiceName] =
base::BindRepeating(&l10n_util::GetStringUTF16,
IDS_UTILITY_PROCESS_PDF_COMPOSITOR_SERVICE_NAME);
(*services)[printing::mojom::kChromePrintingServiceName] =
base::BindRepeating(&l10n_util::GetStringUTF16,
IDS_UTILITY_PROCESS_PRINTING_SERVICE_NAME);
#endif
}
base::Optional<service_manager::Manifest>
AtomBrowserClient::GetServiceManifestOverlay(base::StringPiece name) {
if (name == content::mojom::kBrowserServiceName) {
if (name == content::mojom::kBrowserServiceName)
return GetElectronContentBrowserOverlayManifest();
} else if (name == content::mojom::kPackagedServicesServiceName) {
service_manager::Manifest overlay;
overlay.packaged_services = GetElectronPackagedServicesOverlayManifest();
return overlay;
}
return base::nullopt;
}
std::vector<service_manager::Manifest>
AtomBrowserClient::GetExtraServiceManifests() {
return GetElectronBuiltinServiceManifests();
}
net::NetLog* AtomBrowserClient::GetNetLog() {
return g_browser_process->net_log();
}
content::BrowserMainParts* AtomBrowserClient::CreateBrowserMainParts(
std::unique_ptr<content::BrowserMainParts>
AtomBrowserClient::CreateBrowserMainParts(
const content::MainFunctionParams& params) {
return new AtomBrowserMainParts(params);
return std::make_unique<AtomBrowserMainParts>(params);
}
void AtomBrowserClient::WebNotificationAllowed(
@@ -829,8 +856,6 @@ bool AtomBrowserClient::HandleExternalProtocol(
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
const std::string& method,
const net::HttpRequestHeaders& headers,
network::mojom::URLLoaderFactoryRequest* factory_request,
// clang-format off
network::mojom::URLLoaderFactory*& out_factory) { // NOLINT
@@ -867,7 +892,8 @@ NotificationPresenter* AtomBrowserClient::GetNotificationPresenter() {
}
content::PlatformNotificationService*
AtomBrowserClient::GetPlatformNotificationService() {
AtomBrowserClient::GetPlatformNotificationService(
content::BrowserContext* browser_context) {
if (!notification_service_) {
notification_service_.reset(new PlatformNotificationService(this));
}
@@ -912,9 +938,27 @@ std::string AtomBrowserClient::GetProduct() const {
}
std::string AtomBrowserClient::GetUserAgent() const {
return GetApplicationUserAgent();
if (user_agent_override_.empty())
return GetApplicationUserAgent();
return user_agent_override_;
}
void AtomBrowserClient::SetUserAgent(const std::string& user_agent) {
user_agent_override_ = user_agent;
}
#if defined(OS_WIN)
bool AtomBrowserClient::PreSpawnRenderer(sandbox::TargetPolicy* policy) {
// Allow crashpad to communicate via named pipe.
sandbox::ResultCode result = policy->AddRule(
sandbox::TargetPolicy::SUBSYS_FILES,
sandbox::TargetPolicy::FILES_ALLOW_ANY, L"\\??\\pipe\\crashpad_*");
if (result != sandbox::SBOX_ALL_OK)
return false;
return true;
}
#endif // defined(OS_WIN)
std::string AtomBrowserClient::GetApplicationLocale() {
if (BrowserThread::CurrentlyOn(BrowserThread::IO))
return g_io_thread_application_locale.Get();

View File

@@ -64,6 +64,12 @@ class AtomBrowserClient : public content::ContentBrowserClient,
// content::ContentBrowserClient:
bool ShouldEnableStrictSiteIsolation() override;
std::string GetUserAgent() const override;
void SetUserAgent(const std::string& user_agent);
void SetCanUseCustomSiteInstance(bool should_disable);
bool CanUseCustomSiteInstance() override;
protected:
void RenderProcessWillLaunch(
content::RenderProcessHost* host,
@@ -78,6 +84,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
content::RenderFrameHost* speculative_rfh,
content::BrowserContext* browser_context,
const GURL& url,
bool has_navigation_started,
bool has_request_started,
content::SiteInstance** affinity_site_instance) const override;
void RegisterPendingSiteInstance(
@@ -90,7 +97,8 @@ class AtomBrowserClient : public content::ContentBrowserClient,
base::CommandLine* command_line) override;
void DidCreatePpapiPlugin(content::BrowserPpapiHost* browser_host) override;
std::string GetGeolocationApiKey() override;
content::QuotaPermissionContext* CreateQuotaPermissionContext() override;
scoped_refptr<content::QuotaPermissionContext> CreateQuotaPermissionContext()
override;
content::GeneratedCodeCacheSettings GetGeneratedCodeCacheSettings(
content::BrowserContext* context) override;
void AllowCertificateError(
@@ -98,7 +106,7 @@ class AtomBrowserClient : public content::ContentBrowserClient,
int cert_error,
const net::SSLInfo& ssl_info,
const GURL& request_url,
content::ResourceType resource_type,
bool is_main_frame_request,
bool strict_enforcement,
bool expired_previous_decision,
const base::Callback<void(content::CertificateRequestResultType)>&
@@ -138,15 +146,15 @@ class AtomBrowserClient : public content::ContentBrowserClient,
bool in_memory,
const base::FilePath& relative_partition_path) override;
network::mojom::NetworkContext* GetSystemNetworkContext() override;
void RegisterOutOfProcessServices(OutOfProcessServiceMap* services) override;
base::Optional<service_manager::Manifest> GetServiceManifestOverlay(
base::StringPiece name) override;
std::vector<service_manager::Manifest> GetExtraServiceManifests() override;
net::NetLog* GetNetLog() override;
content::MediaObserver* GetMediaObserver() override;
content::DevToolsManagerDelegate* GetDevToolsManagerDelegate() override;
content::PlatformNotificationService* GetPlatformNotificationService()
override;
content::BrowserMainParts* CreateBrowserMainParts(
content::PlatformNotificationService* GetPlatformNotificationService(
content::BrowserContext* browser_context) override;
std::unique_ptr<content::BrowserMainParts> CreateBrowserMainParts(
const content::MainFunctionParams&) override;
base::FilePath GetDefaultDownloadDirectory() override;
scoped_refptr<network::SharedURLLoaderFactory>
@@ -155,7 +163,9 @@ class AtomBrowserClient : public content::ContentBrowserClient,
network::mojom::NetworkService* network_service) override;
bool ShouldBypassCORB(int render_process_id) const override;
std::string GetProduct() const override;
std::string GetUserAgent() const override;
#if defined(OS_WIN)
bool PreSpawnRenderer(sandbox::TargetPolicy* policy) override;
#endif
// content::RenderProcessHostObserver:
void RenderProcessHostDestroyed(content::RenderProcessHost* host) override;
@@ -171,8 +181,6 @@ class AtomBrowserClient : public content::ContentBrowserClient,
bool is_main_frame,
ui::PageTransition page_transition,
bool has_user_gesture,
const std::string& method,
const net::HttpRequestHeaders& headers,
network::mojom::URLLoaderFactoryRequest* factory_request,
// clang-format off
network::mojom::URLLoaderFactory*& out_factory) // NOLINT
@@ -231,6 +239,10 @@ class AtomBrowserClient : public content::ContentBrowserClient,
mutable base::Lock process_preferences_lock_;
std::map<int, ProcessPreferences> process_preferences_;
std::string user_agent_override_ = "";
bool disable_process_restart_tricks_ = false;
DISALLOW_COPY_AND_ASSIGN(AtomBrowserClient);
};

View File

@@ -7,6 +7,7 @@
#include <utility>
#include "atom/browser/atom_blob_reader.h"
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/atom_browser_main_parts.h"
#include "atom/browser/atom_download_manager_delegate.h"
#include "atom/browser/atom_paths.h"
@@ -67,7 +68,7 @@ AtomBrowserContext::AtomBrowserContext(const std::string& partition,
storage_policy_(new SpecialStoragePolicy),
in_memory_(in_memory),
weak_factory_(this) {
user_agent_ = GetApplicationUserAgent();
user_agent_ = AtomBrowserClient::Get()->GetUserAgent();
// Read options.
base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
@@ -109,11 +110,12 @@ AtomBrowserContext::~AtomBrowserContext() {
NotifyWillBeDestroyed(this);
ShutdownStoragePartitions();
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
std::move(resource_context_));
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
io_handle_->ShutdownOnUIThread();
} else {
BrowserThread::DeleteSoon(BrowserThread::IO, FROM_HERE,
std::move(resource_context_));
}
// Notify any keyed services of browser context destruction.
BrowserContextDependencyManager::GetInstance()->DestroyBrowserContextServices(

View File

@@ -48,6 +48,7 @@
#include "services/device/public/mojom/constants.mojom.h"
#include "services/network/public/cpp/features.h"
#include "services/service_manager/public/cpp/connector.h"
#include "third_party/blink/public/common/features.h"
#include "ui/base/idle/idle.h"
#include "ui/base/material_design/material_design_controller.h"
#include "ui/base/ui_base_switches.h"
@@ -76,7 +77,7 @@
#include "ui/base/l10n/l10n_util.h"
#include "ui/base/l10n/l10n_util_win.h"
#include "ui/display/win/dpi.h"
#include "ui/gfx/platform_font_win.h"
#include "ui/gfx/system_fonts_win.h"
#include "ui/strings/grit/app_locale_settings.h"
#endif
@@ -102,7 +103,7 @@ void Erase(T* container, typename T::iterator iter) {
#if defined(OS_WIN)
// gfx::Font callbacks
void AdjustUIFont(gfx::PlatformFontWin::FontAdjustment* font_adjustment) {
void AdjustUIFont(gfx::win::FontAdjustment* font_adjustment) {
l10n_util::NeedOverrideDefaultUIFont(&font_adjustment->font_family_override,
&font_adjustment->font_scale);
font_adjustment->font_scale *= display::win::GetAccessibilityFontScale();
@@ -209,6 +210,9 @@ void AtomBrowserMainParts::InitializeFeatureList() {
// when node integration is enabled.
disable_features +=
std::string(",") + features::kSpareRendererForSitePerProcess.name;
// Disable LayoutNG as it still isn't fully enabled in Chrome and currently
// is still causing crashes during every day use such as text selection.
disable_features += std::string(",") + blink::features::kLayoutNG.name;
auto feature_list = std::make_unique<base::FeatureList>();
feature_list->InitializeFromCommandLine(enable_features, disable_features);
base::FeatureList::SetInstance(std::move(feature_list));
@@ -302,13 +306,44 @@ void AtomBrowserMainParts::PostEarlyInitialization() {
node_bindings_->Initialize();
// Create the global environment.
node::Environment* env = node_bindings_->CreateEnvironment(
js_env_->context(), js_env_->platform());
js_env_->context(), js_env_->platform(), false);
node_env_.reset(new NodeEnvironment(env));
/**
* 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
* UNSAFE ENVIRONMENT BLOCK BEGINS
*
* DO NOT USE node::Environment inside this block, bad things will happen
* and you won't be able to figure out why. Just don't touch it, the only
* thing that can use it is NodeDebugger and that is ONLY allowed to access
* the inspector agent.
*
* This is unsafe because the environment is not yet bootstrapped, it's a race
* condition where we can't bootstrap before intializing the inspector agent.
*
* Long term we should figure out how to get node to initialize the inspector
* agent in the correct place without us splitting the bootstrap up, but for
* now this works.
* 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨 🚨
*/
// Enable support for v8 inspector
node_debugger_.reset(new NodeDebugger(env));
node_debugger_->Start();
// Only run the node bootstrapper after we have initialized the inspector
// TODO(MarshallOfSound): Figured out a better way to init the inspector
// before bootstrapping
node::BootstrapEnvironment(env);
/**
* ✅ ✅ ✅ ✅ ✅ ✅ ✅
* UNSAFE ENVIRONMENT BLOCK ENDS
*
* Do whatever you want now with that env, it's safe again
* ✅ ✅ ✅ ✅ ✅ ✅ ✅
*/
// Add Electron extended APIs.
electron_bindings_->BindTo(js_env_->isolate(), env->process_object());
@@ -380,8 +415,8 @@ void AtomBrowserMainParts::ToolkitInitialized() {
#endif
#if defined(OS_WIN)
gfx::PlatformFontWin::SetAdjustFontCallback(&AdjustUIFont);
gfx::PlatformFontWin::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
gfx::win::SetAdjustFontCallback(&AdjustUIFont);
gfx::win::SetGetMinimumFontSizeCallback(&GetMinimumFontSize);
wchar_t module_name[MAX_PATH] = {0};
if (GetModuleFileName(NULL, module_name, MAX_PATH))
@@ -469,6 +504,7 @@ void AtomBrowserMainParts::PostMainMessageLoopRun() {
ui::SetX11ErrorHandlers(X11EmptyErrorHandler, X11EmptyIOErrorHandler);
#endif
node_debugger_->Stop();
js_env_->OnMessageLoopDestroying();
#if defined(OS_MACOSX)

View File

@@ -41,8 +41,26 @@ void AtomBrowserMainParts::InitializeMainNib() {
auto application = [principalClass sharedApplication];
NSString* mainNibName = [infoDictionary objectForKey:@"NSMainNibFile"];
auto mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];
NSNib* mainNib;
@try {
mainNib = [[NSNib alloc] initWithNibNamed:mainNibName
bundle:base::mac::FrameworkBundle()];
// Handle failure of initWithNibNamed on SMB shares
// TODO(codebytere): Remove when
// https://bugs.chromium.org/p/chromium/issues/detail?id=932935 is fixed
} @catch (NSException* exception) {
NSString* nibPath =
[NSString stringWithFormat:@"Resources/%@.nib", mainNibName];
nibPath = [base::mac::FrameworkBundle().bundlePath
stringByAppendingPathComponent:nibPath];
NSData* data = [NSData dataWithContentsOfFile:nibPath];
mainNib = [[NSNib alloc] initWithNibData:data
bundle:base::mac::FrameworkBundle()];
}
[mainNib instantiateWithOwner:application topLevelObjects:nil];
[mainNib release];
}

View File

@@ -127,8 +127,8 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
base::Bind(&AtomDownloadManagerDelegate::OnDownloadSaveDialogDone,
base::Unretained(this), download_id, callback);
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
ignore_result(dialog_promise.Then(dialog_callback));
file_dialog::ShowSaveDialog(settings, std::move(dialog_promise));
} else {
callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
@@ -136,54 +136,48 @@ void AtomDownloadManagerDelegate::OnDownloadPathGenerated(
}
}
#if defined(MAS_BUILD)
void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
bool result,
const base::FilePath& path,
const std::string& bookmark)
#else
void AtomDownloadManagerDelegate::OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
bool result,
const base::FilePath& path)
#endif
{
mate::Dictionary result) {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
auto* item = download_manager_->GetDownload(download_id);
if (!item)
return;
if (result) {
// Remember the last selected download directory.
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
download_manager_->GetBrowserContext());
browser_context->prefs()->SetFilePath(prefs::kDownloadDefaultDirectory,
path.DirName());
bool canceled = true;
result.Get("canceled", &canceled);
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
api::DownloadItem* download_item =
api::DownloadItem::FromWrappedClass(isolate, item);
if (download_item)
download_item->SetSavePath(path);
base::FilePath path;
if (!canceled) {
if (result.Get("filePath", &path)) {
// Remember the last selected download directory.
AtomBrowserContext* browser_context = static_cast<AtomBrowserContext*>(
download_manager_->GetBrowserContext());
browser_context->prefs()->SetFilePath(prefs::kDownloadDefaultDirectory,
path.DirName());
v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::Locker locker(isolate);
v8::HandleScope handle_scope(isolate);
api::DownloadItem* download_item =
api::DownloadItem::FromWrappedClass(isolate, item);
if (download_item)
download_item->SetSavePath(path);
}
}
// Running the DownloadTargetCallback with an empty FilePath signals that the
// download should be cancelled. If user cancels the file save dialog, run
// the callback with empty FilePath.
const base::FilePath download_path = result ? path : base::FilePath();
const auto interrupt_reason =
download_path.empty() ? download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED
: download::DOWNLOAD_INTERRUPT_REASON_NONE;
download_callback.Run(download_path,
download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS,
download_path, interrupt_reason);
path.empty() ? download::DOWNLOAD_INTERRUPT_REASON_USER_CANCELED
: download::DOWNLOAD_INTERRUPT_REASON_NONE;
download_callback.Run(path, download::DownloadItem::TARGET_DISPOSITION_PROMPT,
download::DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS, path,
interrupt_reason);
}
void AtomDownloadManagerDelegate::Shutdown() {

View File

@@ -45,20 +45,10 @@ class AtomDownloadManagerDelegate : public content::DownloadManagerDelegate {
const content::DownloadTargetCallback& callback,
const base::FilePath& default_path);
#if defined(MAS_BUILD)
void OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
bool result,
const base::FilePath& path,
const std::string& bookmark);
#else
void OnDownloadSaveDialogDone(
uint32_t download_id,
const content::DownloadTargetCallback& download_callback,
bool result,
const base::FilePath& path);
#endif
mate::Dictionary result);
content::DownloadManager* download_manager_;
base::WeakPtrFactory<AtomDownloadManagerDelegate> weak_ptr_factory_;

View File

@@ -5,6 +5,7 @@
#include "atom/browser/atom_permission_manager.h"
#include <memory>
#include <utility>
#include <vector>
#include "atom/browser/atom_browser_client.h"
@@ -32,9 +33,9 @@ bool WebContentsDestroyed(int process_id) {
}
void PermissionRequestResponseCallbackWrapper(
const AtomPermissionManager::StatusCallback& callback,
AtomPermissionManager::StatusCallback callback,
const std::vector<blink::mojom::PermissionStatus>& vector) {
callback.Run(vector[0]);
std::move(callback).Run(vector[0]);
}
} // namespace
@@ -43,9 +44,9 @@ class AtomPermissionManager::PendingRequest {
public:
PendingRequest(content::RenderFrameHost* render_frame_host,
const std::vector<content::PermissionType>& permissions,
const StatusesCallback& callback)
StatusesCallback callback)
: render_process_id_(render_frame_host->GetProcess()->GetID()),
callback_(callback),
callback_(std::move(callback)),
permissions_(permissions),
results_(permissions.size(), blink::mojom::PermissionStatus::DENIED),
remaining_results_(permissions.size()) {}
@@ -74,11 +75,15 @@ class AtomPermissionManager::PendingRequest {
bool IsComplete() const { return remaining_results_ == 0; }
void RunCallback() const { callback_.Run(results_); }
void RunCallback() {
if (!callback_.is_null()) {
std::move(callback_).Run(results_);
}
}
private:
int render_process_id_;
const StatusesCallback callback_;
StatusesCallback callback_;
std::vector<content::PermissionType> permissions_;
std::vector<blink::mojom::PermissionStatus> results_;
size_t remaining_results_;
@@ -91,8 +96,8 @@ AtomPermissionManager::~AtomPermissionManager() {}
void AtomPermissionManager::SetPermissionRequestHandler(
const RequestHandler& handler) {
if (handler.is_null() && !pending_requests_.IsEmpty()) {
for (PendingRequestsMap::const_iterator iter(&pending_requests_);
!iter.IsAtEnd(); iter.Advance()) {
for (PendingRequestsMap::iterator iter(&pending_requests_); !iter.IsAtEnd();
iter.Advance()) {
auto* request = iter.GetCurrentValue();
if (!WebContentsDestroyed(request->render_process_id()))
request->RunCallback();
@@ -112,11 +117,10 @@ int AtomPermissionManager::RequestPermission(
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(blink::mojom::PermissionStatus)>&
response_callback) {
StatusCallback response_callback) {
return RequestPermissionWithDetails(permission, render_frame_host,
requesting_origin, user_gesture, nullptr,
response_callback);
std::move(response_callback));
}
int AtomPermissionManager::RequestPermissionWithDetails(
@@ -125,11 +129,12 @@ int AtomPermissionManager::RequestPermissionWithDetails(
const GURL& requesting_origin,
bool user_gesture,
const base::DictionaryValue* details,
const StatusCallback& response_callback) {
StatusCallback response_callback) {
return RequestPermissionsWithDetails(
std::vector<content::PermissionType>(1, permission), render_frame_host,
requesting_origin, user_gesture, details,
base::Bind(&PermissionRequestResponseCallbackWrapper, response_callback));
base::BindOnce(PermissionRequestResponseCallbackWrapper,
std::move(response_callback)));
}
int AtomPermissionManager::RequestPermissions(
@@ -137,10 +142,10 @@ int AtomPermissionManager::RequestPermissions(
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const StatusesCallback& response_callback) {
StatusesCallback response_callback) {
return RequestPermissionsWithDetails(permissions, render_frame_host,
requesting_origin, user_gesture, nullptr,
response_callback);
std::move(response_callback));
}
int AtomPermissionManager::RequestPermissionsWithDetails(
@@ -149,9 +154,9 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
const GURL& requesting_origin,
bool user_gesture,
const base::DictionaryValue* details,
const StatusesCallback& response_callback) {
StatusesCallback response_callback) {
if (permissions.empty()) {
response_callback.Run(std::vector<blink::mojom::PermissionStatus>());
std::move(response_callback).Run({});
return content::PermissionController::kNoPendingOperation;
}
@@ -169,26 +174,27 @@ int AtomPermissionManager::RequestPermissionsWithDetails(
}
statuses.push_back(blink::mojom::PermissionStatus::GRANTED);
}
response_callback.Run(statuses);
std::move(response_callback).Run(statuses);
return content::PermissionController::kNoPendingOperation;
}
auto* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
int request_id = pending_requests_.Add(std::make_unique<PendingRequest>(
render_frame_host, permissions, response_callback));
render_frame_host, permissions, std::move(response_callback)));
for (size_t i = 0; i < permissions.size(); ++i) {
auto permission = permissions[i];
const auto callback =
base::Bind(&AtomPermissionManager::OnPermissionResponse,
base::Unretained(this), request_id, i);
if (details == nullptr) {
request_handler_.Run(web_contents, permission, callback,
base::DictionaryValue());
} else {
request_handler_.Run(web_contents, permission, callback, *details);
}
base::BindRepeating(&AtomPermissionManager::OnPermissionResponse,
base::Unretained(this), request_id, i);
auto mutable_details =
details == nullptr ? base::DictionaryValue() : details->Clone();
mutable_details.SetStringKey(
"requestingUrl", render_frame_host->GetLastCommittedURL().spec());
mutable_details.SetBoolKey("isMainFrame",
render_frame_host->GetParent() == nullptr);
request_handler_.Run(web_contents, permission, callback, mutable_details);
}
return request_id;
@@ -224,7 +230,7 @@ int AtomPermissionManager::SubscribePermissionStatusChange(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback) {
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback) {
return -1;
}
@@ -241,8 +247,14 @@ bool AtomPermissionManager::CheckPermissionWithDetails(
}
auto* web_contents =
content::WebContents::FromRenderFrameHost(render_frame_host);
auto mutable_details =
details == nullptr ? base::DictionaryValue() : details->Clone();
mutable_details.SetStringKey("requestingUrl",
render_frame_host->GetLastCommittedURL().spec());
mutable_details.SetBoolKey("isMainFrame",
render_frame_host->GetParent() == nullptr);
return check_handler_.Run(web_contents, permission, requesting_origin,
*details);
mutable_details);
}
blink::mojom::PermissionStatus

View File

@@ -25,52 +25,48 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
AtomPermissionManager();
~AtomPermissionManager() override;
using StatusCallback = base::Callback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback =
base::Callback<void(const std::vector<blink::mojom::PermissionStatus>&)>;
using StatusCallback =
base::OnceCallback<void(blink::mojom::PermissionStatus)>;
using StatusesCallback = base::OnceCallback<void(
const std::vector<blink::mojom::PermissionStatus>&)>;
using RequestHandler = base::Callback<void(content::WebContents*,
content::PermissionType,
const StatusCallback&,
const base::DictionaryValue&)>;
StatusCallback,
const base::Value&)>;
using CheckHandler = base::Callback<bool(content::WebContents*,
content::PermissionType,
const GURL& requesting_origin,
const base::DictionaryValue&)>;
const base::Value&)>;
// Handler to dispatch permission requests in JS.
void SetPermissionRequestHandler(const RequestHandler& handler);
void SetPermissionCheckHandler(const CheckHandler& handler);
// content::PermissionControllerDelegate:
int RequestPermission(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
override;
int RequestPermission(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
StatusCallback callback) override;
int RequestPermissionWithDetails(content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::DictionaryValue* details,
const StatusCallback& callback);
StatusCallback callback);
int RequestPermissions(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::Callback<
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback)
override;
StatusesCallback callback) override;
int RequestPermissionsWithDetails(
const std::vector<content::PermissionType>& permissions,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
bool user_gesture,
const base::DictionaryValue* details,
const base::Callback<
void(const std::vector<blink::mojom::PermissionStatus>&)>& callback);
StatusesCallback callback);
blink::mojom::PermissionStatus GetPermissionStatusForFrame(
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
@@ -98,7 +94,7 @@ class AtomPermissionManager : public content::PermissionControllerDelegate {
content::PermissionType permission,
content::RenderFrameHost* render_frame_host,
const GURL& requesting_origin,
const base::Callback<void(blink::mojom::PermissionStatus)>& callback)
base::RepeatingCallback<void(blink::mojom::PermissionStatus)> callback)
override;
void UnsubscribePermissionStatusChange(int subscription_id) override;

View File

@@ -197,6 +197,7 @@ class Browser : public WindowListObserver {
base::string16 arguments;
base::string16 title;
base::string16 description;
base::FilePath working_dir;
base::FilePath icon_path;
int icon_index;

View File

@@ -149,7 +149,8 @@ bool Browser::IsEmojiPanelSupported() {
void Browser::ShowAboutPanel() {
std::string app_name, version, copyright, icon_path, website;
GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(gtk_about_dialog_new());
GtkWidget* dialogWidget = gtk_about_dialog_new();
GtkAboutDialog* dialog = GTK_ABOUT_DIALOG(dialogWidget);
if (about_panel_options_.GetString("applicationName", &app_name))
gtk_about_dialog_set_program_name(dialog, app_name.c_str());
@@ -161,7 +162,12 @@ void Browser::ShowAboutPanel() {
gtk_about_dialog_set_website(dialog, website.c_str());
if (about_panel_options_.GetString("iconPath", &icon_path)) {
GError* error = nullptr;
GdkPixbuf* icon = gdk_pixbuf_new_from_file(icon_path.c_str(), &error);
constexpr int width = 64; // width of about panel icon in pixels
constexpr int height = 64; // height of about panel icon in pixels
// set preserve_aspect_ratio to true
GdkPixbuf* icon = gdk_pixbuf_new_from_file_at_size(icon_path.c_str(), width,
height, &error);
if (error != nullptr) {
g_warning("%s", error->message);
g_clear_error(&error);
@@ -172,7 +178,7 @@ void Browser::ShowAboutPanel() {
}
gtk_dialog_run(GTK_DIALOG(dialog));
g_clear_object(&dialog);
gtk_widget_destroy(dialogWidget);
}
void Browser::SetAboutPanelOptions(const base::DictionaryValue& options) {

View File

@@ -131,7 +131,7 @@ bool Browser::IsDefaultProtocolClient(const std::string& protocol,
void Browser::SetAppUserModelID(const base::string16& name) {}
bool Browser::SetBadgeCount(int count) {
DockSetBadgeText(count != 0 ? base::IntToString(count) : "");
DockSetBadgeText(count != 0 ? base::NumberToString(count) : "");
badge_count_ = count;
return true;
}

View File

@@ -6,7 +6,6 @@
#include <utility>
#include "chrome/browser/net/chrome_net_log_helper.h"
#include "chrome/common/chrome_switches.h"
#include "components/net_log/chrome_net_log.h"
#include "components/net_log/net_export_file_writer.h"
@@ -19,6 +18,7 @@
#include "components/proxy_config/proxy_config_dictionary.h"
#include "components/proxy_config/proxy_config_pref_names.h"
#include "content/public/common/content_switches.h"
#include "net/log/net_log_capture_mode.h"
#include "net/proxy_resolution/proxy_config.h"
#include "net/proxy_resolution/proxy_config_service.h"
#include "net/proxy_resolution/proxy_config_with_annotation.h"
@@ -105,7 +105,9 @@ void BrowserProcessImpl::PreCreateThreads(
command_line.GetSwitchValuePath(network::switches::kLogNetLog);
if (!log_file.empty()) {
net_log_->StartWritingToFile(
log_file, GetNetCaptureModeFromCommandLine(command_line),
log_file,
net::GetNetCaptureModeFromCommandLine(
command_line, network::switches::kNetLogCaptureMode),
command_line.GetCommandLineString(), std::string());
}
}
@@ -338,3 +340,7 @@ printing::PrintJobManager* BrowserProcessImpl::print_job_manager() {
return nullptr;
#endif
}
StartupData* BrowserProcessImpl::startup_data() {
return nullptr;
}

View File

@@ -114,6 +114,7 @@ class BrowserProcessImpl : public BrowserProcess {
void SetApplicationLocale(const std::string& locale) override;
const std::string& GetApplicationLocale() override;
printing::PrintJobManager* print_job_manager() override;
StartupData* startup_data() override;
private:
#if BUILDFLAG(ENABLE_PRINTING)

View File

@@ -96,9 +96,6 @@ void Browser::Focus() {
}
void Browser::AddRecentDocument(const base::FilePath& path) {
if (base::win::GetVersion() < base::win::VERSION_WIN7)
return;
CComPtr<IShellItem> item;
HRESULT hr = SHCreateItemFromParsingName(path.value().c_str(), NULL,
IID_PPV_ARGS(&item));
@@ -111,13 +108,7 @@ void Browser::AddRecentDocument(const base::FilePath& path) {
}
void Browser::ClearRecentDocuments() {
CComPtr<IApplicationDestinations> destinations;
if (FAILED(destinations.CoCreateInstance(CLSID_ApplicationDestinations, NULL,
CLSCTX_INPROC_SERVER)))
return;
if (FAILED(destinations->SetAppID(GetAppUserModelID())))
return;
destinations->RemoveAllDestinations();
SHAddToRecentDocs(SHARD_APPIDINFO, nullptr);
}
void Browser::SetAppUserModelID(const base::string16& name) {
@@ -141,6 +132,7 @@ bool Browser::SetUserTasks(const std::vector<UserTask>& tasks) {
item.icon_path = task.icon_path;
item.icon_index = task.icon_index;
item.description = task.description;
item.working_dir = task.working_dir;
category.items.push_back(item);
}
@@ -346,7 +338,7 @@ std::string Browser::GetExecutableFileProductName() const {
bool Browser::IsEmojiPanelSupported() {
// emoji picker is supported on Windows 10's Spring 2018 update & above.
return base::win::GetVersion() >= base::win::Version::VERSION_WIN10_RS4;
return base::win::GetVersion() >= base::win::Version::WIN10_RS4;
}
void Browser::ShowEmojiPanel() {

View File

@@ -84,22 +84,23 @@ std::string RegisterFileSystem(content::WebContents* web_contents,
const base::FilePath& path) {
auto* isolated_context = storage::IsolatedContext::GetInstance();
std::string root_name(kRootName);
std::string file_system_id = isolated_context->RegisterFileSystemForPath(
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
storage::IsolatedContext::ScopedFSHandle file_system =
isolated_context->RegisterFileSystemForPath(
storage::kFileSystemTypeNativeLocal, std::string(), path, &root_name);
content::ChildProcessSecurityPolicy* policy =
content::ChildProcessSecurityPolicy::GetInstance();
content::RenderViewHost* render_view_host = web_contents->GetRenderViewHost();
int renderer_id = render_view_host->GetProcess()->GetID();
policy->GrantReadFileSystem(renderer_id, file_system_id);
policy->GrantWriteFileSystem(renderer_id, file_system_id);
policy->GrantCreateFileForFileSystem(renderer_id, file_system_id);
policy->GrantDeleteFromFileSystem(renderer_id, file_system_id);
policy->GrantReadFileSystem(renderer_id, file_system.id());
policy->GrantWriteFileSystem(renderer_id, file_system.id());
policy->GrantCreateFileForFileSystem(renderer_id, file_system.id());
policy->GrantDeleteFromFileSystem(renderer_id, file_system.id());
if (!policy->CanReadFile(renderer_id, path))
policy->GrantReadFile(renderer_id, path);
return file_system_id;
return file_system.id();
}
FileSystem CreateFileSystemStruct(content::WebContents* web_contents,
@@ -327,9 +328,12 @@ void CommonWebContentsDelegate::EnterFullscreenModeForTab(
const blink::WebFullscreenOptions& options) {
if (!owner_window_)
return;
if (IsFullscreenForTabOrPending(source)) {
DCHECK_EQ(fullscreen_frame_, source->GetFocusedFrame());
return;
}
SetHtmlApiFullscreen(true);
owner_window_->NotifyWindowEnterHtmlFullScreen();
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
void CommonWebContentsDelegate::ExitFullscreenModeForTab(
@@ -338,7 +342,6 @@ void CommonWebContentsDelegate::ExitFullscreenModeForTab(
return;
SetHtmlApiFullscreen(false);
owner_window_->NotifyWindowLeaveHtmlFullScreen();
source->GetRenderViewHost()->GetWidget()->SynchronizeVisualProperties();
}
bool CommonWebContentsDelegate::IsFullscreenForTabOrPending(
@@ -352,9 +355,8 @@ blink::WebSecurityStyle CommonWebContentsDelegate::GetSecurityStyle(
SecurityStateTabHelper* helper =
SecurityStateTabHelper::FromWebContents(web_contents);
DCHECK(helper);
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
return security_state::GetSecurityStyle(security_info,
return security_state::GetSecurityStyle(helper->GetSecurityLevel(),
*helper->GetVisibleSecurityState(),
security_style_explanations);
}

View File

@@ -68,6 +68,10 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
bool is_html_fullscreen() const { return html_fullscreen_; }
void set_fullscreen_frame(content::RenderFrameHost* rfh) {
fullscreen_frame_ = rfh;
}
protected:
#if BUILDFLAG(ENABLE_OSR)
virtual OffScreenWebContentsView* GetOffScreenWebContentsView() const;
@@ -203,6 +207,9 @@ class CommonWebContentsDelegate : public content::WebContentsDelegate,
scoped_refptr<base::SequencedTaskRunner> file_task_runner_;
// Stores the frame thats currently in fullscreen, nullptr if there is none.
content::RenderFrameHost* fullscreen_frame_ = nullptr;
base::WeakPtrFactory<CommonWebContentsDelegate> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(CommonWebContentsDelegate);

View File

@@ -6,6 +6,7 @@
#include <utility>
#include "atom/browser/net/url_request_context_getter.h"
#include "components/net_log/chrome_net_log.h"
#include "content/public/browser/browser_thread.h"
#include "content/public/browser/network_service_instance.h"
@@ -35,6 +36,24 @@ IOThread::~IOThread() {
BrowserThread::SetIOThreadDelegate(nullptr);
}
void IOThread::RegisterURLRequestContextGetter(
atom::URLRequestContextGetter* getter) {
base::AutoLock lock(lock_);
DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService));
DCHECK_EQ(0u, request_context_getters_.count(getter));
request_context_getters_.insert(getter);
}
void IOThread::DeregisterURLRequestContextGetter(
atom::URLRequestContextGetter* getter) {
base::AutoLock lock(lock_);
DCHECK(!base::FeatureList::IsEnabled(network::features::kNetworkService));
DCHECK_EQ(1u, request_context_getters_.count(getter));
request_context_getters_.erase(getter);
}
void IOThread::Init() {
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
std::unique_ptr<network::URLRequestContextBuilderMojo> builder =
@@ -45,7 +64,7 @@ void IOThread::Init() {
auto cert_verifier = std::make_unique<net::CachingCertVerifier>(
std::make_unique<net::MultiThreadedCertVerifier>(
net::CertVerifyProc::CreateDefault()));
net::CertVerifyProc::CreateDefault(nullptr)));
builder->SetCertVerifier(std::move(cert_verifier));
// Create the network service, so that shared host resolver
@@ -55,20 +74,24 @@ void IOThread::Init() {
network_service->ConfigureHttpAuthPrefs(
std::move(http_auth_dynamic_params_));
system_network_context_ =
network_service
->CreateNetworkContextWithBuilder(
std::move(network_context_request_),
std::move(network_context_params_), std::move(builder),
&system_request_context_)
.release();
system_network_context_ = network_service->CreateNetworkContextWithBuilder(
std::move(network_context_request_), std::move(network_context_params_),
std::move(builder), &system_request_context_);
}
}
void IOThread::CleanUp() {
if (!base::FeatureList::IsEnabled(network::features::kNetworkService))
if (!base::FeatureList::IsEnabled(network::features::kNetworkService)) {
system_request_context_->proxy_resolution_service()->OnShutdown();
base::AutoLock lock(lock_);
for (auto* getter : request_context_getters_) {
getter->NotifyContextShuttingDown();
}
system_network_context_.reset();
}
if (net_log_)
net_log_->ShutDownBeforeTaskScheduler();
net_log_->ShutDownBeforeThreadPool();
}

View File

@@ -6,12 +6,18 @@
#define ATOM_BROWSER_IO_THREAD_H_
#include <memory>
#include <set>
#include "atom/browser/net/system_network_context_manager.h"
#include "base/macros.h"
#include "base/synchronization/lock.h"
#include "content/public/browser/browser_thread_delegate.h"
#include "services/network/public/mojom/network_service.mojom.h"
namespace atom {
class URLRequestContextGetter;
}
namespace net {
class URLRequestContext;
}
@@ -27,6 +33,9 @@ class IOThread : public content::BrowserThreadDelegate {
SystemNetworkContextManager* system_network_context_manager);
~IOThread() override;
void RegisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
void DeregisterURLRequestContextGetter(atom::URLRequestContextGetter* getter);
protected:
// BrowserThreadDelegate Implementation, runs on the IO thread.
void Init() override;
@@ -39,13 +48,7 @@ class IOThread : public content::BrowserThreadDelegate {
// When the network service is disabled, this holds on to a
// content::NetworkContext class that owns |system_request_context_|.
// TODO(deepak1556): primary network context has to be destroyed after
// other active contexts, but since the ownership of latter is not released
// before IO thread is destroyed, it results in a DCHECK failure.
// We leak the reference to primary context to workaround this issue,
// since there is only one instance for the entire lifetime of app, it is
// safe.
network::mojom::NetworkContext* system_network_context_;
std::unique_ptr<network::mojom::NetworkContext> system_network_context_;
net::URLRequestContext* system_request_context_;
// These are set on the UI thread, and then consumed during initialization on
@@ -59,6 +62,13 @@ class IOThread : public content::BrowserThreadDelegate {
network::mojom::HttpAuthStaticParamsPtr http_auth_static_params_;
network::mojom::HttpAuthDynamicParamsPtr http_auth_dynamic_params_;
// |lock_| protects access to |request_context_getters_|.
base::Lock lock_;
// List of all request contexts that needs to be notified when
// IO thread is shutting down.
std::set<atom::URLRequestContextGetter*> request_context_getters_;
DISALLOW_COPY_AND_ASSIGN(IOThread);
};

View File

@@ -10,7 +10,7 @@
#include "atom/common/node_includes.h"
#include "base/command_line.h"
#include "base/message_loop/message_loop.h"
#include "base/task/task_scheduler/initialization_util.h"
#include "base/task/thread_pool/initialization_util.h"
#include "base/threading/thread_task_runner_handle.h"
#include "content/public/common/content_switches.h"
#include "gin/array_buffer.h"
@@ -30,7 +30,7 @@ JavascriptEnvironment::JavascriptEnvironment(uv_loop_t* event_loop)
isolate_scope_(isolate_),
locker_(isolate_),
handle_scope_(isolate_),
context_(isolate_, v8::Context::New(isolate_)),
context_(isolate_, node::NewContext(isolate_)),
context_scope_(v8::Local<v8::Context>::New(isolate_, context_)) {}
JavascriptEnvironment::~JavascriptEnvironment() = default;
@@ -49,7 +49,7 @@ v8::Isolate* JavascriptEnvironment::Initialize(uv_loop_t* event_loop) {
auto* tracing_controller = tracing_agent->GetTracingController();
node::tracing::TraceEventHelper::SetAgent(tracing_agent);
platform_ = node::CreatePlatform(
base::RecommendedMaxNumberOfThreadsInPool(3, 8, 0.1, 0),
base::RecommendedMaxNumberOfThreadsInThreadGroup(3, 8, 0.1, 0),
tracing_controller);
v8::V8::InitializePlatform(platform_);

View File

@@ -26,7 +26,7 @@ LoginHandler::LoginHandler(net::URLRequest* request,
net::AuthCredentials* credentials,
content::ResourceRequestInfo* resource_request_info)
: credentials_(credentials),
auth_info_(&auth_info),
auth_info_(std::make_unique<net::AuthChallengeInfo>(auth_info)),
auth_callback_(std::move(callback)),
weak_factory_(this) {
DCHECK_CURRENTLY_ON(BrowserThread::IO);

View File

@@ -5,6 +5,8 @@
#ifndef ATOM_BROWSER_LOGIN_HANDLER_H_
#define ATOM_BROWSER_LOGIN_HANDLER_H_
#include <memory>
#include "base/callback.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
@@ -57,7 +59,7 @@ class LoginHandler : public base::RefCountedThreadSafe<LoginHandler> {
net::AuthCredentials* credentials_;
// Who/where/what asked for the authentication.
scoped_refptr<const net::AuthChallengeInfo> auth_info_;
std::unique_ptr<const net::AuthChallengeInfo> auth_info_;
// WebContents associated with the login request.
content::ResourceRequestInfo::WebContentsGetter web_contents_getter_;

View File

@@ -29,7 +29,7 @@ struct Product {
std::string formattedPrice;
// Downloadable Content Information
bool downloadable = false;
bool isDownloadable = false;
Product(const Product&);
Product();

View File

@@ -146,9 +146,7 @@
}
// Downloadable Content Information
if (product.downloadable == true) {
productStruct.downloadable = true;
}
productStruct.isDownloadable = [product downloadable];
return productStruct;
}

View File

@@ -21,7 +21,6 @@
@class AtomPreviewItem;
@class AtomTouchBar;
@class CustomWindowButtonView;
@class FullSizeContentView;
namespace atom {
@@ -158,7 +157,7 @@ class NativeWindowMac : public NativeWindow {
AtomTouchBar* touch_bar() const { return touch_bar_.get(); }
bool zoom_to_page_width() const { return zoom_to_page_width_; }
bool fullscreen_window_title() const { return fullscreen_window_title_; }
bool simple_fullscreen() const { return always_simple_fullscreen_; }
bool always_simple_fullscreen() const { return always_simple_fullscreen_; }
protected:
// views::WidgetDelegate:
@@ -167,7 +166,7 @@ class NativeWindowMac : public NativeWindow {
private:
// Add custom layers to the content view.
void AddContentViewLayers();
void AddContentViewLayers(bool minimizable, bool closable);
void InternalSetParentWindow(NativeWindow* parent, bool attach);
void SetForwardMouseMessages(bool forward);
@@ -182,10 +181,12 @@ class NativeWindowMac : public NativeWindow {
// Event monitor for scroll wheel event.
id wheel_event_monitor_;
// The view that will fill the whole frameless window.
base::scoped_nsobject<FullSizeContentView> container_view_;
// The NSView that used as contentView of window.
//
// For frameless window it would fill the whole window.
base::scoped_nsobject<NSView> container_view_;
// The view that fills the client area.
// The views::View that fills the client area.
std::unique_ptr<RootViewMac> root_view_;
bool is_kiosk_ = false;

View File

@@ -22,15 +22,67 @@
#include "atom/common/options_switches.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h"
#include "base/numerics/ranges.h"
#include "base/strings/sys_string_conversions.h"
#include "components/remote_cocoa/app_shim/bridged_native_widget_impl.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "native_mate/dictionary.h"
#include "skia/ext/skia_utils_mac.h"
#include "ui/gfx/skia_util.h"
#include "ui/gl/gpu_switching_manager.h"
#include "ui/views/background.h"
#include "ui/views/cocoa/bridged_native_widget_host_impl.h"
#include "ui/views/widget/widget.h"
#include "ui/views_bridge_mac/bridged_native_widget_impl.h"
// This view would inform Chromium to resize the hosted views::View.
//
// The overrided methods should behave the same with BridgedContentView.
@interface ElectronAdapatedContentView : NSView {
@private
views::BridgedNativeWidgetHostImpl* bridge_host_;
}
@end
@implementation ElectronAdapatedContentView
- (id)initWithShell:(atom::NativeWindowMac*)shell {
if ((self = [self init])) {
bridge_host_ = views::BridgedNativeWidgetHostImpl::GetFromNativeWindow(
shell->GetNativeWindow());
}
return self;
}
- (void)viewDidMoveToWindow {
// When this view is added to a window, AppKit calls setFrameSize before it is
// added to the window, so the behavior in setFrameSize is not triggered.
NSWindow* window = [self window];
if (window)
[self setFrameSize:NSZeroSize];
}
- (void)setFrameSize:(NSSize)newSize {
// The size passed in here does not always use
// -[NSWindow contentRectForFrameRect]. The following ensures that the
// contentView for a frameless window can extend over the titlebar of the new
// window containing it, since AppKit requires a titlebar to give frameless
// windows correct shadows and rounded corners.
NSWindow* window = [self window];
if (window && [window contentView] == self) {
newSize = [window contentRectForFrameRect:[window frame]].size;
// Ensure that the window geometry be updated on the host side before the
// view size is updated.
bridge_host_->bridge_impl()->UpdateWindowGeometry();
}
[super setFrameSize:newSize];
// The OnViewSizeChanged is marked private in derived class.
static_cast<remote_cocoa::mojom::BridgedNativeWidgetHost*>(bridge_host_)
->OnViewSizeChanged(gfx::Size(newSize.width, newSize.height));
}
@end
// This view always takes the size of its superview. It is intended to be used
// as a NSWindow's contentView. It is needed because NSWindow's implementation
@@ -73,9 +125,11 @@
NSButton* close_button =
[NSWindow standardWindowButton:NSWindowCloseButton
forStyleMask:NSWindowStyleMaskTitled];
[close_button setTag:1];
NSButton* miniaturize_button =
[NSWindow standardWindowButton:NSWindowMiniaturizeButton
forStyleMask:NSWindowStyleMaskTitled];
[miniaturize_button setTag:2];
CGFloat x = 0;
const CGFloat space_between = 20;
@@ -459,7 +513,7 @@ NativeWindowMac::NativeWindowMac(const mate::Dictionary& options,
// Default content view.
SetContentView(new views::View());
AddContentViewLayers();
AddContentViewLayers(minimizable, closable);
original_frame_ = [window_ frame];
original_level_ = [window_ level];
@@ -823,6 +877,7 @@ void NativeWindowMac::SetAlwaysOnTop(bool top,
int relativeLevel,
std::string* error) {
int windowLevel = NSNormalWindowLevel;
bool level_changed = top != widget()->IsAlwaysOnTop();
CGWindowLevel maxWindowLevel = CGWindowLevelForKey(kCGMaximumWindowLevelKey);
CGWindowLevel minWindowLevel = CGWindowLevelForKey(kCGMinimumWindowLevelKey);
@@ -849,12 +904,22 @@ void NativeWindowMac::SetAlwaysOnTop(bool top,
NSInteger newLevel = windowLevel + relativeLevel;
if (newLevel >= minWindowLevel && newLevel <= maxWindowLevel) {
was_maximizable_ = IsMaximizable();
[window_ setLevel:newLevel];
// Set level will make the zoom button revert to default, probably
// a bug of Cocoa or macOS.
[[window_ standardWindowButton:NSWindowZoomButton]
setEnabled:was_maximizable_];
} else {
*error = std::string([
[NSString stringWithFormat:@"relativeLevel must be between %d and %d",
minWindowLevel, maxWindowLevel] UTF8String]);
*error = std::string([[NSString
stringWithFormat:@"relativeLevel must be between %d and %d",
minWindowLevel, maxWindowLevel] UTF8String]);
}
// This must be notified at the very end or IsAlwaysOnTop
// will not yet have been updated to reflect the new status
if (level_changed)
NativeWindow::NotifyWindowAlwaysOnTopChanged();
}
bool NativeWindowMac::IsAlwaysOnTop() {
@@ -1034,7 +1099,8 @@ bool NativeWindowMac::HasShadow() {
}
void NativeWindowMac::SetOpacity(const double opacity) {
[window_ setAlphaValue:opacity];
const double boundedOpacity = base::ClampToRange(opacity, 0.0, 1.0);
[window_ setAlphaValue:boundedOpacity];
}
double NativeWindowMac::GetOpacity() {
@@ -1102,7 +1168,7 @@ void NativeWindowMac::RemoveBrowserView(NativeBrowserView* view) {
}
[view->GetInspectableWebContentsView()->GetNativeView().GetNativeNSView()
removeFromSuperview];
removeFromSuperview];
remove_browser_view(view);
[CATransaction commit];
@@ -1384,7 +1450,7 @@ views::View* NativeWindowMac::GetContentsView() {
return root_view_.get();
}
void NativeWindowMac::AddContentViewLayers() {
void NativeWindowMac::AddContentViewLayers(bool minimizable, bool closable) {
// Make sure the bottom corner is rounded for non-modal windows:
// http://crbug.com/396264.
if (!is_modal()) {
@@ -1424,6 +1490,12 @@ void NativeWindowMac::AddContentViewLayers() {
[[CustomWindowButtonView alloc] initWithFrame:NSZeroRect]);
// NSWindowStyleMaskFullSizeContentView does not work with zoom button
SetFullScreenable(false);
if (!minimizable)
[[buttons_view_ viewWithTag:2] removeFromSuperview];
if (!closable)
[[buttons_view_ viewWithTag:1] removeFromSuperview];
[[window_ contentView] addSubview:buttons_view_];
} else {
if (title_bar_style_ != NORMAL)
@@ -1475,12 +1547,17 @@ void NativeWindowMac::OverrideNSWindowContentView() {
// `BridgedContentView` as content view, which does not support draggable
// regions. In order to make draggable regions work, we have to replace the
// content view with a simple NSView.
container_view_.reset([[FullSizeContentView alloc] init]);
if (has_frame()) {
container_view_.reset(
[[ElectronAdapatedContentView alloc] initWithShell:this]);
} else {
container_view_.reset([[FullSizeContentView alloc] init]);
[container_view_ setFrame:[[[window_ contentView] superview] bounds]];
}
[container_view_
setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
[container_view_ setFrame:[[[window_ contentView] superview] bounds]];
[window_ setContentView:container_view_];
AddContentViewLayers();
AddContentViewLayers(IsMinimizable(), IsClosable());
}
void NativeWindowMac::SetStyleMask(bool on, NSUInteger flag) {

View File

@@ -5,7 +5,6 @@
#include "atom/browser/native_window_views.h"
#if defined(OS_WIN)
#include <objbase.h>
#include <wrl/client.h>
#endif
@@ -26,6 +25,7 @@
#include "atom/common/draggable_region.h"
#include "atom/common/native_mate_converters/image_converter.h"
#include "atom/common/options_switches.h"
#include "base/numerics/ranges.h"
#include "base/strings/utf_string_conversions.h"
#include "content/public/browser/browser_thread.h"
#include "native_mate/dictionary.h"
@@ -59,10 +59,8 @@
#elif defined(OS_WIN)
#include "atom/browser/ui/views/win_frame_view.h"
#include "atom/browser/ui/win/atom_desktop_native_widget_aura.h"
#include "atom/browser/ui/win/atom_desktop_window_tree_host_win.h"
#include "skia/ext/skia_utils_win.h"
#include "ui/base/win/shell.h"
#include "ui/display/display.h"
#include "ui/display/screen.h"
#include "ui/display/win/screen_win.h"
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
@@ -188,11 +186,7 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
if (parent)
params.parent = parent->GetNativeWindow();
params.native_widget = new AtomDesktopNativeWidgetAura(widget());
atom_desktop_window_tree_host_win_ = new AtomDesktopWindowTreeHostWin(
this, widget(),
static_cast<views::DesktopNativeWidgetAura*>(params.native_widget));
params.desktop_window_tree_host = atom_desktop_window_tree_host_win_;
params.native_widget = new AtomDesktopNativeWidgetAura(this);
#elif defined(USE_X11)
std::string name = Browser::Get()->GetName();
// Set WM_WINDOW_ROLE.
@@ -308,7 +302,6 @@ NativeWindowViews::NativeWindowViews(const mate::Dictionary& options,
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
else
last_window_state_ = ui::SHOW_STATE_NORMAL;
last_normal_bounds_ = GetBounds();
#endif
#if defined(OS_LINUX)
@@ -380,6 +373,9 @@ void NativeWindowViews::Show() {
widget()->native_widget_private()->Show(GetRestoredState(), gfx::Rect());
// explicitly focus the window
widget()->Activate();
NotifyWindowShow();
#if defined(USE_X11)
@@ -470,24 +466,15 @@ void NativeWindowViews::SetEnabledInternal(bool enable) {
#endif
}
#if defined(USE_X11)
void NativeWindowViews::Maximize() {
#if defined(OS_WIN)
// For window without WS_THICKFRAME style, we can not call Maximize().
if (!(::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME)) {
restore_bounds_ = GetBounds();
auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
SetBounds(display.work_area(), false);
return;
}
#endif
if (IsVisible())
widget()->Maximize();
else
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
gfx::Rect());
}
#endif
void NativeWindowViews::Unmaximize() {
#if defined(OS_WIN)
@@ -767,10 +754,14 @@ void NativeWindowViews::SetAlwaysOnTop(bool top,
const std::string& level,
int relativeLevel,
std::string* error) {
if (top != widget()->IsAlwaysOnTop())
NativeWindow::NotifyWindowAlwaysOnTopChanged();
bool level_changed = top != widget()->IsAlwaysOnTop();
widget()->SetAlwaysOnTop(top);
// This must be notified at the very end or IsAlwaysOnTop
// will not yet have been updated to reflect the new status
if (level_changed)
NativeWindow::NotifyWindowAlwaysOnTopChanged();
}
bool NativeWindowViews::IsAlwaysOnTop() {
@@ -875,6 +866,7 @@ bool NativeWindowViews::HasShadow() {
void NativeWindowViews::SetOpacity(const double opacity) {
#if defined(OS_WIN)
const double boundedOpacity = base::ClampToRange(opacity, 0.0, 1.0);
HWND hwnd = GetAcceleratedWidget();
if (!layered_) {
LONG ex_style = ::GetWindowLong(hwnd, GWL_EXSTYLE);
@@ -882,9 +874,11 @@ void NativeWindowViews::SetOpacity(const double opacity) {
::SetWindowLong(hwnd, GWL_EXSTYLE, ex_style);
layered_ = true;
}
::SetLayeredWindowAttributes(hwnd, 0, opacity * 255, LWA_ALPHA);
::SetLayeredWindowAttributes(hwnd, 0, boundedOpacity * 255, LWA_ALPHA);
opacity_ = boundedOpacity;
#else
opacity_ = 1.0; // setOpacity unsupported on Linux
#endif
opacity_ = opacity;
}
double NativeWindowViews::GetOpacity() {

View File

@@ -15,7 +15,6 @@
#include "ui/views/widget/widget_observer.h"
#if defined(OS_WIN)
#include "atom/browser/ui/win/message_handler_delegate.h"
#include "atom/browser/ui/win/taskbar_host.h"
#include "base/win/scoped_gdi_object.h"
#endif
@@ -30,16 +29,11 @@ class GlobalMenuBarX11;
class RootView;
class WindowStateWatcher;
#if defined(OS_WIN)
class AtomDesktopWindowTreeHostWin;
#elif defined(USE_X11)
#if defined(USE_X11)
class EventDisabler;
#endif
class NativeWindowViews : public NativeWindow,
#if defined(OS_WIN)
public MessageHandlerDelegate,
#endif
public views::WidgetObserver,
public ui::EventHandler {
public:
@@ -142,6 +136,16 @@ class NativeWindowViews : public NativeWindow,
void DecrementChildModals();
#if defined(OS_WIN)
// Catch-all message handling and filtering. Called before
// HWNDMessageHandler's built-in handling, which may pre-empt some
// expectations in Views/Aura if messages are consumed. Returns true if the
// message was consumed by the delegate and should not be processed further
// by the HWNDMessageHandler. In this case, |result| is returned. |result| is
// not modified otherwise.
bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result);
void SetIcon(HICON small_icon, HICON app_icon);
#elif defined(USE_X11)
void SetIcon(const gfx::ImageSkia& icon);
@@ -180,11 +184,6 @@ class NativeWindowViews : public NativeWindow,
#endif
#if defined(OS_WIN)
// MessageHandlerDelegate:
bool PreHandleMSG(UINT message,
WPARAM w_param,
LPARAM l_param,
LRESULT* result) override;
void HandleSizeEvent(WPARAM w_param, LPARAM l_param);
void SetForwardMouseMessages(bool forward);
static LRESULT CALLBACK SubclassProc(HWND hwnd,
@@ -237,30 +236,11 @@ class NativeWindowViews : public NativeWindow,
#endif
#if defined(OS_WIN)
// Weak ref.
AtomDesktopWindowTreeHostWin* atom_desktop_window_tree_host_win_;
ui::WindowShowState last_window_state_;
gfx::Rect last_normal_placement_bounds_;
// There's an issue with restore on Windows, that sometimes causes the Window
// to receive the wrong size (#2498). To circumvent that, we keep tabs on the
// size of the window while in the normal state (not maximized, minimized or
// fullscreen), so we restore it correctly.
gfx::Rect last_normal_bounds_;
gfx::Rect last_normal_bounds_before_move_;
// last_normal_bounds_ may or may not require update on WM_MOVE. When a
// window is maximized, it is moved (WM_MOVE) to maximum size first and then
// sized (WM_SIZE). In this case, last_normal_bounds_ should not update. We
// keep last_normal_bounds_candidate_ as a candidate which will become valid
// last_normal_bounds_ if the moves are consecutive with no WM_SIZE event in
// between.
gfx::Rect last_normal_bounds_candidate_;
bool consecutive_moves_;
// In charge of running taskbar related APIs.
TaskbarHost taskbar_host_;

View File

@@ -2,14 +2,19 @@
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#include <dwmapi.h>
#include <shellapi.h>
#include "atom/browser/browser.h"
#include "atom/browser/native_window_views.h"
#include "atom/browser/ui/views/root_view.h"
#include "atom/common/atom_constants.h"
#include "content/public/browser/browser_accessibility_state.h"
#include "ui/base/win/accessibility_misc_utils.h"
#include "ui/display/display.h"
#include "ui/display/win/screen_win.h"
#include "ui/gfx/geometry/insets.h"
#include "ui/views/widget/native_widget_private.h"
// Must be included after other Windows headers.
#include <UIAutomationCoreApi.h>
@@ -138,11 +143,164 @@ bool IsScreenReaderActive() {
return screenReader && UiaClientsAreListening();
}
// We use "enum" instead of "enum class" because we need to do bitwise compare.
enum AppbarAutohideEdge {
TOP = 1 << 0,
LEFT = 1 << 1,
BOTTOM = 1 << 2,
RIGHT = 1 << 3,
};
// The thickness of an auto-hide taskbar in pixel.
constexpr int kAutoHideTaskbarThicknessPx = 2;
// Code is copied from chrome_views_delegate_win.cc.
bool MonitorHasAutohideTaskbarForEdge(UINT edge, HMONITOR monitor) {
APPBARDATA taskbar_data = {sizeof(APPBARDATA), NULL, 0, edge};
taskbar_data.hWnd = ::GetForegroundWindow();
// MSDN documents an ABM_GETAUTOHIDEBAREX, which supposedly takes a monitor
// rect and returns autohide bars on that monitor. This sounds like a good
// idea for multi-monitor systems. Unfortunately, it appears to not work at
// least some of the time (erroneously returning NULL) and there's almost no
// online documentation or other sample code using it that suggests ways to
// address this problem. We do the following:-
// 1. Use the ABM_GETAUTOHIDEBAR message. If it works, i.e. returns a valid
// window we are done.
// 2. If the ABM_GETAUTOHIDEBAR message does not work we query the auto hide
// state of the taskbar and then retrieve its position. That call returns
// the edge on which the taskbar is present. If it matches the edge we
// are looking for, we are done.
// NOTE: This call spins a nested run loop.
HWND taskbar = reinterpret_cast<HWND>(
SHAppBarMessage(ABM_GETAUTOHIDEBAR, &taskbar_data));
if (!::IsWindow(taskbar)) {
APPBARDATA taskbar_data = {sizeof(APPBARDATA), 0, 0, 0};
unsigned int taskbar_state = SHAppBarMessage(ABM_GETSTATE, &taskbar_data);
if (!(taskbar_state & ABS_AUTOHIDE))
return false;
taskbar_data.hWnd = ::FindWindow(L"Shell_TrayWnd", NULL);
if (!::IsWindow(taskbar_data.hWnd))
return false;
SHAppBarMessage(ABM_GETTASKBARPOS, &taskbar_data);
if (taskbar_data.uEdge == edge)
taskbar = taskbar_data.hWnd;
}
// There is a potential race condition here:
// 1. A maximized chrome window is fullscreened.
// 2. It is switched back to maximized.
// 3. In the process the window gets a WM_NCCACLSIZE message which calls us to
// get the autohide state.
// 4. The worker thread is invoked. It calls the API to get the autohide
// state. On Windows versions earlier than Windows 7, taskbars could
// easily be always on top or not.
// This meant that we only want to look for taskbars which have the topmost
// bit set. However this causes problems in cases where the window on the
// main thread is still in the process of switching away from fullscreen.
// In this case the taskbar might not yet have the topmost bit set.
// 5. The main thread resumes and does not leave space for the taskbar and
// hence it does not pop when hovered.
//
// To address point 4 above, it is best to not check for the WS_EX_TOPMOST
// window style on the taskbar, as starting from Windows 7, the topmost
// style is always set. We don't support XP and Vista anymore.
if (::IsWindow(taskbar)) {
if (MonitorFromWindow(taskbar, MONITOR_DEFAULTTONEAREST) == monitor)
return true;
// In some cases like when the autohide taskbar is on the left of the
// secondary monitor, the MonitorFromWindow call above fails to return the
// correct monitor the taskbar is on. We fallback to MonitorFromPoint for
// the cursor position in that case, which seems to work well.
POINT cursor_pos = {0};
GetCursorPos(&cursor_pos);
if (MonitorFromPoint(cursor_pos, MONITOR_DEFAULTTONEAREST) == monitor)
return true;
}
return false;
}
int GetAppbarAutohideEdges(HWND hwnd) {
HMONITOR monitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONULL);
if (!monitor)
return 0;
int edges = 0;
if (MonitorHasAutohideTaskbarForEdge(ABE_LEFT, monitor))
edges |= AppbarAutohideEdge::LEFT;
if (MonitorHasAutohideTaskbarForEdge(ABE_TOP, monitor))
edges |= AppbarAutohideEdge::TOP;
if (MonitorHasAutohideTaskbarForEdge(ABE_RIGHT, monitor))
edges |= AppbarAutohideEdge::RIGHT;
if (MonitorHasAutohideTaskbarForEdge(ABE_BOTTOM, monitor))
edges |= AppbarAutohideEdge::BOTTOM;
return edges;
}
void TriggerNCCalcSize(HWND hwnd) {
RECT rcClient;
::GetWindowRect(hwnd, &rcClient);
::SetWindowPos(hwnd, NULL, rcClient.left, rcClient.top,
rcClient.right - rcClient.left, rcClient.bottom - rcClient.top,
SWP_FRAMECHANGED);
}
} // namespace
std::set<NativeWindowViews*> NativeWindowViews::forwarding_windows_;
HHOOK NativeWindowViews::mouse_hook_ = NULL;
void NativeWindowViews::Maximize() {
int autohide_edges = 0;
if (!has_frame())
autohide_edges = GetAppbarAutohideEdges(GetAcceleratedWidget());
// Only use Maximize() when:
// 1. window has WS_THICKFRAME style;
// 2. and window is not frameless when there is autohide taskbar.
if ((::GetWindowLong(GetAcceleratedWidget(), GWL_STYLE) & WS_THICKFRAME) &&
(has_frame() || autohide_edges == 0)) {
if (IsVisible())
widget()->Maximize();
else
widget()->native_widget_private()->Show(ui::SHOW_STATE_MAXIMIZED,
gfx::Rect());
return;
}
gfx::Insets insets;
if (!has_frame()) {
// When taskbar is autohide, we need to leave some space so the window
// isn't treated as a "fullscreen app", which would cause the taskbars
// to disappear.
//
// This trick comes from hwnd_message_handler.cc. While Chromium already
// does this for normal window, somehow it is not applying the trick when
// using frameless window, and we have to do it ourselves.
float scale_factor =
display::win::ScreenWin::GetScaleFactorForHWND(GetAcceleratedWidget());
int thickness = std::ceil(kAutoHideTaskbarThicknessPx / scale_factor);
if (autohide_edges & AppbarAutohideEdge::LEFT)
insets.set_left(-thickness);
if (autohide_edges & AppbarAutohideEdge::TOP)
insets.set_top(-thickness);
if (autohide_edges & AppbarAutohideEdge::RIGHT)
insets.set_right(thickness);
if (autohide_edges & AppbarAutohideEdge::BOTTOM)
insets.set_bottom(thickness);
}
restore_bounds_ = GetBounds();
auto display =
display::Screen::GetScreen()->GetDisplayNearestPoint(GetPosition());
gfx::Rect bounds = display.work_area();
bounds.Inset(insets);
SetBounds(bounds, false);
}
bool NativeWindowViews::ExecuteWindowsCommand(int command_id) {
std::string command = AppCommandToString(command_id);
NotifyWindowExecuteAppCommand(command);
@@ -187,24 +345,35 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
return false;
}
case WM_GETMINMAXINFO: {
WINDOWPLACEMENT wp;
wp.length = sizeof(WINDOWPLACEMENT);
// We need to handle GETMINMAXINFO ourselves because chromium tries to
// get the scale factor of the window during it's version of this handler
// based on the window position, which is invalid at this point. The
// previous method of calling SetWindowPlacement fixed the window
// position for the scale factor calculation but broke other things.
MINMAXINFO* info = reinterpret_cast<MINMAXINFO*>(l_param);
// We do this to work around a Windows bug, where the minimized Window
// would report that the closest display to it is not the one that it was
// previously on (but the leftmost one instead). We restore the position
// of the window during the restore operation, this way chromium can
// use the proper display to calculate the scale factor to use.
if (!last_normal_placement_bounds_.IsEmpty() &&
GetWindowPlacement(GetAcceleratedWidget(), &wp)) {
last_normal_placement_bounds_.set_size(gfx::Size(0, 0));
wp.rcNormalPosition = last_normal_placement_bounds_.ToRECT();
SetWindowPlacement(GetAcceleratedWidget(), &wp);
display::Display display =
display::Screen::GetScreen()->GetDisplayNearestPoint(
last_normal_placement_bounds_.origin());
last_normal_placement_bounds_ = gfx::Rect();
gfx::Size min_size = gfx::ScaleToCeiledSize(
widget()->GetMinimumSize(), display.device_scale_factor());
gfx::Size max_size = gfx::ScaleToCeiledSize(
widget()->GetMaximumSize(), display.device_scale_factor());
info->ptMinTrackSize.x = min_size.width();
info->ptMinTrackSize.y = min_size.height();
if (max_size.width() || max_size.height()) {
if (!max_size.width())
max_size.set_width(GetSystemMetrics(SM_CXMAXTRACK));
if (!max_size.height())
max_size.set_height(GetSystemMetrics(SM_CYMAXTRACK));
info->ptMaxTrackSize.x = max_size.width();
info->ptMaxTrackSize.y = max_size.height();
}
return false;
*result = 1;
return true;
}
case WM_NCCALCSIZE: {
if (!has_frame() && w_param == TRUE) {
@@ -220,8 +389,25 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
// https://blogs.msdn.microsoft.com/wpfsdk/2008/09/08/custom-window-chrome-in-wpf/
DefWindowProcW(GetAcceleratedWidget(), WM_NCCALCSIZE, w_param, l_param);
params->rgrc[0] = PROPOSED;
params->rgrc[1] = BEFORE;
// When fullscreen the window has no border
int border = 0;
if (!IsFullscreen()) {
// When not fullscreen calculate the border size
border = GetSystemMetrics(SM_CXFRAME) +
GetSystemMetrics(SM_CXPADDEDBORDER);
if (!thick_frame_) {
border -= GetSystemMetrics(SM_CXBORDER);
}
}
if (last_window_state_ == ui::SHOW_STATE_MAXIMIZED) {
// Position the top of the frame offset from where windows thinks by
// exactly the border amount. When fullscreen this is 0.
params->rgrc[0].top = PROPOSED.top + border;
} else {
params->rgrc[0] = PROPOSED;
params->rgrc[1] = BEFORE;
}
return true;
} else {
@@ -247,10 +433,6 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
case WM_SIZE: {
// Handle window state change.
HandleSizeEvent(w_param, l_param);
consecutive_moves_ = false;
last_normal_bounds_before_move_ = last_normal_bounds_;
return false;
}
case WM_MOVING: {
@@ -266,15 +448,6 @@ bool NativeWindowViews::PreHandleMSG(UINT message,
}
return false;
}
case WM_MOVE: {
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
if (consecutive_moves_)
last_normal_bounds_ = last_normal_bounds_candidate_;
last_normal_bounds_candidate_ = GetBounds();
consecutive_moves_ = true;
}
return false;
}
case WM_ENDSESSION: {
if (w_param) {
NotifyWindowEndSession();
@@ -304,24 +477,10 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
// window state and notify the user accordingly.
switch (w_param) {
case SIZE_MAXIMIZED: {
// Frameless maximized windows are size compensated by Windows for a
// border that's not actually there, so we must conter-compensate.
// https://blogs.msdn.microsoft.com/wpfsdk/2008/09/08/custom-window-chrome-in-wpf/
if (!has_frame()) {
float scale_factor = display::win::ScreenWin::GetScaleFactorForHWND(
GetAcceleratedWidget());
int border =
GetSystemMetrics(SM_CXFRAME) + GetSystemMetrics(SM_CXPADDEDBORDER);
if (!thick_frame_) {
border -= GetSystemMetrics(SM_CXBORDER);
}
root_view_->SetInsets(gfx::Insets(border).Scale(1.0f / scale_factor));
}
last_window_state_ = ui::SHOW_STATE_MAXIMIZED;
if (consecutive_moves_) {
last_normal_bounds_ = last_normal_bounds_before_move_;
if (!has_frame()) {
TriggerNCCalcSize(GetAcceleratedWidget());
}
NotifyWindowMaximize();
@@ -340,36 +499,27 @@ void NativeWindowViews::HandleSizeEvent(WPARAM w_param, LPARAM l_param) {
NotifyWindowMinimize();
break;
case SIZE_RESTORED:
if (last_window_state_ == ui::SHOW_STATE_NORMAL) {
// Window was resized so we save it's new size.
last_normal_bounds_ = GetBounds();
last_normal_bounds_before_move_ = last_normal_bounds_;
} else {
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
switch (last_window_state_) {
case ui::SHOW_STATE_MAXIMIZED:
last_window_state_ = ui::SHOW_STATE_NORMAL;
NotifyWindowUnmaximize();
if (!has_frame()) {
TriggerNCCalcSize(GetAcceleratedWidget());
}
break;
case ui::SHOW_STATE_MINIMIZED:
if (IsFullscreen()) {
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
NotifyWindowEnterFullScreen();
} else {
last_window_state_ = ui::SHOW_STATE_NORMAL;
root_view_->SetInsets(gfx::Insets(0));
NotifyWindowUnmaximize();
break;
case ui::SHOW_STATE_MINIMIZED:
if (IsFullscreen()) {
last_window_state_ = ui::SHOW_STATE_FULLSCREEN;
NotifyWindowEnterFullScreen();
} else {
last_window_state_ = ui::SHOW_STATE_NORMAL;
// When the window is restored we resize it to the previous known
// normal size.
if (has_frame()) {
SetBounds(last_normal_bounds_, false);
}
NotifyWindowRestore();
}
break;
default:
break;
}
NotifyWindowRestore();
}
break;
default:
break;
}
break;
}

View File

@@ -152,7 +152,7 @@ class CertVerifierRequest : public AtomCertVerifier::Request {
};
AtomCertVerifier::AtomCertVerifier(RequireCTDelegate* ct_delegate)
: default_cert_verifier_(net::CertVerifier::CreateDefault()),
: default_cert_verifier_(net::CertVerifier::CreateDefault(nullptr)),
ct_delegate_(ct_delegate) {}
AtomCertVerifier::~AtomCertVerifier() {}

View File

@@ -29,19 +29,19 @@ namespace atom {
const char* ResourceTypeToString(content::ResourceType type) {
switch (type) {
case content::RESOURCE_TYPE_MAIN_FRAME:
case content::ResourceType::kMainFrame:
return "mainFrame";
case content::RESOURCE_TYPE_SUB_FRAME:
case content::ResourceType::kSubFrame:
return "subFrame";
case content::RESOURCE_TYPE_STYLESHEET:
case content::ResourceType::kStylesheet:
return "stylesheet";
case content::RESOURCE_TYPE_SCRIPT:
case content::ResourceType::kScript:
return "script";
case content::RESOURCE_TYPE_IMAGE:
case content::ResourceType::kImage:
return "image";
case content::RESOURCE_TYPE_OBJECT:
case content::ResourceType::kObject:
return "object";
case content::RESOURCE_TYPE_XHR:
case content::ResourceType::kXhr:
return "xhr";
default:
return "other";

View File

@@ -347,13 +347,13 @@ void AtomURLRequest::OnReceivedRedirect(net::URLRequest* request,
}
void AtomURLRequest::OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) {
const net::AuthChallengeInfo& auth_info) {
DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::UI},
base::BindOnce(&AtomURLRequest::InformDelegateAuthenticationRequired,
this, scoped_refptr<net::AuthChallengeInfo>(auth_info)));
this, auth_info));
}
void AtomURLRequest::OnResponseStarted(net::URLRequest* request,
@@ -468,7 +468,7 @@ void AtomURLRequest::InformDelegateReceivedRedirect(
}
void AtomURLRequest::InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const {
const net::AuthChallengeInfo& auth_info) const {
DCHECK_CURRENTLY_ON(content::BrowserThread::UI);
if (delegate_)
delegate_->OnAuthenticationRequired(auth_info);

View File

@@ -53,7 +53,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const net::RedirectInfo& info,
bool* defer_redirect) override;
void OnAuthRequired(net::URLRequest* request,
net::AuthChallengeInfo* auth_info) override;
const net::AuthChallengeInfo& auth_info) override;
void OnResponseStarted(net::URLRequest* request, int net_error) override;
void OnReadCompleted(net::URLRequest* request, int bytes_read) override;
@@ -93,7 +93,7 @@ class AtomURLRequest : public base::RefCountedThreadSafe<AtomURLRequest>,
const GURL& url,
scoped_refptr<net::HttpResponseHeaders> response_headers) const;
void InformDelegateAuthenticationRequired(
scoped_refptr<net::AuthChallengeInfo> auth_info) const;
const net::AuthChallengeInfo& auth_info) const;
void InformDelegateResponseStarted(
scoped_refptr<net::HttpResponseHeaders>) const;
void InformDelegateResponseData(

View File

@@ -7,6 +7,7 @@
#include <string>
#include <utility>
#include "atom/browser/atom_browser_client.h"
#include "atom/browser/io_thread.h"
#include "atom/common/application_info.h"
#include "atom/common/options_switches.h"
@@ -50,6 +51,8 @@ network::mojom::HttpAuthDynamicParamsPtr CreateHttpAuthDynamicParams() {
command_line->GetSwitchValueASCII(atom::switches::kAuthServerWhitelist);
auth_dynamic_params->delegate_whitelist = command_line->GetSwitchValueASCII(
atom::switches::kAuthNegotiateDelegateWhitelist);
auth_dynamic_params->enable_negotiate_port =
command_line->HasSwitch(atom::switches::kEnableAuthNegotiatePort);
return auth_dynamic_params;
}
@@ -164,8 +167,7 @@ SystemNetworkContextManager::CreateDefaultNetworkContextParams() {
network::mojom::NetworkContextParamsPtr network_context_params =
network::mojom::NetworkContextParams::New();
network_context_params->enable_brotli =
base::FeatureList::IsEnabled(features::kBrotliEncoding);
network_context_params->enable_brotli = true;
network_context_params->enable_referrers = true;
@@ -245,7 +247,8 @@ SystemNetworkContextManager::CreateNetworkContextParams() {
network_context_params->context_name = std::string("system");
network_context_params->user_agent = atom::GetApplicationUserAgent();
network_context_params->user_agent =
atom::AtomBrowserClient::Get()->GetUserAgent();
network_context_params->http_cache_enabled = false;

View File

@@ -38,6 +38,20 @@ void BeforeStartInUI(base::WeakPtr<URLRequestAsyncAsarJob> job,
error = net::ERR_NOT_IMPLEMENTED;
}
// sanitize custom headers
if (request_options && request_options->is_dict()) {
const base::Value* headersDict = request_options->FindDictKey("headers");
if (headersDict) {
for (const auto& iter : headersDict->DictItems()) {
if (!iter.second.is_string()) {
args->ThrowError("Value of '" + iter.first +
"' header has to be a string");
return;
}
}
}
}
base::PostTaskWithTraits(
FROM_HERE, {content::BrowserThread::IO},
base::BindOnce(&URLRequestAsyncAsarJob::StartAsync, job,

View File

@@ -122,7 +122,7 @@ void URLRequestBufferJob::Kill() {
void URLRequestBufferJob::GetResponseInfo(net::HttpResponseInfo* info) {
std::string status("HTTP/1.1 ");
status.append(base::IntToString(status_code_));
status.append(base::NumberToString(status_code_));
status.append(" ");
status.append(net::GetHttpReasonPhrase(status_code_));
status.append("\0\0", 2);

View File

@@ -122,9 +122,13 @@ URLRequestContextGetter::Handle::CreateMainRequestContextGetter(
content::URLRequestInterceptorScopedVector protocol_interceptors) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(!main_request_context_getter_.get());
DCHECK(g_browser_process->io_thread());
LazyInitialize();
main_request_context_getter_ = new URLRequestContextGetter(
this, protocol_handlers, std::move(protocol_interceptors));
g_browser_process->io_thread()->RegisterURLRequestContextGetter(
main_request_context_getter_.get());
return main_request_context_getter_;
}
@@ -203,13 +207,13 @@ void URLRequestContextGetter::Handle::LazyInitialize() {
void URLRequestContextGetter::Handle::ShutdownOnUIThread() {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (main_request_context_getter_.get()) {
if (main_request_context_getter_) {
if (BrowserThread::IsThreadInitialized(BrowserThread::IO)) {
base::PostTaskWithTraits(
FROM_HERE, {BrowserThread::IO},
base::BindOnce(&URLRequestContextGetter::NotifyContextShuttingDown,
base::RetainedRef(main_request_context_getter_),
std::move(resource_context_)));
base::RetainedRef(main_request_context_getter_)));
}
}
@@ -238,18 +242,20 @@ URLRequestContextGetter::~URLRequestContextGetter() {
DCHECK(context_shutting_down_);
}
void URLRequestContextGetter::NotifyContextShuttingDown(
std::unique_ptr<content::ResourceContext> resource_context) {
void URLRequestContextGetter::NotifyContextShuttingDown() {
DCHECK_CURRENTLY_ON(BrowserThread::IO);
DCHECK(g_browser_process->io_thread());
DCHECK(context_handle_);
// todo(brenca): remove once C70 lands
if (url_request_context_ && url_request_context_->cookie_store()) {
url_request_context_->cookie_store()->FlushStore(base::NullCallback());
}
if (context_shutting_down_)
return;
g_browser_process->io_thread()->DeregisterURLRequestContextGetter(this);
context_shutting_down_ = true;
resource_context.reset();
context_handle_->resource_context_.reset();
net::URLRequestContextGetter::NotifyContextShuttingDown();
network_context_.reset();
}
net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
@@ -296,7 +302,7 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() {
const auto& custom_standard_schemes = atom::api::GetStandardSchemes();
cookie_schemes.insert(cookie_schemes.end(), custom_standard_schemes.begin(),
custom_standard_schemes.end());
cookie_monster->SetCookieableSchemes(cookie_schemes);
cookie_monster->SetCookieableSchemes(cookie_schemes, base::NullCallback());
// Setup handlers for custom job factory.
top_job_factory_.reset(new AtomURLRequestJobFactory);

View File

@@ -37,7 +37,7 @@ class URLRequestContextGetter : public net::URLRequestContextGetter {
// Discard reference to URLRequestContext and inform observers to
// shutdown. Must be called only on IO thread.
void NotifyContextShuttingDown(std::unique_ptr<content::ResourceContext>);
void NotifyContextShuttingDown();
AtomURLRequestJobFactory* job_factory() const {
return top_job_factory_.get();

View File

@@ -48,7 +48,7 @@ void BeforeStartInUI(base::WeakPtr<URLRequestStreamJob> job,
status_code = 200;
}
std::string status("HTTP/1.1 ");
status.append(base::IntToString(status_code));
status.append(base::NumberToString(status_code));
status.append(" ");
status.append(
net::GetHttpReasonPhrase(static_cast<net::HttpStatusCode>(status_code)));

View File

@@ -41,9 +41,9 @@ void NodeDebugger::Start() {
std::vector<std::string> v8_args;
std::vector<std::string> errors;
node::options_parser::DebugOptionsParser::instance.Parse(
&args, &exec_args, &v8_args, &options,
node::options_parser::kDisallowedInEnvironment, &errors);
node::options_parser::Parse(&args, &exec_args, &v8_args, &options,
node::options_parser::kDisallowedInEnvironment,
&errors);
if (!errors.empty()) {
// TODO(jeremy): what's the appropriate behaviour here?
@@ -51,13 +51,6 @@ void NodeDebugger::Start() {
<< base::JoinString(errors, " ");
}
// Set process._debugWaitConnect if --inspect-brk was specified to stop
// the debugger on the first line
if (options.wait_for_connect()) {
mate::Dictionary process(env_->isolate(), env_->process_object());
process.Set("_breakFirstLine", true);
}
const char* path = "";
if (inspector->Start(path, options,
std::make_shared<node::HostPort>(options.host_port),
@@ -65,4 +58,12 @@ void NodeDebugger::Start() {
DCHECK(env_->inspector_agent()->IsListening());
}
void NodeDebugger::Stop() {
auto* inspector = env_->inspector_agent();
if (inspector && inspector->IsListening()) {
inspector->WaitForDisconnect();
inspector->Stop();
}
}
} // namespace atom

View File

@@ -20,6 +20,7 @@ class NodeDebugger {
~NodeDebugger();
void Start();
void Stop();
private:
node::Environment* env_;

View File

@@ -79,7 +79,6 @@ PlatformNotificationService::~PlatformNotificationService() {}
void PlatformNotificationService::DisplayNotification(
content::RenderProcessHost* render_process_host,
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
@@ -100,7 +99,6 @@ void PlatformNotificationService::DisplayNotification(
}
void PlatformNotificationService::DisplayPersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& service_worker_scope,
const GURL& origin,
@@ -108,11 +106,9 @@ void PlatformNotificationService::DisplayPersistentNotification(
const blink::NotificationResources& notification_resources) {}
void PlatformNotificationService::ClosePersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id) {}
void PlatformNotificationService::CloseNotification(
content::BrowserContext* browser_context,
const std::string& notification_id) {
auto* presenter = browser_client_->GetNotificationPresenter();
if (!presenter)
@@ -121,25 +117,19 @@ void PlatformNotificationService::CloseNotification(
}
void PlatformNotificationService::GetDisplayedNotifications(
content::BrowserContext* browser_context,
DisplayedNotificationsCallback callback) {}
int64_t PlatformNotificationService::ReadNextPersistentNotificationId(
content::BrowserContext* browser_context) {
int64_t PlatformNotificationService::ReadNextPersistentNotificationId() {
// Electron doesn't support persistent notifications.
return 0;
}
void PlatformNotificationService::RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) {}
void PlatformNotificationService::ScheduleTrigger(
content::BrowserContext* browser_context,
base::Time timestamp) {}
void PlatformNotificationService::ScheduleTrigger(base::Time timestamp) {}
base::Time PlatformNotificationService::ReadNextTriggerTimestamp(
content::BrowserContext* browser_context) {
base::Time PlatformNotificationService::ReadNextTriggerTimestamp() {
return base::Time::Max();
}

View File

@@ -8,7 +8,6 @@
#include <set>
#include <string>
#include "content/public/browser/browser_context.h"
#include "content/public/browser/platform_notification_service.h"
namespace atom {
@@ -25,34 +24,25 @@ class PlatformNotificationService
// content::PlatformNotificationService:
void DisplayNotification(
content::RenderProcessHost* render_process_host,
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
const blink::NotificationResources& notification_resources) override;
void DisplayPersistentNotification(
content::BrowserContext* browser_context,
const std::string& notification_id,
const GURL& service_worker_scope,
const GURL& origin,
const blink::PlatformNotificationData& notification_data,
const blink::NotificationResources& notification_resources) override;
void ClosePersistentNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override;
void CloseNotification(content::BrowserContext* browser_context,
const std::string& notification_id) override;
void ClosePersistentNotification(const std::string& notification_id) override;
void CloseNotification(const std::string& notification_id) override;
void GetDisplayedNotifications(
content::BrowserContext* browser_context,
DisplayedNotificationsCallback callback) override;
int64_t ReadNextPersistentNotificationId(
content::BrowserContext* browser_context) override;
int64_t ReadNextPersistentNotificationId() override;
void RecordNotificationUkmEvent(
content::BrowserContext* browser_context,
const content::NotificationDatabaseData& data) override;
void ScheduleTrigger(content::BrowserContext* browser_context,
base::Time timestamp) override;
base::Time ReadNextTriggerTimestamp(
content::BrowserContext* browser_context) override;
void ScheduleTrigger(base::Time timestamp) override;
base::Time ReadNextTriggerTimestamp() override;
private:
AtomBrowserClient* browser_client_;

View File

@@ -14,7 +14,7 @@
#include "atom/browser/notifications/win/windows_toast_notification.h"
#include "base/environment.h"
#include "base/files/file_util.h"
#include "base/md5.h"
#include "base/hash/md5.h"
#include "base/strings/utf_string_conversions.h"
#include "base/threading/thread_restrictions.h"
#include "base/time/time.h"
@@ -47,7 +47,7 @@ bool SaveIconToPath(const SkBitmap& bitmap, const base::FilePath& path) {
// static
NotificationPresenter* NotificationPresenter::Create() {
auto version = base::win::GetVersion();
if (version < base::win::VERSION_WIN8)
if (version < base::win::Version::WIN8)
return new NotificationPresenterWin7;
if (!WindowsToastNotification::Initialize())
return nullptr;

View File

@@ -270,10 +270,16 @@ LRESULT DesktopNotificationController::Toast::WndProc(HWND hwnd,
case WM_MOUSEACTIVATE:
return MA_NOACTIVATE;
case WM_TIMER:
case WM_TIMER: {
if (wparam == TimerID_AutoDismiss) {
Get(hwnd)->AutoDismiss();
auto* inst = Get(hwnd);
Notification notification(inst->data_);
inst->data_->controller->OnNotificationDismissed(notification);
inst->AutoDismiss();
}
}
return 0;
case WM_LBUTTONDOWN: {

View File

@@ -47,8 +47,12 @@ void Win32Notification::Show(const NotificationOptions& options) {
if (existing) {
existing->tag_.clear();
this->notification_ref_ = std::move(existing->notification_ref_);
this->notification_ref_.Set(options.title, options.msg, image);
// Need to remove the entry in the notifications set that
// NotificationPresenter is holding
existing->Destroy();
} else {
this->notification_ref_ =
presenter->AddNotification(options.title, options.msg, image);

View File

@@ -112,13 +112,13 @@ class ToastEventHandler : public RuntimeClass<RuntimeClassFlags<ClassicCom>,
IFACEMETHODIMP Invoke(
ABI::Windows::UI::Notifications::IToastNotification* sender,
IInspectable* args);
IInspectable* args) override;
IFACEMETHODIMP Invoke(
ABI::Windows::UI::Notifications::IToastNotification* sender,
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e);
ABI::Windows::UI::Notifications::IToastDismissedEventArgs* e) override;
IFACEMETHODIMP Invoke(
ABI::Windows::UI::Notifications::IToastNotification* sender,
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e);
ABI::Windows::UI::Notifications::IToastFailedEventArgs* e) override;
private:
base::WeakPtr<Notification> notification_; // weak ref.

View File

@@ -6,6 +6,7 @@
#include <utility>
#include "base/memory/shared_memory.h"
#include "components/viz/common/resources/resource_format.h"
#include "components/viz/common/resources/resource_sizes.h"
#include "mojo/public/cpp/system/platform_handle.h"

View File

@@ -8,7 +8,7 @@
#include <memory>
#include "base/callback.h"
#include "base/memory/shared_memory.h"
#include "base/memory/shared_memory_mapping.h"
#include "components/viz/host/host_display_client.h"
#include "services/viz/privileged/interfaces/compositing/layered_window_updater.mojom.h"
#include "third_party/skia/include/core/SkBitmap.h"

View File

@@ -12,6 +12,7 @@
#include "base/callback_helpers.h"
#include "base/location.h"
#include "base/memory/ptr_util.h"
#include "base/optional.h"
#include "base/single_thread_task_runner.h"
#include "base/task/post_task.h"
#include "base/time/time.h"
@@ -351,7 +352,7 @@ void OffScreenRenderWidgetHostView::SetBounds(const gfx::Rect& new_bounds) {
SetSize(new_bounds.size());
}
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() const {
gfx::NativeView OffScreenRenderWidgetHostView::GetNativeView() {
return gfx::NativeView();
}
@@ -366,11 +367,11 @@ ui::TextInputClient* OffScreenRenderWidgetHostView::GetTextInputClient() {
void OffScreenRenderWidgetHostView::Focus() {}
bool OffScreenRenderWidgetHostView::HasFocus() const {
bool OffScreenRenderWidgetHostView::HasFocus() {
return false;
}
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() const {
bool OffScreenRenderWidgetHostView::IsSurfaceAvailableForCopy() {
return GetDelegatedFrameHost()->CanCopyFromCompositingSurface();
}
@@ -383,10 +384,10 @@ void OffScreenRenderWidgetHostView::Show() {
delegated_frame_host_->AttachToCompositor(compositor_.get());
delegated_frame_host_->WasShown(
GetLocalSurfaceIdAllocation().local_surface_id(),
GetRootLayer()->bounds().size(), false);
GetRootLayer()->bounds().size(), base::nullopt);
if (render_widget_host_)
render_widget_host_->WasShown(false);
render_widget_host_->WasShown(base::nullopt);
}
void OffScreenRenderWidgetHostView::Hide() {
@@ -411,7 +412,7 @@ void OffScreenRenderWidgetHostView::EnsureSurfaceSynchronizedForWebTest() {
SynchronizeVisualProperties();
}
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() const {
gfx::Rect OffScreenRenderWidgetHostView::GetViewBounds() {
if (IsPopupWidget())
return popup_position_;
@@ -429,8 +430,7 @@ void OffScreenRenderWidgetHostView::SetBackgroundColor(SkColor color) {
}
}
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor()
const {
base::Optional<SkColor> OffScreenRenderWidgetHostView::GetBackgroundColor() {
return background_color_;
}
@@ -438,7 +438,7 @@ void OffScreenRenderWidgetHostView::UpdateBackgroundColor() {
NOTREACHED();
}
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() const {
gfx::Size OffScreenRenderWidgetHostView::GetVisibleViewportSize() {
return size_;
}
@@ -532,8 +532,7 @@ void OffScreenRenderWidgetHostView::TextInputStateChanged(
void OffScreenRenderWidgetHostView::ImeCancelComposition() {}
void OffScreenRenderWidgetHostView::RenderProcessGone(base::TerminationStatus,
int) {
void OffScreenRenderWidgetHostView::RenderProcessGone() {
Destroy();
}
@@ -580,7 +579,7 @@ void OffScreenRenderWidgetHostView::CopyFromSurface(
}
void OffScreenRenderWidgetHostView::GetScreenInfo(
content::ScreenInfo* screen_info) const {
content::ScreenInfo* screen_info) {
screen_info->depth = 24;
screen_info->depth_per_component = 8;
screen_info->orientation_angle = 0;
@@ -621,8 +620,7 @@ void OffScreenRenderWidgetHostView::ImeCompositionRangeChanged(
const gfx::Range&,
const std::vector<gfx::Rect>&) {}
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize()
const {
gfx::Size OffScreenRenderWidgetHostView::GetCompositorViewportPixelSize() {
return gfx::ScaleToCeiledSize(GetRequestedRendererSize(),
current_device_scale_factor_);
}

View File

@@ -84,22 +84,22 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void InitAsChild(gfx::NativeView) override;
void SetSize(const gfx::Size&) override;
void SetBounds(const gfx::Rect&) override;
gfx::NativeView GetNativeView(void) const override;
gfx::NativeView GetNativeView(void) override;
gfx::NativeViewAccessible GetNativeViewAccessible(void) override;
ui::TextInputClient* GetTextInputClient() override;
void Focus(void) override;
bool HasFocus(void) const override;
bool HasFocus(void) override;
uint32_t GetCaptureSequenceNumber() const override;
bool IsSurfaceAvailableForCopy(void) const override;
bool IsSurfaceAvailableForCopy(void) override;
void Show(void) override;
void Hide(void) override;
bool IsShowing(void) override;
void EnsureSurfaceSynchronizedForWebTest() override;
gfx::Rect GetViewBounds(void) const override;
gfx::Size GetVisibleViewportSize() const override;
gfx::Rect GetViewBounds(void) override;
gfx::Size GetVisibleViewportSize() override;
void SetInsets(const gfx::Insets&) override;
void SetBackgroundColor(SkColor color) override;
base::Optional<SkColor> GetBackgroundColor() const override;
base::Optional<SkColor> GetBackgroundColor() override;
void UpdateBackgroundColor() override;
bool LockMouse(void) override;
void UnlockMouse(void) override;
@@ -131,7 +131,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
void SetIsLoading(bool is_loading) override;
void TextInputStateChanged(const content::TextInputState& params) override;
void ImeCancelComposition(void) override;
void RenderProcessGone(base::TerminationStatus, int) override;
void RenderProcessGone() override;
void Destroy(void) override;
void SetTooltipText(const base::string16&) override;
content::CursorManager* GetCursorManager() override;
@@ -139,7 +139,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
const gfx::Rect& src_rect,
const gfx::Size& output_size,
base::OnceCallback<void(const SkBitmap&)> callback) override;
void GetScreenInfo(content::ScreenInfo* results) const override;
void GetScreenInfo(content::ScreenInfo* results) override;
void InitAsGuest(content::RenderWidgetHostView*,
content::RenderWidgetHostViewGuest*) override;
void TransformPointToRootSurface(gfx::PointF* point) override;
@@ -149,7 +149,7 @@ class OffScreenRenderWidgetHostView : public content::RenderWidgetHostViewBase,
CreateSyntheticGestureTarget() override;
void ImeCompositionRangeChanged(const gfx::Range&,
const std::vector<gfx::Rect>&) override;
gfx::Size GetCompositorViewportPixelSize() const override;
gfx::Size GetCompositorViewportPixelSize() override;
content::RenderWidgetHostViewBase* CreateViewForWidget(
content::RenderWidgetHost*,

View File

@@ -17,9 +17,9 @@
<key>CFBundleIconFile</key>
<string>electron.icns</string>
<key>CFBundleVersion</key>
<string>6.0.0-nightly.20190404</string>
<string>6.1.3</string>
<key>CFBundleShortVersionString</key>
<string>6.0.0-nightly.20190404</string>
<string>6.1.3</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.developer-tools</string>
<key>LSMinimumSystemVersion</key>
@@ -32,5 +32,9 @@
<true/>
<key>NSHighResolutionCapable</key>
<true/>
<key>NSMicrophoneUsageDescription</key>
<string>This app needs access to the microphone</string>
<key>NSCameraUsageDescription</key>
<string>This app needs access to the camera</string>
</dict>
</plist>

View File

@@ -50,8 +50,8 @@ END
//
VS_VERSION_INFO VERSIONINFO
FILEVERSION 6,0,0,20190404
PRODUCTVERSION 6,0,0,20190404
FILEVERSION 6,1,3,0
PRODUCTVERSION 6,1,3,0
FILEFLAGSMASK 0x3fL
#ifdef _DEBUG
FILEFLAGS 0x1L
@@ -68,12 +68,12 @@ BEGIN
BEGIN
VALUE "CompanyName", "GitHub, Inc."
VALUE "FileDescription", "Electron"
VALUE "FileVersion", "6.0.0"
VALUE "FileVersion", "6.1.3"
VALUE "InternalName", "electron.exe"
VALUE "LegalCopyright", "Copyright (C) 2015 GitHub, Inc. All rights reserved."
VALUE "OriginalFilename", "electron.exe"
VALUE "ProductName", "Electron"
VALUE "ProductVersion", "6.0.0"
VALUE "ProductVersion", "6.1.3"
VALUE "SquirrelAwareVersion", "1"
END
END

View File

@@ -10,6 +10,8 @@
#import <Cocoa/Cocoa.h>
@interface NSColor (Hex)
- (NSString*)hexadecimalValue;
- (NSString*)RGBAValue;
+ (NSColor*)colorWithHexColorString:(NSString*)hex;
@end

View File

@@ -8,17 +8,65 @@
@implementation NSColor (Hex)
- (NSString*)RGBAValue {
double redFloatValue, greenFloatValue, blueFloatValue, alphaFloatValue;
NSColor* convertedColor =
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
if (convertedColor) {
[convertedColor getRed:&redFloatValue
green:&greenFloatValue
blue:&blueFloatValue
alpha:&alphaFloatValue];
int redIntValue = redFloatValue * 255.99999f;
int greenIntValue = greenFloatValue * 255.99999f;
int blueIntValue = blueFloatValue * 255.99999f;
int alphaIntValue = alphaFloatValue * 255.99999f;
return
[NSString stringWithFormat:@"%02x%02x%02x%02x", redIntValue,
greenIntValue, blueIntValue, alphaIntValue];
}
return nil;
}
- (NSString*)hexadecimalValue {
double redFloatValue, greenFloatValue, blueFloatValue;
NSColor* convertedColor =
[self colorUsingColorSpaceName:NSCalibratedRGBColorSpace];
if (convertedColor) {
[convertedColor getRed:&redFloatValue
green:&greenFloatValue
blue:&blueFloatValue
alpha:NULL];
int redIntValue = redFloatValue * 255.99999f;
int greenIntValue = greenFloatValue * 255.99999f;
int blueIntValue = blueFloatValue * 255.99999f;
return [NSString stringWithFormat:@"#%02x%02x%02x", redIntValue,
greenIntValue, blueIntValue];
}
return nil;
}
+ (NSColor*)colorWithHexColorString:(NSString*)inColorString {
unsigned colorCode = 0;
unsigned char redByte, greenByte, blueByte;
if (inColorString) {
NSScanner* scanner = [NSScanner scannerWithString:inColorString];
(void)[scanner scanHexInt:&colorCode]; // ignore error
}
redByte = (unsigned char)(colorCode >> 16);
greenByte = (unsigned char)(colorCode >> 8);
blueByte = (unsigned char)(colorCode); // masks off high bits
unsigned char redByte = (unsigned char)(colorCode >> 16);
unsigned char greenByte = (unsigned char)(colorCode >> 8);
unsigned char blueByte = (unsigned char)(colorCode); // masks off high bits
return [NSColor colorWithCalibratedRed:(CGFloat)redByte / 0xff
green:(CGFloat)greenByte / 0xff

Some files were not shown because too many files have changed in this diff Show More