/
history-username-password.html
96 lines (83 loc) · 2.77 KB
/
history-username-password.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.setCanOpenWindows();
testRunner.waitUntilDone();
}
function log(msg)
{
document.getElementById("logger").innerHTML += msg + "<br>";
}
function testHistoryObject(historyToTest)
{
try {
historyToTest.replaceState(null, "Phishy Title", location.protocol + "//www.webkit.org" + "@" + location.host);
log("replaceState with username worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.replaceState(null, "Phishy Title", location.protocol + "//:www.webkit.org" + "@" + location.host);
log("replaceState with password worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.replaceState(null, "Phishy Title", location.protocol + "//www.webkit:org" + "@" + location.host);
log("replaceState with username and password worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.replaceState(null, "Phishy Title", "blob:" + location.protocol + "//www.webkit:org" + "@" + location.host);
log("replaceState with username and password worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.pushState(null, "Phishy Title", location.protocol + "//www.webkit.org" + "@" + location.host);
log("pushState with username worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.pushState(null, "Phishy Title", location.protocol + "//:www.webkit.org" + "@" + location.host);
log("pushState with password worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.pushState(null, "Phishy Title", location.protocol + "//www.webkit:org" + "@" + location.host);
log("pushState with username and password worked, shouldn't have.");
} catch(e) {
log(e);
}
try {
historyToTest.pushState(null, "Phishy Title", "blob:" + location.protocol + "//www.webkit:org" + "@" + location.host);
log("pushState with username and password worked, shouldn't have.");
} catch(e) {
log(e);
}
}
function clicked()
{
newWindow = window.open('','newWindow');
testHistoryObject(newWindow.history);
if (window.testRunner)
testRunner.notifyDone();
}
function loaded()
{
testHistoryObject(window.history);
if (window.eventSender) {
var button = document.getElementById("theButton");
eventSender.mouseMoveTo(button.offsetLeft + 5, button.offsetTop + 5);
eventSender.mouseDown();
eventSender.mouseUp();
}
}
</script>
<body onload="loaded();">
<button id="theButton" onclick="clicked();">Click to test in new window</button>
<div id="logger"></div>
</body>