8000 Match sourceMappingURLs not specified at the very end of source files… · stacktracejs/stacktrace-gps@b04c8f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit b04c8f9

Browse files
committed
Match sourceMappingURLs not specified at the very end of source files. Fixes #33.
1 parent e800173 commit b04c8f9

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

spec/stacktrace-gps-spec.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ describe('StackTraceGPS', function() {
233233
});
234234

235235
it('rejects if source map file 404s', function(done) {
236-
var source = 'var foo=function(){};function bar(){}var baz=eval("XXX");\n//@ sourceMappingURL=test.js.map';
236+
var source = 'var foo=function(){};function bar(){}var baz=eval("XXX");\n//# sourceMappingURL=test.js.map';
237237
jasmine.Ajax.stubRequest('http://localhost:9999/test.js').andReturn({responseText: source});
238238
jasmine.Ajax.stubRequest('http://localhost:9999/test.js.map').andReturn({status: 404});
239239
var stackframe = new StackFrame({args: [], fileName: 'http://localhost:9999/test.js', lineNumber: 23, columnNumber: 0});
@@ -295,7 +295,7 @@ describe('StackTraceGPS', function() {
295295

296296
describe('given source and source map that resolves', function() {
297297
beforeEach(function() {
298-
var source = 'var foo=function(){};function bar(){}var baz=eval("XXX");\n//@ sourceMappingURL=test.js.map';
298+
var source = 'var foo=function(){};function bar(){}var baz=eval("XXX");\n//@ sourceMappingURL=test.js.map\n//# sourceURL=test.js';
299299
jasmine.Ajax.stubRequest('http://localhost:9999/test.min.js').andReturn({responseText: source});
300300
var sourceMap = '{"version":3,"sources":["./test.js"],"names":["foo","bar","baz","eval"],"mappings":"AAAA,GAAIA,KAAM,YACV,SAASC,QACT,GAAIC,KAAMC,KAAK","file":"test.min.js"}';
301301
jasmine.Ajax.stubRequest('http://localhost:9999/test.js.map').andReturn({responseText: sourceMap});

stacktrace-gps.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
}
126126

127127
function _findSourceMappingURL(source) {
128-
var m = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/.exec(source);
128+
var m = /\/\/[#@] ?sourceMappingURL=([^\s'"]+)\s*$/m.exec(source);
129129
if (m && m[1]) {
130130
return m[1];
131131
} else {

0 commit comments

Comments
 (0)
0