Closed Bug 1508868 Opened 11 months ago Closed 11 months ago

alert/confirm/prompt should normalize newlines

Categories

(Core :: DOM: Core & HTML, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla65
Tracking Status
firefox65 --- fixed

People

(Reporter: d, Assigned: jdai)

Details

Attachments

(1 file)

Currently calling these with the JS string 'Line 1.1\nLine 1.2\rLine 1.3\r\nLine 1.4\n\rLine 2.1' gives

Line 1.1
Line 1.2Line1.3
Line 1.4
Line 2.1

instead of the expected

Line 1.1
Line 1.2
Line 1.3
Line 1.4

Line 2.1

---

Spec change: https://github.com/whatwg/html/pull/4105

(Manual) tests: https://github.com/web-platform-tests/wpt/pull/13600

Spec: https://html.spec.whatwg.org/multipage/timers-and-user-prompts.html#simple-dialogs , e.g. for alert() steps 5 and 7.
When I filed for this spec change, I also filed bug 1493978 here which is fixed, so I'm not sure what's up here.
As far as I can tell from running the test in Nightly on macOS it was fixed for alert/confirm, but not prompt.

Do you want to take this John?
Flags: needinfo?(jdai)
Priority: -- → P3
Sure.
Assignee: nobody → jdai
Flags: needinfo?(jdai)
It seems that only prompt[1] didn't follow the spec.

[1] https://whatpr.org/html/4105/ba1c3c3...2197ed5/timers-and-user-prompts.html

/form-control-infrastructure.html 
  We already follow the spec.
/form-elements.html 
  It has been handled at bug 1391044
/infrastructure.html 
  There is nothing to do with the code change.
/parsing.html 
  Clarify with <hsivonen> the outcome should be indistinguishable from what the spec requires[2].
  [2] https://searchfox.org/mozilla-central/source/parser/html/javasrc/Tokenizer.java#1545-1557
/timers-and-user-prompts.html 
  It has been handled at bug 1493978 with alert/confirm, but not prompt.
Status: NEW → ASSIGNED
According to spec[1], prompt should normalize newlines.
[1] https://whatpr.org/html/4105/ba1c3c3...2197ed5/timers-and-user-prompts.html
I apparently had not restarted my Firefox Nightly in a while, which explains my results in the OP. I can confirm with the latest nightly alert and confirm are correct, and only prompt has the OP behavior.
Pushed by jdai@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/91f749609e5d
prompt should normalize newlines. r=smaug
https://hg.mozilla.org/mozilla-central/rev/91f749609e5d
Status: ASSIGNED → RESOLVED
Closed: 11 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in before you can comment on or make changes to this bug.