Skip to content

Commit 0a0ead1

Browse files
author
homyakov
committed
Show userAgent on page
1 parent d931f80 commit 0a0ead1

1 file changed

Lines changed: 54 additions & 47 deletions

File tree

test/ExceptionLab.html

Lines changed: 54 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,65 @@
11
<!DOCTYPE html>
22
<html>
3-
<head>
4-
<meta charset="UTF-8" />
5-
<title>Exception Lab</title>
6-
<style>
7-
#info {
8-
height: 25em;
9-
width: 100%;
10-
}
11-
</style>
12-
<script src="ExceptionLab.js"></script>
13-
<script>
14-
function dumpException(ex) {
15-
ex = ex || new Error("Default error");
16-
var text = "{\n " + getExceptionProps(ex).join(",\n ") + "\n}";
17-
document.getElementById("info").innerHTML = text;
18-
}
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>Exception Lab</title>
6+
<style>
7+
#info {
8+
height: 25em;
9+
width: 100%;
10+
}
11+
</style>
12+
<script src="ExceptionLab.js"></script>
13+
<script>
14+
document.getElementById("userAgent").innerHTML = navigator.userAgent;
1915

20-
function dumpException1() {
21-
dumpException();
22-
}
16+
function dumpException(ex) {
17+
ex = ex || new Error("Default error");
18+
var text = "{\n " + getExceptionProps(ex).join(",\n ") + "\n}";
19+
document.getElementById("info").innerHTML = text;
20+
}
2321

24-
function dumpException2() {
25-
try {
26-
undef();
27-
} catch(ex) {
28-
dumpException(ex);
22+
function dumpException1() {
23+
dumpException();
2924
}
30-
}
3125

32-
function dumpException3() {
33-
dumpException((function(x) {
26+
function dumpException2() {
3427
try {
35-
x.undef();
36-
} catch(ex) {
37-
return ex;
28+
undef();
29+
} catch (ex) {
30+
dumpException(ex);
3831
}
39-
})(null));
40-
}
32+
}
4133

42-
function createException4() {
43-
return createException();
44-
}
34+
function dumpException3() {
35+
dumpException((function(x) {
36+
try {
37+
x.undef();
38+
} catch (ex) {
39+
return ex;
40+
}
41+
})(null));
42+
}
4543

46-
function dumpException4() {
47-
dumpException(createException4());
48-
}
49-
</script>
50-
</head>
51-
<body>
52-
<textarea id="info">Info</textarea><br />
53-
<button onclick="dumpException1();">Exception 1</button>
54-
<button onclick="dumpException2();">Exception 2</button>
55-
<button onclick="dumpException3();">Exception 3</button>
56-
<button onclick="dumpException4();">Exception 4</button>
57-
</body>
44+
function createException4() {
45+
return createException();
46+
}
47+
48+
function dumpException4() {
49+
dumpException(createException4());
50+
}
51+
</script>
52+
</head>
53+
<body>
54+
<span id="userAgent">userAgent</span>
55+
<script>
56+
document.getElementById("userAgent").innerHTML = navigator.userAgent;
57+
</script>
58+
<textarea id="info">Info</textarea>
59+
<br/>
60+
<button onclick="dumpException1();">Exception 1</button>
61+
<button onclick="dumpException2();">Exception 2</button>
62+
<button onclick="dumpException3();">Exception 3</button>
63+
<button onclick="dumpException4();">Exception 4</button>
64+
</body>
5865
</html>

0 commit comments

Comments
 (0)