Skip to content

Commit

Permalink
fix: Add crossorigin attribute to script HTML tags
Browse files Browse the repository at this point in the history
The Problem:
When an error occurs in a script that is not served by the
default server spawned by karma, the stack trace gets lost and
only the message "Script Error" is captured and reported back.
This makes it hard to pin-point where the error originated from.

The Solution:
Add "crossorigin" attribute to generated script tags.

Solution is inspired by this article:
https://blog.getsentry.com/2016/05/17/what-is-script-error.html
  • Loading branch information
pardoman committed Jun 30, 2016
1 parent b93b9cc commit 8f541d5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/middleware/karma.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var urlparse = function (urlStr) {
var common = require('./common')

var VERSION = require('../constants').VERSION
var SCRIPT_TAG = '<script type="%s" src="%s"></script>'
var SCRIPT_TAG = '<script type="%s" src="%s" crossorigin="anonymous"></script>'
var LINK_TAG_CSS = '<link type="text/css" href="%s" rel="stylesheet">'
var LINK_TAG_HTML = '<link href="%s" rel="import">'
var SCRIPT_TYPE = {
Expand Down

0 comments on commit 8f541d5

Please sign in to comment.