aboutsummaryrefslogtreecommitdiffstats
path: root/app/scripts/lib
diff options
context:
space:
mode:
Diffstat (limited to 'app/scripts/lib')
-rw-r--r--app/scripts/lib/notification-manager.js11
-rw-r--r--app/scripts/lib/setupRaven.js32
2 files changed, 35 insertions, 8 deletions
diff --git a/app/scripts/lib/notification-manager.js b/app/scripts/lib/notification-manager.js
index adaf60c65..1fcb7cf69 100644
--- a/app/scripts/lib/notification-manager.js
+++ b/app/scripts/lib/notification-manager.js
@@ -13,11 +13,12 @@ class NotificationManager {
this._getPopup((err, popup) => {
if (err) throw err
+ // Bring focus to chrome popup
if (popup) {
- // bring focus to existing popup
+ // bring focus to existing chrome popup
extension.windows.update(popup.id, { focused: true })
} else {
- // create new popup
+ // create new notification popup
extension.windows.create({
url: 'notification.html',
type: 'popup',
@@ -29,6 +30,7 @@ class NotificationManager {
}
closePopup () {
+ // closes notification popup
this._getPopup((err, popup) => {
if (err) throw err
if (!popup) return
@@ -60,9 +62,8 @@ class NotificationManager {
_getPopupIn (windows) {
return windows ? windows.find((win) => {
- return (win && win.type === 'popup' &&
- win.height === height &&
- win.width === width)
+ // Returns notification popup
+ return (win && win.type === 'popup')
}) : null
}
diff --git a/app/scripts/lib/setupRaven.js b/app/scripts/lib/setupRaven.js
index 42e48cb90..02c01b755 100644
--- a/app/scripts/lib/setupRaven.js
+++ b/app/scripts/lib/setupRaven.js
@@ -1,4 +1,4 @@
-const Raven = require('../vendor/raven.min.js')
+const Raven = require('raven-js')
const METAMASK_DEBUG = 'GULP_METAMASK_DEBUG'
const PROD = 'https://3567c198f8a8412082d32655da2961d0@sentry.io/273505'
const DEV = 'https://f59f3dd640d2429d9d0e2445a87ea8e1@sentry.io/273496'
@@ -18,9 +18,35 @@ function setupRaven(opts) {
ravenTarget = PROD
}
- Raven.config(ravenTarget, {
+ const client = Raven.config(ravenTarget, {
release,
- }).install()
+ transport: function(opts) {
+ // modify report urls
+ const report = opts.data
+ rewriteReportUrls(report)
+ // make request normally
+ client._makeRequest(opts)
+ },
+ })
+ client.install()
return Raven
}
+
+function rewriteReportUrls(report) {
+ // update request url
+ report.request.url = toMetamaskUrl(report.request.url)
+ // update exception stack trace
+ report.exception.values.forEach(item => {
+ item.stacktrace.frames.forEach(frame => {
+ frame.filename = toMetamaskUrl(frame.filename)
+ })
+ })
+}
+
+function toMetamaskUrl(origUrl) {
+ const filePath = origUrl.split(location.origin)[1]
+ if (!filePath) return origUrl
+ const metamaskUrl = `metamask${filePath}`
+ return metamaskUrl
+}