[ServiceWorker] Report bad message on receiving Client#{*} calls from a cross-origin client
All JavaScript Client objects seen in a service worker execution context must be matching origin with the service worker (See the bellowing explanation in details), so, if the browser-side received a Client#{postMessage,focus,navigate} call from a cross-origin Client object, it should be treated as a bad message. A detailed explanation: Once a JavaScript Client object has been gotten by the ServiceWorkerGlobalScope (via ServiceWorkerGlobalScope#{Clients,Client} APIs), the corresponding window client navigation (including page redirects) must have already completed and its origin should be matching with the service worker. And, for a window client, once the initial navigation done, its document url won't be changed any more, so its origin should keep matching with the service worker through its lifetime. Even in case that the window starts to navigate to another url, a new ServiceWorkerProviderHost with a new client uuid will be created for that, without any changes to document url of the original ServiceWorkerProviderHost. As above, we're sure a Client#{*} request received in browser-side must be for a client matching origin with the sender service worker. BUG=772793 Change-Id: I821c8cced03288596988d583637157e8f1839b2b Reviewed-on: https://chromium-review.googlesource.com/956111 Commit-Queue: Han Leon <leon.han@intel.com> Reviewed-by:Kinuko Yasuda <kinuko@chromium.org> Reviewed-by:
Makoto Shimazu <shimazu@chromium.org> Reviewed-by:
Matt Falkenhagen <falken@chromium.org> Cr-Commit-Position: refs/heads/master@{#542750}
Showing
Please register or sign in to comment