Commit Graph

69 Commits

Author SHA1 Message Date
Max Brunsfeld
dc320181fc Fix handling of .save and .saveAs rejections
* Make Pane.close, Pane.saveActiveItem, and Pane.saveActiveItemAs async.
* Refactor the logic for prompting to save on window unload
2017-05-31 17:46:04 -07:00
Max Brunsfeld
d4c05e5956 Merge branch 'master' into mb-use-native-text-buffer 2017-05-30 10:25:54 -07:00
Ian Olsen
d5089936bd Merge pull request #14420 from atom/fb-mdt-dock-items-dont-cause-restore-state-prompt
Don't show restore dialog for non-editor dock items
2017-05-24 08:43:35 -07:00
Max Brunsfeld
6c0b70f5f3 Start work on integrating new native TextBuffer version 2017-05-19 11:33:49 -07:00
Matthew Dapena-Tretter
80ced1140c Don't show restore dialog for non-editor dock items
The Nuclide file tree was causing this dialog to be shown every time.
With this commit, we exclude non-editor dock items from the "dirty"
check.
2017-05-15 16:13:29 -07:00
Nathan Sobo
ffd154ec34 Fix lint errors 2017-05-11 21:29:36 -06:00
Nathan Sobo
b7218e5aa4 Fix atom.setSize spec when window is full screen 2017-05-11 21:06:15 -06:00
Nathan Sobo
6c6d38a3f0 Destroy environment to silence leaked editor warning 2017-05-11 21:02:28 -06:00
Nathan Sobo
8743298c4c Avoid polluting test with click events on the test runner
We now pass an isolated document into the AtomEnvironment instance under
test to avoid accidentally handling clicks on the test runner itself.
2017-05-11 17:59:40 -06:00
Nathan Sobo
2e2b35c32c Avoid problems related to calling startEditorWindow in tests 2017-05-11 17:44:16 -06:00
Matthew Dapena-Tretter
ddd8a8b978 Add atom.whenShellEnvironmentLoaded()
This provides a way to be notified when the shell environment has
loaded—even if it's already happened.
2017-04-11 18:10:00 -07:00
Michelle Tilley
3ab08754db These should probably be here 2017-03-23 23:42:55 -07:00
Katrina Uychaco
3d9ce1610d 👕 2017-03-23 10:40:20 -07:00
Katrina Uychaco
4c1cb16e77 Merge remote-tracking branch 'origin/master' into ku-mkt-restore-atom-env-when-adding-folder-to-fresh-window 2017-03-22 20:36:59 -07:00
Michelle Tilley
01175d774c 🔥 fit 2017-03-22 20:30:08 -07:00
Michelle Tilley
d9b73fa645 Restore state when opening folders to applicable windows
Note: "clean window" is defined as 1) having an empty project and 2)
having no pane items or only empty unnamed buffers

When project is empty and there is saved state associated with the
opened/added folders...
* Open a file or folder (from command line or Open menu)
  * If we have a clean window, restore project state in window
  * If window is dirty, restore saved state in new window
2017-03-22 20:25:57 -07:00
Michelle Tilley
910fef97a0 Restore state when adding folders to applicable windows
Note: "clean window" is defined as 1) having an empty project and 2)
having no pane items or only empty unnamed buffers

Adding folder(s)
* If we have a clean window, restore project state in window
* If window is dirty, prompt user to
  * add folder to the existing window LOSING state
  * OR open project folder in a new window
2017-03-22 20:24:50 -07:00
Antonio Scandurra
284f2c62e5 Start fixing tests 2017-03-11 19:05:28 +01:00
Katrina Uychaco
d891f2376c Restore saved state when adding folders to empty project 2017-03-08 14:40:58 -08:00
Max Brunsfeld
c26509cfab Throw an error when assertions fail if built from source
Signed-off-by: Nathan Sobo <nathan@github.com>
2017-03-02 10:14:59 -08:00
Nathan Sobo
2ad6f83239 Allow metadata to be passed to atom.assert 2017-02-13 10:29:04 -07:00
Damien Guard
3fd1dbdce3 Clean up temporary files when running specs 2016-12-01 10:48:45 -08:00
Damien Guard
cf0bae0301 Skip autoupdater tests on Win32, we don't use electron autoUpdate there 2016-11-29 16:55:14 -08:00
Indrek Ardel
55f3311c01 Remove unused variables 2016-09-26 20:52:13 +03:00
Max Brunsfeld
fe480d8fa4 Do not add project directories that do not exist
Signed-off-by: Nathan Sobo <nathan@github.com>
2016-09-14 13:48:17 -07:00
Max Brunsfeld
6ca1676bcb Access auto-updater through new electron API in AtomEnvironment spec 2016-09-07 16:36:00 +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
Max Brunsfeld
637e525807 Use fake document & window in atom environment serialization spec 2016-08-08 16:32:58 -07:00
Max Brunsfeld
e8c834e483 Serialize & deserialize the TextEditorRegistry in AtomEnvironment 2016-08-08 15:38:17 -07:00
Antonio Scandurra
005022567b Merge pull request #11348 from atom/wl-drewmnoel-electron
Update Electron to 0.36.12
2016-04-30 09:19:17 +02:00
Antonio Scandurra
c5a76d4a7d Persist the entire state on reload
This fixes an annoying problem that prevented the state of marker layers
from being saved when the window was reloaded either via `Cmd+R` in
DevTools or via `Ctrl+Option+Cmd+L` in Atom.

The issue was that we were *always* scheduling `saveState` on an idle
callback: `window.onbeforeunload`, however, doesn't wait for that event
before closing the window, and thus that state was never saved in those
situations.

The solution is to use idle callbacks only during the critical code path
(i.e. on mousedown and keydown), but save it synchronously otherwise.
Saving something to IndexedDB is actually asynchronous too, but it seems
like Chrome fulfills `put` requests that get executed right during
`onbeforeunload`.
2016-04-29 14:41:34 +02:00
Damien Guard
99e716f9ed Fix specs failures on Windows including paths 2016-04-15 11:25:05 -07:00
Drew Noel
fb5bfe1b3a Fix old electron require syntax in specs 2016-04-01 22:17:00 -04:00
Antonio Scandurra
cbb911cde8 💚 2016-03-23 13:44:17 +01:00
Antonio Scandurra
c2242e46c2 Read state from StorageFolder when it can’t be found in StateStore 2016-03-23 10:31:26 +01:00
Antonio Scandurra
4b017759c9 Ensure project.serialize is called with atom.saveState options
This is because we have made the `project.serialize(options)` parameter optional
for backwards compatibility (i.e. #11111), and we want to make sure we don't
make the mistake of not passing it internally.
2016-03-10 09:41:50 +01:00
Antonio Scandurra
8caa9d0a95 🎨 Better wording on specs 2016-03-07 17:21:09 +01:00
Antonio Scandurra
a3bed908d7 Don't partially serialize after unloading editor window 2016-03-07 17:14:52 +01:00
Antonio Scandurra
12587073d2 🎨 isQuitting -> isUnloading 2016-03-07 10:52:16 +01:00
Antonio Scandurra
3d15b6e16b Merge branch 'master' into as-serialize-history-without-snapshots 2016-03-07 10:33:52 +01:00
Antonio Scandurra
0fdc190989 Use isQuitting: false when saving state on key/mouse down 2016-03-04 17:08:32 +01:00
Ben Ogle
02368a9fc6 Add atom.getReleaseChannel 2016-03-01 15:09:05 -08:00
Arnaud Rinquin
53693b4d0f Add the -a, --add CLI option 2016-02-19 08:54:17 +00:00
Max Brunsfeld
2e7101e5eb Don't display an editor window in atom-environment-spec 2016-02-18 15:11:26 -08:00
Max Brunsfeld
43656a9861 Load packages before deserializing state 2016-02-18 09:17:34 -08:00
Katrina Uychaco
6f4936983e Revert test since startEditorWindow no longer returns a promise 2016-02-11 15:40:04 -08:00
Katrina Uychaco
7b808257a6 Add test to check for indexedDB connection 2016-02-10 11:04:30 -08:00
Katrina Uychaco
6e0328b048 Refactor to use StateStore instead of StorageFolder 2016-02-04 21:45:00 -08:00
Katrina Uychaco
a54f4679af Fix tests 2016-01-28 15:46:40 -07:00
Katrina Uychaco
54a03516bf Save state asynchronously on mousedown and keydown events. Tests WIP 2016-01-28 00:58:58 -07:00