Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(34)

Side by Side Diff: chrome/test/data/extensions/api_test/webstore_private/noframe2.html

Issue 10959032: Protect the entire webstore origin, not just the webstore path, with XFO. Follow-up to crrev.com/1… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <body onload="dropFrame()">
3 This represents not an extension, but an HTML page within an untrusted
4 origin (127.0.0.1).
5 <script>
6 var interval_id = -1;
7 var check_count = 0;
8 function dropFrame() {
9 var s = location.href.toString();
10 if (s.indexOf('127.0.0.1') > 0) {
11 // try to frame a copy of an error page from the webstore origin, but
12 // not under the webstore root directory. The server does not send
13 // an x-frame-options header for the error page.
14 var f = document.createElement('iframe');
15 s = s.replace('127.0.0.1', 'www.example.com');
16 s = s.replace('/files/', '/nonesuch/');
17 f.src = s;
18 f.onload = checkFrame;
19 f.onerror = checkFrame;
20 document.body.appendChild(f);
21 // There's an open issue in WK where neither onload or onerror fires
22 // when interrupted by XFO, so use a setInterval() workaround. Remove
23 // this workaround when resolved, but in the mean time, mark the test
24 // FLAKY, because there is no reason to believe the server will respond
25 // within the time frame.
26 interval_id = setInterval("checkFrame()", 500);
27 }
28 }
29
30 function checkFrame() {
31 try {
32 // If the frame was blocked, we instead have an about:blank frame which we
33 // can access.
34 x = window.frames[0].document.location.href;
35 document.title = 'PASS: ' + x;
36 clearInterval(interval_id);
37 }
38 catch (e) {
39 // Frame was not yet blocked, so we have no access.
40 if (++check_count > 40) {
41 document.title = 'FAIL';
42 clearInterval(interval_id);
43 }
44 }
45 }
46 </script>
47 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698