Closed Bug 1528721 Opened 1 year ago Closed 1 year ago

[wpt-sync] Sync PR 15403 - XMLSerializer: Support element prefix rewriting.

Categories

(Core :: DOM: Core & HTML, enhancement, P4)

enhancement

Tracking

()

RESOLVED FIXED
mozilla67
Tracking Status
firefox67 --- fixed

People

(Reporter: wptsync, Unassigned)

References

()

Details

(Whiteboard: [wptsync downstream])

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

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

Kent Tamura <tkent@chromium.org> wrote:

XMLSerializer: Support element prefix rewriting.

We need to change the prefix of an element if:

  • The element's namespace is same as the inherited default namespace,
    and the element prefix is not empty,
  • The prefix-namespace pair of an element is not declared, and there
    is another prefix associated to the namespace, or
  • The namespace of an element is not associated to any prefixes, and
    the element's prefix is declared for another namespace in the
    element.

This CL implements Step 11, 12.1 to 12.5 of [1].

  • Add capability to serialize prefix which is not element.prefix()
    to MarkupFormatter

  • MarkupAccumulator::AppendElement() returns a serialized prefix,
    and AppendEndTag() takes it as an argument.

  • MarkupAccumulator::AppendStartTagOpen() implements the steps, and
    returns a serialized prefix as well as 'ignore namespace
    definition attribute' flag.

  • MarkupAccumulator::RetrievePreferredPrefixString():
    Remove the code for empty prefix for elements. Empty prefix is
    handled in the callsite.

  • MarkupAccumulator::ShouldAddNamespaceElement(): Removed. It's not
    used any longer.

  • dom/domparsing/xmlserializer-xml-namespace-expected.txt:
    The new behavior is expected. We successfully find 'xml' prefix.

[1] https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node

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

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

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 start tag serialization applied the original prefix even if it is declared in an ancestor element.: FAIL
    Check if start tag serialization drops element prefix if the namespace is same as inherited default namespace.: FAIL
    Check if start tag serialization takes into account of its xmlns:* attributes: 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/165c390054b2
[wpt PR 15403] - XMLSerializer: Support element prefix rewriting., a=testonly
Pushed by james@hoppipolla.co.uk:
https://hg.mozilla.org/integration/mozilla-inbound/rev/d1afd891ac34
[wpt PR 15403] - XMLSerializer: Support element prefix rewriting., a=testonly
Status: NEW → RESOLVED
Closed: 1 year ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla67
You need to log in before you can comment on or make changes to this bug.