[wpt-sync] Sync PR 15343 - domparsing: Fix an issue that XMLSerializer generates new prefix for an attribute with an existing namespace

RESOLVED FIXED in Firefox 67

Status

()

enhancement
P4
normal
RESOLVED FIXED
3 months ago
2 months ago

People

(Reporter: wptsync, Unassigned)

Tracking

unspecified
mozilla67
Points:
---

Firefox Tracking Flags

(firefox67 fixed)

Details

(Whiteboard: [wptsync downstream], )

Assignee

Description

3 months ago

Sync web-platform-tests PR 15343 into mozilla-central (this bug is closed when the sync is complete).

PR: https://github.com/web-platform-tests/wpt/pull/15343
Details from upstream follow.

Kent Tamura <tkent@chromium.org> wrote:

domparsing: Fix an issue that XMLSerializer generates new prefix for an attribute with an existing namespace

Add an implementation of "retrieving a preferred prefix string"
[1], and apply it to attribute serialization.

The specification says we need to keep a map like [2]

namespace URI => [older prefix, ..., newer prefix]

in order to retrieve most-recently-declared prefix. However, our
current implementation is:

prefix => (namespace URI, declaration index)

When we search the map for a namespace URI, we chose a prefix with
the largest declaration index.

The failing test case in XMLSerializer-serializeToString.html follows
the specification, but Firefox, Safari, and Chrome without this CL
preserve prefix in such case. This CL keeps the interoperable behavior.

[1] https://w3c.github.io/DOM-Parsing/#dfn-retrieving-a-preferred-prefix-string
[2] https://w3c.github.io/DOM-Parsing/#dfn-namespace-prefix-map

Bug: 906807
Change-Id: Idaea590ba19c9c21acbaf456ea91ce550c74db5a

Reviewed-on: https://chromium-review.googlesource.com/1445033
WPT-Export-Revision: 84008f12fea1e42ce516b56368ef7de0966769e0

Assignee

Updated

3 months ago
Component: web-platform-tests → DOM
Product: Testing → Core
Assignee

Comment 4

3 months ago
Ran 1 tests and 9 subtests
OK     : 1
PASS   : 6
FAIL   : 3

New tests that have failures or other problems:
/domparsing/XMLSerializer-serializeToString.html
    Check if an attribute with namespace and no prefix is serialized with the nearest-declared prefix even if the prefix is assigned to another namespace.: FAIL
    Check if the prefix of an attribute is NOT preserved in a case where neither its prefix nor its namespace URI is not already used.: FAIL
    Check if the prefix of an attribute is replaced with a generated one in a case where the prefix is already mapped to a different namespace URI.: FAIL
Component: DOM → DOM: Core & HTML
Product: Core → Core

Comment 5

2 months ago
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/1a78f6d88afa
[wpt PR 15343] - domparsing: Fix an issue that XMLSerializer generates new prefix for an attribute with an existing namespace, a=testonly

Comment 6

2 months ago
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2e35ac1f3c21
[wpt PR 15343] - domparsing: Fix an issue that XMLSerializer generates new prefix for an attribute with an existing namespace, a=testonly

Comment 7

2 months ago
bugherder
Status: NEW → RESOLVED
Last Resolved: 2 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.