Merge remote-tracking branch 'origin/pr/3506'
This commit is contained in:
commit
e5b6ccd716
@ -457,7 +457,8 @@ class SessionManager(QObject):
|
|||||||
|
|
||||||
@cmdutils.register(instance='session-manager')
|
@cmdutils.register(instance='session-manager')
|
||||||
@cmdutils.argument('name', completion=miscmodels.session)
|
@cmdutils.argument('name', completion=miscmodels.session)
|
||||||
def session_load(self, name, clear=False, temp=False, force=False):
|
def session_load(self, name, clear=False, temp=False, force=False,
|
||||||
|
delete=False):
|
||||||
"""Load a session.
|
"""Load a session.
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
@ -466,6 +467,7 @@ class SessionManager(QObject):
|
|||||||
temp: Don't set the current session for :session-save.
|
temp: Don't set the current session for :session-save.
|
||||||
force: Force loading internal sessions (starting with an
|
force: Force loading internal sessions (starting with an
|
||||||
underline).
|
underline).
|
||||||
|
delete: Delete the saved session once it has loaded.
|
||||||
"""
|
"""
|
||||||
if name.startswith('_') and not force:
|
if name.startswith('_') and not force:
|
||||||
raise cmdexc.CommandError("{} is an internal session, use --force "
|
raise cmdexc.CommandError("{} is an internal session, use --force "
|
||||||
@ -482,6 +484,17 @@ class SessionManager(QObject):
|
|||||||
if clear:
|
if clear:
|
||||||
for win in old_windows:
|
for win in old_windows:
|
||||||
win.close()
|
win.close()
|
||||||
|
if delete:
|
||||||
|
try:
|
||||||
|
self.delete(name)
|
||||||
|
except SessionError as e:
|
||||||
|
log.sessions.exception("Error while deleting session!")
|
||||||
|
raise cmdexc.CommandError(
|
||||||
|
"Error while deleting session: {}"
|
||||||
|
.format(e))
|
||||||
|
else:
|
||||||
|
log.sessions.debug(
|
||||||
|
"Loaded & deleted session {}.".format(name))
|
||||||
|
|
||||||
@cmdutils.register(instance='session-manager')
|
@cmdutils.register(instance='session-manager')
|
||||||
@cmdutils.argument('name', completion=miscmodels.session)
|
@cmdutils.argument('name', completion=miscmodels.session)
|
||||||
|
@ -364,6 +364,16 @@ Feature: Saving and loading sessions
|
|||||||
And I run :session-load loaded_session
|
And I run :session-load loaded_session
|
||||||
Then data/numbers/2.txt should be loaded
|
Then data/numbers/2.txt should be loaded
|
||||||
|
|
||||||
|
@qtwebengine_flaky
|
||||||
|
Scenario: Loading and deleting a session
|
||||||
|
When I open about:blank
|
||||||
|
And I run :session-save loaded_session
|
||||||
|
And I replace "about:blank" by "http://localhost:(port)/data/numbers/2.txt" in the "loaded_session" session file
|
||||||
|
And I run :session-load --delete loaded_session
|
||||||
|
And I wait for "Loaded & deleted session loaded_session." in the log
|
||||||
|
Then data/numbers/2.txt should be loaded
|
||||||
|
And the session loaded_session should not exist
|
||||||
|
|
||||||
Scenario: Loading a session which doesn't exist
|
Scenario: Loading a session which doesn't exist
|
||||||
When I run :session-load inexistent_session
|
When I run :session-load inexistent_session
|
||||||
Then the error "Session inexistent_session not found!" should be shown
|
Then the error "Session inexistent_session not found!" should be shown
|
||||||
|
Loading…
Reference in New Issue
Block a user