Bug 1498410 - Part 2 - Export Screenshots 35.0.0 (upgrade Raven to 3.27.0); r=ianbicking

MozReview-Commit-ID: 711GJNJtNYn

Differential Revision: https://phabricator.services.mozilla.com/D8504

--HG--
rename : browser/extensions/screenshots/webextension/build/raven.js => browser/extensions/screenshots/build/raven.js
extra : moz-landing-system : lando
This commit is contained in:
Jared Hirsch 2018-10-15 20:11:30 +00:00
Родитель 612276648b
Коммит fa19a006c8
1 изменённых файлов: 148 добавлений и 43 удалений

Просмотреть файл

@ -1,12 +1,12 @@
/*! Raven.js 3.25.2 (30b6d4e) | github.com/getsentry/raven-js */
/*! Raven.js 3.27.0 (200cffcc) | github.com/getsentry/raven-js */
/*
* Includes TraceKit
* https://github.com/getsentry/TraceKit
*
* Copyright 2018 Matt Robenolt and other contributors
* Released under the BSD license
* https://github.com/getsentry/raven-js/blob/master/LICENSE
* Copyright (c) 2018 Sentry (https://sentry.io) and individual contributors.
* All rights reserved.
* https://github.com/getsentry/sentry-javascript/blob/master/packages/raven-js/LICENSE
*
*/
@ -117,11 +117,7 @@ function now() {
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: {};
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
var _document = _window.document;
var _navigator = _window.navigator;
@ -170,7 +166,6 @@ function Raven() {
};
this._fetchDefaults = {
method: 'POST',
keepalive: true,
// Despite all stars in the sky saying that Edge supports old draft syntax, aka 'never', 'always', 'origin' and 'default
// https://caniuse.com/#feat=referrer-policy
// It doesn't. And it throw exception instead of ignoring this parameter...
@ -211,7 +206,7 @@ Raven.prototype = {
// webpack (using a build step causes webpack #1617). Grunt verifies that
// this value matches package.json during build.
// See: https://github.com/getsentry/raven-js/issues/465
VERSION: '3.25.2',
VERSION: '3.27.0',
debug: false,
@ -377,7 +372,7 @@ Raven.prototype = {
if (isFunction(options)) {
args = func || [];
func = options;
options = undefined;
options = {};
}
return this.wrap(options, func).apply(this, args);
@ -388,7 +383,7 @@ Raven.prototype = {
*
* @param {object} options A specific set of options for this context [optional]
* @param {function} func The function to be wrapped in a new context
* @param {function} func A function to call before the try/catch wrapper [optional, private]
* @param {function} _before A function to call before the try/catch wrapper [optional, private]
* @return {function} The newly wrapped functions with a context
*/
wrap: function(options, func, _before) {
@ -501,8 +496,9 @@ Raven.prototype = {
_promiseRejectionHandler: function(event) {
this._logDebug('debug', 'Raven caught unhandled promise rejection:', event);
this.captureException(event.reason, {
extra: {
unhandledPromiseRejection: true
mechanism: {
type: 'onunhandledrejection',
handled: false
}
});
},
@ -687,7 +683,9 @@ Raven.prototype = {
return;
}
if (this._globalOptions.stacktrace || (options && options.stacktrace)) {
// Always attempt to get stacktrace if message is empty.
// It's the only way to provide any helpful information to the user.
if (this._globalOptions.stacktrace || options.stacktrace || data.message === '') {
// fingerprint on msg, not stack trace (legacy behavior, could be revisited)
data.fingerprint = data.fingerprint == null ? msg : data.fingerprint;
@ -946,34 +944,40 @@ Raven.prototype = {
)
return;
options = options || {};
options = objectMerge(
{
eventId: this.lastEventId(),
dsn: this._dsn,
user: this._globalContext.user || {}
},
options
);
var lastEventId = options.eventId || this.lastEventId();
if (!lastEventId) {
if (!options.eventId) {
throw new RavenConfigError('Missing eventId');
}
var dsn = options.dsn || this._dsn;
if (!dsn) {
if (!options.dsn) {
throw new RavenConfigError('Missing DSN');
}
var encode = encodeURIComponent;
var qs = '';
qs += '?eventId=' + encode(lastEventId);
qs += '&dsn=' + encode(dsn);
var encodedOptions = [];
var user = options.user || this._globalContext.user;
if (user) {
if (user.name) qs += '&name=' + encode(user.name);
if (user.email) qs += '&email=' + encode(user.email);
for (var key in options) {
if (key === 'user') {
var user = options.user;
if (user.name) encodedOptions.push('name=' + encode(user.name));
if (user.email) encodedOptions.push('email=' + encode(user.email));
} else {
encodedOptions.push(encode(key) + '=' + encode(options[key]));
}
}
var globalServer = this._getGlobalServer(this._parseDSN(dsn));
var globalServer = this._getGlobalServer(this._parseDSN(options.dsn));
var script = _document.createElement('script');
script.async = true;
script.src = globalServer + '/api/embed/error-page/' + qs;
script.src = globalServer + '/api/embed/error-page/?' + encodedOptions.join('&');
(_document.head || _document.body).appendChild(script);
},
@ -1179,7 +1183,15 @@ Raven.prototype = {
}
var originalCallback = args[0];
if (isFunction(originalCallback)) {
args[0] = self.wrap(originalCallback);
args[0] = self.wrap(
{
mechanism: {
type: 'instrument',
data: {function: orig.name || '<anonymous>'}
}
},
originalCallback
);
}
// IE < 9 doesn't support .call/.apply on setInterval/setTimeout, but it
@ -1206,7 +1218,19 @@ Raven.prototype = {
// preserve arity
try {
if (fn && fn.handleEvent) {
fn.handleEvent = self.wrap(fn.handleEvent);
fn.handleEvent = self.wrap(
{
mechanism: {
type: 'instrument',
data: {
target: global,
function: 'handleEvent',
handler: (fn && fn.name) || '<anonymous>'
}
}
},
fn.handleEvent
);
}
} catch (err) {
// can sometimes get 'Permission denied to access property "handle Event'
@ -1246,7 +1270,20 @@ Raven.prototype = {
return orig.call(
this,
evtName,
self.wrap(fn, undefined, before),
self.wrap(
{
mechanism: {
type: 'instrument',
data: {
target: global,
function: 'addEventListener',
handler: (fn && fn.name) || '<anonymous>'
}
}
},
fn,
before
),
capture,
secure
);
@ -1280,7 +1317,20 @@ Raven.prototype = {
'requestAnimationFrame',
function(orig) {
return function(cb) {
return orig(self.wrap(cb));
return orig(
self.wrap(
{
mechanism: {
type: 'instrument',
data: {
function: 'requestAnimationFrame',
handler: (orig && orig.name) || '<anonymous>'
}
}
},
cb
)
);
};
},
wrappedBuiltIns
@ -1343,7 +1393,15 @@ Raven.prototype = {
function wrapProp(prop, xhr) {
if (prop in xhr && isFunction(xhr[prop])) {
fill(xhr, prop, function(orig) {
return self.wrap(orig);
return self.wrap(
{
mechanism: {
type: 'instrument',
data: {function: prop, handler: (orig && orig.name) || '<anonymous>'}
}
},
orig
);
}); // intentionally don't track filled methods on XHR instances
}
}
@ -1408,7 +1466,19 @@ Raven.prototype = {
xhr,
'onreadystatechange',
function(orig) {
return self.wrap(orig, undefined, onreadystatechangeHandler);
return self.wrap(
{
mechanism: {
type: 'instrument',
data: {
function: 'onreadystatechange',
handler: (orig && orig.name) || '<anonymous>'
}
}
},
orig,
onreadystatechangeHandler
);
} /* intentionally don't track this instrumentation */
);
} else {
@ -1632,10 +1702,16 @@ Raven.prototype = {
return globalServer;
},
_handleOnErrorStackInfo: function() {
_handleOnErrorStackInfo: function(stackInfo, options) {
options = options || {};
options.mechanism = options.mechanism || {
type: 'onerror',
handled: false
};
// if we are intentionally ignoring errors via onerror, bail out
if (!this._ignoreOnError) {
this._handleStackInfo.apply(this, arguments);
this._handleStackInfo(stackInfo, options);
}
},
@ -1772,6 +1848,27 @@ Raven.prototype = {
options
);
var ex = data.exception.values[0];
if (ex.type == null && ex.value === '') {
ex.value = 'Unrecoverable error caught';
}
// Move mechanism from options to exception interface
// We do this, as requiring user to pass `{exception:{mechanism:{ ... }}}` would be
// too much
if (!data.exception.mechanism && data.mechanism) {
data.exception.mechanism = data.mechanism;
delete data.mechanism;
}
data.exception.mechanism = objectMerge(
{
type: 'generic',
handled: true
},
data.exception.mechanism || {}
);
// Fire away!
this._send(data);
},
@ -2335,7 +2432,11 @@ var stringify = _dereq_(7);
var _window =
typeof window !== 'undefined'
? window
: typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};
: typeof global !== 'undefined'
? global
: typeof self !== 'undefined'
? self
: {};
function isObject(what) {
return typeof what === 'object' && what !== null;
@ -2749,6 +2850,9 @@ function isSameStacktrace(stack1, stack2) {
var frames1 = stack1.frames;
var frames2 = stack2.frames;
// Exit early if stacktrace is malformed
if (frames1 === undefined || frames2 === undefined) return false;
// Exit early if frame count differs
if (frames1.length !== frames2.length) return false;
@ -3019,11 +3123,12 @@ function getLocationOrigin() {
// Oh dear IE10...
if (!document.location.origin) {
document.location.origin =
return (
document.location.protocol +
'//' +
document.location.hostname +
(document.location.port ? ':' + document.location.port : '');
(document.location.port ? ':' + document.location.port : '')
);
}
return document.location.origin;
@ -4007,4 +4112,4 @@ function md5(string, key, raw) {
module.exports = md5;
},{}]},{},[4])(4)
});
});