diff options
Diffstat (limited to 'testing/web-platform/tests/eventsource/shared-worker/eventsource-constructor-non-same-origin.js')
-rw-r--r-- | testing/web-platform/tests/eventsource/shared-worker/eventsource-constructor-non-same-origin.js | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/testing/web-platform/tests/eventsource/shared-worker/eventsource-constructor-non-same-origin.js b/testing/web-platform/tests/eventsource/shared-worker/eventsource-constructor-non-same-origin.js new file mode 100644 index 0000000000..a68dc5b0b7 --- /dev/null +++ b/testing/web-platform/tests/eventsource/shared-worker/eventsource-constructor-non-same-origin.js @@ -0,0 +1,13 @@ +onconnect = function(e) { +try { + var port = e.ports[0] + var url = decodeURIComponent(location.hash.substr(1)) + var source = new EventSource(url) + source.onerror = function(e) { + port.postMessage([true, this.readyState, 'data' in e]) + this.close(); + } +} catch(e) { + port.postMessage([false, String(e)]) +} +}
\ No newline at end of file |