| Index: chrome/test/data/extensions/platform_apps/web_view/shim/main.js
|
| diff --git a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
|
| index ddabbcd9030fb80066bfd819e024afe440da5e38..28869d19f19d6c57654bfa835a3fc8a1ede5e2e5 100644
|
| --- a/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
|
| +++ b/chrome/test/data/extensions/platform_apps/web_view/shim/main.js
|
| @@ -430,6 +430,28 @@ function testChromeExtensionRelativePath() {
|
| document.body.appendChild(webview);
|
| }
|
|
|
| +// This test verifies that guests are blocked from navigating the webview to a
|
| +// data URL.
|
| +function testContentInitiatedNavigationToDataUrlBlocked() {
|
| + var navUrl = "data:text/html,foo";
|
| + var webview = document.createElement('webview');
|
| + webview.addEventListener('consolemessage', function(e) {
|
| + if (e.message.startsWith(
|
| + 'Not allowed to top-level navigate to resource:')) {
|
| + embedder.test.succeed();
|
| + }
|
| + });
|
| + webview.addEventListener('loadstop', function(e) {
|
| + if (webview.getAttribute('src') == navUrl) {
|
| + embedder.test.fail();
|
| + }
|
| + });
|
| + webview.setAttribute('src',
|
| + 'data:text/html,<script>window.location.href = "' + navUrl +
|
| + '";</scr' + 'ipt>');
|
| + document.body.appendChild(webview);
|
| +}
|
| +
|
| // Tests that a <webview> that starts with "display: none" style loads
|
| // properly.
|
| function testDisplayNoneWebviewLoad() {
|
| @@ -3052,6 +3074,8 @@ embedder.test.testList = {
|
| 'testAPIMethodExistence': testAPIMethodExistence,
|
| 'testChromeExtensionURL': testChromeExtensionURL,
|
| 'testChromeExtensionRelativePath': testChromeExtensionRelativePath,
|
| + 'testContentInitiatedNavigationToDataUrlBlocked':
|
| + testContentInitiatedNavigationToDataUrlBlocked,
|
| 'testDisplayNoneWebviewLoad': testDisplayNoneWebviewLoad,
|
| 'testDisplayNoneWebviewRemoveChild': testDisplayNoneWebviewRemoveChild,
|
| 'testInlineScriptFromAccessibleResources':
|
|
|