Try to fix some errors caused by bad ordering
This commit is contained in:
parent
70c21e528f
commit
81553df1c4
|
@ -273,6 +273,7 @@ export default class MessagesPuppeteer {
|
||||||
() => this._waitForLoginCancel(),
|
() => this._waitForLoginCancel(),
|
||||||
].map(promiseFn => cancelableResolve(promiseFn)))
|
].map(promiseFn => cancelableResolve(promiseFn)))
|
||||||
|
|
||||||
|
if (!this.loginCancelled) {
|
||||||
this.log("Removing observers")
|
this.log("Removing observers")
|
||||||
// TODO __mautrixController is undefined when cancelling, why?
|
// TODO __mautrixController is undefined when cancelling, why?
|
||||||
await this.page.evaluate(ownID => window.__mautrixController.setOwnID(ownID), this.ownID)
|
await this.page.evaluate(ownID => window.__mautrixController.setOwnID(ownID), this.ownID)
|
||||||
|
@ -280,6 +281,9 @@ export default class MessagesPuppeteer {
|
||||||
await this.page.evaluate(() => window.__mautrixController.removeQRAppearObserver())
|
await this.page.evaluate(() => window.__mautrixController.removeQRAppearObserver())
|
||||||
await this.page.evaluate(() => window.__mautrixController.removeEmailAppearObserver())
|
await this.page.evaluate(() => window.__mautrixController.removeEmailAppearObserver())
|
||||||
await this.page.evaluate(() => window.__mautrixController.removePINAppearObserver())
|
await this.page.evaluate(() => window.__mautrixController.removePINAppearObserver())
|
||||||
|
} else {
|
||||||
|
this.loginCancelled = false
|
||||||
|
}
|
||||||
delete this.login_email
|
delete this.login_email
|
||||||
delete this.login_password
|
delete this.login_password
|
||||||
|
|
||||||
|
@ -340,6 +344,7 @@ export default class MessagesPuppeteer {
|
||||||
* Close the browser.
|
* Close the browser.
|
||||||
*/
|
*/
|
||||||
async stop() {
|
async stop() {
|
||||||
|
this.stopObserving()
|
||||||
this.taskQueue.stop()
|
this.taskQueue.stop()
|
||||||
if (this.page) {
|
if (this.page) {
|
||||||
await this.page.close()
|
await this.page.close()
|
||||||
|
@ -356,6 +361,9 @@ export default class MessagesPuppeteer {
|
||||||
* @return {Promise<boolean>} - Whether or not the session is logged in.
|
* @return {Promise<boolean>} - Whether or not the session is logged in.
|
||||||
*/
|
*/
|
||||||
async isLoggedIn() {
|
async isLoggedIn() {
|
||||||
|
if (!this.page) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
const selectors = [
|
const selectors = [
|
||||||
"#mainApp:not(.MdNonDisp)",
|
"#mainApp:not(.MdNonDisp)",
|
||||||
"#wrap_message_sync",
|
"#wrap_message_sync",
|
||||||
|
|
Loading…
Reference in New Issue