Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / http / tests / security / object-literals.html
blobd09ee38b43c3239db813571b6318279729b70b6f
1 <html>
2 <body>
3 <head>
4 <script>
5 if (window.testRunner) {
6 testRunner.dumpAsText();
7 testRunner.waitUntilDone();
10 function log(msg) {
11 var div = document.createElement('div');
12 div.appendChild(document.createTextNode(msg));
13 document.getElementById('console').appendChild(div);
16 window.addEventListener('message', function (e) {
17 switch(e.data) {
18 case 'ready':
19 // Call the function stored from the old iframe content.
20 setTimeout(ready_callback, 0);
21 break;
22 case 'done':
23 if (window.testRunner)
24 testRunner.notifyDone();
25 break;
26 default:
27 log(e.data);
28 break;
30 }, false);
32 var stored_function = function() {
33 log('FAIL: Original function called.');
36 function set_function(f) {
37 // Store function in old_function.
38 stored_function = f;
39 // Change the source of the iframe.
40 frames[0].location =
41 "http://localhost:8000/security/resources/object-literals-cross-origin.html";
44 function ready_callback() {
45 stored_function();
46 frames[0].postMessage('go', '*');
48 </script>
49 </head>
50 <iframe src="resources/object-literals-same-origin.html"></iframe>
51 <div id="console">
52 </div>
53 </body>
54 </html>