Commit b5dbd25b authored by Baptiste Delpey's avatar Baptiste Delpey Committed by Romain Bignon

factorize state dumping

parent d78bf072
......@@ -282,6 +282,11 @@ class Module(object):
self.storage = BackendStorage(self.name, storage)
self.storage.load(self.STORAGE)
def dump_state(self):
if hasattr(self.browser, 'dump_state'):
self.storage.set('browser_state', self.browser.dump_state())
self.storage.save()
def deinit(self):
"""
This abstract method is called when the backend is unloaded.
......@@ -289,9 +294,8 @@ class Module(object):
if self._browser is None:
return
if hasattr(self.browser, 'dump_state'):
self.storage.set('browser_state', self.browser.dump_state())
self.storage.save()
self.dump_state()
if hasattr(self.browser, 'deinit'):
self.browser.deinit()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment