RESOLVED FIXED 153925
Object.getOwnPropertyDescriptor() does not work on sub-frame's window
https://bugs.webkit.org/show_bug.cgi?id=153925
Summary Object.getOwnPropertyDescriptor() does not work on sub-frame's window
Chris Dumez
Reported 2016-02-05 12:37:35 PST
Object.getOwnPropertyDescriptor() does not work on sub-frame's windows, it returns undefined in WebKit but works as expected in Firefox and Chrome.
Attachments
Patch (5.92 KB, patch)
2016-02-05 15:29 PST, Chris Dumez
no flags
Archive of layout-test-results from ews102 for mac-yosemite (758.87 KB, application/zip)
2016-02-05 16:15 PST, Build Bot
no flags
Patch (36.60 KB, patch)
2016-02-05 16:16 PST, Chris Dumez
no flags
Patch (42.11 KB, patch)
2016-02-05 19:25 PST, Chris Dumez
darin: review+
Chris Dumez
Comment 1 2016-02-05 15:29:19 PST
Build Bot
Comment 2 2016-02-05 16:15:08 PST
Comment on attachment 270776 [details] Patch Attachment 270776 [details] did not pass mac-ews (mac): Output: http://webkit-queues.webkit.org/results/788171 New failing tests: http/tests/security/cross-frame-access-getOwnPropertyDescriptor.html
Build Bot
Comment 3 2016-02-05 16:15:13 PST
Created attachment 270779 [details] Archive of layout-test-results from ews102 for mac-yosemite The attached test failures were seen while running run-webkit-tests on the mac-ews. Bot: ews102 Port: mac-yosemite Platform: Mac OS X 10.10.5
Chris Dumez
Comment 4 2016-02-05 16:16:57 PST
Chris Dumez
Comment 5 2016-02-05 19:25:41 PST
Chris Dumez
Comment 6 2016-02-05 19:30:05 PST
Comment on attachment 270787 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=270787&action=review > LayoutTests/http/tests/security/cross-origin-window-property-access-expected.txt:11 > PASS Object.getOwnPropertyDescriptor(window, "document").get.call(crossOriginWindow) threw exception TypeError: undefined is not an object (evaluating 'Object.getOwnPropertyDescriptor(window, "document").get.call'). This one throws instead of returning undefined and logging a console message. This is because Object.getOwnPropertyDescriptor(window, "document") currently returns a 'value' descriptor instead of a getter/setter one (which does not match the spec or Firefox). > LayoutTests/http/tests/security/cross-origin-window-property-access.html:30 > + shouldThrowOrReturnUndefined('Object.getOwnPropertyDescriptor(window, "name").get.call(crossOriginWindow)'); Following Gavin's suggestion, I added more cross-origin getter tests to make sure we don't bypass origin checks.
Darin Adler
Comment 7 2016-02-06 08:25:46 PST
Comment on attachment 270787 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=270787&action=review > Source/JavaScriptCore/runtime/JSObject.cpp:2586 > /* Workaround, JSDOMWindow::getOwnPropertySlot searches the prototype chain. :-( */ Since you are touching this, I suggest modernizing this comment too. I don’t think it’s clear at all. And it’s a /* */ comment too!
Chris Dumez
Comment 8 2016-02-06 10:12:21 PST
Note You need to log in before you can comment on or make changes to this bug.