| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <!-- This page can create whatever iframe structure you want, across whatever | 2 <!-- This page can create whatever iframe structure you want, across whatever |
| 3 sites you want. This is useful for testing site isolation. | 3 sites you want. This is useful for testing site isolation. |
| 4 | 4 |
| 5 Example usage in a browsertest, explained: | 5 Example usage in a browsertest, explained: |
| 6 | 6 |
| 7 GURL url = embedded_test_server()-> | 7 GURL url = embedded_test_server()-> |
| 8 GetURL("a.com", "/cross_site_iframe_factory.html?a(b(c,d))"); | 8 GetURL("a.com", "/cross_site_iframe_factory.html?a(b(c,d))"); |
| 9 | 9 |
| 10 When you navigate to the above URL, the outer document (on a.com) will create a | 10 When you navigate to the above URL, the outer document (on a.com) will create a |
| 11 single iframe: | 11 single iframe: |
| 12 | 12 |
| 13 <iframe src="http://b.com:1234/cross_site_iframe_factory.html?b(c(),d())"> | 13 <iframe src="http://b.com:1234/cross_site_iframe_factory.html?b(c(),d())"> |
| 14 | 14 |
| 15 Inside of which, then, are created the two leaf iframes: | 15 Inside of which, then, are created the two leaf iframes: |
| 16 | 16 |
| 17 <iframe src="http://c.com:1234/cross_site_iframe_factory.html?c()"> | 17 <iframe src="http://c.com:1234/cross_site_iframe_factory.html?c()"> |
| 18 <iframe src="http://d.com:1234/cross_site_iframe_factory.html?d()"> | 18 <iframe src="http://d.com:1234/cross_site_iframe_factory.html?d()"> |
| 19 | 19 |
| 20 To make this page work, your browsertest needs a MockHostResolver, like: | 20 To make this page work, your browsertest needs a MockHostResolver, like: |
| 21 | 21 |
| 22 void SetUpOnMainThread() override { | 22 void SetUpOnMainThread() override { |
| 23 host_resolver()->AddRule("*", "127.0.0.1"); | 23 host_resolver()->AddRule("*", "127.0.0.1"); |
| 24 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 24 ASSERT_TRUE(embedded_test_server()->Start()); |
| 25 } | 25 } |
| 26 | 26 |
| 27 You can play around with the arguments by loading this page via file://, but | 27 You can play around with the arguments by loading this page via file://, but |
| 28 you probably won't get the same process behavior as if you loaded via http. --> | 28 you probably won't get the same process behavior as if you loaded via http. --> |
| 29 <head> | 29 <head> |
| 30 <title>Cross-site iframe factory</title> | 30 <title>Cross-site iframe factory</title> |
| 31 <style> | 31 <style> |
| 32 body { | 32 body { |
| 33 font-family: Sans-Serif; | 33 font-family: Sans-Serif; |
| 34 text-align: center; | 34 text-align: center; |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 iframe.style.borderColor = borderColorForSite(site); | 161 iframe.style.borderColor = borderColorForSite(site); |
| 162 iframe.width = frameTree.children[i].layoutX; | 162 iframe.width = frameTree.children[i].layoutX; |
| 163 iframe.height = frameTree.children[i].layoutY; | 163 iframe.height = frameTree.children[i].layoutY; |
| 164 document.body.appendChild(iframe); | 164 document.body.appendChild(iframe); |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 | 167 |
| 168 main(); | 168 main(); |
| 169 </script> | 169 </script> |
| 170 </body></html> | 170 </body></html> |
| OLD | NEW |