rollbar / rollbar.js

Error tracking and logging from Javascript to Rollbar

Home Page:https://docs.rollbar.com/docs/javascript

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

CSP not logging in Safari

liamfirth opened this issue · comments

Safari doesn't log content security policy violations because it doesn't emit the securitypolicyviolation on the window object, only on the document object. Rollbar JS only listens on the window object:

this.addListener("contentsecuritypolicy", this._window, "securitypolicyviolation", null, t, !1)

this.addListener('contentsecuritypolicy', this._window, 'securitypolicyviolation', null, cspHandler, false);

Confirmed in MDN Browser compatibility data mdn/browser-compat-data#12334

You can also test this in a real-life scenario, events are logged when you attach them to document but not on window in Safari (works in Chrome). In the below example nothing is showing in the Rollbar dashboard but logged to console:

Screenshot 2021-12-13 at 10 33 23