Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

[Bug]: window.open("about:blank") replaces the preview page, which breaks MSAL login and its redirect fallback

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

メンテナーはふだん 1 日以内に返信

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

評価

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

調査の方向性

apps/desktop/src/preview/Manager.ts から始め、プレビューのアタッチパスにある isPopupUrl、previewWindowOpenAction、setWindowOpenHandler を読みます。about:blank を使用した window.open のケースを再現し、その後、拒否されたポップアップではない URL がプレビューに読み込まれなくなっていることと、リダイレクトのフォールバックで元のページが引き続き利用できることを確認します。

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

説明

bug via-triage
Before submitting
  • I searched existing issues and did not find a duplicate.
  • I included enough detail to reproduce or investigate the problem.
Area

apps/desktop

Steps to reproduce
  1. Open any page in a preview tab, for example http://localhost:3000/.

  2. Run this in the page, for example from a click handler:

    const w = window.open('about:blank', 'popup', 'width=483,height=600')
    console.log(w) // null
    
  3. The call returns null, and then the preview tab navigates to about:blank. The original page is gone.

This is how @azure/msal-browser opens its popup. With the default asyncPopups: false, loginPopup() and acquireTokenPopup() call window.open("about:blank", …) synchronously in the click handler, then set the popup's URL (PopupClient.openSizedPopup). Other SDKs pre-open a blank popup this way to keep the user gesture.

Expected behavior

If the preview won't open a real window for about:blank, it should deny the call without navigating the preview tab. window.open then returns null and the page stays as it was, which is what a normal popup blocker does. SDKs detect this case and fall back: MSAL throws popup_window_error, and apps typically call loginRedirect() next.

Actual behavior

The call is denied and the preview tab loads about:blank. MSAL throws popup_window_error, and the app's loginRedirect() fallback runs from a page that is already being replaced. The tab stays blank, with no Microsoft sign-in. Reading sessionStorage on that page then throws SecurityError: Access is denied for this document.

Cause, in apps/desktop/src/preview/Manager.ts on main (c2fa9fc911):

  • isPopupUrl deliberately excludes about:blank, for the contextIsolation reason in its comment. So previewWindowOpenAction returns "navigate" for this new-window request.
  • The setWindowOpenHandler in the preview attach path handles "navigate" with wc.loadURL(details.url) and returns { action: "deny" }. For about:blank, this loads a blank page over the opener.

Loading about:blank into the opener never helps. A possible fix: when the URL isn't a popup URL, for example about:blank or "", return { action: "deny" } without calling loadURL. The page then gets a plain blocked popup and can use its own fallback.

Related: #6561 / #8435 (OAuth popups for http(s) URLs) and #13953 (target="_blank" loads in place). The new-tab fix planned for #13953 covers http(s) tab dispositions, not this about:blank new-window case.

Impact

Blocks work completely

Version or commit

T3Code(Nightly)/0.0.44-nightly.20260929.2456 (Electron 44.4.2, Chrome 152.0.7977.130)

Environment

Ubuntu 26.04.1 LTS, Linux 7.0.0-34-generic

Logs or stack traces
[auth] loginPopup failed, trying loginRedirect BrowserAuthError: popup_window_error: Error opening popup window. This can happen if you are using IE or if popups are blocked in the browser.
    at createBrowserAuthError (...)
    at PopupClient.openPopup (...)
    at PopupClient.initiateAuthRequest (...)
Workaround

Two app-side options:

  • In the page, replace window.open with a stub that returns null without calling the native handler. The redirect fallback then works: we confirmed a full sign-in through Microsoft this way.
  • Detect Electron/ in the user agent and call loginRedirect() directly, without trying the popup.
主要言語
TypeScript
スター
24k
フォーク
6.3k
平均マージ
10時間 20分
マージ済み PR(30日)
309

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

はじめの一歩

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

pingdotgg/t3code のほかの issue

pingdotgg/t3code の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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