[wpt-sync] Sync PR 15389 - XMLSerializer should drop xmlns="..." in some cases

RESOLVED FIXED in Firefox 67

Status

()

enhancement
P4
normal
RESOLVED FIXED
5 months ago
4 months ago

People

(Reporter: wptsync, Unassigned)

Tracking

unspecified
mozilla67
Points:
---

Firefox Tracking Flags

(firefox67 fixed)

Details

(Whiteboard: [wptsync downstream], )

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

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

Kent Tamura <tkent@chromium.org> wrote:

XMLSerializer should drop xmlns="..." in some cases

If an element has no prefix and its namespace is different from
the current default namespace, the element needs to add
xmlns="\<elements-namesapce-uri>". In such case, we need to drop
existing xmlns="\<other-uri>" and need to take care of existing
xmlns="\<elements-namespace-uri>".

Implementation:
Follow the specification in the following points:

  • Stop registering default namespace to prefix-namespace /
    namespace-prefixes maps.
  • The default namespace is tracked by NamespaceContext::
    context_namespace_.
  • 'local default namespace' is computed in 'recording the namespace
    information' algorithm.
  • NamespaceContext::Add(): Make sure arguments are not empty.
  • Move MarkupAccumulator::RecordNamespacInformation to NamespaceContext,
    and update the default namespace handling.
  • AppendElement() respects to 'ignore namespace definition attribute' flag.
  • Implement some parts of the specification to
  • keep track the default namespace
  • return correct 'ignore namespace definition attribute' value
  • add an appropriate xmlns="..."

Bug: 929035
Change-Id: Id5f0090d5dc08334c202e6ef9b107f1645fb3120
Reviewed-on: https://chromium-review.googlesource.com/c/1471671
Commit-Queue: Kent Tamura \<tkent@chromium.org>
Auto-Submit: Kent Tamura \<tkent@chromium.org>
Reviewed-by: Yoshifumi Inoue \<yosin@chromium.org>
Cr-Commit-Position: refs/heads/master@{#632142}

PR 15389 applied with additional changes from upstream: d2c49d8610185244a31e04ef32aae70da0dd35f7, c815526cd9d6fe1039b3736b06b05c348cdd64d8, 265330b7d26194cb60157a18ac399127d21f6b99, 2647e1e8f6995d12f44edbf0b4fce752e5cb7ec5, 6fb30bc55bf721c87d2ff32640deefc1b01061ab
Component: web-platform-tests → DOM
Product: Testing → Core
Ran 1 tests and 15 subtests
OK     : 1
PASS   : 6
FAIL   : 9

New tests that have failures or other problems:
/domparsing/XMLSerializer-serializeToString.html
    Check if "ns1" is generated even if the element already has xmlns:ns1.: FAIL
    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 attribute serialization takes into account of following xmlns:* attributes: FAIL
    Check if attribute serialization takes into account of the same prefix declared in an ancestor element: FAIL
    Check if generated prefixes match to "ns${index}".: FAIL
    Check if inconsistent xmlns="..." is dropped.: FAIL
    Check if no special handling for XLink namespace unlike HTML serializer.: 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
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/7f5ce8587ad9
[wpt PR 15389] - XMLSerializer should drop xmlns="..." in some cases, a=testonly
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/db38aa6ecb16
[wpt PR 15389] - XMLSerializer should drop xmlns="..." in some cases, a=testonly
Status: NEW → RESOLVED
Closed: 4 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.