File tree Expand file tree Collapse file tree 2 files changed +28
-20
lines changed Expand file tree Collapse file tree 2 files changed +28
-20
lines changed Original file line number Diff line number Diff line change @@ -1387,21 +1387,6 @@ Raven.prototype = {
1387
1387
} ,
1388
1388
1389
1389
_normalizeFrame : function ( frame , stackInfoUrl ) {
1390
- if ( ! frame . url ) {
1391
- // Case when we don't have any information about the error
1392
- // E.g. throwing a string or raw object in Firefox
1393
- // Generating synthetic error doesn't add any value here
1394
- //
1395
- // We should probably somehow let user know that he should fix his code
1396
- return {
1397
- filename : stackInfoUrl , // fallback to whole stacks url from onerror handler
1398
- lineno : frame . line ,
1399
- colno : frame . column ,
1400
- function : frame . func || '?' , // if we dont have a file url, we most likely won't have a function name either
1401
- in_app : true // this will always come from the user's code
1402
- } ;
1403
- }
1404
-
1405
1390
// normalize the frames data
1406
1391
var normalized = {
1407
1392
filename : frame . url ,
@@ -1410,6 +1395,15 @@ Raven.prototype = {
1410
1395
function : frame . func || '?'
1411
1396
} ;
1412
1397
1398
+ // Case when we don't have any information about the error
1399
+ // E.g. throwing a string or raw object, instead of an `Error` in Firefox
1400
+ // Generating synthetic error doesn't add any value here
1401
+ //
1402
+ // We should probably somehow let a user know that they should fix their code
1403
+ if ( ! frame . url ) {
1404
+ normalized . filename = stackInfoUrl ; // fallback to whole stacks url from onerror handler
1405
+ }
1406
+
1413
1407
normalized . in_app = ! // determine if an exception came from outside of our app
1414
1408
// first we check the global includePaths list.
1415
1409
(
Original file line number Diff line number Diff line change 38
38
} ;
39
39
} ( ) ) ;
40
40
41
- // Custom event factories for cross-browser compatibility
42
-
41
+ /**
42
+ * Custom event factories for cross-browser compatibility
43
+ *
44
+ * Gecko browsers are using non-standard `initKeyEvent`, where others implemented `initKeyboardEvent`.
45
+ * To make it more consistent, we try to use standardized `MouseEvent`/`KeyboardEvent` now
46
+ * and fallback to older implementations for legacy browsers only.
47
+ *
48
+ * See deprecation notes:
49
+ * https://developer.mozilla.org/en-US/docs/Web/API/Document/createEvent
50
+ * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyEvent
51
+ * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/initKeyboardEvent
52
+ *
53
+ * References:
54
+ * https://developer.mozilla.org/en-US/docs/Web/API/MouseEvent#Specifications
55
+ * https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent#Specifications
56
+ */
43
57
function createMouseEvent ( options ) {
44
58
var options = {
45
59
bubbles : true ,
62
76
}
63
77
}
64
78
65
- function createKeyboardEvent ( key = 'a' ) {
79
+ function createKeyboardEvent ( key ) {
66
80
var options = {
67
81
bubbles : true ,
68
82
cancelable : true ,
69
83
view : window ,
70
- key : key ,
71
- charCode : key . charCodeAt ( )
84
+ key : key || 'a'
72
85
}
86
+ options . charCode = options . key . charCodeAt ( ) ;
73
87
74
88
if ( 'KeyboardEvent' in window ) {
75
89
return new KeyboardEvent ( 'keypress' , options ) ;
You can’t perform that action at this time.
0 commit comments