RESOLVED FIXED 121390
Set MessageEvent.source to the newly created port for shared workers' connect events
https://bugs.webkit.org/show_bug.cgi?id=121390
Summary Set MessageEvent.source to the newly created port for shared workers' connect...
Chris Dumez
Reported 2013-09-15 07:15:20 PDT
Consider merging the following patch from Blink: """ Set MessageEvent.source to the newly created port for shared workers' connect events instead of previously null, as per the latest specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/comms.html#dom-messageevent-source http://www.whatwg.org/specs/web-apps/current-work/multipage/workers.html#dom-sharedworker """ Blink revisions: https://src.chromium.org/viewvc/blink?revision=156385&view=revision https://src.chromium.org/viewvc/blink?revision=156420&view=revision
Attachments
Patch (17.11 KB, patch)
2013-09-15 08:02 PDT, Chris Dumez
no flags
Patch (19.80 KB, patch)
2013-09-17 00:56 PDT, Chris Dumez
no flags
Chris Dumez
Comment 1 2013-09-15 08:02:25 PDT
Darin Adler
Comment 2 2013-09-16 09:38:29 PDT
Comment on attachment 211708 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=211708&action=review > Source/WebCore/dom/EventTarget.h:114 > + virtual MessagePort* toMessagePort(); Given that the only client uses this as "isMessagePort", maybe we should add that instead? > Source/WebCore/dom/MessageEvent.h:59 > + static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, const ScriptValue& data = ScriptValue(), const String& origin = "", const String& lastEventId = "", PassRefPtr<EventTarget> source = 0) I think the default values should be emptyString() instead of "", although not 100% sure that compiles. Null strings would be even more efficient, but that might require a look at the body of the constructor to see if that will change behavior. > Source/WebCore/dom/MessageEvent.h:63 > + static PassRefPtr<MessageEvent> create(PassOwnPtr<MessagePortArray> ports, PassRefPtr<SerializedScriptValue> data, const String& origin = "", const String& lastEventId = "", PassRefPtr<EventTarget> source = 0) Ditto. > Source/WebCore/dom/MessagePort.h:78 > + MessagePort* toMessagePort() OVERRIDE { return this; } Should mark either this class or this function as FINAL. SHould make this function private as there is no reason to call it on a MessagePort object. > Source/WebCore/workers/SharedWorkerGlobalScope.cpp:49 > + RefPtr<MessagePort> sourcePort = port; Naming here is unclear. Both sourcePort and port sound fine to use. That’s why we normally use the crazy “prp” naming scheme, so it won’t be ambiguous which one to use. > Source/WebCore/workers/SharedWorkerGlobalScope.cpp:50 > + RefPtr<MessageEvent> event = MessageEvent::create(adoptPtr(new MessagePortArray(1, sourcePort)), ScriptValue(), "", "", sourcePort); Should use emptyString() instead of "". No question at a call site like this one.
Chris Dumez
Comment 3 2013-09-17 00:56:43 PDT
Chris Dumez
Comment 4 2013-09-17 00:58:23 PDT
I took all the feedback into consideration. I am requesting review again due to some non-trivial changes (using null Strings instead of empty ones in MessageEvent).
WebKit Commit Bot
Comment 5 2013-09-17 08:24:29 PDT
Comment on attachment 211870 [details] Patch Clearing flags on attachment: 211870 Committed r155959: <http://trac.webkit.org/changeset/155959>
WebKit Commit Bot
Comment 6 2013-09-17 08:24:32 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.