squash_javascript 1.0.2 → 1.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/README.md +1 -1
- data/bin/upload_source_map +1 -1
- data/lib/squash/javascript/engine.rb +1 -1
- data/lib/squash/javascript/source_map.rb +2 -2
- data/lib/squash/javascript.rb +1 -1
- data/vendor/assets/javascripts/squash_javascript/client.coffee +20 -15
- data/vendor/assets/javascripts/squash_javascript/index.js +1 -1
- data/vendor/assets/javascripts/squash_javascript/tracekit.js +9 -6
- data/vendor/assets/javascripts/squash_javascript.min.js +24 -24
- data/vendor/assets/javascripts/squash_javascript.orig.js +26 -17
- metadata +9 -26
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
Yzg2ZTI5ZWVkNzI4NmQ4NzQ3MzA5OTc4ZGJlNGE0OGNjZDdlMGY4Yw==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
NWVkMTA3NTMzYTQyZDExYjlmMDdiNzNmNDJhM2IzMTgxNjYzMmM4NA==
|
7
|
+
SHA512:
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
NGU0MmQ1MDc5MjNjNTYzNDlkZmY2Mzk0NmRhNWQwNGEwMDRkOWQ5ZTBmNGVl
|
10
|
+
OWI3ZTkyZDgyMmMzNjg1OTdjMGI0NTc5OWIwMzdlMGNmMzQ1OGMwMGZjZjI1
|
11
|
+
ODc0MjE1NzA0NjkwMmU2ZGM5YjAzZjAyNmI0ZDAxYTRjMzEwYmI=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
MzhkODM0MzVmNjM0YmI4NTE2NmRmNzcxODZmOTVhODU1NmUzZmI1NjkwNmRj
|
14
|
+
NDA0ZjQxOWE0NmM0NmVlZDBmNzZlM2EwMGEwMzJhZDk2ODk1YTIwOWI0ZDgz
|
15
|
+
ODNlNzkzNzNiMWZkOTk2MDNkNjU5Y2ZhYjBlZWU1NmE5NWQ3OTk=
|
data/README.md
CHANGED
@@ -22,7 +22,7 @@ install with `rake setup`.
|
|
22
22
|
|
23
23
|
### Ruby library
|
24
24
|
|
25
|
-
Markdown-formatted YARD documentation is available by running
|
25
|
+
Markdown-formatted YARD documentation is available by running `rake doc:ruby`.
|
26
26
|
The documentation is written to the `doc/ruby` directory.
|
27
27
|
|
28
28
|
Compatibility
|
data/bin/upload_source_map
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2013 Square Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -97,7 +97,7 @@ class Squash::Javascript::SourceMap
|
|
97
97
|
while index < mappings.length
|
98
98
|
entry = mappings[index]
|
99
99
|
mapping = entry if entry.route == route && entry.compiled_line == line && entry.compiled_column <= column
|
100
|
-
break if entry.route > route || entry.compiled_line > line
|
100
|
+
break if entry.route > route || (entry.route == route && entry.compiled_line > line)
|
101
101
|
index += 1
|
102
102
|
end
|
103
103
|
|
data/lib/squash/javascript.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright
|
1
|
+
# Copyright 2013 Square Inc.
|
2
2
|
#
|
3
3
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
4
4
|
# you may not use this file except in compliance with the License.
|
@@ -29,7 +29,7 @@ class root.SquashJavascript
|
|
29
29
|
class _SquashJavascript
|
30
30
|
# @private
|
31
31
|
constructor: ->
|
32
|
-
TraceKit.report.subscribe (error) -> SquashJavascript.instance().report(error)
|
32
|
+
TraceKit.report.subscribe (info, error) -> SquashJavascript.instance().report(info, error)
|
33
33
|
|
34
34
|
# Sets configuration options. See the README file for a list of accepted
|
35
35
|
# configuration options. Multiple calls will merge new options in.
|
@@ -55,15 +55,17 @@ class _SquashJavascript
|
|
55
55
|
# installs a listener that notifies the server for thrown exceptions.
|
56
56
|
#
|
57
57
|
# @param [Error] error The error to record.
|
58
|
+
# @param [Object] user_data Additional user data to send up with the error.
|
58
59
|
#
|
59
|
-
notify: (error) ->
|
60
|
+
notify: (error, user_data) ->
|
60
61
|
if error instanceof Error
|
62
|
+
error._squash_user_data = user_data
|
61
63
|
TraceKit.report(error)
|
62
64
|
else
|
63
65
|
throw error
|
64
66
|
|
65
67
|
# @private
|
66
|
-
report: (error) ->
|
68
|
+
report: (info, error) ->
|
67
69
|
try
|
68
70
|
return false if @options?.disabled
|
69
71
|
if !@options?.APIKey || !@options?.environment ||
|
@@ -71,28 +73,28 @@ class _SquashJavascript
|
|
71
73
|
console.error "Missing required Squash configuration keys"
|
72
74
|
return false
|
73
75
|
|
74
|
-
return false if this.shouldIgnoreError(
|
75
|
-
return false unless
|
76
|
+
return false if this.shouldIgnoreError(info)
|
77
|
+
return false unless info.stack
|
76
78
|
|
77
|
-
fields =
|
79
|
+
fields = new Object()
|
78
80
|
fields.api_key = @options.APIKey
|
79
81
|
fields.environment = @options.environment
|
80
82
|
fields.client = "javascript"
|
81
83
|
fields.revision = @options.revision
|
82
84
|
|
83
|
-
fields.class_name =
|
85
|
+
fields.class_name = info.type ? info.name
|
84
86
|
# errors that make it up to window.onerror get stupidly rewritten: their
|
85
87
|
# class is set to "Error" and the ACTUAL class is integrated into the
|
86
88
|
# message (e.g., "Uncaught TypeError: [message]")
|
87
|
-
if !
|
89
|
+
if !info.name && (matches = info.message.match(/^(Uncaught )?(\w+): (.+)/))
|
88
90
|
fields.class_name = matches[2]
|
89
91
|
fields.message = matches[3]
|
90
92
|
else
|
91
|
-
fields.message =
|
93
|
+
fields.message = info.message
|
92
94
|
fields.class_name ?= 'Error' # when all else fails
|
93
95
|
|
94
|
-
fields.backtraces = buildBacktrace(
|
95
|
-
fields.capture_method =
|
96
|
+
fields.backtraces = buildBacktrace(info.stack)
|
97
|
+
fields.capture_method = info.mode
|
96
98
|
fields.occurred_at = ISODateString(new Date())
|
97
99
|
|
98
100
|
fields.schema = window.location.protocol.replace(/:$/, '')
|
@@ -110,6 +112,9 @@ class _SquashJavascript
|
|
110
112
|
fields.window_height = window.innerHeight
|
111
113
|
fields.color_depth = screen.colorDepth
|
112
114
|
|
115
|
+
if error
|
116
|
+
(fields[k] = v for own k, v of error._squash_user_data)
|
117
|
+
|
113
118
|
body = JSON.stringify(fields)
|
114
119
|
this.HTTPTransmit (@options.APIHost + @options.notifyPath),
|
115
120
|
[ ['Content-Type', 'application/json'] ],
|
@@ -118,7 +123,7 @@ class _SquashJavascript
|
|
118
123
|
return true
|
119
124
|
catch internal_error
|
120
125
|
console.error "Error while trying to notify Squash:", internal_error.stack
|
121
|
-
console.error "-- original error:",
|
126
|
+
console.error "-- original error:", info
|
122
127
|
|
123
128
|
# Runs the given `block`. If an exception is thrown within the function, adds
|
124
129
|
# the given user data to the exception and re-throws it.
|
@@ -173,8 +178,8 @@ class _SquashJavascript
|
|
173
178
|
# @private
|
174
179
|
HTTPTransmit: (url, headers, body) ->
|
175
180
|
request = new XMLHttpRequest()
|
176
|
-
request.timeout = @options.transmitTimeout
|
177
181
|
request.open "POST", url, true
|
182
|
+
request.timeout = @options.transmitTimeout
|
178
183
|
for header in headers
|
179
184
|
request.setRequestHeader header[0], header[1]
|
180
185
|
request.send body
|
@@ -197,7 +202,7 @@ class _SquashJavascript
|
|
197
202
|
backtraces = []
|
198
203
|
for line in stack
|
199
204
|
context = line.context
|
200
|
-
context = null if context && any(context, (cline) -> cline.length > 200)
|
205
|
+
context = null if context && any(context, (cline) -> cline && cline.length > 200)
|
201
206
|
backtraces.push {url: line.url, line: line.line, column: line.column, symbol: line.func, context: context, type: 'minified'}
|
202
207
|
return [ {name: "Active Thread", faulted: true, backtrace: backtraces} ]
|
203
208
|
|
@@ -74,13 +74,14 @@ TraceKit.report = (function () {
|
|
74
74
|
/**
|
75
75
|
* Dispatch stack information to all handlers.
|
76
76
|
* @param {Object.<string, *>} stack
|
77
|
+
* @param {Error} e
|
77
78
|
*/
|
78
|
-
function notifyHandlers(stack) {
|
79
|
+
function notifyHandlers(stack, e) {
|
79
80
|
var exception = null;
|
80
81
|
for (var i in handlers) {
|
81
82
|
if (handlers.hasOwnProperty(i)) {
|
82
83
|
try {
|
83
|
-
handlers[i](stack);
|
84
|
+
handlers[i](stack, e);
|
84
85
|
}
|
85
86
|
catch (inner) {
|
86
87
|
exception = inner;
|
@@ -105,10 +106,12 @@ TraceKit.report = (function () {
|
|
105
106
|
*/
|
106
107
|
window.onerror = function (message, url, lineNo) {
|
107
108
|
var stack = null;
|
109
|
+
var ex = null;
|
108
110
|
|
109
111
|
if (lastExceptionStack) {
|
110
112
|
TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(lastExceptionStack, url, lineNo, message);
|
111
113
|
stack = lastExceptionStack;
|
114
|
+
ex = lastException;
|
112
115
|
lastExceptionStack = null;
|
113
116
|
lastException = null;
|
114
117
|
}
|
@@ -119,7 +122,7 @@ TraceKit.report = (function () {
|
|
119
122
|
stack = { 'mode': 'onerror', 'message': message, 'stack': [ location ] };
|
120
123
|
}
|
121
124
|
|
122
|
-
notifyHandlers(stack);
|
125
|
+
notifyHandlers(stack, ex);
|
123
126
|
|
124
127
|
if (_oldOnerrorHandler) {
|
125
128
|
return _oldOnerrorHandler.apply(this, arguments);
|
@@ -141,7 +144,7 @@ TraceKit.report = (function () {
|
|
141
144
|
var s = lastExceptionStack;
|
142
145
|
lastExceptionStack = null;
|
143
146
|
lastException = null;
|
144
|
-
notifyHandlers(s);
|
147
|
+
notifyHandlers(s, ex);
|
145
148
|
}
|
146
149
|
}
|
147
150
|
|
@@ -157,7 +160,7 @@ TraceKit.report = (function () {
|
|
157
160
|
if (lastException === ex) {
|
158
161
|
lastExceptionStack = null;
|
159
162
|
lastException = null;
|
160
|
-
notifyHandlers(stack);
|
163
|
+
notifyHandlers(stack, ex);
|
161
164
|
}
|
162
165
|
}, (stack.incomplete ? 2000 : 0));
|
163
166
|
|
@@ -545,7 +548,7 @@ TraceKit.computeStackTrace = (function () {
|
|
545
548
|
return null;
|
546
549
|
}
|
547
550
|
|
548
|
-
var chrome = /^\s*at (\S
|
551
|
+
var chrome = /^\s*at (?:new )?(.+) (?:\[as \S+\] )?\(((?:file|http):.*?):(\d+)(?::(\d+))?\)\s*$/i,
|
549
552
|
gecko = /^\s*(\S*)(?:\((.*?)\))?@((?:file|http).*?):(\d+)(?::(\d+))?\s*$/i,
|
550
553
|
lines = ex.stack.split("\n"),
|
551
554
|
stack = [],
|
@@ -1,24 +1,24 @@
|
|
1
|
-
(function(){var
|
2
|
-
a=[];for(d in b)
|
3
|
-
!b.stack)return!1;a=
|
4
|
-
(a.port=window.location.port);a.path=window.location.pathname;a.query=window.location.search;""!==window.location.hash&&(a.fragment=window.location.hash);a.user_agent=navigator.userAgent;a.screen_width=screen.width;a.screen_height=screen.height;a.window_width=window.innerWidth;a.window_height=window.innerHeight;a.color_depth=screen.colorDepth;c=JSON.stringify(a);this.HTTPTransmit(this.options.APIHost+
|
5
|
-
|
6
|
-
1):(b=0,[]);b=arguments[b++];try{return b()}catch(c){throw c._squash_ignored_exceptions=(c._squash_ignored_exceptions||[]).concat(d),c;}};e.prototype.ignoringExceptions=function(){var b,d,c;d=2<=arguments.length?
|
7
|
-
d,c){var a,
|
8
|
-
|
9
|
-
0;for(
|
10
|
-
TraceKit.report=function(){function
|
11
|
-
TraceKit.computeStackTrace.guessFunctionName(
|
12
|
-
TraceKit.computeStackTrace=function(){function
|
13
|
-
|
14
|
-
"\\$&")}function
|
15
|
-
function
|
16
|
-
c[1];c=
|
17
|
-
b.context,!1}a.stack.unshift(b);return a.partial=!0}a.incomplete=!0;return!1}function
|
18
|
-
|
19
|
-
|
20
|
-
for(var
|
21
|
-
}try{var
|
22
|
-
{url:
|
23
|
-
name:a.name,message:
|
24
|
-
(function(
|
1
|
+
(function(){var m,f={}.hasOwnProperty,h=[].slice,e="undefined"!==typeof exports&&null!==exports?exports:this,k=function(){},v;v=void 0;k.instance=function(){return null!=v?v:v=new m};e.SquashJavascript=k;var e=function(){TraceKit.report.subscribe(function(b,d){return SquashJavascript.instance().report(b,d)})},p,s,x,g;e.prototype.configure=function(b){var d,c,a;this.options||(this.options={disabled:!1,notifyPath:"/api/1.0/notify",transmitTimeout:15E3,ignoredExceptionClasses:[],ignoredExceptionMessages:{}});
|
2
|
+
a=[];for(d in b)f.call(b,d)&&(c=b[d],a.push(this.options[d]=c));return a};e.prototype.notify=function(b,d){if(b instanceof Error)return b._squash_user_data=d,TraceKit.report(b);throw b;};e.prototype.report=function(b,d){var c,a,i,l,B,G,q,j,e,k,h,g;try{if(null!=(G=this.options)&&G.disabled)return!1;if(!(null!=(q=this.options)&&q.APIKey)||!(null!=(j=this.options)&&j.environment)||!(null!=(e=this.options)&&e.revision)||!(null!=(k=this.options)&&k.APIHost))return console.error("Missing required Squash configuration keys"),
|
3
|
+
!1;if(this.shouldIgnoreError(b)||!b.stack)return!1;a={};a.api_key=this.options.APIKey;a.environment=this.options.environment;a.client="javascript";a.revision=this.options.revision;a.class_name=null!=(h=b.type)?h:b.name;!b.name&&(l=b.message.match(/^(Uncaught )?(\w+): (.+)/))?(a.class_name=l[2],a.message=l[3]):a.message=b.message;null==a.class_name&&(a.class_name="Error");a.backtraces=x(b.stack);a.capture_method=b.mode;a.occurred_at=p(new Date);a.schema=window.location.protocol.replace(/:$/,"");a.host=
|
4
|
+
window.location.hostname;0<window.location.port.length&&(a.port=window.location.port);a.path=window.location.pathname;a.query=window.location.search;""!==window.location.hash&&(a.fragment=window.location.hash);a.user_agent=navigator.userAgent;a.screen_width=screen.width;a.screen_height=screen.height;a.window_width=window.innerWidth;a.window_height=window.innerHeight;a.color_depth=screen.colorDepth;if(d)for(i in g=d._squash_user_data,g)f.call(g,i)&&(B=g[i],a[i]=B);c=JSON.stringify(a);this.HTTPTransmit(this.options.APIHost+
|
5
|
+
this.options.notifyPath,[["Content-Type","application/json"]],c);return!0}catch(s){return console.error("Error while trying to notify Squash:",s.stack),console.error("-- original error:",b)}};e.prototype.addUserData=function(b,d){try{return d()}catch(c){throw null==c._squash_user_data&&(c._squash_user_data={}),g(c._squash_user_data,b),c;}};e.prototype.addingUserData=function(b,d){return function(){var c;c=1<=arguments.length?h.call(arguments,0):[];return SquashJavascript.instance().addUserData(b,
|
6
|
+
function(){return d.apply(null,c)})}};e.prototype.ignoreExceptions=function(){var b,d;d=2<=arguments.length?h.call(arguments,0,b=arguments.length-1):(b=0,[]);b=arguments[b++];try{return b()}catch(c){throw c._squash_ignored_exceptions=(c._squash_ignored_exceptions||[]).concat(d),c;}};e.prototype.ignoringExceptions=function(){var b,d,c;d=2<=arguments.length?h.call(arguments,0,c=arguments.length-1):(c=0,[]);b=arguments[c++];return function(){var a,i;a=1<=arguments.length?h.call(arguments,0):[];return(i=
|
7
|
+
SquashJavascript.instance()).ignoreExceptions.apply(i,h.call(d).concat([function(){return b.apply(null,a)}]))}};e.prototype.HTTPTransmit=function(b,d,c){var a,i,l;a=new XMLHttpRequest;a.open("POST",b,!0);a.timeout=this.options.transmitTimeout;i=0;for(l=d.length;i<l;i++)b=d[i],a.setRequestHeader(b[0],b[1]);a.send(c);return a};e.prototype.shouldIgnoreError=function(b){var d;d=this.options.ignoredExceptionClasses.concat(b._squash_ignored_exceptions||[]);return s(d,function(c){return b.name===c})?!0:
|
8
|
+
s(this.options.ignoredExceptionMessages,function(c,a){return b.name===c?s(a,function(a){return b.message.match(a)}):!1})};x=function(b){var d,c,a,i,l;d=[];i=0;for(l=b.length;i<l;i++)a=b[i],(c=a.context)&&s(c,function(a){return a&&200<a.length})&&(c=null),d.push({url:a.url,line:a.line,column:a.column,symbol:a.func,context:c,type:"minified"});return[{name:"Active Thread",faulted:!0,backtrace:d}]};p=function(b){var d;d=function(b){return 10>b?"0"+b:b};return""+b.getUTCFullYear()+"-"+d(b.getUTCMonth()+
|
9
|
+
1)+"-"+d(b.getUTCDate())+"T"+d(b.getUTCHours())+":"+d(b.getUTCMinutes())+":"+d(b.getUTCSeconds())+"Z"};s=function(b,d){var c,a,i;if(b instanceof Array){a=0;for(i=b.length;a<i;a++)if(c=b[a],d(c))return!0}else for(c in b)if(f.call(b,c)&&(a=b[c],d(c,a)))return!0;return!1};g=function(b,d){var c,a,i;i=[];for(c in d)f.call(d,c)&&(a=d[c],i.push(b[c]=a));return i};m=e}).call(this);var TraceKit={};
|
10
|
+
TraceKit.report=function(){function m(e,k){var f=null,g;for(g in h)if(h.hasOwnProperty(g))try{h[g](e,k)}catch(b){f=b}if(f)throw f;}function f(p){if(k){if(e===p)return;var h=k;e=k=null;m(h,p)}var f=TraceKit.computeStackTrace(p);k=f;e=p;window.setTimeout(function(){e===p&&(e=k=null,m(f,p))},f.incomplete?2E3:0);throw p;}var h=[],e=null,k=null,v=window.onerror;window.onerror=function(p,f,h){var g=null,b=null;k?(TraceKit.computeStackTrace.augmentStackTraceWithInitialElement(k,f,h,p),g=k,b=e,e=k=null):
|
11
|
+
(g={url:f,line:h},g.func=TraceKit.computeStackTrace.guessFunctionName(g.url,g.line),g.context=TraceKit.computeStackTrace.gatherContext(g.url,g.line),g={mode:"onerror",message:p,stack:[g]});m(g,b);return v?v.apply(this,arguments):!1};f.subscribe=function(e){h.push(e)};f.unsubscribe=function(e){for(var f=h.length-1;0<=f;--f)h[f]===e&&h.splice(f,1)};return f}();
|
12
|
+
TraceKit.computeStackTrace=function(){function m(a){if(!c.hasOwnProperty(a)){var i,b=a.split("/");if(2<b.length&&b[2]===document.domain)try{void 0===XMLHttpRequest&&(XMLHttpRequest=function(){try{return new ActiveXObject("Msxml2.XMLHTTP.6.0")}catch(a){}try{return new ActiveXObject("Msxml2.XMLHTTP.3.0")}catch(i){}try{return new ActiveXObject("Msxml2.XMLHTTP")}catch(b){}try{return new ActiveXObject("Microsoft.XMLHTTP")}catch(l){}throw Error("No XHR.");});var B=new XMLHttpRequest;B.open("GET",a,!1);
|
13
|
+
B.send("");i=B.responseText}catch(d){i=""}else i=[];c[a]=i.length?i.split("\n"):[]}return c[a]}function f(a,i){var b=/function ([^(]*)\(([^)]*)\)/,d=/['"]?([0-9A-Za-z$_]+)['"]?\s*[:=]\s*(function|eval|new Function)/,c="",e=m(a),j;if(!e.length)return"?";for(var f=0;10>f;++f)if(c=e[i-f]+c,void 0!==c&&((j=d.exec(c))||(j=b.exec(c))))return j[1];return"?"}function h(a,b){var l=m(a),c=[],d=!1;if(!l.length)return null;for(var b=b-1,e=b-2,f=b+2;e<f;++e)c.push(l[e]),void 0!==l[e]&&(d=!0);return d?c:null}function e(a){return a.replace(/[\-\[\]{}()*+?.,\\\^$|#]/g,
|
14
|
+
"\\$&")}function k(a){return e(a).replace("<","(?:<|<)").replace(">","(?:>|>)").replace("&","(?:&|&)").replace('"','(?:"|")').replace(/\s+/g,"\\s+")}function v(a,b){for(var l,c,d=0,e=b.length;d<e;++d)if((l=m(b[d])).length)if(l=l.join("\n"),c=a.exec(l))return{url:b[d],line:l.substring(0,c.index).split("\n").length,column:c.index-l.lastIndexOf("\n",c.index)-1};return null}function p(a,b,l){var b=m(b),a=RegExp("\\b"+e(a)+"\\b"),c,l=l-1;return b&&b.length>l&&(c=a.exec(b[l]))?c.index:null}
|
15
|
+
function s(a){var b=[window.location.href],c=document.getElementsByTagName("script"),a=""+a,d;for(d=0;d<c.length;++d){var f=c[d];f.src&&b.push(f.src)}(c=/^function(?:\s+([\w$]+))?\s*\(([\w\s,]*)\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a))?(d=c[1]?"\\s+"+c[1]:"",f=c[2].split(",").join("\\s*,\\s*"),c=e(c[3]).replace(/;$/,";?").replace(/\s+/g,"\\s+"),d=RegExp("function"+d+"\\s*\\(\\s*"+f+"\\s*\\)\\s*{\\s*"+c+"\\s*}")):d=RegExp(e(a).replace(/\s+/g,"\\s+"));if(d=v(d,b))return d;if(c=/^function on([\w$]+)\s*\(event\)\s*\{\s*(\S[\s\S]*\S)\s*\}\s*$/.exec(a)){a=
|
16
|
+
c[1];c=k(c[2]);d=RegExp("on"+a+"=[\\'\"]\\s*"+c+"\\s*[\\'\"]","i");if(d=v(d,b[0]))return d;d=RegExp(c);if(d=v(d,b))return d}return null}function x(a,b,d,c){b={url:b,line:d};if(b.url&&b.line){a.incomplete=!1;b.func||(b.func=f(b.url,b.line));b.context||(b.context=h(b.url,b.line));if(c=/ '([^']+)' /.exec(c))b.column=p(c[1],b.url,b.line);if(0<a.stack.length&&a.stack[0].url===b.url){if(a.stack[0].line===b.line)return!1;if(!a.stack[0].line&&a.stack[0].func===b.func)return a.stack[0].line=b.line,a.stack[0].context=
|
17
|
+
b.context,!1}a.stack.unshift(b);return a.partial=!0}a.incomplete=!0;return!1}function g(a,c){for(var d=/function\s+([_$a-zA-Z\xA0-\uFFFF][_$a-zA-Z0-9\xA0-\uFFFF]*)?\s*\(/i,e=[],h={},k,j,g=arguments.callee.caller;g;g=g.caller)if(!(g===b||g===TraceKit.report)){j={url:null,func:"?",line:null,column:null};if(g.name)j.func=g.name;else if(k=d.exec(g.toString()))j.func=k[1];if(k=s(g)){j.url=k.url;j.line=k.line;"?"===j.func&&(j.func=f(j.url,j.line));var m=/ '([^']+)' /.exec(a.message||a.description);m&&(j.column=
|
18
|
+
p(m[1],k.url,k.line))}h[""+g]&&(j.recursion=!0);e.push(j)}c&&e.splice(0,c);d={mode:"callers",name:a.name,message:a.message,stack:e};x(d,a.sourceURL||a.fileName,a.line||a.lineNumber,a.message||a.description);return d}function b(a,b){var c=null,b=void 0===b?0:+b;try{for(var e=/ line (\d+), column (\d+) in (?:<anonymous function: ([^>]+)>|([^\)]+))\((.*)\) in (.*):\s*$/i,s=a.stacktrace.split("\n"),q=[],j,x=0,L=s.length;x<L;x+=2)if(j=e.exec(s[x])){var w={line:+j[1],column:+j[2],func:j[3]||j[4],args:j[5]?
|
19
|
+
j[5].split(","):[],url:j[6]};!w.func&&w.line&&(w.func=f(w.url,w.line));if(w.line)try{w.context=h(w.url,w.line)}catch(U){}w.context||(w.context=[s[x+1]]);q.push(w)}c=q.length?{mode:"stacktrace",name:a.name,message:a.message,stack:q}:null;if(c)return c}catch(M){if(d)throw M;}try{if(a.stack){var e=/^\s*at (?:new )?(.+) (?:\[as \S+\] )?\(((?:file|http):.*?):(\d+)(?::(\d+))?\)\s*$/i,s=/^\s*(\S*)(?:\((.*?)\))?@((?:file|http).*?):(\d+)(?::(\d+))?\s*$/i,D=a.stack.split("\n"),q=[],r,t,C=/^(.*) is undefined$/.exec(a.message);
|
20
|
+
j=0;for(var F=D.length;j<F;++j){if(r=s.exec(D[j]))t={url:r[3],func:r[1],args:r[2]?r[2].split(","):"",line:+r[4],column:r[5]?+r[5]:null};else if(r=e.exec(D[j]))t={url:r[2],func:r[1],line:+r[3],column:r[4]?+r[4]:null};else continue;!t.func&&t.line&&(t.func=f(t.url,t.line));t.line&&(t.context=h(t.url,t.line));q.push(t)}q[0]&&(q[0].line&&!q[0].column&&C)&&(q[0].column=p(C[1],q[0].url,q[0].line));c=q.length?{mode:"stack",name:a.name,message:a.message,stack:q}:null}else c=null;if(c)return c}catch(N){if(d)throw N;
|
21
|
+
}try{var z=a.message.split("\n");if(4>z.length)c=null;else{D=/^\s*Line (\d+) of linked script ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;r=/^\s*Line (\d+) of inline#(\d+) script in ((?:file|http)\S+)(?:: in function (\S+))?\s*$/i;t=/^\s*Line (\d+) of function script\s*$/i;var C=[],n=document.getElementsByTagName("script"),F=[],y,u,H,A;for(u in n)n.hasOwnProperty(u)&&!n[u].src&&F.push(n[u]);u=2;for(H=z.length;u<H;u+=2){n=null;if(y=D.exec(z[u]))n={url:y[2],func:y[3],line:+y[1]};else if(y=r.exec(z[u])){var n=
|
22
|
+
{url:y[3],func:y[4]},O=+y[1],I=F[y[2]-1];if(I&&(A=m(n.url))){A=A.join("\n");var J=A.indexOf(I.innerText);0<=J&&(n.line=O+A.substring(0,J).split("\n").length)}}else if(y=t.exec(z[u])){var K=window.location.href.replace(/#.*$/,""),P=y[1],Q=RegExp(k(z[u+1]));A=v(Q,[K]);n={url:K,line:A?A.line:P,func:""}}if(n){n.func||(n.func=f(n.url,n.line));var E=h(n.url,n.line),R=E?E[Math.floor(E.length/2)]:null;n.context=E&&R.replace(/^\s*/,"")===z[u+1].replace(/^\s*/,"")?E:[z[u+1]];C.push(n)}}c=C.length?{mode:"multiline",
|
23
|
+
name:a.name,message:z[0],stack:C}:null}if(c)return c}catch(S){if(d)throw S;}try{if(c=g(a,b+1))return c}catch(T){if(d)throw T;}return{mode:"failed"}}var d=!1,c={};b.augmentStackTraceWithInitialElement=x;b.guessFunctionName=f;b.gatherContext=h;b.ofCaller=function(a){a=(void 0===a?0:+a)+1;try{0()}catch(c){return b(c,a+1)}return null};return b}();
|
24
|
+
(function(m){var f=Array.prototype.slice,h=m.setTimeout;m.setTimeout=function(){var e=f.call(arguments,0),m=e[0];e[0]=function(){try{m.apply(this,arguments)}catch(e){throw TraceKit.report(e),e;}};return h.apply(this,e)};var e=m.setInterval;m.setInterval=function(){var k=f.call(arguments,0),h=k[0];k[0]=function(){try{h.apply(this,arguments)}catch(e){throw TraceKit.report(e),e;}};return e.apply(this,k)}})(window);
|
@@ -25,8 +25,8 @@
|
|
25
25
|
var ISODateString, any, buildBacktrace, mergeBang;
|
26
26
|
|
27
27
|
function _SquashJavascript() {
|
28
|
-
TraceKit.report.subscribe(function(error) {
|
29
|
-
return SquashJavascript.instance().report(error);
|
28
|
+
TraceKit.report.subscribe(function(info, error) {
|
29
|
+
return SquashJavascript.instance().report(info, error);
|
30
30
|
});
|
31
31
|
}
|
32
32
|
|
@@ -48,16 +48,17 @@
|
|
48
48
|
return _results;
|
49
49
|
};
|
50
50
|
|
51
|
-
_SquashJavascript.prototype.notify = function(error) {
|
51
|
+
_SquashJavascript.prototype.notify = function(error, user_data) {
|
52
52
|
if (error instanceof Error) {
|
53
|
+
error._squash_user_data = user_data;
|
53
54
|
return TraceKit.report(error);
|
54
55
|
} else {
|
55
56
|
throw error;
|
56
57
|
}
|
57
58
|
};
|
58
59
|
|
59
|
-
_SquashJavascript.prototype.report = function(error) {
|
60
|
-
var body, fields, matches, _ref, _ref1, _ref2, _ref3, _ref4, _ref5;
|
60
|
+
_SquashJavascript.prototype.report = function(info, error) {
|
61
|
+
var body, fields, k, matches, v, _ref, _ref1, _ref2, _ref3, _ref4, _ref5, _ref6, _ref7;
|
61
62
|
try {
|
62
63
|
if ((_ref = this.options) != null ? _ref.disabled : void 0) {
|
63
64
|
return false;
|
@@ -66,29 +67,29 @@
|
|
66
67
|
console.error("Missing required Squash configuration keys");
|
67
68
|
return false;
|
68
69
|
}
|
69
|
-
if (this.shouldIgnoreError(
|
70
|
+
if (this.shouldIgnoreError(info)) {
|
70
71
|
return false;
|
71
72
|
}
|
72
|
-
if (!
|
73
|
+
if (!info.stack) {
|
73
74
|
return false;
|
74
75
|
}
|
75
|
-
fields =
|
76
|
+
fields = new Object();
|
76
77
|
fields.api_key = this.options.APIKey;
|
77
78
|
fields.environment = this.options.environment;
|
78
79
|
fields.client = "javascript";
|
79
80
|
fields.revision = this.options.revision;
|
80
|
-
fields.class_name =
|
81
|
-
if (!
|
81
|
+
fields.class_name = (_ref5 = info.type) != null ? _ref5 : info.name;
|
82
|
+
if (!info.name && (matches = info.message.match(/^(Uncaught )?(\w+): (.+)/))) {
|
82
83
|
fields.class_name = matches[2];
|
83
84
|
fields.message = matches[3];
|
84
85
|
} else {
|
85
|
-
fields.message =
|
86
|
+
fields.message = info.message;
|
86
87
|
}
|
87
|
-
if ((
|
88
|
+
if ((_ref6 = fields.class_name) == null) {
|
88
89
|
fields.class_name = 'Error';
|
89
90
|
}
|
90
|
-
fields.backtraces = buildBacktrace(
|
91
|
-
fields.capture_method =
|
91
|
+
fields.backtraces = buildBacktrace(info.stack);
|
92
|
+
fields.capture_method = info.mode;
|
92
93
|
fields.occurred_at = ISODateString(new Date());
|
93
94
|
fields.schema = window.location.protocol.replace(/:$/, '');
|
94
95
|
fields.host = window.location.hostname;
|
@@ -106,12 +107,20 @@
|
|
106
107
|
fields.window_width = window.innerWidth;
|
107
108
|
fields.window_height = window.innerHeight;
|
108
109
|
fields.color_depth = screen.colorDepth;
|
110
|
+
if (error) {
|
111
|
+
_ref7 = error._squash_user_data;
|
112
|
+
for (k in _ref7) {
|
113
|
+
if (!__hasProp.call(_ref7, k)) continue;
|
114
|
+
v = _ref7[k];
|
115
|
+
fields[k] = v;
|
116
|
+
}
|
117
|
+
}
|
109
118
|
body = JSON.stringify(fields);
|
110
119
|
this.HTTPTransmit(this.options.APIHost + this.options.notifyPath, [['Content-Type', 'application/json']], body);
|
111
120
|
return true;
|
112
121
|
} catch (internal_error) {
|
113
122
|
console.error("Error while trying to notify Squash:", internal_error.stack);
|
114
|
-
return console.error("-- original error:",
|
123
|
+
return console.error("-- original error:", info);
|
115
124
|
}
|
116
125
|
};
|
117
126
|
|
@@ -164,8 +173,8 @@
|
|
164
173
|
_SquashJavascript.prototype.HTTPTransmit = function(url, headers, body) {
|
165
174
|
var header, request, _i, _len;
|
166
175
|
request = new XMLHttpRequest();
|
167
|
-
request.timeout = this.options.transmitTimeout;
|
168
176
|
request.open("POST", url, true);
|
177
|
+
request.timeout = this.options.transmitTimeout;
|
169
178
|
for (_i = 0, _len = headers.length; _i < _len; _i++) {
|
170
179
|
header = headers[_i];
|
171
180
|
request.setRequestHeader(header[0], header[1]);
|
@@ -200,7 +209,7 @@
|
|
200
209
|
line = stack[_i];
|
201
210
|
context = line.context;
|
202
211
|
if (context && any(context, function(cline) {
|
203
|
-
return cline.length > 200;
|
212
|
+
return cline && cline.length > 200;
|
204
213
|
})) {
|
205
214
|
context = null;
|
206
215
|
}
|
metadata
CHANGED
@@ -1,36 +1,34 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: squash_javascript
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
5
|
-
prerelease:
|
4
|
+
version: 1.0.3
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tim Morgan
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 2014-01-23 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: railties
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
17
|
- - ! '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
|
-
version:
|
19
|
+
version: !binary |-
|
20
|
+
My4x
|
22
21
|
type: :runtime
|
23
22
|
prerelease: false
|
24
23
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
24
|
requirements:
|
27
25
|
- - ! '>='
|
28
26
|
- !ruby/object:Gem::Version
|
29
|
-
version:
|
27
|
+
version: !binary |-
|
28
|
+
My4x
|
30
29
|
- !ruby/object:Gem::Dependency
|
31
30
|
name: json
|
32
31
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
32
|
requirements:
|
35
33
|
- - ! '>='
|
36
34
|
- !ruby/object:Gem::Version
|
@@ -38,7 +36,6 @@ dependencies:
|
|
38
36
|
type: :runtime
|
39
37
|
prerelease: false
|
40
38
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
39
|
requirements:
|
43
40
|
- - ! '>='
|
44
41
|
- !ruby/object:Gem::Version
|
@@ -46,7 +43,6 @@ dependencies:
|
|
46
43
|
- !ruby/object:Gem::Dependency
|
47
44
|
name: squash_uploader
|
48
45
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
46
|
requirements:
|
51
47
|
- - ! '>='
|
52
48
|
- !ruby/object:Gem::Version
|
@@ -54,7 +50,6 @@ dependencies:
|
|
54
50
|
type: :runtime
|
55
51
|
prerelease: false
|
56
52
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
53
|
requirements:
|
59
54
|
- - ! '>='
|
60
55
|
- !ruby/object:Gem::Version
|
@@ -62,7 +57,6 @@ dependencies:
|
|
62
57
|
- !ruby/object:Gem::Dependency
|
63
58
|
name: yard
|
64
59
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
60
|
requirements:
|
67
61
|
- - ! '>='
|
68
62
|
- !ruby/object:Gem::Version
|
@@ -70,7 +64,6 @@ dependencies:
|
|
70
64
|
type: :development
|
71
65
|
prerelease: false
|
72
66
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
67
|
requirements:
|
75
68
|
- - ! '>='
|
76
69
|
- !ruby/object:Gem::Version
|
@@ -78,7 +71,6 @@ dependencies:
|
|
78
71
|
- !ruby/object:Gem::Dependency
|
79
72
|
name: redcarpet
|
80
73
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
74
|
requirements:
|
83
75
|
- - ! '>='
|
84
76
|
- !ruby/object:Gem::Version
|
@@ -86,7 +78,6 @@ dependencies:
|
|
86
78
|
type: :development
|
87
79
|
prerelease: false
|
88
80
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
81
|
requirements:
|
91
82
|
- - ! '>='
|
92
83
|
- !ruby/object:Gem::Version
|
@@ -94,7 +85,6 @@ dependencies:
|
|
94
85
|
- !ruby/object:Gem::Dependency
|
95
86
|
name: jeweler
|
96
87
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
88
|
requirements:
|
99
89
|
- - ! '>='
|
100
90
|
- !ruby/object:Gem::Version
|
@@ -102,7 +92,6 @@ dependencies:
|
|
102
92
|
type: :development
|
103
93
|
prerelease: false
|
104
94
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
95
|
requirements:
|
107
96
|
- - ! '>='
|
108
97
|
- !ruby/object:Gem::Version
|
@@ -110,7 +99,6 @@ dependencies:
|
|
110
99
|
- !ruby/object:Gem::Dependency
|
111
100
|
name: rspec
|
112
101
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
102
|
requirements:
|
115
103
|
- - ! '>='
|
116
104
|
- !ruby/object:Gem::Version
|
@@ -118,7 +106,6 @@ dependencies:
|
|
118
106
|
type: :development
|
119
107
|
prerelease: false
|
120
108
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
109
|
requirements:
|
123
110
|
- - ! '>='
|
124
111
|
- !ruby/object:Gem::Version
|
@@ -147,29 +134,25 @@ files:
|
|
147
134
|
homepage: http://github.com/SquareSquash/javascript
|
148
135
|
licenses:
|
149
136
|
- Apache 2.0
|
137
|
+
metadata: {}
|
150
138
|
post_install_message:
|
151
139
|
rdoc_options: []
|
152
140
|
require_paths:
|
153
141
|
- lib
|
154
142
|
required_ruby_version: !ruby/object:Gem::Requirement
|
155
|
-
none: false
|
156
143
|
requirements:
|
157
144
|
- - ! '>='
|
158
145
|
- !ruby/object:Gem::Version
|
159
146
|
version: '0'
|
160
|
-
segments:
|
161
|
-
- 0
|
162
|
-
hash: 2284752948071690059
|
163
147
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
-
none: false
|
165
148
|
requirements:
|
166
149
|
- - ! '>='
|
167
150
|
- !ruby/object:Gem::Version
|
168
151
|
version: '0'
|
169
152
|
requirements: []
|
170
153
|
rubyforge_project:
|
171
|
-
rubygems_version:
|
154
|
+
rubygems_version: 2.2.1
|
172
155
|
signing_key:
|
173
|
-
specification_version:
|
156
|
+
specification_version: 4
|
174
157
|
summary: Squash client for JavaScript projects
|
175
158
|
test_files: []
|