Commit graph

411 commits

Author SHA1 Message Date
Shelley Vohr
41c2685204
feat: promisify win.capturePage() (#15743)
* feat: promisify win.capturePage

* mark optional arg correctly

* Add to breaking changes doc

* properly deprecate win.capturePage

* remove change from api-contract

* document both callback and promise versions

* address docs feedback

* update promisification progress doc
2018-11-27 23:50:53 -05:00
Pedro Pontes
57d2ae1aec revert: "fix: window.open site instance should belong to same browsing instance (#15216)" (#15757)
This reverts commit 8f35198bfb.
2018-11-20 21:28:26 +01:00
Jeremy Apthorp
0642be296d
fix: crash in sandbox on linux when getting execPath (#15701) 2018-11-15 12:59:01 -08:00
Shelley Vohr
565e4c5910
chore: fix window width in spec for win (#15693) 2018-11-13 11:31:03 -05:00
Pedro Pontes
8f35198bfb fix: window.open site instance should belong to same browsing instance (#15216) 2018-11-12 22:01:43 +01:00
Shelley Vohr
c06f023313
feat: allow partial setting of window bounds (#15677)
Extend the existing win.setBounds functionality by allowing developers to partially update bounds without being forced to pass in all four bounds values. No existing functionality is altere
2018-11-12 15:31:14 -05:00
Robo
82322968a3 refactor: printing implementation (#15143)
* refactor: basic printing

* move build files to chromium_src/BUILD.gn
* remove dependency on chrome prerender sources

* spec: move printing specs behind feature flag

* build: register pdf compositor service
2018-11-09 14:42:34 +11:00
Cheng Zhao
2f3a8ecd42
fix: child window with nativeWindowOpen should disable node integration (#15213)
* fix: child window with nativeWindowOpen should disable node integration

* Revert "fix: do not enable node integration in child window if not enabled (#15076)"

This reverts commit 0252d7686c.

This patch is not needed anymore since we are force disabling node integration
for child windows.
2018-10-25 15:31:07 +09:00
Alexey Kuzmin
b3f134de06 test: asyncawaitify one of sandbox related tests (#15252) 2018-10-19 14:28:23 +11:00
Michelle Tilley
51f3fb9bde
fix: correctly enable and disable windows on Windows and Linux (#15184) 2018-10-18 14:23:40 -07:00
Milan Burda
d3efc52745 feat: add webPreferences.enableRemoteModule option (#13028) 2018-10-13 20:50:07 +03:00
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
Shelley Vohr
bf491de9fe
fix styling and add spec 2018-02-28 00:22:42 -08:00
shelley vohr
846be03f1d remove support for hidden-inset (#11975) 2018-02-20 11:09:54 -06:00
Samuel Attard
9bd7d53cf8 Handle empty handles (#11598)
* Handle empty handles

* Close and dispose window at end of void test

* Dispose of existing window before running void 0 spec
2018-02-12 14:46:29 -05:00
Samuel Attard
b3234f634b Add ability to set arbitrary arguments in a renderer process (#11850) 2018-02-12 11:54:31 -06:00
Nitish Sakhawalkar
62d2a3472f Fix test BrowserWindow.addTabbedWindow() (#11795)
* Fix test BrowserWindow.addTabbedWindow()

* Address review comments
2018-02-02 19:31:02 -07:00
Cheng Zhao
cb3a9c69ab Add a SessionPreferences to manage session related data
By design the BrowserClient should not be aware of the api:: classes.
2017-12-05 15:59:15 +09:00
Samuel Attard
eaa4b71c24 Remove .only 2017-12-05 11:35:54 +09:00
Samuel Attard
009459bd38 Standard JS 2017-12-05 11:35:54 +09:00
Samuel Attard
3b80ee0655 Move global preload implementation to be session based 2017-12-05 11:35:53 +09:00
Samuel Attard
0ddd078aaf Add ability to set global preload scripts 2017-12-05 11:35:27 +09:00
Cheng Zhao
1c0ea0286e
Merge pull request #11235 from electron/standard-10
infra: Upgrade to StandardJS 10
2017-11-27 15:42:52 +09:00
Felix Rieseberg
9f0df695ca 🔧 Spec: Fix style issues 2017-11-23 14:22:58 -08:00
Felix Rieseberg
0278e380de 🔧 Spec: Don’t use deprecated new Buffer() 2017-11-23 14:22:31 -08:00
Heilig Benedek
62594780e0 run the new test only on windows 2017-11-23 21:25:26 +01:00
Heilig Benedek
710ca230f3 update tests to reflect new behaviour 2017-11-23 21:25:25 +01:00
Felix Rieseberg
b7bc4eb586 👷 Let’s test the undefined case, too 2017-11-22 14:38:08 -08:00
Felix Rieseberg
14db204315 👷 Add a spec 2017-11-22 14:37:46 -08:00
shelley vohr
c7e40a2a64
Merge pull request #11133 from electron/skip-tests-that-should-be-skipped
Explicitly skip tests that should be skipped
2017-11-21 10:13:18 +01:00
Aleksei Kuzmin
cf749a8e18 Explicitly skip tests that should be skipped 2017-11-20 14:43:23 +01:00
Felix Rieseberg
5b18bea7e3 🔧 Alex has good ideas 2017-11-18 10:59:09 -08:00
Felix Rieseberg
3311e0bd67 👷 This calls for tests 2017-11-18 00:51:27 -08:00
Aleksei Kuzmin
2bd44612fd Revert "Merge pull request #10989 from electron/temporary-disable-visibility-state-tests"
This reverts commit f3125358c0, reversing
changes made to 7b9ad5001b.
2017-11-02 03:22:27 +03:00
Aleksei Kuzmin
0df058dc1e Temporary disable "document.visibilityState/hidden" tests
Task to enable them:
https://github.com/electron/electron/issues/10988
2017-11-02 00:06:38 +03:00
Shelley Vohr
28c009fcc0
linting is important 2017-11-01 10:56:53 -04:00
Shelley Vohr
d2e1705c80
convert app and browser spec to ES6 2017-11-01 10:48:09 -04:00
John Kleinschmidt
15bfb86eec Make sure test closes window
Newly added test was leaving window open causing tests to fail
2017-10-04 11:35:41 -04:00
Cheng Zhao
8c5bb5969c Merge pull request #10667 from dittos/window-opacity
Add window opacity support
2017-10-04 15:03:45 +09:00
Daniel Ma
1bb042a661 feat(NativeWindowMac): addTabbedWindow
Add support for the [`NSWindow addTabbedWindow`][nsw] method on MacOSX

This plays nicely with the changes from #9052 and #9725

Usage samples available in [this commit][c] in my fork of
`electron-quick-start`

[nsw]: https://developer.apple.com/documentation/appkit/nswindow/1855947-addtabbedwindow
[c]: 79f06591df
2017-10-03 20:11:16 +09:00
Taeho Kim
7570ec9d39 Add BrowserWindow.getOpacity for consistency 2017-10-03 00:08:10 +09:00
Ted Kim
7f2c4a9e06 Add window opacity support 2017-09-29 17:49:10 +09:00
Cheng Zhao
073583ff3d spec: The parent option should not affect show option 2017-09-14 14:48:42 +09:00
xaviergonz
0d69738bd6 using standard javascript 2017-09-14 14:38:54 +09:00
xaviergonz
0301961c25 Update api-browser-window-spec.js 2017-09-14 14:38:54 +09:00
Vanessa Yuen
9a7d8a0511 merge master into fix-fullscreen-with-resizable-flag. 2017-09-12 18:34:23 -04:00
Cheng Zhao
10ab870237 Merge pull request #10321 from kaylanm/macos-native-tab-api
🍎 Add macOS native tab methods to window API
2017-09-11 18:49:56 +09:00
Cheng Zhao
7f4b74f8c6 spec: Compare id instead of the object
Otherwise it is impossible to see what's wrong.
2017-08-29 15:45:16 +09:00
Cheng Zhao
f0f17fffd8 spec: Do not test window positions
They were too flaky.
2017-08-29 14:23:39 +09:00
sungpark
bf07c5aebd fix contextIsolation issue while webPreference sandbox is on
contextIsolation didn't work while sandbox is on. The fix is contextIsolation picked up while sandbox on
2017-08-23 10:52:02 -07:00
Michael Kaylan
b4428e7e41 🍎 Add macOS native tab methods to window API 2017-08-21 23:24:30 -04:00