Commit graph

93 commits

Author SHA1 Message Date
Samuel Maddock
8ee153dae1 feat: add support for content scripts 'all_frames' option (#17258)
* feat: add support for content scripts 'all_frames' option

* merged content script tests

'all_frames' test now runs on all variants of sandbox/contentIsolation configurations :D
2019-03-08 15:53:25 -08:00
Milan Burda
64078324bf refactor: make CHROME_GET_MESSAGES handler async (#17148) 2019-02-27 21:30:35 -06:00
Milan Burda
5a99ea4c46 refactor: merge ipcMainUtils.handle / handleSync (#17062) 2019-02-26 15:48:26 -08:00
ZYSzys
a40d826b11 chore: remove unused catch bindings (#16121) 2019-02-21 09:26:07 +00:00
Milan Burda
975a035d34 chore: re-enable devtools renderer sandbox (#16864)
* chore: re-enable devtools renderer sandbox

* chore: enable sandbox for chrome extension background script host renderers
2019-02-15 15:10:32 +05:30
Stewart Lord
84ef9cae6c fix: send chrome.runtime/tabs.sendMessage result to correct sender (#16945)
Additionally, use `.once` instead of `.on` for result specific listeners.
2019-02-14 06:07:55 -10:00
Samuel Maddock
8f6a543398 feat: add chrome.runtime.getManifest (#16891)
* feat: add chrome.runtime.getManifest

* Add test for chrome.runtime.getManifest

* Use IPC utils for getManifest internals
2019-02-13 07:16:12 -10:00
Milan Burda
d8ba1278d1 chore: disable the remote module in devtools / chrome extension background scripts (#16866)
* cache isRemoteModuleEnabled

* chore: disable the remote module in devtools / chrome extension background scripts
2019-02-11 10:42:37 -10:00
Milan Burda
7a3d220347 refactor: implement Chrome Extension APIs without the remote module (#16686)
* refactor: implement Chrome Extension APIs without the remote module

* remove unused potentiallyRemoteRequire
2019-02-10 10:38:14 -08:00
Milan Burda
1632c4b837 refactor: implement chrome.i18n.getMessage() without the remote module (#16739)
* refactor: implement chrome.i18n.getMessage() without the remote module

* replace navigator.language with app.getLocale()
2019-02-08 12:07:09 -08:00
Samuel Attard
af64140100
refactor: enforce naming of ipcMainInternal (#16689) 2019-02-04 14:49:53 -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
607b53c883 security: block chrome.tabs.executeScript() for non chrome-extension: URLs (#15929) 2018-12-11 10:45:46 +01:00
Benjamin Pasero
c74ae107f1 fix: do not print an error for an expected condition (#15991) (#15992) 2018-12-10 12:06:26 -08:00
Eric
10db2bce4e fix: loading of devtools extensions on startup (#13844)
* Fix loading of devtools extensions on startup

The persisted DevTools Extensions were not being loaded correctly at startup. The `addDevToolsExtension` function was not defined when it was being called. An error was being thrown and ignored, so the whole thing would fail silently. I moved the code to load the extensions to the end of the event handler, so now it works.

* fixup: remove trailing spaces to unblock CI

* fixup: add logging when the Electron Enable Logging env var is set

* Fix linter error on undefined srcDirectory

* fixup: catch exception when loading extension

* Revert "fixup: catch exception when loading extension"

This reverts commit 42c2cf95bcaab8abfc5fbecbe4365d3adfe36d5b.
2018-10-19 11:22:42 +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
Samuel Attard
176a76217c
chore: have 'use strict' consistently across our lib files (#14721) 2018-09-23 00:28:50 +12:00
Samuel Attard
558fff69e7
chore: update to standard 12 2018-09-14 14:57:01 +10:00
kaylie
3c64062f69 Replace custom function with Object.values() 2018-02-05 20:03:28 -08:00
Felix Rieseberg
f7d6e3fa7b 🔧 Disable standard/no-callback-literal where necessary 2017-11-23 13:53:03 -08:00
Alexandre Lachèze
e1a232e7c8 Add support for css in content_scripts 2017-09-14 17:23:33 +09:00
Kevin Sawicki
34fff57646 Grant the devtools access to the extension origins 2017-08-15 16:19:21 +03:00
John Kleinschmidt
ccdff72ee4 Merge pull request #9918 from alexstrat/add-extensions-loading-api
Introduce Chrome extensions management APIs independent of Dev Tools Extensions
2017-08-07 20:06:22 -04:00
Alexandre Lachèze
03ec155ecb Oops 2017-07-05 17:34:04 +02:00
Alexandre Lachèze
cba53604eb Introduce extensions management APIs indépendant of Dev Tools Extensions
- introduce API BrowserWindow#[add,remove,get]Extension
- make [add,remove, get]DevToolsExtension use newly introduced API
- make the app persist only the extensions added via
#addDevToolsExtension
2017-07-03 20:01:08 +02:00
Boik
2e9ace6f59 Use Buffer.from instead of deprecated new Buffer
Use Buffer.from instead of deprecated new Buffer.
2017-06-12 16:57:42 +08:00
Samuel Attard
01005688b6
Implement chrome.runtime.onMessage response callback 2016-11-15 21:30:40 +11:00
Thiago de Arruda
a64978b812 Use the routing id on api::WebContents::GetID
The sandbox option allows multiple webContents in one renderer process, so using
the only the renderer id to identify WebContents instances is no longer an
option.

WebContents::GetID now returns a 64-bit integer, which is composed of both the
process id(high 32), and the RenderViewHost routing id(low 32). Also add a
`GetProcessID` that retrieves the renderer process id, a requirement in some of
our javascript code.
2016-09-27 06:01:47 -03:00
Kevin Sawicki
902bd0564e Require Buffer explicitly instead of relying on global 2016-09-08 10:17:06 -07:00
Cheng Zhao
41d2799514 Run background pages in separate partition
This avoids the default partition always being created on startup, so it
gives users a chance to run session.fromParititon.
2016-07-13 16:22:55 +09:00
Cheng Zhao
e653c67153 Move chromeExtensionHandler out of ready handler
This code were in ready handler because we could not require "protocol"
before ready before. It is now safe to move the code out.
2016-07-13 12:23:14 +09:00
Cheng Zhao
d739d8772c Move session-created event to app
This follows the convention of other *-created events.
2016-07-13 12:23:14 +09:00
Jhen
d4f64ce943 Use background page path instead of generated path
if extension use manifest.background.page
2016-07-01 23:50:31 +08:00
Jhen
76f4bd01eb Support background.page in extension manifest 2016-06-30 16:04:13 +08:00
Kevin Sawicki
df22082110 Call loadExtension from addDevToolsExtension 2016-06-17 14:53:51 -07:00
Kevin Sawicki
65abaee299 Forward will/did navigate events to extensions 2016-06-16 12:07:59 -07:00
Cheng Zhao
bb10551d23 Work around a compiler bug that crashes on Windows 2016-06-16 10:55:25 +09:00
Kevin Sawicki
ae6ffa6d5e unkown -> unknown 2016-06-14 15:47:33 -07:00
Kevin Sawicki
ee09c7534a Only add extensions to windows and webviews 2016-06-14 15:47:33 -07:00
Kevin Sawicki
f29801ad2b Add background page web contents type 2016-06-14 15:47:33 -07:00
Kevin Sawicki
f25c1f864b Use RenderProcessPreferences for non-remote web contents 2016-06-14 15:47:32 -07:00
Kevin Sawicki
56001b481e Emit web-contents-created on app 2016-06-13 08:59:57 -07:00
Kevin Sawicki
1f245d5ff6 Add getDevToolsExtensions API 2016-06-10 09:26:38 -07:00
Kevin Sawicki
0a26075699 Add BrowserWindow.isDevToolsExtensionInstalled API 2016-06-10 09:24:04 -07:00
Cheng Zhao
ccaf837da4 Merge pull request #5964 from electron/manifest-errors
Throw errors reading/parsing manifest.json files
2016-06-10 03:28:57 +00:00
Kevin Sawicki
84960af793 Add initial chrome.i18n.getMessage API 2016-06-09 13:57:08 -07:00
Kevin Sawicki
6d3fc611bd Tweak duplicate extension message 2016-06-09 10:08:21 -07:00
Kevin Sawicki
f46edd5186 Throw errors reading/parsing manifest.json 2016-06-09 09:45:02 -07:00
deepak1556
4749e18fc0 fix spec and docs 2016-06-09 10:48:05 +05:30
deepak1556
cb5e648502 register extension handler for every session created 2016-06-09 10:40:51 +05:30