Commit Graph

95 Commits

Author SHA1 Message Date
Nathan Sobo
f14587d3cc Use app activate event instead of defunct activate-with-no-open-windows
This restores the ability to open a Window by single-clicking the dock
icon on macOS.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2016-09-22 15:54:44 -06:00
Nathan Sobo
19a4f1ab89 Null guard AtomWindow instance in window-method ipc handler
Since things are async, I think the window could potentially disappear
before we can handle the message.
2016-09-22 14:14:37 -06:00
Nathan Sobo
3a4ae04f74 Use call/respondTo helpers to return a promise from window method ipcs
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2016-09-22 12:18:09 -06:00
Nathan Sobo
50128949d4 Call window methods on AtomWindow when ipc'ing from render process
This enables saveState to be called when requesting a window reload from the render process.

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2016-09-22 11:41:57 -06:00
Nathan Sobo
9ace7b899c Bind promptForRestart since it calls a method now
Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2016-09-22 11:29:39 -06:00
Max Brunsfeld
3039024d17 Go back to using promise based on window:loaded event in main process tests 2016-09-21 11:37:24 -07:00
Max Brunsfeld
da6bfedc76 Merge branch 'master' into mb-ns-avoid-adding-non-existent-project-directories 2016-09-21 09:54:04 -07:00
Max Brunsfeld
833b3b0ab0 Save state when reloading AtomWindow
Signed-off-by: Nathan Sobo <nathan@github.com>
2016-09-20 16:10:11 -07:00
Nathan Sobo
7872875c57 🎨 2016-09-20 15:15:55 -06:00
Nathan Sobo
fe9a7d1db3 Preserve command line flags when restarting
This performs restarts in the main process and uses ipc to request restarts from application windows. We preserve the following settings:

* dev mode
* custom resource path
* safe mode
* portable mode
* socket path
* log file path
* user data dir
2016-09-20 15:13:46 -06:00
Nathan Sobo
1d740b4169 Relaunch Atom when changing the title bar style
Now that we have the required API

Signed-off-by: Max Brunsfeld <maxbrunsfeld@github.com>
2016-09-20 11:39:58 -06:00
Max Brunsfeld
30fdb70dfd Initialize app-started promise before reloading AtomWindow 2016-09-20 09:53:54 -07:00
Nathan Sobo
7bba3e86b2 Try this on travis 2016-09-16 16:47:33 -06:00
Nathan Sobo
212cb0df34 Resolve AtomWindow.reload promise once window fully starts 2016-09-16 14:33:30 -06:00
Nathan Sobo
5fad2bdbf9 Return a promise from AtomWindow.reload that resolves on window:loaded 2016-09-16 14:10:34 -06:00
Nathan Sobo
0ff0b269b1 Don't wait for spec windows to save state
Since spec windows don't register handlers for the IPC messages requested window state to be saved, the promise never resolves and the close button needs to be clicked twice. To avoid this, we'll just resolve the promise immediately in a spec window so we can proceed to close it.
2016-09-12 10:26:40 -06:00
Damien Guard
77a09a7447 Remove app load time console output 2016-09-09 13:08:00 -07:00
Antonio Scandurra
ccd381b8ad Merge pull request #12645 from atom/as-fix-app-not-quitting-on-windows-and-linux
Fix app not quitting on win32 and linux when closing the last window
2016-09-09 17:57:57 +02:00
Antonio Scandurra
e2a3b75db2 Fix app not quitting on win32 and linux when closing the last window
This regression was caused by a nuance in the way we maintain state in
`AtomApplication` for open windows. Specifically, when closing the last
window on Windows and Linux, we were explicitly calling `app.quit`
*before* removing such window from the list of open ones. In turn, this
caused the new `before-quit` behavior introduced in #12619 to work
improperly because it made the application wait on saving the state of a
stale window before exiting.

With this commit we are fixing that by making sure the stale window is
removed before calling `app.quit` in `removeWindow`.
2016-09-09 10:51:40 +02:00
Damien Guard
6ebd1ad582 Remove accidental logging statements checked in 3eb55d7d 2016-09-08 21:49:48 -07:00
Damien Guard
3eb55d7db0 Add Windows file.ico lost in move to new build 2016-09-08 21:16:55 -07:00
Damien Guard
7c48b947d7 Windows shell upgrade fixes #12642 2016-09-08 15:58:27 -07:00
Antonio Scandurra
34a99f9c82 Write tests to ensure quitting the application works as expected 2016-09-07 14:18:52 +02:00
Antonio Scandurra
0f6eadcfce Wait for windows' state to be saved before closing the app or any window
Previously, we used to save the window's state in the renderer process
`beforeunload` event handler: because of the synchronous nature of event
handlers and the asynchronous design of IndexedDB, this could
potentially not save anything if windows close fast enough to prevent
IndexedDB from committing the pending transaction containing the state.
(Ref.: https://mzl.la/2bXCXDn)

With this commit, we will intercept the `before-quit` events on
`electron.app` and the `close` event on `BrowserWindow` (which will fire
respectively before quitting the application and before closing a
window), and prevent them from performing the default action. We will
then ask each renderer process to save its state and, finally, close the
window and/or the app.
2016-09-07 13:03:33 +02:00
Alan
71ee729f84 Change Help->Documentation url from https to http (Fix #12583)
The flight manual page does not have a secure connection, so navigating
to the https link would result in a SSL_ERROR_BAD_CERT_DOMAIN error.

It might be better to add a secure connection to the server rather than
pulling this commit.
2016-09-01 14:14:17 -07:00
Nathan Sobo
b3009f1387 Focus application on all code paths that open windows in main process
I think this should take the application out of “app nap” on macOS,
leading to better responsiveness when opening paths from the CLI.
2016-08-28 06:17:41 -06:00
Damien Guard
cf36ecf3ca Merge branch 'master' into sm-windows-file-icon 2016-08-25 18:20:51 -07:00
Damien Guard
ba704cf29e Copy file icon and use as icon for Atom associated files 2016-08-25 11:31:17 -07:00
Damien Guard
b6a72b058d Set the app name in Windows file handler to handle beta 2016-08-23 13:32:42 -07:00
Damien Guard
d47fd28c86 Focus new window when existing copy of Atom running fixes #4324 2016-08-12 17:45:24 -07:00
Antonio Scandurra
753db274fc Clear storage data after each AtomApplication test
This, along with using a temporary directory as the ATOM_HOME, will make
sure that tests won't share any state with one another, possibly
increasing the level of resiliency of the suite.
2016-08-12 15:20:58 +02:00
Antonio Scandurra
c422699c80 Call @config.load() in AtomApplication constructor
This is needed in order to test configuration settings like
`restorePreviousWindowsOnStart`. Even if this call has side effects, its
scope is pretty constrained because it affects only the temporary
directory we create before each atom-application test.
2016-08-12 11:21:37 +02:00
Antonio Scandurra
f287e8783f Return an AtomWindow array in loadState or null if no state is found 2016-08-12 10:49:46 +02:00
Antonio Scandurra
fff2ecd162 Extract a AtomApplication.prototype.launch method
...so that we can exercise loading previously opened windows stored
state after the application is restarted. In addition, this resembles
more what we run in production, and therefore allows us to have a better
coverage of the code paths we run in the real application.
2016-08-12 10:44:09 +02:00
Antonio Scandurra
a8c73f0529 Fix calling atom --version 2016-08-12 09:33:15 +02:00
Nathan Sobo
dbfd0cc605 Move integration test of window persistence to main process tests 2016-08-11 15:28:11 -06:00
Nathan Sobo
f1295d39a8 Close all windows in AtomApplication.destroy 2016-08-11 14:31:36 -06:00
Nathan Sobo
6994060e72 Use fat arrow where it is needed 2016-08-11 14:31:23 -06:00
Nathan Sobo
2fe5027b57 Set the userData dir to a temp directory for main process tests
This ensures that the indexedDB is accessible even if another Atom is
running.
2016-08-11 14:30:52 -06:00
Nathan Sobo
324e8d6c7a Move env assignment into parseCommandLine
A bit of a misnomer but makes things more testable so I’ll accept it
until we can do more overhaul.
2016-08-11 14:30:22 -06:00
Nathan Sobo
847911f0fe Extract parseCommandLine from main.js to its own file for testing
Signed-off-by: Antonio Scandurra <as-cii@github.com>
2016-08-11 12:44:20 -06:00
Nathan Sobo
502339b830 Replace chromedriver test of window offset with main process mocha test
Signed-off-by: Antonio Scandurra <as-cii@github.com>
2016-08-11 10:33:12 -06:00
Nathan Sobo
d8b2a1f4b6 Break out constructor side effects into AtomApplication.initialize
Signed-off-by: Antonio Scandurra <as-cii@github.com>
2016-08-11 08:15:00 -06:00
Antonio Scandurra
45afe07dc1 Don't throw an error when ATOM_HOME does not exist 2016-08-03 15:59:00 +02:00
Nathan Sobo
c1b2042bcc 🎨 2016-08-02 16:19:38 -06:00
Nathan Sobo
0240206d93 Merge branch 'master' into brumm-master 2016-08-02 15:39:57 -06:00
Damien Guard
f3caa67109 Ensure beta is detected from path 2016-07-29 15:51:45 -07:00
Damien Guard
82efce08ed Fix WinShell closure/for issue, improve error handling 2016-07-29 14:48:33 -07:00
Antonio Scandurra
9ad9a96b34 Copy comments 2016-07-27 15:09:08 +02:00
Antonio Scandurra
ccccafd4ea 🎨 2016-07-27 15:01:50 +02:00