Bug 98907 - Document calls createElement with the wrong parameters.
Summary: Document calls createElement with the wrong parameters.
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Mike West
URL:
Keywords:
Depends on:
Blocks: 98050
  Show dependency treegraph
 
Reported: 2012-10-10 08:01 PDT by Mike West
Modified: 2012-10-10 21:56 PDT (History)
4 users (show)

See Also:


Attachments
Patch (1.70 KB, patch)
2012-10-10 08:06 PDT, Mike West
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mike West 2012-10-10 08:01:49 PDT
Document calls createElement with the wrong parameters.
Comment 1 Mike West 2012-10-10 08:06:25 PDT
Created attachment 167998 [details]
Patch
Comment 2 Mike West 2012-10-10 08:10:58 PDT
This isn't so trivial as the others I've seen today.

Document::importNode calls Document::createElement with a QualifiedName and ExceptionCode. The Document::createElement that takes a QualifiedName doesn't generate an exception; the second argument is a bool, which the ExceptionCode autocasts into.

There is, however, a Document::createElement that takes an AtomicString and an Exception code. I wonder if that was the original intent. CCing Kent Tamura, who looks like he wrote that code in the first place.

Hi Kent! Would you mind taking a look at this?
Comment 3 jochen 2012-10-10 08:21:23 PDT
(In reply to comment #2)
> This isn't so trivial as the others I've seen today.
> 
> Document::importNode calls Document::createElement with a QualifiedName and ExceptionCode. The Document::createElement that takes a QualifiedName doesn't generate an exception; the second argument is a bool, which the ExceptionCode autocasts into.
> 
> There is, however, a Document::createElement that takes an AtomicString and an Exception code. I wonder if that was the original intent. CCing Kent Tamura, who looks like he wrote that code in the first place.
> 
> Hi Kent! Would you mind taking a look at this?

I could imagine that you'd need to invoke the version that actually takes a ec: if the document is an xml doc, a different type of element needs to be created.
Comment 4 Mike West 2012-10-10 08:27:21 PDT
(In reply to comment #3)
> (In reply to comment #2)
> > This isn't so trivial as the others I've seen today.
> > 
> > Document::importNode calls Document::createElement with a QualifiedName and ExceptionCode. The Document::createElement that takes a QualifiedName doesn't generate an exception; the second argument is a bool, which the ExceptionCode autocasts into.
> > 
> > There is, however, a Document::createElement that takes an AtomicString and an Exception code. I wonder if that was the original intent. CCing Kent Tamura, who looks like he wrote that code in the first place.
> > 
> > Hi Kent! Would you mind taking a look at this?
> 
> I could imagine that you'd need to invoke the version that actually takes a ec: if the document is an xml doc, a different type of element needs to be created.

So we likely need 'oldElement->localName()' instead of 'oldElement->tagQName()'?
Comment 5 Kent Tamura 2012-10-10 17:55:32 PDT
The purpose of http://trac.webkit.org/changeset/104275 was to use createElement with QualifiedName argument. So the patch is correct.
Comment 6 Kent Tamura 2012-10-10 17:55:45 PDT
Comment on attachment 167998 [details]
Patch

ok
Comment 7 Mike West 2012-10-10 21:38:26 PDT
Comment on attachment 167998 [details]
Patch

Alright, thanks for taking a look! Throwing this into the queue.
Comment 8 WebKit Review Bot 2012-10-10 21:56:52 PDT
Comment on attachment 167998 [details]
Patch

Clearing flags on attachment: 167998

Committed r131015: <http://trac.webkit.org/changeset/131015>
Comment 9 WebKit Review Bot 2012-10-10 21:56:55 PDT
All reviewed patches have been landed.  Closing bug.