Commit graph

79 commits

Author SHA1 Message Date
Nitish Sakhawalkar
cf5224140b Chrome changed the devtools url
chrome-devtools:// to devtools://
28b21a67f0
2019-05-17 16:16:25 -07:00
Electron Bot
2616911f7a chore: bump chromium to 7dff37844cb3 (master) (#18059) 2019-04-30 17:18:22 -07:00
Cheng Zhao
a4fcc32799
feat: upgrade to Node 12 (#17838)
* fix: add boringssl backport to support node upgrade

* fix: Update node_includes.h, add DCHECK macros

* fix: Update node Debug Options parser usage

* fix: Fix asar setup

* fix: using v8Util in isolated context

* fix: make "process" available in preload scripts

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

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

* chore: update node dep sha

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

* fix: make original-fs work with streams

* build: override node module version

* fix: use _linkedBinding in content_script/init.js

* chore: update node ref in DEPS

* build: node_module_version should be 73
2019-04-26 18:55:12 +09:00
Electron Bot
716cb28430 chore: bump chromium to 1e9f9a24aa12 (master) (#17880)
* chore: bump chromium in DEPS to 1e9f9a24aa12bea9cf194a82a7e249bd1242ec4f

* chore: update patches

* Make WebContents' theme color a base::Optional<SkColor>

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

* update autofill patch for incorrect header includes

* Move Shell messages to web_test and rename to BlinkTest.

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

* Make PlatformNotificationServiceImpl a KeyedService.

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

* Move MediaPlayerId to its own file.

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

* Remove net/base/completion_callback.h, which is no longer used

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

* AW NS: support file scheme cookies

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

* Remove SecurityInfo and adapt remaining consumers

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

* Remove deprecated type-specific number to string conversion functions

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

* DevTools: Adding new performance histograms for launch of top 4 tools

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

* Update include paths for //base/hash/hash.h

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

* build: Disable ensure_gn_version gclient hook for mac CI checkout

* update patches

* use maybe version of v8::String::NewFromTwoByte

* bump appveyor image version

* fix mac ci hopefully

* Convert enum to enum class for MenuAnchorPosition

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

* use maybe version of ToObject

* RenderViewHost::GetProcess is no longer const

* Unrefcount AuthChallengeInfo

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

* MenuButtonController takes Button rather than MenuButton

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

* add //ui/views_bridge_mac to deps to fix link error

* forward declare views::Button in atom::MenuDelegate

* more v8 patches

* base/{=> hash}/md5.h

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

* gfx::{PlatformFontWin => win}::*

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

* fix v8 patches

* [base] Rename TaskScheduler to ThreadPool

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

* use internal_config_base for bytecode_builtins_list_generator

avoids windows link errors

* FIXME: temporarily disable v8/breakpad integration

* FIXME: temporarily disable prevent-will-redirect test

* FIXME: disable neon on aarch64 pending crbug.com/953815

* update to account for WebCursor refactor

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

* enable stack dumping on appveyor

* Revert "FIXME: disable neon on aarch64 pending crbug.com/953815"

This reverts commit 57f082026be3d83069f2a2814684abf4dc9e7b53.

* fix: remove const qualifiers to match upstream

* fix: remove const qualifiers to match upstream in cc files as well

* don't throw an error when testing if an object is an object

* use non-deprecated Buffer constructor

* Remove net::CookieSameSite::DEFAULT_MODE enum value

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

* depend on modded dbus-native to work around buffer deprecation

https://github.com/sidorares/dbus-native/pull/262

* revert clang roll to fix arm build on linux

* fixup! depend on modded dbus-native to work around buffer deprecation

need more coffee

* update coffee-script

* robustify verify-mksnapshot w.r.t. command-line parameters

* Revert "robustify verify-mksnapshot w.r.t. command-line parameters"

This reverts commit a49af01411f684f6025528d604895c3696e0bc57.

* fix mksnapshot by matching args

* update patches

* TMP: enable rdp on appveyor

* Changed ContentBrowserClient::CreateQuotaPermissionContext() to return scoped_refptr.

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

* Make content::ResourceType an enum class.

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

* fixup! Make content::ResourceType an enum class.

* turn off rdp

* use net::CompletionRepeatingCallback instead of base::Callback<void(int)>

* remove disable_ensure_gn_version_gclient_hook.patch

* copy repeating callback instead of std::move

* fix lint

* add completion_repeating_callback.h include
2019-04-20 10:20:37 -07:00
Samuel Attard
829050daab
build: rename sandbox bundle (#17831) 2019-04-17 17:18:03 -04:00
Milan Burda
77d59e99b6 feat: emit process 'loaded' event in sandboxed renderers (#17680) 2019-04-04 11:35:06 -07:00
Jeremy Apthorp
53f6cbccbf
refactor: use mojo for electron internal IPC (#17406)
* refactor: use mojo for electron internal IPC

* add sender_id, drop MessageSync

* remove usages of AtomFrameMsg_Message

* iwyu

* first draft of renderer->browser direction

* refactor to reuse a single ipc interface

* implement TakeHeapSnapshot through mojo

* the rest of the owl^WtakeHeapSnapshot mojofication

* remove no-op overrides in AtomRendererClient

* delete renderer-side ElectronApiServiceImpl when its pipe is destroyed

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

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

* undo changes to manifests.cc

* unify sandboxed + unsandboxed ipc events

* lint

* register ElectronBrowser mojo service on devtools WebContents

* fix takeHeapSnapshopt failure paths

* {electron_api => atom}::mojom

* add send_to_all to ElectronRenderer::Message

* keep interface alive until callback is called

* review comments

* use GetContext from RendererClientBase

* robustify a test that uses window.open

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

* add v8::MicrotasksScope and node::CallbackScope

* iwyu

* use weakptr to api::WebContents instead of Unretained

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

* iwyu + comments

* remove unused WeakPtrFactory

* inline OnRendererMessage[Sync]

* cleanups & comments

* use helper methods instead of inline lambdas

* remove unneeded async in test

* add mojo to manifests deps

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

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

* update gn check targets list

* move interface registration back to RenderFrameCreated
2019-04-02 15:38:16 -07:00
Shelley Vohr
38d75010c7
chore: rename atomBinding to electronBinding (#17419) 2019-03-18 12:37:06 -07:00
Nitish Sakhawalkar
e77d065875 chore: node_includes header no longer needs to be at the end of the list (#17090)
Until one of the latest version of node, the definition of the DISALLOW_COPY_AND_ASSIGN macro in node was different than in chromium. That is no longer the case, so just undefining the macro in node_includes.h works.
2019-03-11 17:13:43 -07:00
Samuel Maddock
f943db7ad5 feat: Add content script world isolation (#17032)
* Execute content script in isolated world

* Inject script into newly created extension worlds

* Create new content_script_bundle for extension scripts

* Initialize chrome API in content script bundle

* Define Chrome extension isolated world ID range

1 << 20 was chosen as it provides a sufficiently large range of IDs for extensions, but also provides a large enough buffer for any user worlds in [1000, 1 << 20).

Ultimately this range can be changed if any user application raises it as an issue.

* Insert content script CSS into document

This now avoids a script wrapper to inject the style sheet. This closely matches the code used by chromium in `ScriptInjection::InjectCss`.

* Pass extension ID to isolated world via v8 private
2019-03-11 16:27:57 -07:00
Robo
5afb7dc715 refactor: load electron builtin modules with process._linkedBinding (#17247)
* refactor: load electron builtin modules with process._linkedBinding

NODE_BUILTING_MODULE_CONTEXT_AWARE and process.binding are
removed in https://github.com/nodejs/node/pull/25829. This changes
uses the alternative available without any functionality change.

* chore: roll node
2019-03-08 10:29:52 -08:00
Samuel Maddock
42b7b25ac3 feat: support chrome extensions in sandboxed renderer (#16218)
* Add content script injector to sandboxed renderer

* Fix 'getRenderProcessPreferences' binding to the wrong object

* Pass getRenderProcessPreferences to content-scripts-injector

* Emit document-start and document-end  events in sandboxed renderer

* Use GetContext from RendererClientBase

* Prevent script context crash caused by lazily initialization

* Remove frame filtering logic for onExit callback

Since we're keeping track of which frames we've injected the bundle into, this logic is redundant.

* Add initial content script tests

* Add contextIsolation variants to content script tests

* Add set include

* Fix already loaded extension error

* Add tests for content scripts 'run_at' options

* Catch script injection eval error when CSP forbids it

This can occur in a rendered sandbox when a CSP is enabled. We'll need to switch to using isolated worlds to fix this.

* Fix content script tests not properly cleaning up extensions

* Fix lint and type errors
2019-03-07 16:00:28 -08:00
Milan Burda
cc90919384 refactor: pass internal flag via IPC message struct for consistency (#16490) 2019-01-23 08:24:57 -08:00
Samuel Attard
58a6fe13d6
feat: preloads and nodeIntegration in iframes (#16425)
* feat: add support for node / preloads in subframes

This feature has delibrately been built / implemented in such a way
that it has minimum impact on existing apps / code-paths.
Without enabling the new "nodeSupportInSubFrames" option basically none of this
new code will be hit.

The things that I believe need extra scrutiny are:

* Introduction of `event.reply` for IPC events and usage of `event.reply` instead of `event.sender.send()`
* Usage of `node::FreeEnvironment(env)` when the new option is enabled in order to avoid memory leaks.  I have tested this quite a bit and haven't managed to cause a crash but it is still feature flagged behind the "nodeSupportInSubFrames" flag to avoid potential impact.

Closes #10569
Closes #10401
Closes #11868
Closes #12505
Closes #14035

* feat: add support preloads in subframes for sandboxed renderers

* spec: add tests for new nodeSupportInSubFrames option

* spec: fix specs for .reply and ._replyInternal for internal messages

* chore: revert change to use flag instead of environment set size

* chore: clean up subframe impl

* chore: apply suggestions from code review

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

* chore: clean up reply usage

* chore: fix TS docs generation

* chore: cleanup after rebase

* chore: rename wrap to add in event fns
2019-01-22 11:24:46 -08:00
Milan Burda
0e27f133d7 refactor: delete atom_api_renderer_ipc.h (#16481) 2019-01-21 22:31:37 -08:00
Milan Burda
b965e54efc fix: <webview> not working with contextIsolation + sandbox (#16469) 2019-01-22 10:08:16 +09:00
Alex Garbutt
dcb670fa46 fix: emit IPC event in correct context if isolation and sandbox enabled (#16352)
* fix: emit IPC event in correct context if isolation and sandbox enabled

IPC events were not being delivered to renderer processes when both
`contextIsolation` and `sandbox` were enabled. This is because the
`AtomSandboxedRenderFrameObserver` class was incorrectly using the
`MainWorldScriptContext`, rather than conditionally selecting the
context based on if isolation was enabled.

Fixes #11922
2019-01-12 14:19:20 +01:00
Robo
52fe92d02e feat: Upgrade to Chromium 71.0.3578.98 (#15966) 2019-01-11 17:00:43 -08:00
deepak1556
e1336d8453 chore: fix v8 deprecation warnings 2018-12-03 20:07:43 +05:30
deepak1556
66349261a5 fix: update to per context v8::Script::Compile api 2018-12-03 20:07:39 +05:30
Milan Burda
07f8f5f95a refactor: eliminate duplicate code exposing process APIs (#15824) 2018-11-28 11:08:17 -05:00
Milan Burda
81e00d8e56 chore: fix V8 deprecation warnings (#15842) 2018-11-27 16:42:02 -05:00
Samuel Attard
0b0a17ff91 fix: load the chrome.* API on chrome-extension pages in sandbox mode (#15563)
With mixed sandbox enabled we need to load the chrome.* APIs in the
sandbox init.js so that chrome extensions load correctly.

This mirrors the equivilant impl in `atom_renderer_client.cc`

Fixes #15561
2018-11-21 12:56:58 -05:00
Jeremy Apthorp
0642be296d
fix: crash in sandbox on linux when getting execPath (#15701) 2018-11-15 12:59:01 -08:00
Michelle Tilley
2a8e8a0603 fix: make certain values on process read-only (#15628)
* docs: Add 'worker' as a possible value for `process.type`

* fix: make certain properties on `process` read only:

* `mas`
* `windowsStore`
* `versions.electron`
* `versions.chrome`
* `type`
* `pid`
* `sandboxed`
2018-11-08 10:28:06 -04:00
Milan Burda
8ba271efba refactor: eliminate brightray (#15240) 2018-10-24 12:49:10 +02:00
Heilig Benedek
a82bcc7e3c refactor: move printing out of chromium_src (#15023)
* remove printing related things from chromium_src

* chore: add printing build flag and patch

* fix: include PrintingService on other platforms too

* fix: printing_handler is only needed on Windows

* fix: format BUILD.gn properly

* fix: rename printing build flag to avoid conflict with chromium

* fix: place previously missed printing calls behind build flag

* fix: accidentally renamed flag in patch file

* fix: don't include all printing strings

* fix: allow ShowItemInFolder and OpenItem to block, fixing a DCHECK crash

* fix: make things compile, some changes got lost while rebasing

* fix: remove rogue line from BUILD.gn

* chore: update patch description

* style: lint fix

* chore: use chromium printing buildflag, move node related stuff out of patch

* revert: remove ScopedAllowBlockingForTesting call

* fix: fix my rebase blooper

* fix: re-add header lost during rebase, update patch

* fix: add <map> include, tweak the patch a bit

* revert: remove rogue diff from patch

* fix: clean up after rebase
2018-10-13 12:57:04 +11:00
Milan Burda
b50f86ef43 refactor: use separate ipc-renderer-internal / ipc-main-internal APIs for Electron internals (#13940) 2018-10-07 00:48:00 +13:00
Jeremy Apthorp
de581ca0b4 PathService -> base::PathService 2018-10-04 00:12:54 +02:00
Milan Burda
ce38be74df refactor: simplify process object initialization for sandboxed renderers (#14878)
Also fix `process.windowsStore`.
2018-09-30 23:24:00 +02:00
Aleksei Kuzmin
7fc3bcaa02 chore: run clang-format
- atom/
 - brightray/
 - chromium_src/
2018-09-19 17:18:10 +02:00
Charles Kerr
d663b4eaee
fix: fix gn cpplint warnings (#14583)
* chore: fix cpplint 'include_what_you_use' warnings

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

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

Use C style strings instead of std::string.

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

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

* refactor: remove global string variables.

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

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

* fix: initializer error introduced in last commit

* fix: remove WIP file that was included by accident

* fix: include order

* fix: include order

* fix: include order

* fix: include order, again
2018-09-12 19:25:56 -05:00
Samuel Attard
14df89f214 Remove the 'getProcessMemoryInfo' API
* Underlying APIs have been removed in Chromium
  * https://chromium-review.googlesource.com/c/chromium/src/+/969089
  * https://chromium-review.googlesource.com/c/chromium/src/+/953723
  * https://bugs.chromium.org/p/chromium/issues/detail?id=819289
* https://github.com/electron/electron/projects/11#card-11509601
2018-09-11 20:21:32 +02:00
Aleksei Kuzmin
0afebdc531 The Great Blink mv for source files, part 2.
https://chromium-review.googlesource.com/1001153
2018-09-11 20:21:32 +02:00
Milan Burda
c17a1b37ea feat: add event.senderId property to IPCs sent via ipcRenderer.sendTo (#14395) 2018-08-31 20:13:51 -05:00
Milan Burda
e6e3ccfc50 refactor: use std::string instead of base::string16 for IPC channel names (#14286) 2018-08-24 10:30:37 -05:00
Milan Burda
fc85d02786 feat: expose missing process APIs in sandboxed renderers (#13505) 2018-08-21 11:05:45 -07:00
Milan Burda
702cc84bd3 Don't pass preloadPath via ELECTRON_BROWSER_SANDBOX_LOAD for security reasons (#13031) 2018-08-10 17:19:49 -05:00
Milan Burda
db38c8b620 Fix process.execPath returning parent process path instead of the helper in sandboxed renderer (#13839) 2018-07-30 11:13:42 +10:00
Cheng Zhao
e2029435c4 fix: use context counter as contextId
For sandboxed renderer it may not have a node::Environment in the context,
using a increasing counter as contextId works for all cases.
2018-07-19 11:00:10 -07:00
PalmerAL
ffc15e02a6 fix: add native function to create preload script (#13032)
* add native function to create preload script

* add tests

* fix formatting

* fix tests

* rerun CI
2018-07-13 11:17:11 +09:00
Hari Juturu
eb223f8bc3 Enable webview in sandbox renderer (#13435)
* Enable webview in sandbox renderer
Security: Inherit embedder prefs onto webview

* cache lastwebprefs
2018-07-03 02:06:26 +10:00
Thiago de Arruda
6ff111a141 perf: don't use JSON to send the result of ipcRenderer.sendSync. (#8953)
* Don't use JSON to send the result of `ipcRenderer.sendSync`.

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

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

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

* Don't base64 encode Buffers

* Don't allocate V8ValueConverter on the heap

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

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

* Refactor problematic test to make it more reliable

* Add tests for NaN and Infinity
2018-06-13 17:38:31 +10:00
Milan Burda
6ad0a22602 Add process.getHeapStatistics() (#13183) 2018-06-10 22:00:36 +10:00
Jeremy Apthorp
e6695cf2ec [chromium-style] override / virtual warnings 2018-04-19 11:12:10 -07:00
Jeremy Apthorp
a635f078c6 [chromium-style] auto variable type must not deduce to a raw pointer type 2018-04-19 11:10:52 -07:00
Shelley Vohr
c6f4bbd143
also format missing .cc files 2018-04-18 20:48:45 -04:00
Robo
ad2baccefa tools: pass custom template for js2c (#12593)
* Update node v9.7.0 ref

* tools: pass custom template to node/tools/js2c.py
2018-04-13 08:20:04 -04:00
Nitish Sakhawalkar
9d1527b1df Fix context menu for sandbox devtools (#11933) 2018-03-22 16:15:57 +09:00
deepak1556
3cfe66e4c3 move ipc use from rvh to rfh 2018-03-09 15:01:09 +05:30