phpdesktop icon indicating copy to clipboard operation
phpdesktop copied to clipboard

Windows: JS Dialogs, Popup Windows and Dev Tools issues

Open oleteacher opened this issue 1 year ago • 16 comments

Thanks for releasing Windows Chrome 130.

I do not think it is my end, have tried on my desktop and laptop.

Cannot get any of the JavaScript alerts to work in dialogs.php

Cannot get the dev tools to show using either f12 or Show Dev Tools (right click). Using right click, there is no log shown, using f12 there is log entry shown.

Maybe this will help:

 17:35:43.922 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:64782/dialogs.php
- 17:35:43.000 INFO: GET 200 /favicon.ico
- 17:37:36.125 DEBUG: ClientHandler::OnAfterCreated()
- 17:37:36.125 DEBUG: GetBrowserWindow(): not found, hwnd = 3019194
- 17:37:36.140 DEBUG: BrowserWindow::BrowserWindow() created for Popup
- 17:37:36.140 DEBUG: StoreBrowserWindow(): hwnd = 3019194
- 17:37:36.140 DEBUG: GetBrowserWindow(): not found, hwnd = 0
- 17:37:36.140 DEBUG: Centering popup window relative to its parent
- 17:45:04.984 DEBUG: OnLoadingStateChange: loading=1, url=http://127.0.0.1:64782/dialogs.php
- 17:45:04.094 INFO: GET 200 /dialogs.php
- 17:45:04.109 INFO: GET 200 /style.css
- 17:45:05.672 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:64782/dialogs.php
- 17:45:05.765 INFO: GET 200 /favicon.ico
- 17:45:56.765 DEBUG: OnLoadingStateChange: loading=1, url=http://127.0.0.1:64782/dialogs.php
- 17:45:56.859 INFO: GET 200 /dialogs.php
- 17:45:56.875 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:64782/dialogs.php
- 17:45:56.969 INFO: GET 200 /favicon.ico
- 17:47:00.687 DEBUG: F12 pressed, opening developer tools

Default dialogs.php debug.log:

-field-trial-handle=4432,i,15068399474415448331,6920777093694457870,262144 --variations-seed-version --enable-logging=handle --log-file=4364 --mojo-platform-channel-handle=4408 /prefetch:8
- 18:00:25.890 DEBUG: OnLoadingStateChange: loading=1, url=http://127.0.0.1:65361/
- 18:00:25.515 DEBUG: OnBrowserCreated()
- 18:00:25.515 ERROR: StoreJavascriptApi() failed, api already exists
- 18:00:25.594 DEBUG: OnContextCreated()
- 18:00:25.969 INFO: GET 200 /dialogs.php
- 18:00:25.984 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:65361/dialogs.php
- 18:00:25.078 INFO: GET 200 /favicon.ico
[3892:18700:1110/180028.660:INFO:CONSOLE(0)] "A window.prompt() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5637107137642496", source: http://127.0.0.1:65361/dialogs.php (0)
[3892:18700:1110/180029.760:INFO:CONSOLE(0)] "A window.prompt() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5637107137642496", source: http://127.0.0.1:65361/dialogs.php (0)
- 18:01:00.953 DEBUG: WM_DESTROY
- 18:01:00.953 DEBUG: RemoveBrowserWindow(): hwnd = 1381480
- 18:01:00.953 INFO: Stopping Mongoose web server
- 18:01:00.953 DEBUG: Mongoose webserver stopped immediately
- 18:01:00.969 DEBUG: OnBeforeClose() hwnd=726084
- 18:01:00.969 DEBUG: RemoveBrowserWindow(): hwnd = 726084
- 18:01:00.984 DEBUG: GetBrowserWindow(): not found, hwnd = 726084
- 18:01:00.984 WARNING: RemoveBrowserWindow() failed: GetBrowserWindow() failed
- 18:01:00.984 DEBUG: Calling CefQuitMessageLoop()
- 18:01:00.172 INFO: Ended application
- 18:01:00.172 INFO: --------------------------------------------------------

Testing a custom dialogs.php debug.log:

- 17:45:56.765 DEBUG: OnLoadingStateChange: loading=1, url=http://127.0.0.1:64782/dialogs.php
- 17:45:56.422 DEBUG: OnContextCreated()
- 17:45:56.422 ERROR: GetJavascriptApi() failed, api not found
- 17:45:56.422 ERROR: GetJavascriptApi() failed in OnContextCreated()
- 17:45:56.422 DEBUG: OnContextCreated()
- 17:45:56.422 ERROR: GetJavascriptApi() failed, api not found
- 17:45:56.422 ERROR: GetJavascriptApi() failed in OnContextCreated()
- 17:45:56.859 INFO: GET 200 /dialogs.php
[24116:24220:1110/174556.746:INFO:CONSOLE(104)] "Uncaught SyntaxError: Unexpected identifier 'confirmMessage'", source: http://127.0.0.1:64782/dialogs.php (104)
- 17:45:56.875 DEBUG: OnLoadingStateChange: loading=0, url=http://127.0.0.1:64782/dialogs.php
- 17:45:56.969 INFO: GET 200 /favicon.ico
[24116:24220:1110/174559.044:INFO:CONSOLE(54)] "Uncaught ReferenceError: showAlert is not defined", source: http://127.0.0.1:64782/dialogs.php (54)
[24116:24220:1110/174600.271:INFO:CONSOLE(56)] "Uncaught ReferenceError: showConfirm is not defined", source: http://127.0.0.1:64782/dialogs.php (56)
[24116:24220:1110/174600.623:INFO:CONSOLE(56)] "Uncaught ReferenceError: showConfirm is not defined", source: http://127.0.0.1:64782/dialogs.php (56)
[24116:24220:1110/174600.857:INFO:CONSOLE(56)] "Uncaught ReferenceError: showConfirm is not defined", source: http://127.0.0.1:64782/dialogs.php (56)
[24116:24220:1110/174601.584:INFO:CONSOLE(58)] "Uncaught ReferenceError: showPrompt is not defined", source: http://127.0.0.1:64782/dialogs.php (58)
[24116:24220:1110/174601.865:INFO:CONSOLE(58)] "Uncaught ReferenceError: showPrompt is not defined", source: http://127.0.0.1:64782/dialogs.php (58)
- 17:47:00.687 DEBUG: F12 pressed, opening developer tools
- 17:54:41.140 DEBUG: WM_DESTROY
- 17:54:41.156 DEBUG: RemoveBrowserWindow(): hwnd = 201864
- 17:54:41.203 DEBUG: OnBeforeClose() hwnd=3019194
- 17:54:41.203 DEBUG: RemoveBrowserWindow(): hwnd = 3019194
- 17:54:41.219 DEBUG: Calling CefQuitMessageLoop()
- 17:54:41.250 DEBUG: OnBeforeClose() hwnd=7210128
- 17:54:41.250 DEBUG: RemoveBrowserWindow(): hwnd = 7210128
- 17:54:41.250 DEBUG: GetBrowserWindow(): not found, hwnd = 7210128
- 17:54:41.250 WARNING: RemoveBrowserWindow() failed: GetBrowserWindow() failed
- 17:54:41.250 DEBUG: Calling CefQuitMessageLoop()
[22280:22440:1110/175441.466:WARNING:sqlite_persistent_store_backend_base.cc(198)] Failed to post task from FlushAndNotifyInBackground@net\extras\sqlite\sqlite_persistent_store_backend_base.cc:248 to client_task_runner_.
- 17:54:41.640 INFO: Ended application
- 17:54:41.640 INFO: --------------------------------------------------------

oleteacher avatar Nov 10 '24 23:11 oleteacher

I noticed the issue with dialogs, however devtools worked for me fine. I recall I changed runtime style from chrome to alloy later and I think this may have broken devtools.

cztomczak avatar Nov 11 '24 12:11 cztomczak

popups.php works ok for me.

cztomczak avatar Nov 11 '24 12:11 cztomczak

Commit https://github.com/cztomczak/phpdesktop/commit/8ceda28bc3464b0a13df69bb2356ad4b449ee7f7 adds runtime_style setting configurable through settings.json.

runtime_style
This option is supported only on some platforms.

Default value: "alloy"

Alternative value is "chrome" which can provide more features and looks similar to native Chrome.

With chrome runtime style dialogs do work ok. Popups look like native Chromium browser with a tab.

I am mostly testing alloy style which hides Chromium styles.

cztomczak avatar Nov 11 '24 13:11 cztomczak

Developer Tools fixed in commit https://github.com/cztomczak/phpdesktop/commit/0a04732e9dd141d9054ad05077dd77f5cf279bca.

cztomczak avatar Nov 11 '24 15:11 cztomczak

Thank you for looking into!

oleteacher avatar Nov 11 '24 17:11 oleteacher

Dialogs don't work due to bug in upstream CEF: https://github.com/chromiumembedded/cef/issues/3818 https://magpcss.org/ceforum/viewtopic.php?f=6&t=20041

cztomczak avatar Nov 11 '24 21:11 cztomczak

New release 130.1 is ready: https://github.com/cztomczak/phpdesktop/releases/tag/chrome-v130.1

cztomczak avatar Nov 12 '24 12:11 cztomczak

That is great Czarek. Thank you. Will close this now.

oleteacher avatar Nov 12 '24 17:11 oleteacher

No popup dialogs shown. Thought you may find this helpful:

- 11:50:15.672 DEBUG: JS dialog: Test alert
- 11:50:17.672 DEBUG: JS dialog: Test confirm
- 11:50:17.672 INFO: JS Console: [Warning] A window.confirm() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5140698722467840(http://127.0.0.1:50988/dialogs.php:0)
- 11:50:18.859 DEBUG: JS dialog: Test
- 11:50:18.859 INFO: JS Console: [Warning] A window.prompt() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5637107137642496(http://127.0.0.1:50988/dialogs.php:0)

oleteacher avatar Nov 12 '24 17:11 oleteacher

JS dialogs are still unfixed, so you may re-open this. Dialogs will be fixed when it's fixed in upstream and phpdesktop updates Chromium version to sync with upstream.

cztomczak avatar Nov 12 '24 19:11 cztomczak

FYI to anybody coming across this thread when looking into js dialog suppression: Change "runtime_style" from "alloy" to "chrome" in settings.json (in app main directory), and js dialogs will work again: https://github.com/cztomczak/phpdesktop/blob/chrome130/settings.json#L51

taoteh1221 avatar Feb 04 '25 16:02 taoteh1221

I seem to get this problem on windows 130.1 but on MACOS 130.1 is working fine

Image

A window.confirm() dialog generated by this page was suppressed because this page is not the active tab of the front window. Please make sure your dialogs are triggered by user interactions to avoid this situation. https://www.chromestatus.com/feature/5140698722467840

Donno191 avatar Feb 18 '25 13:02 Donno191

@Donno191 Thanks for input. But I am talking about:

Cannot get any of the JavaScript alerts to work in dialogs.php

<a href="javascript:alert('Test alert')">window.alert()</a>,
<a href="javascript:confirm('Test confirm')">window.confirm()</a>,
<a href="javascript:void(prompt('Test', 'prompt'))">window.prompt()</a>

Not sure how this applies to the situation?

"Please make sure your dialogs are triggered by user interactions to avoid this situation"

oleteacher avatar Feb 18 '25 18:02 oleteacher

@Donno191 Change "runtime_style" from "alloy" to "chrome" in the Windows version. This fixes suppression of javascript dialogs.

taoteh1221 avatar Feb 18 '25 20:02 taoteh1221

@Donno191 Change "runtime_style" from "alloy" to "chrome" in the Windows version. This fixes suppression of javascript dialogs.

This works, also fixed desktop notifications, but it also has a few drawbacks. Stuff like saving passwords and whatnot also shows up as part of the "chrome" runtime style.

TCB13 avatar Feb 19 '25 00:02 TCB13

This works, also fixed desktop notifications, but it also has a few drawbacks. Stuff like saving passwords and whatnot also shows up as part of the "chrome" runtime style.

Yes, and pop-up windows look different in 'Chrome' mode. They open in a new browser instance with a URL bar, and their size is random rather than defined. While this means you can solve the Alerts() problem with 'Chrome' mode, it brings other problems.

tucan39 avatar Sep 25 '25 16:09 tucan39