Skip to content

Commit

Permalink
Fix trimHeadFrames appearing in outbound payload in some cases (getse…
Browse files Browse the repository at this point in the history
  • Loading branch information
benvinegar authored and denstepa committed Jan 5, 2017
1 parent f31d1d8 commit 9e852b1
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/raven.js
Original file line number Diff line number Diff line change
Expand Up @@ -1141,8 +1141,6 @@ Raven.prototype = {
for (var j = 0; j < options.trimHeadFrames && j < frames.length; j++) {
frames[j].in_app = false;
}
// ... delete to prevent from appearing in outbound payload
delete options.trimHeadFrames;
}
}
frames = frames.slice(0, this._globalOptions.stackTraceLimit);
Expand Down Expand Up @@ -1263,6 +1261,9 @@ Raven.prototype = {
baseData.request = httpData;
}

// HACK: delete `trimHeadFrames` to prevent from appearing in outbound payload
if (data.trimHeadFrames) delete data.trimHeadFrames;

data = objectMerge(baseData, data);

// Merge in the tags and extra separately since objectMerge doesn't handle a deep merge
Expand Down
19 changes: 19 additions & 0 deletions test/integration/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,25 @@ describe('integration', function () {
);
});

it('should generate a synthetic trace for captureException w/ non-errors', function (done) {
var iframe = this.iframe;
iframeExecute(iframe, done,
function () {
setTimeout(done);


Raven.captureException({foo:'bar'});
},
function () {
var ravenData = iframe.contentWindow.ravenData[0];
assert.isAbove(ravenData.stacktrace.frames.length, 1);

// verify trimHeadFrames hasn't slipped into final payload
assert.isUndefined(ravenData.trimHeadFrames);
}
);
});

it('should capture an Error object passed to Raven.captureException w/ maxMessageLength set (#647)', function (done) {
var iframe = this.iframe;
iframeExecute(iframe, done,
Expand Down

0 comments on commit 9e852b1

Please sign in to comment.