(event)
| 133 | } |
| 134 | |
| 135 | function onGlobalMessage(event) { |
| 136 | // This will catch all incoming messages (even from other windows!), so we need to try reasonably hard to |
| 137 | // avoid letting anyone else trick us into firing off. We test the origin is still this window, and that a |
| 138 | // (randomly generated) unpredictable identifying prefix is present. |
| 139 | if (event.source === global && isStringAndStartsWith(event.data, MESSAGE_PREFIX)) { |
| 140 | var handle = event.data.substring(MESSAGE_PREFIX.length); |
| 141 | tasks.runIfPresent(handle); |
| 142 | } |
| 143 | } |
| 144 | if (global.addEventListener) { |
| 145 | global.addEventListener("message", onGlobalMessage, false); |
| 146 | } else { |
nothing calls this directly
no test coverage detected