RESOLVED WONTFIX Bug 163189
MessageEvent.ports should be nullable
https://bugs.webkit.org/show_bug.cgi?id=163189
Summary MessageEvent.ports should be nullable
Chris Dumez
Reported 2016-10-09 17:39:54 PDT
MessageEvent.ports should be nullable: - https://html.spec.whatwg.org/multipage/comms.html#the-messageevent-interfaces Firefox and Chrome agree with the specification.
Attachments
Patch (27.99 KB, patch)
2016-10-09 21:45 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2016-10-09 21:45:05 PDT
Sam Weinig
Comment 2 2016-10-09 22:20:52 PDT
Comment on attachment 291059 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=291059&action=review > Source/WebCore/dom/MessageEvent.h:44 > + std::unique_ptr<MessagePortArray> ports; Can this be Optional<MessagePortArray> instead? Do you have any memory of why this is a unique_ptr in MessageEvent itself? (Doesn't seem like the overhead of an empty Vector would worth it for a transient event).
Chris Dumez
Comment 3 2016-10-09 22:31:14 PDT
(In reply to comment #2) > Comment on attachment 291059 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=291059&action=review > > > Source/WebCore/dom/MessageEvent.h:44 > > + std::unique_ptr<MessagePortArray> ports; > > Can this be Optional<MessagePortArray> instead? Do you have any memory of > why this is a unique_ptr in MessageEvent itself? (Doesn't seem like the > overhead of an empty Vector would worth it for a transient event). I do not know why the implementation is using unique_ptr<>. I guess it is possible we did not have Optional<> at the time. Anyway, I'll look into using Optional<> tomorrow. Hopefully this is not too much refactoring.
Darin Adler
Comment 4 2016-10-09 23:06:14 PDT
Comment on attachment 291059 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=291059&action=review > Source/WebCore/bindings/js/JSMessageEventCustom.cpp:79 > if (RefPtr<SerializedScriptValue> serializedValue = event.dataAsSerializedScriptValue()) { Should use auto. > Source/WebCore/bindings/scripts/CodeGeneratorJS.pm:5442 > + Ref<${interfaceName}> event = ${interfaceName}::createForBindings(eventType, WTFMove(eventInit)); Should use auto.
Chris Dumez
Comment 5 2016-10-10 09:39:17 PDT
I filed a bug against the spec to see if it would be possible to make the attribute non-nullable in the specification instead: - https://github.com/whatwg/html/issues/1882 Making this attribute nullable is not really useful (except for aligning with other browsers).
Chris Dumez
Comment 6 2016-10-10 15:33:32 PDT
Note You need to log in before you can comment on or make changes to this bug.