Bug 178839 - messageEvent.source can also be a ServiceWorker
Summary: messageEvent.source can also be a ServiceWorker
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Chris Dumez
URL: https://html.spec.whatwg.org/multipag...
Keywords: InRadar
Depends on:
Blocks: 178794
  Show dependency treegraph
Reported: 2017-10-25 17:46 PDT by Chris Dumez
Modified: 2017-11-15 12:44 PST (History)
14 users (show)

See Also:

Patch (4.80 KB, patch)
2017-10-25 18:13 PDT, Chris Dumez
no flags Details | Formatted Diff | Diff
Patch (4.79 KB, patch)
2017-10-25 19:35 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 2017-10-25 17:46:35 PDT
messageEvent.source can also be a ServiceWorker:
- https://html.spec.whatwg.org/multipage/comms.html#messageeventsource
Comment 1 Chris Dumez 2017-10-25 18:13:11 PDT
Created attachment 324933 [details]
Comment 2 Brady Eidson 2017-10-25 19:21:57 PDT
Comment on attachment 324933 [details]

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

> Source/WebCore/dom/MessageEvent.h:46
> -using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>;
> +using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>
> +    , RefPtr<ServiceWorker>
> +#endif
> +    >;

This is gross. I'd almost prefer a single line duplicating all 3 possibilities for the #if ENABLE() case.

> Source/WebCore/dom/MessageEvent.idl:33
> +typedef (DOMWindow or MessagePort or ServiceWorker) MessageEventSource;
> +#else
> +typedef (DOMWindow or MessagePort) MessageEventSource;
> +#endif

Like this is what I was alluding to up there ^^^
Comment 3 Chris Dumez 2017-10-25 19:35:39 PDT
Created attachment 324944 [details]
Comment 4 WebKit Commit Bot 2017-10-25 19:57:11 PDT
Comment on attachment 324944 [details]

Clearing flags on attachment: 324944

Committed r224000: <https://trac.webkit.org/changeset/224000>
Comment 5 WebKit Commit Bot 2017-10-25 19:57:13 PDT
All reviewed patches have been landed.  Closing bug.
Comment 6 Sam Weinig 2017-10-25 20:02:50 PDT
:(. I was getting so close to getting rid of the preprocessor for IDL files. 

Would an alternative approach, where in non-ENABLE(SERVICE_WORKER) we have a dummy ServiceWorker class work in this case (I am considering this for the non-ENABLE(VIDEO) case). Without a way to get a ServiceWorker from script, the fact that it is included in the union should not be observable.
Comment 7 Radar WebKit Bug Importer 2017-11-15 12:44:49 PST