RESOLVED FIXED Bug 160354
Window's named properties should be exposed on a WindowProperties object in its prototype
https://bugs.webkit.org/show_bug.cgi?id=160354
Summary Window's named properties should be exposed on a WindowProperties object in i...
Chris Dumez
Reported 2016-07-29 12:56:46 PDT
Window's named properties should be exposed on a WindowProperties object in its prototype: - http://heycam.github.io/webidl/#named-properties-object Firefox and Chrome both comply with the specification. However, in WebKit, there is no "WindowProperties" object in the Window prototype chain and the named properties are exposed on the Window object itself.
Attachments
WIP Patch (24.16 KB, patch)
2016-07-29 13:00 PDT, Chris Dumez
no flags
Patch (30.23 KB, patch)
2016-07-29 13:44 PDT, Chris Dumez
no flags
Patch (31.07 KB, patch)
2016-07-29 16:47 PDT, Chris Dumez
no flags
Patch (31.08 KB, patch)
2016-08-05 10:24 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-07-29 13:00:49 PDT
Created attachment 284892 [details] WIP Patch
Chris Dumez
Comment 2 2016-07-29 13:44:01 PDT
Gavin Barraclough
Comment 3 2016-07-29 15:42:56 PDT
Comment on attachment 284897 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284897&action=review r- for index getter precedence. > Source/WebCore/bindings/js/JSDOMWindowProperties.cpp:41 > +static bool jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter(JSDOMWindowProperties* thisObject, Frame& frame, ExecState* exec, PropertyName propertyName, PropertySlot& slot) Given comments below, you may just be able to fold this in to getOwnPropertySlot. > Source/WebCore/bindings/js/JSDOMWindowProperties.cpp:87 > + if (thisObject->classInfo() == info() && frame) I think the info part of this check is redundant – isn't think checking the same thing as ASSERT_GC_OBJECT_INHERITS above? > Source/WebCore/bindings/js/JSDOMWindowProperties.cpp:99 > + if (thisObject->classInfo() == info() && frame) Ditto – info check appears to be redundant. > Source/WebCore/bindings/js/JSDOMWindowProperties.cpp:100 > + return jsDOMWindowPropertiesGetOwnPropertySlotNamedItemGetter(thisObject, *frame, state, propertyName, slot); getOwnPropertySlotByIndex should be the same as getOwnPropertySlot - own properties should take precedence, then you should check for presence on the prototype before allowing named getters. I'd probably just make getOwnPropertySlotByIndex call getOwnPropertySlot. > LayoutTests/fast/dom/Window/es52-globals-expected.txt:5 > +FAIL window.hasOwnProperty("div") should be true. Was false. Maybe should keep these but also add checks for window.__proto__.__proto.hasOwnProperty("f") (I think it's the proto-proto its' now on?) [ Or more standardsy: Object.getPrototypeOf(Object.getPrototypeOf(window)).hasOwnProperty("f") ]
Chris Dumez
Comment 4 2016-07-29 16:47:21 PDT
Chris Dumez
Comment 5 2016-07-29 18:09:59 PDT
Comment on attachment 284917 [details] Patch Clearing flags on attachment: 284917 Committed r203935: <http://trac.webkit.org/changeset/203935>
Chris Dumez
Comment 6 2016-07-29 18:10:04 PDT
All reviewed patches have been landed. Closing bug.
WebKit Commit Bot
Comment 7 2016-08-05 04:19:53 PDT
Re-opened since this is blocked by bug 160596
Chris Dumez
Comment 8 2016-08-05 08:43:17 PDT
Comment on attachment 284917 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=284917&action=review > Source/WebCore/bindings/js/JSDOMWindowProperties.h:61 > + Ref<DOMWindow> m_window; Assuming the memory regression is real, I suspect the Ref'ing of the DOMWindow here is a bad thing. I don't think we really need it either. We can probably just get the window from the JSGlobalObject when needed.
Chris Dumez
Comment 9 2016-08-05 10:24:15 PDT
Chris Dumez
Comment 10 2016-08-05 10:25:17 PDT
Comment on attachment 285429 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=285429&action=review > Source/WebCore/bindings/js/JSDOMWindowProperties.cpp:87 > + auto& window = jsCast<JSDOMWindowBase*>(thisObject->globalObject())->wrapped(); I got rid of the m_window data member (which was a string Ref to DOMWindow) and access the Window via the global object now.
Chris Dumez
Comment 11 2016-08-05 11:37:44 PDT
Comment on attachment 285429 [details] Patch Clearing flags on attachment: 285429 Committed r204179: <http://trac.webkit.org/changeset/204179>
Chris Dumez
Comment 12 2016-08-05 11:37:50 PDT
All reviewed patches have been landed. Closing bug.
Note You need to log in before you can comment on or make changes to this bug.