Index: third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/connect-src-self.sub.js |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/connect-src-self.sub.js b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/connect-src-self.sub.js |
index f7332e35ba2da2f8902209e53e2600cf5347f057..8c533abdda3f555e9ea17b5a92cb0387a48d028e 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/connect-src-self.sub.js |
+++ b/third_party/WebKit/LayoutTests/external/wpt/content-security-policy/inside-worker/support/connect-src-self.sub.js |
@@ -15,12 +15,9 @@ async_test(t => { |
assert_no_csp_event_for_url(t, url); |
var xhr = new XMLHttpRequest(); |
- try { |
- xhr.open("GET", url); |
- t.done(); |
- } catch (e) { |
- assert_unreached(); |
- } |
+ xhr.open("GET", url); |
+ xhr.onload = t.step_func_done(); |
+ xhr.onerror = t.unreached_func(); |
xhr.send(); |
}, "Same-origin XHR in " + self.location.protocol + self.location.search); |
@@ -29,34 +26,32 @@ async_test(t => { |
var url = "http://{{domains[www]}}:{{ports[http][1]}}/common/text-plain.txt?cross-origin-fetch"; |
Promise.all([ |
- waitUntilCSPEventForURL(t, url), |
+ // TODO(mkwst): A 'securitypolicyviolation' event should fire. |
fetch(url) |
.catch(t.step_func(e => assert_true(e instanceof TypeError))) |
- ]).then(_ => t.done()); |
+ ]).then(t.step_func_done()); |
}, "Cross-origin 'fetch()' in " + self.location.protocol + self.location.search); |
async_test(t => { |
var url = "http://{{domains[www]}}:{{ports[http][1]}}/common/text-plain.txt?cross-origin-xhr"; |
Promise.all([ |
- waitUntilCSPEventForURL(t, url), |
+ // TODO(mkwst): A 'securitypolicyviolation' event should fire. |
new Promise((resolve, reject) => { |
var xhr = new XMLHttpRequest(); |
- try { |
- xhr.open("GET", url); |
- reject("xhr.open should have thrown"); |
- } catch (e) { |
- resolve(); |
- } |
+ xhr.open("GET", url); |
+ xhr.onload = t.step_func(_ => reject("xhr.open should have thrown.")); |
+ xhr.onerror = t.step_func(resolve); |
+ xhr.send(); |
}) |
- ]).then(_ => t.done()); |
+ ]).then(t.step_func_done()); |
}, "Cross-origin XHR in " + self.location.protocol + self.location.search); |
// Same-origin redirecting to cross-origin |
async_test(t => { |
var url = "{{location[server]}}/common/redirect-opt-in.py?status=307&location=http://{{domains[www]}}:{{ports[http][1]}}/common/text-plain.txt?cross-origin-fetch"; |
- // TODO(mkwst): The event should be firing. :( |
+ // TODO(mkwst): A 'securitypolicyviolation' event should fire. |
fetch(url) |
.catch(t.step_func_done(e => assert_true(e instanceof TypeError))) |
}, "Same-origin => cross-origin 'fetch()' in " + self.location.protocol + self.location.search); |