Bug 162311 - Object.getOwnPropertyDescriptor() does not work correctly cross origin
Summary: Object.getOwnPropertyDescriptor() does not work correctly cross origin
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: DOM (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL:
Keywords: WebExposed
Depends on: 162536
Blocks: 162328
  Show dependency treegraph
 
Reported: 2016-09-20 11:39 PDT by Chris Dumez
Modified: 2016-09-24 23:04 PDT (History)
8 users (show)

See Also:


Attachments
Patch (23.71 KB, patch)
2016-09-20 14:37 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Dumez 2016-09-20 11:39:13 PDT
Object.getOwnPropertyDescriptor() does not work correctly cross origin. In particular:
- We return value descriptors for attributes instead of getter/setter descriptors
- attributes / operations are wrongly marked as non-configurable

Corresponding specification:
- https://html.spec.whatwg.org/#crossoriginproperties-(-o-)
- https://html.spec.whatwg.org/#crossorigingetownpropertyhelper-(-o,-p-)

W3C test:
http://w3c-test.org/html/browsers/origin/cross-origin-objects/cross-origin-objects.html
Comment 1 Chris Dumez 2016-09-20 14:37:37 PDT
Created attachment 289398 [details]
Patch
Comment 2 Chris Dumez 2016-09-20 16:01:57 PDT
Comment on attachment 289398 [details]
Patch

Geoff, would you mind taking a look?
Comment 3 Chris Dumez 2016-09-20 18:52:27 PDT
Comment on attachment 289398 [details]
Patch

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

> LayoutTests/imported/w3c/web-platform-tests/html/browsers/origin/cross-origin-objects/cross-origin-objects-expected.txt:14
> +FAIL [[Enumerate]] should return an empty iterator assert_unreached: Shouldn't have been able to enumerate href on cross-origin Location Reached unreachable code

I filed Bug 162328 for this remaining failure.
Comment 4 WebKit Commit Bot 2016-09-21 11:25:48 PDT
Comment on attachment 289398 [details]
Patch

Clearing flags on attachment: 289398

Committed r206221: <http://trac.webkit.org/changeset/206221>
Comment 5 WebKit Commit Bot 2016-09-21 11:25:55 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Chris Dumez 2016-09-21 13:08:48 PDT
Comment on attachment 289398 [details]
Patch

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

> Source/WebCore/bindings/js/JSLocationCustom.cpp:60
> +    // Getting location.href cross origin needs to throw. However, getOwnPropertyDescriptor() needs to return

I filed https://github.com/whatwg/html/issues/1807 so that this behavior gets clarified at specification level.