Bug 133336 - Ignore usemap attributes without '#' in img element
Summary: Ignore usemap attributes without '#' in img element
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Jinwoo Song
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-05-27 21:30 PDT by Jinwoo Song
Modified: 2014-08-19 21:32 PDT (History)
5 users (show)

See Also:


Attachments
Patch (4.36 KB, patch)
2014-05-27 21:31 PDT, Jinwoo Song
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion (497.81 KB, application/zip)
2014-05-27 22:54 PDT, Build Bot
no flags Details
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion (498.80 KB, application/zip)
2014-05-27 23:57 PDT, Build Bot
no flags Details
Patch (4.31 KB, patch)
2014-05-28 00:03 PDT, Jinwoo Song
no flags Details | Formatted Diff | Diff
Patch (4.31 KB, patch)
2014-05-28 00:48 PDT, Jinwoo Song
no flags Details | Formatted Diff | Diff
Patch (5.52 KB, patch)
2014-06-01 23:22 PDT, Jinwoo Song
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Jinwoo Song 2014-05-27 21:30:03 PDT
HTML5 specification says we should ignore usemap attributes without #.
http://www.w3.org/TR/html5/infrastructure.html#valid-hash-name-reference
Comment 1 Jinwoo Song 2014-05-27 21:31:40 PDT
Created attachment 232166 [details]
Patch
Comment 2 Build Bot 2014-05-27 22:54:25 PDT
Comment on attachment 232166 [details]
Patch

Attachment 232166 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/5169700786929664

New failing tests:
fast/images/image-map-multiple-xhtml.xhtml
Comment 3 Build Bot 2014-05-27 22:54:28 PDT
Created attachment 232171 [details]
Archive of layout-test-results from webkit-ews-06 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-06  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 4 Build Bot 2014-05-27 23:56:59 PDT
Comment on attachment 232166 [details]
Patch

Attachment 232166 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/4660278742482944

New failing tests:
fast/images/image-map-multiple-xhtml.xhtml
Comment 5 Build Bot 2014-05-27 23:57:04 PDT
Created attachment 232174 [details]
Archive of layout-test-results from webkit-ews-05 for mac-mountainlion

The attached test failures were seen while running run-webkit-tests on the mac-ews.
Bot: webkit-ews-05  Port: mac-mountainlion  Platform: Mac OS X 10.8.5
Comment 6 Jinwoo Song 2014-05-28 00:03:13 PDT
Created attachment 232175 [details]
Patch
Comment 7 Jinwoo Song 2014-05-28 00:48:40 PDT
Created attachment 232176 [details]
Patch
Comment 8 Ryosuke Niwa 2014-05-28 18:25:01 PDT
Comment on attachment 232176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232176&action=review

> Source/WebCore/dom/TreeScope.cpp:210
> +    if (m_rootNode.document().isHTMLDocument() && hashPos == notFound)
> +        return nullptr;

What do other browsers do?  I'm very afraid that this is not a backwards compatible change.
Comment 9 Jinwoo Song 2014-05-28 18:33:11 PDT
Comment on attachment 232176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232176&action=review

>> Source/WebCore/dom/TreeScope.cpp:210
>> +        return nullptr;
> 
> What do other browsers do?  I'm very afraid that this is not a backwards compatible change.

FireFox and IE.10 does not support usemap attribute if it has not '#'. Blink works as WebKit as of now.
Comment 10 Darin Adler 2014-05-30 11:58:19 PDT
Comment on attachment 232176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232176&action=review

>>> Source/WebCore/dom/TreeScope.cpp:210
>>> +        return nullptr;
>> 
>> What do other browsers do?  I'm very afraid that this is not a backwards compatible change.
> 
> FireFox and IE.10 does not support usemap attribute if it has not '#'. Blink works as WebKit as of now.

Why specific to HTML documents? That part seems wrong to me.

> Source/WebCore/dom/TreeScope.cpp:211
>      String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();

If we’re exiting when hashPos is notFound, then we should be removing the ? : expression here.
Comment 11 Darin Adler 2014-05-30 11:59:14 PDT
Comment on attachment 232176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232176&action=review

>>>> Source/WebCore/dom/TreeScope.cpp:210
>>>> +        return nullptr;
>>> 
>>> What do other browsers do?  I'm very afraid that this is not a backwards compatible change.
>> 
>> FireFox and IE.10 does not support usemap attribute if it has not '#'. Blink works as WebKit as of now.
> 
> Why specific to HTML documents? That part seems wrong to me.

Given the many years of support for this in WebKit, it’s likely that some WebKit-specific content is accidentally depending on the old behavior. We’ll have to find some way of researching that question.
Comment 12 Jinwoo Song 2014-06-01 23:22:05 PDT
Created attachment 232368 [details]
Patch

Applied Darin's comments.
Comment 13 Jinwoo Song 2014-06-01 23:24:33 PDT
Comment on attachment 232176 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=232176&action=review

>> Source/WebCore/dom/TreeScope.cpp:211
>>      String name = (hashPos == notFound ? url : url.substring(hashPos + 1)).impl();
> 
> If we’re exiting when hashPos is notFound, then we should be removing the ? : expression here.

I also agree that we need a way to handle this kind of issues. Specially, if there it is impossible to provide the legacy behavior like this, how can we apply the latest spec to the implementation?
Comment 14 Ryosuke Niwa 2014-08-19 04:13:54 PDT
r=me if we believe websites don't rely on this feature.
Comment 15 WebKit Commit Bot 2014-08-19 21:32:27 PDT
Comment on attachment 232368 [details]
Patch

Clearing flags on attachment: 232368

Committed r172796: <http://trac.webkit.org/changeset/172796>
Comment 16 WebKit Commit Bot 2014-08-19 21:32:32 PDT
All reviewed patches have been landed.  Closing bug.