Commit graph

203 commits

Author SHA1 Message Date
Jeremy Apthorp
f537366387 test: move security warnings spec to main runner (#20055) 2019-09-03 16:02:22 +09:00
Jeremy Apthorp
af138dab55
test: move webRequest spec to main runner (#19992) 2019-08-28 13:56:15 -07:00
Shelley Vohr
e8fa248571
fix: crash in window.print() (#19690)
* fix: crash in window.print()

* add preliminary tests
2019-08-12 23:44:14 -07:00
Cheng Zhao
04dbd5c53f fix: don't handle browser messages before document element is created (#19718)
* 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:38:41 -07:00
Milan Burda
419ce494e9 refactor: use IPC helpers in window-setup (#17948) 2019-07-09 02:43:49 +03:00
Jerry Wu
dee331519c fix: disable nodeIntegration & insecure resource warnings for localhost (#18814)
* fix: disable remote host nodeIntegration warning for localhost

In warnAboutNodeWithRemoteContent(), add a check to see if the hostname
is "localhost" and prevent the warning message if it is.

* fix: disable loading insecure resources warning for localhost

In warnAboutInsecureResources(), filter out resources from localhost
since they are most likely not a threat.

* test: add tests for ignoring security warnings when using localhost

Add tests for ignoring warning messages for the following scenarios:
  1. node integration with remote content from localhost
  2. loading insecure resources from localhost

* test: fix insecure resource test

* test: pass nodeIntegration with remote test on did-finish-load

* test: maybe fix node integration test (error w/ conv circular struct)

* test: update test description

* test: use "load" event to check when nodeIntegration test has finished

Instead of relying on the "did-finish-load" event, which may result in
a race condition, add an "onload" handler that logs "loaded" to the
console. This will execute _after_ the nodeIntegration check, so it
can be safely used as a signal to indicate that the test is done.

* test: rename base-page-security-load-message.html

* fix: ignore enabled remote module warning for localhost

* refactor: add isLocalhost()
2019-07-02 19:36:50 +09:00
Jeremy Apthorp
ec8697bcdc
test: move protocol specs to main process (#18923) 2019-06-27 14:20:29 -07:00
Micha Hanselmann
504edf2cf6 test: correct fake tests in api-protocol-spec (#18869)
* fix protocol 404 fake tests

* fix another fake test

* fix last fake test (hopefully)
2019-06-19 13:40:49 -07:00
Jeremy Apthorp
e5d1e7b4da fix: move window.open postMessage test to main runner to fix flake (#18735) 2019-06-12 08:35:58 +09:00
Cheng Zhao
8de9ba6df6
chore: run protocol tests in separate WebContents (#18202) 2019-05-10 09:51:44 +09:00
Milan Burda
546466b209 feat: add <webview>.getWebContentsId() (#17407) 2019-03-26 10:57:27 +09:00
Shelley Vohr
3ca87d205f
feat: make zoomLevel/zoomFactor sync (#16410)
* feat: make zoomLevel/zoomFactor sync

* update ts defs dep
2019-01-20 23:40:27 -08: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
Pedro Pontes
9c783f53ba fix: do not allow the window to grab focus when tabbing / shift+tabbing (#16042)
* fix: do not allow the window to grab focus when tabbing / shift+tabbing

* test: add tests.
2018-12-18 23:44:51 -07:00
Cheng Zhao
8584c2f14b
fix: register webview in main world when using contextIsolation (#16067) 2018-12-14 15:38:35 +09:00
Pedro Pontes
d5d1fa8290 fix: use appropriate site instance for cross-site nav's (#15821)
* fix: use Chromium's determined new site instance as candidate when navigating.

When navigating to a new address, consider using Chromium's determined site instance
for the new page as it should belong to an existing browsing instance when the
navigation was triggered by window.open().

fixes 8100.

* Revert "fix: use Chromium's determined new site instance as candidate when navigating."

This reverts commit eb95f935654a2c4d4457821297670836c10fdfd5.

* fix: delegate site instance creation back to content when sandboxed.

* fix: ensure site isolation is on

* test: adapt ut for cross-site navigation

* fix: register pending processes during a navigation.

* refactor: dont call loadURL for a window constructed from an existing webContents.

* test: add sandboxed affinity UT's.

* fix: check affinity before deciding if to force a new site instance.

* chore: adapt subsequent patch.

* refactor: constify logically const methods.

* fix: do not reuse site instances when navigation redirects cross-site.

* test: ensure localStorage accessible after x-site redirect.

* test: adapt localStorage acess denied UT for site isolation.

* fix: do not send render-view-deleted for speculative frames.

* chore: amend tests after rebase.

* test: add ut for webContents' render-view-deleted emission

* fix: introduce current-render-view-deleted for current RVH's deletions.

Revert render-view-deleted to being emitted with any RVH's deletion.
current-render-view-deleted is emitted only when the RVH being deleted
is the current one.

* refactor: style and comments fixed.
2018-12-05 17:03:39 +09:00
Cheng Zhao
ca7dec2082 fix: default prop of location should be empty str 2018-12-04 17:11:26 +09:00
Nitish Sakhawalkar
a9ca152069 feat: Spellchecker Async Implementation (#14032)
* feat:Spellchecker Async Implementation

* Adhere to chromium style

* Updating dependency to use gh branch

* Update docs and electron-typescript-definitions module

* Fix lint

* Update electron typescript definitions version

* Update spec

* Address review
2018-10-18 11:11:53 -05:00
deepak1556
7ec05fb202 spec: update media-started-playing tests based on the autoplay policy 2018-10-09 14:39:39 -07:00
Milan Burda
c61db523c7 refactor: replace var with const / let (#14866) 2018-09-29 09:17:00 +10:00
Milan Burda
38419e3a6a chore: address TODO for WebContents.prototype.setSize / reportRemovedAttribute removal (#14517)
* chore: remove WebContents.prototype.setSize

* chore: remove reportRemovedAttribute

* chore: remove unused fixtures
2018-09-11 17:58:57 +10: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
Robo
bce5bd87a8 fix: opt into location services once device service has been started (#14253)
* fix: opt into location services once device service has been started

* refactor: provide fake location provider to mock geolocation reponses

* chore: add spec for navigator.geolocation api using fake location provider
2018-08-23 08:51:46 -07:00
Jeremy Apthorp
bdceea6aca fix: enable spell checking, which broke in upgrade to ch66
Chromium commit [03563dd163][1] changed the way that the
spellcheck-enabled status was checked, defaulting to false.

Added the first (!) test for spellchecking, too.

Fixes #13608.

[1]: 03563dd163
2018-07-11 10:27:56 -07:00
Jeremy Apthorp
f50f8e3f3d chore: [gn] fix CSP warning in debugger API test (#13541)
There's an attempt to suppress the warning in `spec/static/main.js`, which
sets `process.env.ELECTRON_DISABLE_SECURITY_WARNINGS`. However, it sets the
variable too late in the boot process: by the time that line in main.js has
run, a child zygote has already been booted. `test.py` works around this by
setting that environment variable outside of the test process, to ensure that
it gets propagated to all children.

I've been running the GN tests directly with `./out/Default/electron
electron/spec`, rather than through the wrapper script, and the
`api-debugger-spec.js` tests were failing, because they depend on a particular
log message being the first one emitted, and the CSP warning was causing that
test to fail, since it wasn't being correctly suppressed.

Instead of writing another wrapper script, this just fixes the underlying thing
that the warning is complaining about, which I think is reasonable because the
test's pass/fail depends on this specific behaviour.
2018-07-06 15:01:33 -04:00
Cheng Zhao
e42c6d3eb7
fix the crash when loading site with jquery (#13475) 2018-06-29 09:42:04 +09:00
Cheng Zhao
44aad039c6 fix: do not expose Node's external strings (#13438) 2018-06-27 10:18:09 +10:00
Aleksei Kuzmin
417fe29dc0 Fix the media events test
Playing a media now requires a user gesture.
See https://goo.gl/xX8pDD.
2018-06-19 11:49:45 +10:00
Alexey Kuzmin
0d5e98a201 Slightly rewrite <webview> tag tests (#13122) 2018-06-01 10:56:48 +02:00
Alexey Kuzmin
fc34076c2b Refactor <webview> tag tests (#12886) 2018-05-14 17:00:49 -05:00
Charles Kerr
c2673aa970 Set appropriate defaults for webview options (#12271)
* Persist defaults to webPreferences object to JS land can read the inferred values instead of just user defined values

* Test inherited default propogation

* Refactor to remove coupling from fetching values and defaults

* Test description type

* Fix up tests
2018-03-15 13:56:46 +09:00
Cheng Zhao
cde0c1d418 Print detailed error for serviceWorker test (#12186) 2018-03-08 21:06:29 -05:00
Felix Rieseberg
d586ef2f39 feature: Hot security tips (#11810)
* 🔧 Add security issue detection (and logs)

* 🔧 Check for it on load

* 👷 Add some tests

* 👷 Make the linter happy

* 🔧 Allow them to be enabled by force

* 📝 Make message slightly prettier

* 🔧 Fix a typo in the code comment

* 🔧 Classic mistake

* 🚀 Optimize things a bit more

* 👷 Add tests, fix tests

* 📝 Document things

* 🔧 Make linter happy

* 🔧 One more piece of cleanup
2018-02-03 07:50:12 -07:00
Ahmed Mohamed Ali
b6109030a1 Fix missing eof missing from html test files 2017-11-13 21:22:36 +01:00
Ahmed Mohamed Ali
1f2c949316 Merge branch 'master' of https://github.com/ahmedmohamedali/electron 2017-11-13 21:16:52 +01:00
Ahmed Mohamed Ali
ff707a0f3d Fix issues in the file for the tests. 2017-11-13 21:13:19 +01:00
Ahmed
9b3960fe90
Merge branch 'master' into master 2017-11-08 18:03:55 +01:00
Ahmed Mohamed Ali
44f91e12e1 Add tests for fix described in #10793 2017-10-19 16:15:02 +02:00
Yuya Ochiai
6326c6727e Add did-attach-webview event 2017-10-07 22:52:20 +09:00
Birunthan Mohanathas
7d2226e05e Let Chromium manage document.visibilityState and document.hidden
Chromium already includes the necessary plumbing to manage the
visibility properties and `visibilitychange` event so this gets rid of
most of our custom logic for `BrowserWindow` and `BrowserView`.

Note that `webview` remains unchanged and is still affected by the issues
listed below.

User facing changes:

- The `document` visibility properties and `visibilitychange` event are
  now also updated/fired in response to occlusion changes on macOS. In
  other words, `document.visibilityState` will now be `hidden` on macOS
  if the window is occluded by another window.

- Previously, `visibilitychange` was also fired by *both* Electron and
  Chromium in some cases (e.g. when hiding the window). Now it is only
  fired by Chromium so you no longer get duplicate events.

- The visiblity state of `BrowserWindow`s created with `{ show: false }`
  is now initially `visible` until the window is shown and hidden.

- The visibility state of `BrowserWindow`s with `backgroundThrottling`
  disabled is now permanently `visible`.

This should also fix #6860 (but not for `webview`).
2017-06-06 15:16:01 -07:00
Kevin Sawicki
fd782706b2 Add explicit spec for removing preload from webview 2017-05-17 13:47:00 -07:00
Kevin Sawicki
e817dbf50a Add failing spec for webviewTag inheritance 2017-05-17 13:27:28 -07:00
Kevin Sawicki
56a4a69dee Add more non-matching target origins 2017-05-01 08:45:38 -07:00
Kevin Sawicki
efc62629ef Fix typo in fixture comment 2017-05-01 08:45:38 -07:00
Kevin Sawicki
3c58d50f87 Add failing spec for targetOrigin handling 2017-05-01 08:45:38 -07:00
Kevin Sawicki
cee0507090 Add failing spec for inheriting Javascript web preference 2017-04-25 12:57:53 -07:00
Cheng Zhao
033aa16e04 test: Node integration in web workers 2017-03-20 12:52:46 -07:00
deepak1556
224ffe44aa add spec 2017-03-08 19:16:55 +05:30
deepak1556
a57af31b99 add zoom specs based on standard protocols 2017-02-18 01:41:39 +05:30
deepak1556
403e7681c1 add basic webview zoom specs 2017-02-18 01:34:32 +05:30
deepak1556
dfc2e6c4a8 add temporary zoom api spec 2017-02-18 01:34:32 +05:30
Kevin Sawicki
86007fe61d Update blur parent window spec 2017-02-15 08:28:55 -08:00
Kevin Sawicki
35908ac398 Add webContents.focus() spec 2017-02-15 08:28:55 -08:00
Cheng Zhao
c72438f09f WebInspector has been split up 2017-02-06 10:34:29 -08:00
Kevin Sawicki
977680d00b Add spec for midi without sysex permission 2017-01-19 09:05:59 +02:00
Kevin Sawicki
37b7dda3c5 Remove use of now private guestId 2017-01-16 12:38:16 -08:00
Kevin Sawicki
12382f064b Add failing spec for cycle in options 2017-01-06 09:58:40 -08:00
Zeke Sikelianos
b0c4c79c49 remove unused webview fixture 2016-12-22 10:41:05 -08:00
Zeke Sikelianos
1085c28612 rename all web-view files to webview 2016-12-22 10:41:05 -08:00
Kevin Sawicki
b08bc02cde Merge pull request #8137 from deepak1556/media_device_id_patch
session: reset media device id salt when cookies are cleared
2016-12-12 13:34:24 -08:00
Paul Frazee
99ea50649a finish implementation of {secure:true} opt on protocol.registerStandardScehesm, and add working test 2016-12-12 12:49:57 -08:00
deepak1556
e043dabcb8 add spec 2016-12-04 00:22:57 +05:30
Cheng Zhao
a1dfdbdde4 spec: Should check origin before accessing window.opener 2016-11-16 07:50:30 -08:00
Birunthan Mohanathas
2986b7bc4a Allow webview guests to be resized manually
This adds the `disableguestresize` property for webviews to prevent the
webview guest from reacting to size changes of the webview element. This
also partially documents the `webContents.setSize` function in order to
manually control the webview guest size.

These two features can be combined to improve resize performance for
e.g. webviews that span the entire window. This greatly reduces the lag
described in #6905.
2016-11-15 11:00:09 -08:00
Kevin Sawicki
dda3fcef91 Add failing spec for notification permission crash 2016-10-31 08:54:56 -07:00
Kevin Sawicki
99414065a9 Add char/keypress event tests 2016-10-10 09:35:44 -07:00
Kevin Sawicki
e4b0577cb0 Assert key and code in keyup input event spec 2016-10-10 09:35:44 -07:00
Kevin Sawicki
d69367aa9b Add keydown sendInputEvent specs 2016-10-10 09:35:43 -07:00
Michael Vasseur
edd80d88a9 Update BrowserWindow's test to check additional features upon window.open() call 2016-10-05 13:45:15 +02:00
deepak1556
7ba947aee9 add spec 2016-09-22 00:15:25 +05:30
Cheng Zhao
e3e450613d Merge pull request #7157 from Mossop/moveguest
Allow moving a webcontents to a different webview
2016-09-20 14:28:42 +09:00
Dave Townsend
47df447e4f Test that replacement history entries don't break forward navigation.
This is a test for #7175
2016-09-16 17:08:54 -07:00
Dave Townsend
313b2faa3c Add a guestinstance attribute to webviews reflecting their current guest
instance ID and allowing moving a guest instance to a new webview.
2016-09-09 10:32:05 -07:00
deepak1556
ae297760af add spec and docs 2016-08-24 06:53:14 +05:30
Kevin Sawicki
a184b6afb3 Add spec for window.open from <webview> 2016-06-09 12:02:01 -07:00
Kevin Sawicki
19787544b5 Add failing spec for webview devtools extension 2016-06-08 12:00:12 -07:00
Cheng Zhao
a58b84bbd7 spec: ipcRenderer.sendTo sends message to WebContents 2016-05-28 20:50:30 +09:00
Kevin Sawicki
4e68a8d16e Remove logging in parent page 2016-05-25 09:12:52 -07:00
Kevin Sawicki
1e15ce6ccd Add failing spec for webview visiblity changes 2016-05-25 09:12:52 -07:00
Kevin Sawicki
b09c81202a Add test for webview zoomFactor inheritance 2016-05-19 14:46:52 -07:00
deepak1556
1ff33b7c81 protocol: fix registerStandardSchemes api 2016-05-08 01:36:34 +05:30
Kevin Sawicki
e4bd592e0e Add failing spec 2016-04-21 11:49:42 -07:00
Cheng Zhao
bb70defcb8 spec: webview should work without script tag in page 2016-04-12 15:10:26 +09:00
Rob Brackett
c1b1348735 Add resourceType arg to webContents did-get-response-details event.
Fixes #5074 and follows @zcbenz's recommendation to expose ResourceTypeToString from atom_network_delegate publicly.
Also adds testing for other arguments to the `did-get-response-details` events, since there were no existing tests for them.
2016-04-08 11:19:36 -07:00
Kevin Sawicki
7734f6af62 Remove semicolons 2016-04-01 16:52:55 -07:00
Kevin Sawicki
909ed54bef Remove stray log 2016-04-01 16:52:28 -07:00
Kevin Sawicki
fd12e1f506 Add failing spec for webview nodeIntegration inheritance 2016-04-01 16:47:17 -07:00
Kevin Sawicki
9e66df23d0 Add clearer assertion of process being undefined 2016-04-01 16:40:33 -07:00
Kevin Sawicki
777704e659 Add failing spec for nodeIntegration inheritance 2016-04-01 16:39:06 -07:00
Zeke Sikelianos
7c58f7fb02 eradicate all per-file eslint globals 2016-03-30 17:00:34 -07:00
Zeke Sikelianos
c4b6cf4a8e do more manual cleanup and specify globals 2016-03-30 17:00:32 -07:00
Zeke Sikelianos
f35f362272 autoformat more files 2016-03-30 17:00:31 -07:00
Cheng Zhao
08e5c1f6fe Merge branch 'webcontent_invalid_loadurl_patch' of https://github.com/deepak1556/atom-shell into deepak1556-webcontent_invalid_loadurl_patch 2016-02-15 21:14:54 +08:00
Robo
f7556de9fb add spec for new permissions 2016-01-30 19:10:52 +05:30
Robo
f32bf08eb3 add spec 2016-01-29 15:23:28 +05:30
Cheng Zhao
60d44b3b04 spec: Remove annoying outputs from savePage test 2016-01-15 16:36:35 +08:00
Cheng Zhao
941232a76b Merge pull request #3975 from leethomas/add-webview-navigation-events
Add webview navigation events
2016-01-04 11:24:27 +08:00
leethomas
ce733e5927 add tests to insure window.location.hash changes & window.history.replaceState cause 'did-navigate-in-page' to fire 2016-01-01 18:51:47 -08:00