Closed Bug 1273997 Opened 8 years ago Closed 5 years ago

alert, prompt, confirm don't work inside the viewport

Categories

(DevTools :: Responsive Design Mode, defect, P3)

defect

Tracking

(firefox66 verified)

VERIFIED FIXED
Firefox 66
Tracking Status
firefox66 --- verified

People

(Reporter: jryans, Assigned: pbro)

References

Details

(Whiteboard: [multiviewport][reserve-rdm][dt-q])

User Story

`window.alert()` fails inside the viewport, nothing happens:

- data:text/html,<script>onclick=function(){alert('ok')}</script>
  I think it relates to mozbrowsershowmodalprompt

`prompt` and `confirm` have similar issues.

Attachments

(1 file)

(Copied from :ochameau's review of bug 1240913.)
Flags: qe-verify?
Flags: qe-verify? → qe-verify+
QA Contact: mihai.boldan
Just a remark regarding this issue: once you opened the RDM once in a tab's lifetime, window.alert()/window.open() won't work anymore, even if you close the RDM, reload the page, or change the URL.
Priority: P3 → P2
I've started to look at this one locally, so I'll grab it for now.
Assignee: nobody → jryans
Status: NEW → ASSIGNED
Iteration: --- → 51.2 - Aug 29
Priority: P2 → P1
Iteration: 51.2 - Aug 29 → 51.3 - Sep 12
I think part Benoit mentions in comment 2 is the more serious problem, since we're messing up the tab even after RDM is closed.  I'll break that out to a separate bug.  (It appears only the window.alert is impacted this way.  window.open does work once you closed RDM.)

I created bug 1300214 for that portion.  Furthermore, I think that's the only piece we really need before enabling in Nightly, so I'll move this back to reserve.
Assignee: jryans → nobody
Status: ASSIGNED → NEW
Priority: P1 → P3
Iteration: 51.3 - Sep 12 → ---
I am working on the window.open() portion in bug 1310851.
Summary: window.open, alert don't work inside the viewport → window.alert doesn't work inside the viewport
User Story: (updated)
Also affects window.prompt, but you probably already knew that.
.. and confirm() too  (ran into this on a form confirming a db modification while trying to test throttling - apparently bug #1349559 will let me avoid this problem)
I just ran across the issue with alert not working in responsive design mode.  It seems that this is still an open bug.  Or is it a settings issue?  Please advise.
User Story: (updated)
Summary: window.alert doesn't work inside the viewport → alert, prompt, confirm don't work inside the viewport
Still an issue in 59.0.3.
Product: Firefox → DevTools
I'm at 61.0.1 and the problem still there.
window.open() won't return window reference as well
I think this should have a higher priority since it seems it is affecting a lot of developers using the RDM.
Whiteboard: [multiviewport][reserve-rdm] → [multiviewport][reserve-rdm][dt-q]
I would like to add that this should be considered a higher priority.

I just spent over an hour debugging code, resetting browser settings to default, disabling plug-ins, and ask co-workers to test a page in their browser. I was using RDM to simulate the screen of a coworker who had a larger display than me, and suddenly our save confirmation prompts stopped working (which made it so modal layers couldn't be closed at all).

I had figured that a recent Firefox update decided to disable them or something (IE disabled prompt() a few years ago) and I was > < this close to creating an emergency porting for all my code.

I had completely forgotten that I was in RDM mode and only when a co-worker mentioned it did I think to close out RDM - and sure enough the code works again.
With the way RDM works today, this isn't a trivial fix.
I've been looking at the code for this and related comments on this bug, and I do think that support alert() should be quite easy.
Supporting prompt and confirm though seem a lot harder, but it's perhaps because I don't know where to look yet.
It'd be great if the mozbrowser iframe we use could just be allowed to open these prompt dialogs by default. And it's probably the right fix.
In the meantime, listening to mozbrowsershowmodalprompt events will make it possible to relay alerts through the outer browser, but sending back the return value of confirm/prompt calls seems trickier.

If we can't do them quickly, we should at least make sure users understand that they're not supported. Many people have lost hours just wondering why their code wasn't working, when really RDM was just silently swallowing the alert/confirm/prompt dialogs.

So I would suggest implementing a fix for alerts, and warning users for prompt/confirm for the time being.
And in the meantime, starting the investigation on the platform side, to allow mozbrowser iframes to do all 3 types of prompts.
Comment on attachment 9029624 [details]
Bug 1273997 - Minimap support for alerts in RDM by relaying alerts on outer browser

Hi Ryan, not sure how much time you have these days for Mozilla-stuff, but in case you have a few minutes to spare, what do you think of this (see comment 21 for the rationale behind this)?
Attachment #9029624 - Flags: feedback?(jryans)
Thank you. I understand the fix may not be trivial, but at the very least a warning message in the console that messages are being suppressed due to RDM would be a huge time saver.
Comment on attachment 9029624 [details]
Bug 1273997 - Minimap support for alerts in RDM by relaying alerts on outer browser

Let me drop this attachment as it turned out to be much easier than I thought to support comfirm/prompt too, since we have all the APIs we need thanks to BrowserElementPromptService.
Thank you Ryan for your guidance on IRC yesterday.
Attachment #9029624 - Attachment is obsolete: true
Attachment #9029624 - Flags: feedback?(jryans)
Attachment #9029624 - Attachment is obsolete: false
Seems like a reasonable approach to me.  Sorry this area is so painful...
Assignee: nobody → pbrosset
Status: NEW → ASSIGNED
Pushed by pbrosset@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/95e9c87e234b
Minimap support for alerts in RDM by relaying alerts on outer browser r=ochameau,jryans
https://hg.mozilla.org/mozilla-central/rev/95e9c87e234b
Status: ASSIGNED → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 66

Verified Fixed on latest Nightly 66.0a1 (2019-01-10) (64-bit) on Windows 10, Ubuntu 16.04 and Mac OS 10.13.

Status: RESOLVED → VERIFIED
Flags: qe-verify+
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: