8fd4f5ba0e
* use waitForEvent for the CSP service as @alisdair suggested * Secrets engine not secret engine * move algorithm -> hash_algorithm and add support for picking signature_algorithm for RSA keys when signing or verifying in transit
28 lines
632 B
JavaScript
28 lines
632 B
JavaScript
/*eslint-disable no-constant-condition*/
|
|
import Ember from 'ember';
|
|
import { task, waitForEvent } from 'ember-concurrency';
|
|
|
|
const { Service, computed } = Ember;
|
|
|
|
export default Service.extend({
|
|
events: [],
|
|
connectionViolations: computed.filterBy('events', 'violatedDirective', 'connect-src'),
|
|
|
|
attach() {
|
|
this.get('monitor').perform();
|
|
},
|
|
|
|
remove() {
|
|
this.get('monitor').cancelAll();
|
|
},
|
|
|
|
monitor: task(function*() {
|
|
this.get('events').clear();
|
|
|
|
while (true) {
|
|
let event = yield waitForEvent(window.document, 'securitypolicyviolation');
|
|
this.get('events').addObject(event);
|
|
}
|
|
}),
|
|
});
|