Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(reporter): do not allow URL domains to span new lines
This was causing some excruciating error logs with the default format of cross-domain iframe errors: ``` Error: Blocked a frame with origin "http://localhost:9876" from accessing a cross-origin frame. at Error (native) at Function.method.restore (absolute/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/fa96dc8102e4c5416f4cd38061107a08.browserify?f4458f57b50ae627f718945da619dae7c682b4a0:60376:28) at each (absolute/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/fa96dc8102e4c5416f4cd38061107a08.browserify?f4458f57b50ae627f718945da619dae7c682b4a0:57875:33) at Object.restore (absolute/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/fa96dc8102e4c5416f4cd38061107a08.browserify?f4458f57b50ae627f718945da619dae7c682b4a0:57895:17) at Object.restore (absolute/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/fa96dc8102e4c5416f4cd38061107a08.browserify?f4458f57b50ae627f718945da619dae7c682b4a0:59163:42) at Context.<anonymous> (absolute/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/fa96dc8102e4c5416f4cd38061107a08.browserify?f4458f57b50ae627f718945da619dae7c682b4a0:109551:13) ``` The old regex would find that `https://` then include everything that wasn't a slash, which included the next two lines into the `/absolute`. The output would be similar to: ``` Error: Blocked a frame with origin "/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/afde9a0a28f71236ac3340462d6ca94e.browserify:60376:28 <- node_modules/sinon/lib/sinon/util/core.js:154:0) at each (/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/afde9a0a28f71236ac3340462d6ca94e.browserify:57875:33 <- node_modules/sinon/lib/sinon/collection.js:34:0) ... ``` With this, we prevent the domain from spanning the newline character, and now the output is: ``` Error: Blocked a frame with origin "http://localhost:9876" from accessing a cross-origin frame. at Error (native) at Function.method.restore (/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/6c039bf5162f620e4d2667e56f143a02.browserify:60376:28 <- node_modules/sinon/lib/sinon/util/core.js:154:0) at each (/var/folders/8m/vg2kf8h50bj9gy5r9gwn20dw00_y0z/T/6c039bf5162f620e4d2667e56f143a02.browserify:57875:33 <- node_modules/sinon/lib/sinon/collection.js:34:0) ... ```
- Loading branch information