- From: James Yang <notifications@github.com>
- Date: Tue, 05 Jun 2018 01:32:01 -0700
- To: w3c/ServiceWorker <ServiceWorker@noreply.github.com>
- Cc: Subscribed <subscribed@noreply.github.com>
Received on Tuesday, 5 June 2018 08:32:25 UTC
I've facing a problem that cannot be resolved with current spec, that is determine whether nested frame/iframe have same parent client. Demo: https://sw-iframe-rowdnkvoih.now.sh Source: https://gist.github.com/futurist/cb1f5d1ff08df503d36a56a12171e5d1 In this demo, nested iframe want to find the parent `pub.html` to get message and display the exact same message with it's parent `pub.html`, but how to distinguish which `pub.html` iframe is the right parent? The core part is ```js self.clients.matchAll().then(clientList=>{ const client = clientList.find(c=>c.url.endsWith('pub.html')) client.postMessage('sub', [channel.port2]) }) ``` I'm thinking of get `clientId` from each request, but every `mode: navigate` request result in empty `clientId`, and break the chain of it's parent. So here the only way I can find is to `matchAll` and find one, but it's **not right**. Is this an issue that can be improved? -- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/w3c/ServiceWorker/issues/1321
Received on Tuesday, 5 June 2018 08:32:25 UTC