forked from bugsnag/bugsnag-js
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsmoke.html
72 lines (58 loc) · 2.12 KB
/
smoke.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
<!DOCTYPE html>
<body>
<h1>Smoke test</h1>
<p>To pass fully the screen must go yellow, then aqua automatically, then dark green on click.</p>
<p>IE 6/7/8 should go beige, then aqua automatically, then light green on click. Because they don't support intercepting events (but they do support stacktraces).</p>
<p>IE 9 should go beige, skip aqua, and then go bright green. Because it doesn't support multiline stack-traces</p>
<p>N.B. if load times are slow on IE 9/10/11, try running it from a different directory.</p>
<hr/>
<script>BUGSNAG_TESTING = true;</script>
<script src="../src/bugsnag.js" data-apikey="a60409cf3d6fa1f8ac9906fe88364aa2"></script>
<script src="http://code.jquery.com/jquery-1.10.2.js"></script>
<script>
function alphabet() {
throw new Error("by gum");
}
function soup() {
alphabet();
}
function spaghetti() {
alphabet();
}
function ordering() {
alphabet();
}
function logPre(data) {
$('<pre>').text(data).appendTo('body');
}
Bugsnag.testRequest = function (url, data) {
if (window.JSON) {
logPre(JSON.stringify(data, null, 4));
} else {
logPre($.param(data));
}
logPre(data.stacktrace);
if (data.metaData && data.metaData.Event && data.stacktrace.match(/soup/)
) {
document.body.style.backgroundColor = 'yellow';
} else if (data.stacktrace.match(/spaghetti/)) {
document.body.style.backgroundColor = 'aqua';
} else if (data.metaData && data.metaData.Event && data.metaData.Event.target && data.stacktrace.match(/ordering/)) {
document.body.style.backgroundColor = 'green';
} else if (data.stacktrace.match(/soup/) || (data.stacktrace.match(/alphabet/) && data.metaData && data.metaData.Event && data.metaData.Event.type == "DOMContentLoaded")) {
document.body.style.backgroundColor = 'beige';
} else if (data.stacktrace.match(/ordering/) || (data.stacktrace.match(/alphabet/) && data.metaData && data.metaData.Event && data.metaData.Event.type == "click")) {
document.body.style.backgroundColor = '#0F0';
}
};
$(function () {
setTimeout(function () {
spaghetti();
}, 500);
$('body').click(function () {
ordering();
});
soup();
});
</script>
</body>