mirror of
https://github.com/atom/atom.git
synced 2026-01-24 06:18:03 -05:00
Serialize root view state to a string of JSON when storing it on the window upon refresh
This avoid situations where arrays in the window state pointed to a different constructor than the current context's Array constructor.
This commit is contained in:
@@ -53,7 +53,7 @@ describe "Window", ->
|
||||
expect(atom.rootViewStates[$windowNumber]).toBeUndefined()
|
||||
expectedState = window.rootView.serialize()
|
||||
$(window).trigger 'beforeunload'
|
||||
expect(atom.rootViewStates[$windowNumber]).toEqual expectedState
|
||||
expect(atom.rootViewStates[$windowNumber]).toEqual JSON.stringify(expectedState)
|
||||
|
||||
it "unsubscribes from all buffers", ->
|
||||
editor1 = rootView.activeEditor()
|
||||
|
||||
@@ -85,7 +85,7 @@ class RootView extends View
|
||||
extension.activate(this, @extensionStates[extension.name])
|
||||
|
||||
deactivate: ->
|
||||
atom.rootViewStates[$windowNumber] = @serialize()
|
||||
atom.rootViewStates[$windowNumber] = JSON.stringify(@serialize())
|
||||
extension.deactivate?() for name, extension of @extensions
|
||||
@remove()
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ windowAdditions =
|
||||
attachRootView: (pathToOpen) ->
|
||||
rootViewState = atom.rootViewStates[$windowNumber]
|
||||
if rootViewState
|
||||
@rootView = RootView.deserialize(rootViewState)
|
||||
@rootView = RootView.deserialize(JSON.parse(rootViewState))
|
||||
else
|
||||
@rootView = new RootView(pathToOpen)
|
||||
@rootView.open() unless pathToOpen
|
||||
|
||||
Reference in New Issue
Block a user