Commit 7335d73c authored by Keishi Hattori's avatar Keishi Hattori Committed by Commit Bot

Change web_tests to work without universal access to file urls

To introduce EventLoop concept we can't have AllowUniversalAccessFromFileURLs changing midway, and so we will be making AllowUniversalAccessFromFileURLs false for web_tests by default.

This CL changes iframes with dataurl to srcdoc since srcdoc allows access without AllowUniversalAccessFromFileURLs.

Change-Id: Ic99ca1aaf33c37365caf7d1218f5847fd36c0409
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1531924Reviewed-by: default avatarTaiju Tsuiki <tzik@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Keishi Hattori <keishi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652490}
parent 41ff6162
...@@ -33,6 +33,6 @@ function check_navigator() { ...@@ -33,6 +33,6 @@ function check_navigator() {
} }
</script> </script>
<!-- iframe with some contents --> <!-- iframe with some contents -->
<iframe src="data:text/html,<html></html>" id="subframe"></iframe> <iframe srcdoc="<html></html>" id="subframe"></iframe>
</body> </body>
</html> </html>
...@@ -45,7 +45,7 @@ ...@@ -45,7 +45,7 @@
</head> </head>
<body id="body"> <body id="body">
<a id="a1" href="#">A</a> <a id="a1" href="#">A</a>
<iframe id="iframe1" src="data:text/html,<div>div</div><p>p</p>"></iframe> <iframe id="iframe1" srcdoc="<div>div</div><p>p</p>"></iframe>
<div id="console"></div> <div id="console"></div>
</body> </body>
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<html> <html>
<body> <body>
<script src="../../resources/js-test.js"></script> <script src="../../resources/js-test.js"></script>
<iframe id="frame1" src="data:text/html,<input>" width="800" height="600"></iframe> <iframe id="frame1" srcdoc="<input>" width="800" height="600"></iframe>
<iframe id="frame2" src="data:text/html,<input>" width="800" height="600"></iframe> <iframe id="frame2" srcdoc="<input>" width="800" height="600"></iframe>
<script> <script>
description('Make sure that clicking on an inactive frame clears existing element focus.'); description('Make sure that clicking on an inactive frame clears existing element focus.');
jsTestIsAsync = true; jsTestIsAsync = true;
......
...@@ -6,7 +6,7 @@ function mouseOver() ...@@ -6,7 +6,7 @@ function mouseOver()
{ {
var trouble = document.createElement('iframe'); var trouble = document.createElement('iframe');
trouble.id='trouble'; trouble.id='trouble';
trouble.src="data:text/html,... then into this iframe to crash." trouble.srcdoc="... then into this iframe to crash."
document.getElementById("parentNode").appendChild(trouble); document.getElementById("parentNode").appendChild(trouble);
} }
......
<iframe src="data:text/html,<div id=foo></div>"></iframe> <iframe srcdoc="<div id=foo></div>"></iframe>
<script> <script>
if (window.testRunner) if (window.testRunner)
testRunner.dumpAsText(); testRunner.dumpAsText();
......
...@@ -11,12 +11,13 @@ var innerWindow = ifr.contentWindow; ...@@ -11,12 +11,13 @@ var innerWindow = ifr.contentWindow;
var width = 0; var width = 0;
var height = 0; var height = 0;
innerWindow.onresize = () => {
width = innerWindow.innerWidth;
height = innerWindow.innerHeight;
};
onload = () => { onload = () => {
// Add event listener after the srcdoc has been loaded, but before it is displayed.
innerWindow.onresize = () => {
width = innerWindow.innerWidth;
height = innerWindow.innerHeight;
};
raf2(() => { raf2(() => {
assert_true(innerWindow.innerWidth == 0); assert_true(innerWindow.innerWidth == 0);
assert_true(innerWindow.innerHeight == 0); assert_true(innerWindow.innerHeight == 0);
......
...@@ -11,4 +11,4 @@ function test() { ...@@ -11,4 +11,4 @@ function test() {
} }
} }
</script> </script>
<iframe id="f" onload="test();" src="data:text/html,<body></body>"></iframe> <iframe id="f" onload="test();" srcdoc="<body></body>"></iframe>
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
<html> <html>
<body> <body>
<script src="../../resources/js-test.js"></script> <script src="../../resources/js-test.js"></script>
<iframe id="frame1" src="data:text/html,<input id='input'>" ></iframe> <iframe id="frame1" srcdoc="<input id='input'>" ></iframe>
<iframe id="frame2" src="data:text/html,<div>This is a iframe element</div>"></iframe> <iframe id="frame2" srcdoc="<div>This is a iframe element</div>"></iframe>
<script> <script>
description('Make sure that moving focus on an inactive frame fires blur event on existing element focus.'); description('Make sure that moving focus on an inactive frame fires blur event on existing element focus.');
var doc; var doc;
......
...@@ -3,7 +3,7 @@ test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no ...@@ -3,7 +3,7 @@ test for BidiRun leaks as reported in rdar://problem/4987649. Its layout has no
particular meaning. particular meaning.
</p> </p>
<div><input type='file' id='input'></input></div> <div><input type='file' id='input'></input></div>
<iframe id='iframe' src="data:text/html,<input type='file' id='input'></input>"></iframe> <iframe id='iframe' srcdoc="<input type='file' id='input'></input>"></iframe>
<script> <script>
window.onload = function main() window.onload = function main()
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml"> <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<p>This is <a id="start" href="a">link_1</a>.</p> <p>This is <a id="start" href="a">link_1</a>.</p>
<br>This is <iframe id="1" width=0 height=0 src="data:text/html, <br>This is <iframe id="1" width=0 height=0 srcdoc="
<body> <body>
<a id='11' href='http://a'>b</a> <a id='11' href='http://a'>b</a>
<a id='12' href='http://a'>c</a> <a id='12' href='http://a'>c</a>
......
...@@ -37,7 +37,7 @@ ...@@ -37,7 +37,7 @@
<body id="some-content" xmlns="http://www.w3.org/1999/xhtml"> <body id="some-content" xmlns="http://www.w3.org/1999/xhtml">
<p>This is <a id="start" href="a">link_1</a>.</p> <p>This is <a id="start" href="a">link_1</a>.</p>
<br>This is <iframe id="1" width=100 height=100 style="display:none" src="data:text/html, <br>This is <iframe id="1" width=100 height=100 style="display:none" srcdoc="
<body> <body>
<a id='11' href='http://a'>b</a> <a id='11' href='http://a'>b</a>
<a id='12' href='http://a'>c</a> <a id='12' href='http://a'>c</a>
......
<div><a id="start" href="a">a</a></div> <div><a id="start" href="a">a</a></div>
<iframe id="frameA" width="80" height="80" scrolling="auto" src="data:text/html, <iframe id="frameA" width="80" height="80" scrolling="auto" srcdoc="
<body id='frameAbody'> <body id='frameAbody'>
<img width=120 height=200 src='resources/green.png'> <img width=120 height=200 src='resources/green.png'>
</body> </body>
"></iframe><br> "></iframe><br>
<iframe id="frameB" scrolling="auto" src="data:text/html, <iframe id="frameB" scrolling="auto" srcdoc="
<body id='frameBbody'> <body id='frameBbody'>
<img width=120 height=200 src='resources/green.png'> <img width=120 height=200 src='resources/green.png'>
</body> </body>
......
<div><a id="start" href="">a</a></div> <div><a id="start" href="">a</a></div>
<iframe id="frameA" src="data:text/html, <iframe id="frameA" srcdoc="
<body id='frameAbody'> <body id='frameAbody'>
<a id='b' href=''>b</a><br> <a id='b' href=''>b</a><br>
<a id='c' href=''>c</a><br> <a id='c' href=''>c</a><br>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
</body> </body>
"></iframe><br> "></iframe><br>
<iframe id="frameB" src="data:text/html, <iframe id="frameB" srcdoc="
<body id='frameBbody'> <body id='frameBbody'>
<a id='g' href=''>g</a> <a id='g' href=''>g</a>
<a id='h' href=''>h</a> <a id='h' href=''>h</a>
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
<a id="start" href="">Link</a><br> <a id="start" href="">Link</a><br>
</td> </td>
<td valign="top"> <td valign="top">
<iframe id="frameA" width="50%" height="100px" frameborder="1" src="data:text/html, <iframe id="frameA" width="50%" height="100px" frameborder="1" srcdoc="
<body id='frameAbody'> <body id='frameAbody'>
<a id='b' href=''>b</a> <a id='b' href=''>b</a>
<a id='c' href=''>c</a> <a id='c' href=''>c</a>
......
<div><a id="start" href="a"><img src="resources/green.png" width=30 height=30></a></div> <div><a id="start" href="a"><img src="resources/green.png" width=30 height=30></a></div>
<iframe id="frameA" width="80" height="80" scrolling="auto" src="data:text/html, <iframe id="frameA" width="80" height="80" scrolling="auto" srcdoc="
<body id='frameAbody'> <body id='frameAbody'>
<a id='1' href='a'><img src='no_image' width=30 height=30></a> <a id='1' href='a'><img src='no_image' width=30 height=30></a>
<div> <div>
......
<a id="start" href="#">Start</a><br> <a id="start" href="#">Start</a><br>
<iframe id="frameA" src="data:text/html, <iframe id="frameA" srcdoc="
<body id='frameAbody'> <body id='frameAbody'>
<a id='a' href='%23' style='margin-left: 125px'>a</a> <a id='a' href='%23' style='margin-left: 125px'>a</a>
</body>" </body>"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment