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