InvalidStateError is thrown when trying to set valueAsNumber of an input with type="datetime-local" on Google Maps
Categories
(Core :: DOM: Core & HTML, defect, P3)
Tracking
()
Webcompat Priority | ? |
People
(Reporter: ksenia, Unassigned)
References
(Blocks 1 open bug, )
Details
Attachments
(1 file)
308 bytes,
text/html
|
Details |
As reported here https://github.com/webcompat/web-bugs/issues/39281
Steps to reproduce:
- On Firefox on Android/RDM navigate to https://www.google.com/maps/dir/Fettstraße+20,+D-20357+Hamburg,+Deutschland/Hauptkirche+St.+Michaelis,+Englische+Planke,+Hamburg/@53.5586949,9.9852882,14z/data=!4m8!4m7!1m2!1m1!1s0x47b18f4493d02fe1:0x6280c2a6cea3ed83!1m2!1m1!1s0x47b18f11e1dd5b45:0x187d5dca009a4b19!3e3?gl=de
- Tap the Bus icon.
- Tap the "Leave now" drop-down button.
- Observe behavior.
Expected results:
A menu with predefined options and a time/date change option are available.
Actual result:
Menu is not displayed.
The issue seems to be with the following code (I've attached a reduced version to the bug):
try {
var a = _.Qb("INPUT");
a.setAttribute("type", "datetime-local");
a.value = "testing";
if ("testing" == a.value)
return !1;
a.valueAsNumber = 1542675700770;
return 1542675700770 == a.valueAsNumber
} catch (b) {
return !1
}
Firefox fails to set valueAsNumber in this function, and the "Leave now" button gets "disabled"=true later on, and therefore becomes unclickable.
Note that there is a User Agent detection happening as well, but seems that the problem with valueAsNumber
is the underlying issue.
Reporter | ||
Updated•5 years ago
|
Comment 1•5 years ago
|
||
Why was it thrown here https://searchfox.org/mozilla-central/source/dom/html/HTMLInputElement.cpp#1783 ?
Comment 2•5 years ago
•
|
||
(In reply to Hsin-Yi Tsai [:hsinyi] from comment #1)
Why was it thrown here https://searchfox.org/mozilla-central/source/dom/html/HTMLInputElement.cpp#1783 ?
NS_ERROR_DOM_INVALID_STATE_ERR was thrown because mType was still NS_FORM_INPUT_TEXT. Why was mType not changed to NS_FORM_INPUT_DATETIME_LOCAL even after we setAttribute as 'a.setAttribute("type", "datetime-local");' in the attached test case? Didn't we call into this line?
John, maybe you can share some thoughts here, where our code went wrong?
Comment 4•5 years ago
|
||
Thanks John for pointing this out that we don't enable it.
Description
•