Closed Bug 1583623 Opened 5 years ago Closed 5 years ago

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)

68 Branch
All
Unspecified
defect

Tracking

()

RESOLVED DUPLICATE of bug 1306217
Webcompat Priority ?

People

(Reporter: ksenia, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file)

Attached file 39281.html (deleted) —

As reported here https://github.com/webcompat/web-bugs/issues/39281

Steps to reproduce:

  1. 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
  2. Tap the Bus icon.
  3. Tap the "Leave now" drop-down button.
  4. 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.

Webcompat Priority: --- → ?

(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?

Flags: needinfo?(jdai)

Sure, I'll take a look. Keep NI for me.

Thanks John for pointing this out that we don't enable it.

Status: NEW → RESOLVED
Closed: 5 years ago
Flags: needinfo?(jdai)
Resolution: --- → DUPLICATE
Depends on: 1605611
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: