Past names map is not updated when an element that no longer has a name/id is removed from the form

RESOLVED FIXED in Firefox 53

Status

()

RESOLVED FIXED
2 years ago
2 years ago

People

(Reporter: myvyang, Assigned: bzbarsky)

Tracking

48 Branch
mozilla53
Points:
---

Firefox Tracking Flags

(firefox53 fixed)

Details

Attachments

(2 attachments)

(Reporter)

Description

2 years ago
Created attachment 8812071 [details]
attr.html

User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.98 Safari/537.36

Steps to reproduce:

as code attached in attr.html

in other browsers, after removeChild, attributes will be update; but on firefox not.


Actual results:

in firefox, console shows `<input>`

in other browser ,like chrome, safari ,IE, console shows `NamedNodeMap`


Expected results:

run like other browser

Comment 1

2 years ago
Boris, can you check if Gecko behaves normaly according to the specs and the other browsers, please.
Component: Untriaged → DOM
Flags: needinfo?(bzbarsky)
Product: Firefox → Core
(Assignee)

Comment 2

2 years ago
The relevant spec bit here is:

  If an element listed in a form element's past names map changes form owner, then its entries must be
  removed from that map.

We definitely have code to do that in HTMLFormElement::RemoveElementFromTable.  The problem is that this code is only called when the element has a name/id that should place it in the table.  I'll write up a fix.
Blocks: 879319
Summary: tag.attributes not update while tag's childNode update → Past names map is not updated when an element that no longer has a name/id is removed from the form
(Assignee)

Updated

2 years ago
Assignee: nobody → bzbarsky
Status: UNCONFIRMED → NEW
Ever confirmed: true
(Assignee)

Comment 3

2 years ago
Created attachment 8812408 [details] [diff] [review]
Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore
Attachment #8812408 - Flags: review?(amarchesini)
(Assignee)

Updated

2 years ago
Flags: needinfo?(bzbarsky)
Comment on attachment 8812408 [details] [diff] [review]
Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore

Review of attachment 8812408 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/html/HTMLFormElement.cpp
@@ +2560,5 @@
> +  if (!aElement->HasFlag(MAY_BE_IN_PAST_NAMES_MAP)) {
> +    return;
> +  }
> +
> +  aElement->UnsetFlags(MAY_BE_IN_PAST_NAMES_MAP);  

extra spaces.
Attachment #8812408 - Flags: review?(amarchesini) → review+

Comment 5

2 years ago
Pushed by bzbarsky@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2a9eb529688b
Remove entries from a form's past names map when an element is removed from the form, even if that element doesn't have a name or id anymore.  r=baku

Comment 6

2 years ago
bugherder
https://hg.mozilla.org/mozilla-central/rev/2a9eb529688b
Status: NEW → RESOLVED
Last Resolved: 2 years ago
status-firefox53: --- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.