When we block a Worker or SharedWorker via CSP, we should fire the worker's `onerror` event rather than throwing in the constructor. That is, the following test should pass:
```
var w = new Worker(url);
w.onmessage = t.unreached_func("Ping should not be sent.");
Promise.all([
waitUntilCSPEventForURL(t, reportedURL)
.then(t.step_func(e => {
assert_equals(e.blockedURI, reportedURL);
assert_equals(e.violatedDirective, "worker-src");
assert_equals(e.effectiveDirective, "worker-src");
})),
waitUntilEvent(w, "error")
]).then(t.step_func_done());
```
Currently, we throw, which is unfortunate.
Fixing dedicated workers is trivial. Fixing SharedWorkers is a nightmare.
Comment 1 by sheriffbot@chromium.org
, Nov 8 2017Status: Untriaged (was: Available)