fix(firefox): throw error when added script blocked by CSP#1841
fix(firefox): throw error when added script blocked by CSP#1841yury-s merged 1 commit intomicrosoft:masterfrom
Conversation
| return (await context.evaluateHandleInternal(addScriptContent, { content: content!, type })).asElement()!; | ||
| // Another round trip to the browser to ensure that we receive CSP error messages | ||
| // (if any) logged asynchronously in a separate task on the content main thread. | ||
| if (this._page._delegate.cspErrorsAsynchronousForInlineScipts) |
There was a problem hiding this comment.
We should probably do the same for inline styles and test it.
There was a problem hiding this comment.
No, styles are different. I thought the same but the styles seem to be handled asynchronously and they support onload/error events. We already have a test for this.
| // Another round trip to the browser to ensure that we receive CSP error messages | ||
| // (if any) logged asynchronously in a separate task on the content main thread. | ||
| if (this._page._delegate.cspErrorsAsynchronousForInlineScipts) | ||
| await context.evaluateInternal(() => true); |
There was a problem hiding this comment.
Have you found the source of this? Are we sure it is a single task?
There was a problem hiding this comment.
The console logging happens in a separate task on the main thread. My assumption here is that the second evaluate is handled in its own task after the logging, so there is still a room for false positives. I could add some hooks in the native part to report the error synchronously via juggler but I felt like the problem we are fixing doesn't warrant it.
No description provided.