Commit graph

350 commits

Author SHA1 Message Date
Jeremy Apthorp
45c2dcddb0 disable failing assert in beginFrameSubscription dirty-rectangle test 2018-10-04 00:15:00 +02:00
Jeremy Apthorp
09f018ce8c test: fix frame-subscriber test on Mac 2018-10-04 00:14:59 +02:00
Milan Burda
3ad3ade828 refactor: add prefer-const to .eslintrc + fix errors (#14880) 2018-10-02 11:56:31 +10:00
Milan Burda
c61db523c7 refactor: replace var with const / let (#14866) 2018-09-29 09:17:00 +10:00
Troy
560b1c17af fix: setMaximizable to be true if window is resizable & maximizable (#14648)
* setMaximizable to be true if window is resizable & maximizable

* Fix linting

* Add regressive test to verify maxmizable state

* Leaves maximizable state of window alone if setResizable is called

* Fix exclusive test

* Fix crashing text

* SetMaximizable unconditionally

* Remember former maximizable state

* Fix accidental mac variable deletion

* Logic modification

* Lint

* Remove unneeded test

* Remove unneeded variable since only Windows is effect
2018-09-26 11:41:40 +10:00
Samuel Attard
50a4a8e9c3
spec: add test for syncronous access to blink APIs (#14637)
This test should ensure we catch a regression of #13787
2018-09-25 10:40:15 +12:00
Samuel Attard
7065093869
feat: add will-redirect (#13866)
* feat: add will-redirect to allow people to prevent 30X redirects

* spec: add tests for the will-redirect event

* refactor: implement will-redirect using NavigationThrottle instead of PostTask

This avoids a potential race condition and immediately cancels the
navigation

* docs: add docs for did-redirect-navigation

* refactor: move AtomNavigationThrottle out of net folder

* refactor: update header guard for atom_navigation_throttle.h

* refactor: fix chromium style errors in the GN build

* refactor: update throttle impl to NOTREACHED and std::make_unqique
2018-09-16 01:42:43 +10:00
Samuel Attard
21aa28d60f
refactor: s/resolverGetters/resolveGetters 2018-09-14 16:41:21 +10:00
Samuel Attard
5c8c31c93d
spec: update 'BrowserWindow.fromBrowserView(browserView) returns undefined if not attached - returns undefined if not attached' to match docs (null not undefined) 2018-09-14 16:38:44 +10:00
Samuel Attard
91cc453ccc
spec: add helper to resolve property getters 2018-09-14 16:36:23 +10:00
Samuel Attard
558fff69e7
chore: update to standard 12 2018-09-14 14:57:01 +10:00
Robo
e860748d6b fix: Invalidate weak ptrs before window Javascript object is destroyed (#14532)
* fix: Invalidate weak ptrs before window Javascript object is destroyed

* chore: add regression test for #14513

This test is similar to the original gist at https://gist.github.com/bpasero/a02a645e11f4946dcca1331d0299149d -- the key is to open multiple windows and add an `app.on('browser-window-focus') listener that accesses window.id.

* fix: last commit didn't test the right thing.

The test needs to run in the main process to reproduce the
conditions reported in #14513
2018-09-12 13:58:04 -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
Milan Burda
58577bd431 feat: add options to webContents.loadFile (#14515) 2018-09-11 17:56:49 +10:00
Nitish Sakhawalkar
a2ab0d8ebe fix: notify focus change right away rather not on next tick (#14453)
* fix: Notify focus change right away, not on next tick

* fix: emit the JS blur/focus events on next tick to avoid race condition

* address feedback from review

* fix: bind deferred Emit() calls to a WeakPtr

This is so that the deferred Emit() calls will be canceled
if the TopLevelWindow is destroyed.

* chore: remove wip/test code cruft

* fix: make linter happy

* Enable disabled tests

* refactor: cleaner impl of EmitEventSoon()

* Revert "Merge branch 'fix-win-focus' of github.com:electron/electron into fix-win-focus"

This reverts commit 90576806eb271d059f0a215c67e9b4b04f7396a4, reversing
changes made to 9c13e47779a3af78fe0970c1f3d6cd040a5354e6.

* Restore 704722c1, which was removed in error.

We apologise again for the fault in the subtitles. Those responsible for sacking the people who have just been sacked have been sacked.
2018-09-07 13:21:58 -05:00
Milan Burda
c63014c256 refactor: use loadFile when appropriate in tests (#14422) 2018-09-04 09:50:53 -05:00
Robo
32158ca5dd chore: refactor context isolation spec (#14394)
* spec: refactor BrowserWindow module contextIsolation option

* spec: check for serialzation in isolated renderers separately
2018-09-01 08:51:29 +12:00
Emmanuel Kimmerlin
5f6706ac33 feat: BrowserWindow.getNormalBounds() (#13290)
* First commit

* Add Mac support (1st attempt)

* Add Mac support (2nd attempt)

* Simplify tests

* Restore window state !

* Looking at other tests, seems minimize, maximize, fullscreen are skipped when in CI

* Fix Mac tests

* Restore tests in CI

* Fix typo

* widget getRestoredBounds not working on Mac !!

* widget getRestoredBounds not working on Mac !!

* Add IsNormal function

* Add IsNormal

* IsNormal => isNormal

* Deactivate fullscreen on Mac. Do not receive leave-fullscreen event

* Set default original_frame_

* Set default original_frame_

* Fix Mac
2018-08-24 14:33:27 -07:00
Jeremy Apthorp
c452be02b9 refactor: properly report on skipped native modules tests (#13894) 2018-08-24 14:24:24 -07: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
9a1ad2b93f fix: ipcRemote.sendSync regression after moving away from JSON for return values (#13941) 2018-08-09 19:45:10 +10:00
Jeremy Apthorp
3bdff2d238
feat: allow setting window shape (#13789)
This binds Widget::SetShape, an API that already exists in Chromium (for
Windows and Linux). It's a more reliable method of having some parts of
your window be "click-through" than the current `setIgnoreMouseEvents`
API, which messes around with the `WS_EX_LAYERED` window style on
Windows, causing strange bugs and incompatibility with hardware
acceleration.
2018-07-30 13:37:40 -07: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
Birunthan Mohanathas
a42ca9eecc feat: Add BrowserWindow.setWindowButtonVisibility()
Fixes #12701 and supersedes #13131.

Ideally we would have added `setTitleBarStyle()`, but that is a
significantly more involved change. For example, consider the case where
we switch from `hidden` to `normal`. We would not only have to show the
traffic light buttons, we would also have to switch the window from a
frameless to a framed window and deal with various other window state.
Lets instead implement a simple solution for #12701.
2018-07-25 10:12:27 -07:00
Aleksei Kuzmin
ea16445be7 chore: [tests] update some BrowserWindow tests
- manually close an existing windows before creating a new one.
  We have to do it because the `afterEach` hook doesn't get called
  if a test fails.
- add some async/await goodies
2018-07-24 10:02:54 -07:00
Cheng Zhao
305e3aad40
refactor: remove private webContents.getId() API (#13674) 2018-07-23 18:08:36 +09:00
Cheng Zhao
222291631d spec: openDevTools should not crash for frameless window 2018-07-16 10:23:43 +09:00
Cheng Zhao
35b867ff7d Fix failed devtools tests due to fs.statSyncNoException not working (#13584)
* Revert "spec: disable the i18nString test"

This reverts commit 86c79653de.

* update node to fix fs.statSyncNoException
2018-07-09 09:38:48 -05:00
Cheng Zhao
86c79653de spec: disable the i18nString test
It is failed because of fs.statSyncNoException, I'll fix it in another
PR.
2018-07-06 09:07:56 +09:00
Cheng Zhao
56c24406d6 spec: enable back devtools tests 2018-07-06 09:07:56 +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
Heilig Benedek
f643ce4f66 revert: frame subscriber deprecation and re-enable tests 2018-06-19 19:49:44 +02:00
Aleksei Kuzmin
25e5c174f5 Disable a test 2018-06-19 11:49:46 +10:00
Aleksei Kuzmin
03a63a485f FIXME: Disable some of the focus related tests
They all pass localy, so it must be a CI issue.
2018-06-19 11:49:46 +10:00
Aleksei Kuzmin
de6a5de914 Disable all failing tests 2018-06-19 11:49:45 +10:00
Aleksei Kuzmin
3ca288aba4 FIXME: Disable "BrowserWindow module extensions and dev tools extensions works when used with partitions" test 2018-06-19 11:49:45 +10:00
Aleksei Kuzmin
6c0b5cd76c FIXME: Disable "BrowserWindow module beginFrameSubscription method" tests 2018-06-19 11:49:45 +10:00
deepak1556
7b47d69efe Remove did-get-response-details and did-get-redirect-request events
https://chromium-review.googlesource.com/c/chromium/src/+/805008
https://chromium-review.googlesource.com/c/chromium/src/+/786320
2018-06-19 11:49:41 +10:00
Milan Burda
2eb5b751f3 exit HTML fullscreen when window leaves fullscreen (#13090) 2018-06-18 16:48:20 +09: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
Alexey Kuzmin
d5dfb19508 Update some tests (#12917)
* Use Chai for webview tests

* Slightly rewrite one of the <webview> tests

"dom-ready event" > "throws a custom error..."

* Use Chai for BrowserWindow tests

* Rewrite BrowserWindow.addDevToolsExtension tests
2018-05-14 13:17:31 -05:00
Heilig Benedek
eae0674f61 Match chromium's workaround when setting size of unresizable windows 2018-05-12 17:37:31 +02:00
Alexey Kuzmin
3fd0ec99ae Better OSR tests (#12817)
* Add features.isOffscreenRenderingEnabled()

* Use .isOffscreenRenderingEnabled() to determine if OSR is available

* Add a helper closeTheWindow() function

* Skip OSR tests if they are disabled
2018-05-03 11:10:25 -05:00
Nitish Sakhawalkar
2579071b98 Deprecate did-get-response-details and did-get-redirect-request (#12615)
* Deprecate webContents events did-get-response-details and did-get-redirect-request.

* Update guest view files

* Update webview tag docs and update specs

* Update deprecate.event function

* Update comment

* Update more

* Update documentation for other deprecated event
2018-04-23 14:46:12 -05:00
Nitish Sakhawalkar
6fc819dae1 Fix transparency in capturePage (#12561)
* Fix transparent window capture. Transparency is preserved and not converted to black pixels anymore

* Add test to make sure aplha channel exists in captured image
2018-04-10 19:07:15 +09:00
Nitish Sakhawalkar
970f79e32f Check for devtools in BrowserWindow.getFocusedWindow() (#12526) 2018-04-06 09:21:32 -04: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
Hari Juturu
704af29543 Exposing process.env status (#12166) 2018-03-14 12:01:40 +09:00
Hari Juturu
2f4fd3324b Preload doesn't load in sandboxed render if preload path contains special chars (#12037)
* Adding missing headers

* adding ut

* Removing the file path exists check

* fixing test

* exposing window.require in UT
2018-03-07 11:40:00 -05:00