提交 1697cde5 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

bug fix: reset browser status clean

上级 661a3cb7
...@@ -68,7 +68,8 @@ function onBrowserDead(e) { ...@@ -68,7 +68,8 @@ function onBrowserDead(e) {
log.verbose('PuppetWebEvent', 'onBrowserDead(%s)', e.message || e) log.verbose('PuppetWebEvent', 'onBrowserDead(%s)', e.message || e)
if (!this.browser || !this.bridge) { if (!this.browser || !this.bridge) {
log.error('PuppetWebEvent', 'onBrowserDead() browser or bridge not found. do nothing') log.error('PuppetWebEvent', 'onBrowserDead() browser or bridge not found. do nothing')
return // should not return here, because we must reset isBrowserBirthing in the final closure
throw new Error('no browser & no bridge')
} }
log.verbose('PuppetWebEvent', 'onBrowserDead() try to reborn browser') log.verbose('PuppetWebEvent', 'onBrowserDead() try to reborn browser')
...@@ -254,15 +255,17 @@ function onServerLogin(data, attempt = 0) { ...@@ -254,15 +255,17 @@ function onServerLogin(data, attempt = 0) {
function onServerLogout(data) { function onServerLogout(data) {
if (this.user) { if (this.user) {
this.emit('logout', this.user) this.emit('logout', this.user)
} else { log.verbose('PuppetWebEvent', 'onServerLogout() without this.user initialized') } } else if (this.userId) {
this.emit('logout', this.userId)
} else { log.verbose('PuppetWebEvent', 'onServerLogout() without this.user or userId initialized') }
this.user = null
this.userId = null this.userId = null
this.user = null
this.browser.cleanSession() // this.browser.cleanSession()
.catch(e => { /* fail safe */ // .catch(e => { /* fail safe */
log.verbose('PuppetWebEvent', 'onServerLogout() browser.cleanSession() exception: %s', e.message) // log.verbose('PuppetWebEvent', 'onServerLogout() browser.cleanSession() exception: %s', e.message)
}) // })
} }
function onServerMessage(data) { function onServerMessage(data) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册