[Bug]: F-37 Generic dialogs register an `unload` listener (Chrome: "Permissions policy violation: unload is not allowed")
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- javascript
- 領域
- frontend
調査の方向性
nextcloud-libraries/nextcloud-dialogs の lib/components/GenericDialog.vue から始めて、unload リスナーのライフサイクルを調査します。legacy webpack バンドルが core-common.js をどのように生成するかを確認し、そのうえで、説明されているとおりにリスナーを削除するか置き換えるべきかを判断します。完了条件は、該当するバンドルが効果のない unload リスナーを登録しなくなり、Chrome の violation を発生させなくなることです。
索引モデルが issue の本文から書いたものです。
説明
⚠️ This issue respects the following points: ⚠️
- This is not a troubleshooting question, general support matter, or webserver/proxy problem, but likely a bug (if unsure, ask the Community Help Forum).
- This issue is not already reported on Github OR solved at the Community Help Forum (I've searched!).
- I'm using a maintained major version of Nextcloud Server and tested against the latest patch level. (Supported major versions and current patch levels).
- I agree to follow Nextcloud's Code of Conduct.
- I've tried my best to provide clear reproduction steps that someone unfamiliar with this bug could use to reproduce it.
Bug description
F-37 · Generic dialogs register an unload listener (Chrome: "Permissions policy violation: unload is not allowed")
| Repository | nextcloud-libraries/nextcloud-dialogs |
| Severity | Low (console violation on every confirmation dialog; the listener has no effect) |
| Component | lib/components/GenericDialog.vue |
| Affects | @nextcloud/dialogs 7.5.0, used by Nextcloud 35.0.1 (e.g. the confirmation when deleting files) |
| Verified | Chrome DevTools on a production instance; source of the bundled library |
What happens
Deleting files shows the confirmation dialog, and Chrome logs
[Violation] Permissions policy violation: unload is not allowed in this document.
confirmDestructive @ dialogs.js …
Cause
const handleUnload = () => `${props.name}: ${props.text}`
onMounted(() => window.addEventListener('unload', handleUnload))
onUnmounted(() => window.removeEventListener('unload', handleUnload))
The return value of an unload handler is ignored, so the listener does nothing. It looks like it
was meant to be beforeunload (warn before leaving the page while a dialog is open). Chrome is
phasing out unload and blocks it by default on more and more sites, which produces the violation.
Suggestion
Use beforeunload with event.preventDefault() if the warning is wanted, or remove the listener.
The patch in this package removes it in the legacy (webpack) bundle, core-common.js, which the
Files app uses. The copy in the Vite bundles stays: rebuilding them renames hundreds of chunk files.
Steps to reproduce
see the top
Expected behavior
see the top
Nextcloud Server version
35
Operating system
None
PHP engine version
None
Web server
None
Database engine version
None
Is this bug present after an update or on a fresh install?
None
Are you using the Nextcloud Server Encryption module?
None
What user-backends are you using?
- Default user-backend (database)
- LDAP/ Active Directory
- SSO - SAML
- Other
Configuration report
List of activated Apps
Nextcloud Signing status
Nextcloud Logs
Additional info
No response
- 主要言語
- PHP
- スター
- 37k
- フォーク
- 5.3k
- 平均マージ
- 2日 1時間
- マージ済み PR(30日)
- 723
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
nextcloud/server のほかの issue
-
34-feedback
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
enhancement feature: TaskProcessing good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
1. to develop technical debt
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
メンテナーはふだん 1 日以内に返信
-
0. Needs triage 35-feedback bug
難易度 1/5 1時間未満 初心者へのやさしさ 92/100
メンテナーはふだん 1 日以内に返信
-
0. Needs triage 35-feedback bug
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
nextcloud/server の issue をすべて見る
似ている issue
-
Bug Enhancement Performance
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
メンテナーはふだん 1 日以内に返信
-
Feature Status: Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
メンテナーはふだん 1 日以内に返信
-
frontend low-priority
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
mplodowski/dynamicpdf-plugin#336 ·
メンテナーはふだん 1 日以内に返信
-
Add Zammad対応中かも @Arslan-TR が今日担当しました。 オープンrequest
難易度 2/5 1〜3時間 初心者へのやさしさ 66/100
endoflife-date/endoflife.date#11298 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
FriendsOfFlarum/best-answer#137 ·