Repository navigation
Gérer alert, confirm, prompt et beforeunload dans les frontends intégrés (#452) - #486
Conversation
…nds (#452) WKWebView implements the three WKUIDelegate panel methods with an NSAlert sheet (without them these calls did nothing); WebKitGTK, CEF and WebView2 keep their engine's dialogs. A shared injection point (frontend/ScriptDialogs.hpp) answers the dialogs in each frontend for tests, and closing the window with a box open dismisses it. Scenarios cover WebKitGTK and CEF locally; WKWebView and WebView2 scenarios are added but not run on this machine.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Walkthrough
Merge Risk:
|
There was a problem hiding this comment.
Note
Copilot was unable to complete this review at the selected tier due to model policy or plan restrictions.
🟡 Changes recommended
A misleading API comment in include/webfront/frontend/ScriptDialogs.hpp incorrectly states that beforeunload dialog text is empty despite implementations passing through engine-provided text, so the documentation must be corrected before approval.
1 open issue
What changed in this PR
This pull request implements support for JavaScript alert, confirm, prompt, and beforeunload across the integrated frontends (WKWebView, WebKitGTK, CEF, WebView2), adds a shared dialog API, extends frontend integration tests, and updates documentation/ADR notes.
Changes:
- Introduces shared script-dialog types (
ScriptDialog,ScriptDialogAnswer,ScriptDialogHandler) and wires a test injection hook into each frontend. - Implements/bridges engine-specific dialog handlers: WKWebView (
WKUIDelegate+NSAlertsheet), WebKitGTK (script-dialog), CEF (CefJSDialogHandler), WebView2 (ScriptDialogOpening). - Adds/extends integration tests and CMake/CTest registration, plus documentation updates (FRONTENDS, CHANGELOG, ADR-020 v1.2).
| File | Summary |
|---|---|
test/web/WKWebViewLifecycle.cpp |
Adds WKWebView lifecycle scenarios covering script dialogs and closing behavior with a dialog open. |
test/web/WebView2Lifecycle.cpp |
Adds a WebView2 scenario validating script dialog handling via ScriptDialogOpening and injected answers. |
test/web/WebKitGTKLifecycle.cpp |
Adds WebKitGTK scenarios for script dialogs and close-with-dialog behavior. |
test/web/script-dialogs.html |
Adds an HTML fixture that triggers alert/confirm/prompt (and hold mode) and encodes results via document title. |
test/web/CMakeLists.txt |
Registers additional web test modes (including CEF dialog-related modes) in the test matrix. |
test/web/CEFFileServices.cpp |
Extends CEF file-services tests with dialog/hold modes and assertions around dialog behavior. |
include/webfront/frontend/WKWebView.hpp |
Implements WKUIDelegate dialog callbacks, adds answerScriptDialog injection hook, and WKWebView-specific dialog presentation logic. |
include/webfront/frontend/WebView2.hpp |
Wires WebView2 ScriptDialogOpening handling and optional injection-based answering. |
include/webfront/frontend/WebKitGTK.hpp |
Hooks WebKitGTK script-dialog signal, supports injected answers, and tracks dialog-open events for tests. |
include/webfront/frontend/ScriptDialogs.hpp |
Introduces shared dialog types/handler interface used by all integrated frontends. |
include/webfront/frontend/CEF.hpp |
Adds a CEF JS dialog handler with optional injected answering and default engine dialog fallback behavior. |
docs/FRONTENDS.md |
Documents per-frontend dialog behavior and related test scenarios. |
docs/CHANGELOG.md |
Adds an unreleased changelog entry for integrated-frontend script dialog support. |
docs/adr/ADR-020-services-systeme.md |
Updates ADR-020 to v1.2 reflecting the status/progress tied to this task. |
cmake/WKWebViewSupport.cmake |
Registers WKWebView script-dialog-related tests in CTest. |
cmake/WebView2Support.cmake |
Registers the WebView2 script-dialog test mode in CTest. |
cmake/WebKitGTKSupport.cmake |
Registers WebKitGTK script-dialog and close-with-dialog test modes in CTest. |
This pull request requires changes.
Review effort: Balanced
…ier close tests, WKWebView sheet ownership (#452)
… closing the window skips beforeunload (#452)
|
Origine opaque sous WKWebView : corrigé dans e1f7703. |

Épique #446, tâche #452 (ADR-020, règle 6).
Contenu
WKUIDelegate(sans elles, ces appels ne faisaient rien) affichent une feuilleNSAlertattachée à la fenêtre ; seules les frames de l'origine de l'application sont servies, les autres sont rejetées.beforeunloadn'est pas pris en charge sous WKWebView : le délégué public n'a pas de méthode pour lui et il ne passe pas parconfirm(il emprunte un sélecteur privé, non implémenté). Une page qui en dépend peut perdre des modifications non enregistrées ; limite documentée.script-dialog), CEF (CefJSDialogHandler), WebView2 (ScriptDialogOpening) : dialogues du moteur par défaut, avec un point d'injection de test.frontend/ScriptDialogs.hpp: types partagés (ScriptDialog,ScriptDialogAnswer,ScriptDialogHandler).docs/FRONTENDS.md,docs/CHANGELOG.md, ADR-020 version 1.2.Validation
WebKitGTKAdapter-script-dialogs,-close-with-script-dialog,CEFFileServices-dialogs,-hold; 437 tests hors intégration web.beforeunload: câblé sous WebKitGTK, CEF et WebView2, jamais déclenché par un scénario (le moteur exige un geste utilisateur) ; non pris en charge sous WKWebView.Après fusion, il restera à dispatcher
BuildAndTest.ymlsur la branche (CEF GCC et Clang).