1 var truealert
= window
.alert
; // we overwrite window.alert sometimes
3 // Walk up the caller chain and try to find a reference to the Inspector's window
5 var obj
= doAttack
.caller
;
7 i
< 1000 && (obj
.arguments
.length
== 0 || !obj
.arguments
[0].target
);
11 if (i
== 1000) return;
12 var win
= obj
.arguments
[0].target
.ownerDocument
.defaultView
;
17 var xhr
= new win
.XMLHttpRequest();
18 var url
= prompt("Test failed. To prove it, I'm going " +
19 "to make a cross-domain XMLHttpRequest. Where " +
20 "would you like me to send it?\n\nHint: You can " +
21 "also try a file:// URL.", "http://www.example.com/");
22 xhr
.open("GET", url
, false);
24 truealert("Result:\n\n" + xhr
.responseText
);
27 function instructions(params
) {
28 var str
= "<p>This test tries to make a cross-domain XMLHttpRequest to " +
29 "check whether JavaScript object wrappers are working (bug 16837, bug 16011).</p>" +
30 "<p>View this page from an http:// URL to ensure that it's in a different " +
31 "origin from the Inspector.</p>" +
32 "<p>Instructions:</p>" +
34 "<li>Right click the box" +
35 "<img id=logo src='../resources/webkit-background.png'" +
36 "style='border: 1px solid black; display: block; margin: 1em;'>" +
37 "<li>Choose \"Inspect Element\" from the context menu";
39 str
+= "<li>Select the Console";
40 str
+= "<li>Type " + params
.trigger
+ " into the console and hit Enter";
42 str
+= "<li>" + params
.trigger
;
44 str
+= "<li>If the test failed, a prompt will appear.</ol>";