Bug 98025 - [Microdata] itemprop names must not override builtin properties
Summary: [Microdata] itemprop names must not override builtin properties
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Arko Saha
URL:
Keywords:
Depends on:
Blocks: 92986
  Show dependency treegraph
 
Reported: 2012-10-01 06:28 PDT by Arko Saha
Modified: 2012-10-02 23:28 PDT (History)
5 users (show)

See Also:


Attachments
Patch (5.24 KB, patch)
2012-10-01 06:36 PDT, Arko Saha
haraken: review+
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Arko Saha 2012-10-01 06:28:43 PDT
HTMLPropertiesCollection[propertyName] must not return PropertyNodeList if 'propertyName' is a method of HTMLPropertiesCollection interface.

Sample test:

test(function () {
	var testEl = makeEl('div',{itemscope:'itemscope', id:'outerDiv'});
	var item = testEl.properties.item;
	testEl.innerHTML = '<div itemprop="item" id="innerDiv"></div>';
	assert_equals( testEl.properties['item'], item, 'item' );
}, 'itemprop names must not override builtin properties');

Expected: testEl.properties['item'] should not return PropertyNodeList (NodeList contains innerDiv) because 'item' is a method of HTMLPropertiesCollection interface.

It should return -

function item() {
    [native code]
}

Actual: Returns "[object PropertyNodeList]"
Comment 1 Arko Saha 2012-10-01 06:36:43 PDT
Created attachment 166464 [details]
Patch
Comment 2 Kentaro Hara 2012-10-01 06:47:23 PDT
Comment on attachment 166464 [details]
Patch

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

Looks good.

> Source/WebCore/ChangeLog:10
> +        We should look in the prototype for functions before assuming it as
> +        an item's name. Return false if the prototype of the object has a
> +        property (function) with propertyName.

Would you add a spec link to the ChangeLog? (I'm sure this change would be correct, but I'd like to verify it in the spec just in case.)
Comment 3 Arko Saha 2012-10-01 07:39:23 PDT
(In reply to comment #2)
> Would you add a spec link to the ChangeLog? (I'm sure this change would be correct, but I'd like to verify it in the spec just in case.)

Named properties spec is defined http://dev.w3.org/2006/webapi/WebIDL/#idl-named-properties
According to named property visibility algorithm http://dev.w3.org/2006/webapi/WebIDL/#indexed-and-named-properties
...
7. If the result of calling the [[HasProperty]] internal method on prototype with property name P is true, then return false.
...

Also [OverrideBuiltins] is not declared for any of the properties, hence no overriding is allowed in this case.
Comment 4 Kentaro Hara 2012-10-01 08:12:24 PDT
Comment on attachment 166464 [details]
Patch

Thanks for the clarification!
Comment 5 Arko Saha 2012-10-02 23:28:45 PDT
Committed r130255: <http://trac.webkit.org/changeset/130255>