checkIfAllFieldsPresent can re-run after resolving, crashing on a destroyed webview

オープン 初心者向け
#21 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

評価

難易度
1/5
見積もり時間
1時間未満
初心者へのやさしさ
90/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
electron, typescript
領域
desktop

調査の方向性

まず、checkIfAllFieldsPresent 関数と、それを呼び出す独立した cookie、request、localStorage の watcher を見つけます。すべての webview 操作の前に resolved state が確認されていることを検証し、その後 watcher の呼び出しを繰り返して再現またはテストし、2 回目の呼び出しで破棄された BrowserWindow に対して close が呼び出されないことを確認します。

索引モデルが issue の本文から書いたものです。

説明

checkIfAllFieldsPresent has no guard against being invoked again after it already found all fields and called webview.close():

const checkIfAllFieldsPresent = () => {
    for (const field of requiredFields) { ... }
    resolved = true
    webview.close()
    resolve({ cookies: output })
}

It's wired up to multiple independent watchers (cookie, request, localStorage), any of which can fire again in the async window between webview.close() being called and the window actually finishing destruction. A second call re-enters the function and calls webview.close() again on an already-closing/destroyed BrowserWindow, throwing TypeError: Object has been destroyed as an uncaught main-process exception (crashes/kills the app, not just the login flow). This becomes much easier to hit if a polling-based fix for the SPA cookie-watcher issue is added, but the race exists today with just the two navigation events.

Fix direction: add an early if (resolved) return guard at the top of checkIfAllFieldsPresent.

主要言語
TypeScript
スター
63
フォーク
8
PR マージ指標
30日以内にマージされた PR はありません

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mautrix/manager のほかの issue

mautrix/manager の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。