Browser-laptop: window.prompt is not supported currently

Created on 24 Dec 2015  路  22Comments  路  Source: brave/browser-laptop

Test plan

  1. Visit https://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt
  2. Click the Try it button on the right hand side
  3. Confirm prompt is shown; text should be selected
  4. Type Brave and click OK
  5. Confirm Hello Brave! How are you today? is shown
  6. Repeat steps 2 - 5, except press enter to submit instead of clicking OK
  7. Click the Try it button on the right hand side
  8. Click Cancel button
  9. Confirm User cancelled the prompt. is shown
  10. Repeat steps 8 and 9 except press escape instead of clicking Cancel

Original issue description

We can patch here:
https://github.com/atom/electron/blob/c4931bb2d12f5905cdf434ed6ff1a755ccad053f/atom/renderer/lib/override.coffee#L92

window.prompt

Qchecked-Linux Qchecked-Win64 Qchecked-macOS Qtest-plan-specified bug crash parity prioritP3 release-noteinclude

Most helpful comment

馃帀 Thanks guys. Now if I want to super lazily implement user input, I don't have to do any extra work.

All 22 comments

I think the work I'm doing in electron right now might help out with this

looks like prompt is still not supported?

So maybe is this the reason of #1723, #1311, #1859 and like that?

+1 from Twitter; a user who would like to use Brave internally, but cannot due to the lack of window.prompt: https://twitter.com/jamonholmgren/status/821964305964765184

@bridiver do you know if the underlying support is there for this? If so, I can knock this out pretty easily. It should help w/ out extension support

We are currently relying on window.prompt for our dashboard, so support for this would be highly appreciated! :)

Just learned from a user today that WooCommerce (3+ million WordPress users) uses window.prompt.

Chromium to change behavior of dialogs: Chromium policy on JavaScript dialogs

1+ need it for my WebApp....
(#push)

It is not likely that electron is going to implement prompt.
see https://github.com/electron/electron/issues/472

@mojoaxel we don't need electron to implement prompt because we have our own fork that has diverged significantly. It wouldn't be difficult to implement prompt

+1 from peterkroon via https://github.com/brave/browser-laptop/issues/11010

Steps to Reproduce

Go to: https://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt
Click on button "Try it!"

Plus one "wow, this is a thing?" I am pretty shocked I've run into this... to be honest, I was just messing around with getting a simple input value. Was this intentionally bypassed for any particular reason?

@shortstuffsushi not bypassed for any reason- we just haven't had the time to implement it yet

I did rework a lot of the alert code and I believe it should be somewhat easy to add:

Here is the block of code that gets called when window.prompt is triggered
https://github.com/brave/browser-laptop/blob/41a0523d088f2c90a2148eafd40f52b9d10dcedf/app/browser/tabMessageBox.js#L47-L52

The smart move might be to edit the MessageBox component to allow for an edit control and handle prompts using the existing tabMessageBox code

Warning: The Try it button in the example above crashes the browser. Reproduced with Brave 0.20.30 on macOS 0.13.x.

Tentatively assigning to 0.23.x since this does cause a crash

馃帀 Thanks guys. Now if I want to super lazily implement user input, I don't have to do any extra work.

Verified with macOS 10.12.6 using

  • 0.23.80 53a429f
  • Muon 8.0.8
  • libchromiumcontent 68.0.3440.84

Verified on Ubuntu 18 x64 using

  • 0.23.80 53a429f
  • Muon 8.0.8
  • libchromiumcontent 68.0.3440.84
Was this page helpful?
0 / 5 - 0 ratings

Related issues

bsclifton picture bsclifton  路  3Comments

luixxiul picture luixxiul  路  3Comments

antiroyalty picture antiroyalty  路  3Comments

jonathansampson picture jonathansampson  路  3Comments

luixxiul picture luixxiul  路  3Comments