Bug 117764 - Serializer doesn't handling inconsistent prefixes properly
Summary: Serializer doesn't handling inconsistent prefixes properly
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: XML (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-06-18 17:10 PDT by Alex Milowski
Modified: 2013-08-29 06:49 PDT (History)
2 users (show)

See Also:


Attachments
An example of inconsistent handling of namespaces for attributes (989 bytes, application/xhtml+xml)
2013-06-19 11:11 PDT, Alex Milowski
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Milowski 2013-06-18 17:10:28 PDT
When constructing an XML document programmatically, the namespaces in use and prefixes may be inconsistent.  For example, the results of merging cloned nodes from different sources may end up with conflicting prefix to namespace mappings.  These conflicts must be detected and the prefixes adjusted.

The current implementation allows multiple namespace attributes for the same prefix which results in an XML parsing error for any receiving application.
Comment 1 Alexey Proskuryakov 2013-06-19 10:33:15 PDT
Could you please attach a test case fixing which would be the purpose of this bug? We have quite a few bugs about namespace serialization already, and it's difficult to track them without explicitly distinct test cases.
Comment 2 Alex Milowski 2013-06-19 11:11:09 PDT
Created attachment 205019 [details]
An example of inconsistent handling of namespaces for attributes

Here is the missing attachment that I thought I filed with the original bug.

The test does:

1.  Creates two attributes with different namespaces but the same prefix.

2. Redefined a common prefix (xlink).

The outcome right now is:

1. The "p" prefix is declared twice with to different namespace URIs.

2. A extra xmlns:xlink attribute that maps the the XLink namespace URI is added.

Of course, that won't parser properly on the way back in.
Comment 3 Rob Buis 2013-07-01 18:49:50 PDT
Bug 19121 has a patch up that fixes this bug too. I incorporated the testcase in it.
Comment 4 Rob Buis 2013-08-29 06:49:43 PDT
Committed r154779: <http://trac.webkit.org/changeset/154779>.