Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / chrome / test / data / extensions / api_test / webstore_private / noframe.html
blob0d89f611222eabd80a35c56cd154f6e50d2929cd
1 <!DOCTYPE html>
2 <body onload="dropFrame()">
3 This represents not an extension, but an HTML page within the test harness
4 webstore origin (www.example.com), for which the response headers have been
5 misconfigured to allow framing by the 127.0.0.1 origin.
6 <script>
7 var interval_id = -1;
8 var check_count = 0;
9 function dropFrame() {
10 var s = location.href.toString();
11 if (s.indexOf('127.0.0.1') > 0) {
12 // try to frame a copy of ourselves from the webstore origin.
13 var f = document.createElement('iframe');
14 f.src = s.replace('127.0.0.1', 'www.example.com');
15 f.onload = checkFrame;
16 f.onerror = checkFrame;
17 document.body.appendChild(f);
18 // There's an open issue in WK where neither onload or onerror fires
19 // when interrupted by XFO, so use a setInterval() workaround. Remove
20 // this workaround when resolved, but in the mean time, mark the test
21 // FLAKY, because there is no reason to believe the server will respond
22 // within the time frame.
23 interval_id = setInterval("checkFrame()", 500);
27 function checkFrame() {
28 try {
29 // If the frame was blocked, we instead have an about:blank frame which we
30 // can access.
31 x = window.frames[0].document.location.href;
32 document.title = 'PASS: ' + x;
33 clearInterval(interval_id);
35 catch (e) {
36 // Frame was not yet blocked, so we have no access.
37 if (++check_count > 40) {
38 document.title = 'FAIL';
39 clearInterval(interval_id);
43 </script>
44 </html>