Just to take an inventory of the scope here, there are
7 postMessage APIs, 5 defined in HTML and 2 in Service Workers.
I believe that the interop risk here the main consideration, i.e. the risk that not all browser engines will come along for the ride. Dave, you linked to some discussion on
https://github.com/whatwg/html/issues/3799, have you tried to seek feedback directly also? Although this whole change makes sense to me, postMessage is a pretty fundamental API, so extra prodding is warranted IMHO.
I see that the tentative tests are already merged, yay:
(We have issues with
timeouts in Edge.) I see that broken-origin.tentative.html is now actually failing in Chrome Dev, where it was passing before. Can you look into that? In either case, thank you for sharing your comprehensive tests early!
Aside about compat and fowards compat:
This is indeed structurally similar to
EventListenerOptions and
EventListenerOptions.passive, where an optional boolean became an optional (boolean or dictionary). There, the compat concern was whether existing content might already pass an object as the argument and depend on it evaluating to true, and there was also a "forwards compat" concern where new content using the feature would start breaking unnecessarily badly in browsers which didn't yet support it.
However, when you look at the details, the cases are quite different. The compat risk isn't high, because the suggested feature detect depends on postMessage(something, {}) throwing an exception before this change, so any such code out there is currently broken. It's possible that the site works anyway and that not throwing an exception will cause something to really break, but it's unlikely, and adding use counters couldn't tell if the change is good or bad, so let's just look out for regressions. Forward compat isn't much of a concern for similar reasons.