messageEvent.source can also be a ServiceWorker:
Created attachment 324933 [details]
Comment on attachment 324933 [details]
View in context: https://bugs.webkit.org/attachment.cgi?id=324933&action=review
> -using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>>;
> +using MessageEventSource = Variant<RefPtr<DOMWindow>, RefPtr<MessagePort>
> +#if ENABLE(SERVICE_WORKER)
> + , RefPtr<ServiceWorker>
> + >;
This is gross. I'd almost prefer a single line duplicating all 3 possibilities for the #if ENABLE() case.
> +#if defined(ENABLE_SERVICE_WORKER) && ENABLE_SERVICE_WORKER
> +typedef (DOMWindow or MessagePort or ServiceWorker) MessageEventSource;
> +typedef (DOMWindow or MessagePort) MessageEventSource;
Like this is what I was alluding to up there ^^^
Created attachment 324944 [details]
Comment on attachment 324944 [details]
Clearing flags on attachment: 324944
Committed r224000: <https://trac.webkit.org/changeset/224000>
All reviewed patches have been landed. Closing bug.
:(. 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.