| 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 489cb875d574ecc388177283837210eb64688bac..35d6af17661c83984c5b1a6688bdf193d3b65387 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
|
| @@ -47,13 +47,18 @@ util.createWebViewTagInDOM = function(partitionName) {
|
| var webview = document.createElement('webview');
|
| webview.style.width = '300px';
|
| webview.style.height = '200px';
|
| - var urlDummy = 'data:text/html,<body>Initial dummy guest</body>';
|
| + var urlDummy = util.createDataUrl('<body>Initial dummy guest</body>');
|
| webview.setAttribute('src', urlDummy);
|
| webview.setAttribute('partition', partitionName);
|
| document.body.appendChild(webview);
|
| return webview;
|
| };
|
|
|
| +// Creates a data: URL correctly escaping the html content.
|
| +util.createDataUrl = function(html) {
|
| + return 'data:text/html,' + encodeURIComponent(html);
|
| +};
|
| +
|
| embedder.test = {};
|
| embedder.test.succeed = function() {
|
| chrome.test.sendMessage('DoneShimTest.PASSED');
|
| @@ -105,7 +110,8 @@ function testAutosizeBeforeNavigation() {
|
| embedder.test.succeed();
|
| });
|
|
|
| - webview.setAttribute('src', 'data:text/html,webview test sizechanged event');
|
| + webview.setAttribute('src',
|
| + util.createDataUrl('webview test sizechanged event'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -159,7 +165,8 @@ function testAutosizeAfterNavigation() {
|
|
|
| webview.style.width = '50px';
|
| webview.style.height = '100px';
|
| - webview.setAttribute('src', 'data:text/html,webview test sizechanged event');
|
| + webview.setAttribute('src',
|
| + util.createDataUrl('webview test sizechanged event'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -218,7 +225,7 @@ function testAutosizeWithPartialAttributes() {
|
|
|
| webview.style.width = '640px';
|
| webview.style.height = '480px';
|
| - webview.setAttribute('src', 'data:text/html,webview check autosize');
|
| + webview.setAttribute('src', util.createDataUrl('webview check autosize'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -265,7 +272,7 @@ function testAutosizeRemoveAttributes() {
|
|
|
| webview.style.width = '640px';
|
| webview.style.height = '480px';
|
| - webview.setAttribute('src', 'data:text/html,webview check autosize');
|
| + webview.setAttribute('src', util.createDataUrl('webview check autosize'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -295,7 +302,7 @@ function testAPIMethodExistence() {
|
| typeof webview.contentWindow.postMessage);
|
| embedder.test.succeed();
|
| });
|
| - webview.setAttribute('src', 'data:text/html,webview check api');
|
| + webview.setAttribute('src', util.createDataUrl('webview check api'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -357,7 +364,7 @@ function testWebRequestAPIExistence() {
|
|
|
| embedder.test.succeed();
|
| });
|
| - webview.setAttribute('src', 'data:text/html,webview check api');
|
| + webview.setAttribute('src', util.createDataUrl('webview check api'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -381,7 +388,7 @@ function testEventName() {
|
| embedder.test.succeed();
|
| });
|
|
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -409,10 +416,10 @@ function testOnEventProperties() {
|
| embedder.test.succeed();
|
| };
|
|
|
| - webview.setAttribute('src', 'data:text/html,next navigation');
|
| + webview.setAttribute('src', util.createDataUrl('next navigation'));
|
| });
|
|
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -430,7 +437,7 @@ function testLoadProgressEvent() {
|
| progress = evt.progress;
|
| });
|
|
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -440,7 +447,7 @@ function testLoadProgressEvent() {
|
| // fire without crashing.
|
| function testDestroyOnEventListener() {
|
| var webview = util.createWebViewTagInDOM(arguments.callee.name);
|
| - var url = 'data:text/html,<body>Destroy test</body>';
|
| + var url = util.createDataUrl('<body>Destroy test</body>');
|
|
|
| var loadCommitCount = 0;
|
| function loadCommitCommon(e) {
|
| @@ -473,7 +480,7 @@ function testDestroyOnEventListener() {
|
| // which should not be possible.
|
| function testCannotMutateEventName() {
|
| var webview = util.createWebViewTagInDOM(arguments.callee.name);
|
| - var url = 'data:text/html,<body>Two</body>';
|
| + var url = util.createDataUrl('<body>Two</body>');
|
|
|
| var loadCommitACalled = false;
|
| var loadCommitBCalled = false;
|
| @@ -521,7 +528,7 @@ function testCannotMutateEventName() {
|
| function testPartitionRaisesException() {
|
| var webview = document.createElement('webview');
|
| webview.setAttribute('partition', arguments.callee.name);
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| setTimeout(function() {
|
| try {
|
| @@ -561,7 +568,7 @@ function testExecuteScript() {
|
| embedder.test.succeed();
|
| });
|
| });
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -590,20 +597,20 @@ function testTerminateAfterExit() {
|
| // webview.terminate() caused a browser crash.
|
| setTimeout(function() {
|
| loadstopSucceedsTest = true;
|
| - webview.setAttribute('src', 'data:text/html,test second page');
|
| + webview.setAttribute('src', util.createDataUrl('test second page'));
|
| }, 0);
|
| });
|
|
|
| - webview.setAttribute('src', 'data:text/html,test terminate() crash.');
|
| + webview.setAttribute('src', util.createDataUrl('test terminate() crash.'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| // This test verifies that multiple consecutive changes to the <webview> src
|
| // attribute will cause a navigation.
|
| function testNavOnConsecutiveSrcAttributeChanges() {
|
| - var testPage1 = 'data:text/html,test page 1';
|
| - var testPage2 = 'data:text/html,test page 2';
|
| - var testPage3 = 'data:text/html,test page 3';
|
| + var testPage1 = util.createDataUrl('test page 1');
|
| + var testPage2 = util.createDataUrl('test page 2');
|
| + var testPage3 = util.createDataUrl('test page 3');
|
| var webview = new WebView();
|
| webview.partition = arguments.callee.name;
|
| var loadCommitCount = 0;
|
| @@ -625,9 +632,9 @@ function testNavOnConsecutiveSrcAttributeChanges() {
|
| // This test verifies that we can set the <webview> src multiple times and the
|
| // changes will cause a navigation.
|
| function testNavOnSrcAttributeChange() {
|
| - var testPage1 = 'data:text/html,test page 1';
|
| - var testPage2 = 'data:text/html,test page 2';
|
| - var testPage3 = 'data:text/html,test page 3';
|
| + var testPage1 = util.createDataUrl('test page 1');
|
| + var testPage2 = util.createDataUrl('test page 2');
|
| + var testPage3 = util.createDataUrl('test page 3');
|
| var tests = [testPage1, testPage2, testPage3];
|
| var webview = new WebView();
|
| webview.partition = arguments.callee.name;
|
| @@ -664,16 +671,16 @@ function testAssignSrcAfterCrash() {
|
| });
|
| webview.addEventListener('exit', function(evt) {
|
| terminated = true;
|
| - webview.setAttribute('src', 'data:text/html,test page');
|
| + webview.setAttribute('src', util.createDataUrl('test page'));
|
| });
|
| - webview.setAttribute('src', 'data:text/html,test page');
|
| + webview.setAttribute('src', util.createDataUrl('test page'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| // This test verifies that <webview> reloads the page if the src attribute is
|
| // assigned the same value.
|
| function testReassignSrcAttribute() {
|
| - var dataUrl = 'data:text/html,test page';
|
| + var dataUrl = util.createDataUrl('test page');
|
| var webview = new WebView();
|
| webview.partition = arguments.callee.name;
|
|
|
| @@ -697,7 +704,7 @@ function testReassignSrcAttribute() {
|
| // This test verifies that <webview> restores the src attribute if it is
|
| // removed after navigation.
|
| function testRemoveSrcAttribute() {
|
| - var dataUrl = 'data:text/html,test page';
|
| + var dataUrl = util.createDataUrl('test page');
|
| var webview = document.createElement('webview');
|
| webview.setAttribute('partition', arguments.callee.name);
|
| var terminated = false;
|
| @@ -750,9 +757,9 @@ function testPluginLoadPermission() {
|
| embedder.test.assertEq('function', typeof e.request.deny);
|
| embedder.test.succeed();
|
| });
|
| - webview.setAttribute('src', 'data:text/html,<body>' +
|
| + webview.setAttribute('src', util.createDataUrl('<body>' +
|
| '<embed type="application/x-ppapi-tests">' +
|
| - '</embed></body>');
|
| + '</embed></body>'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -847,7 +854,7 @@ function testContentLoadEvent() {
|
| webview.addEventListener('contentload', function(e) {
|
| embedder.test.succeed();
|
| });
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| @@ -903,7 +910,7 @@ function testWebRequestListenerSurvivesReparenting() {
|
| // value corresponding to the processId of the guest process.
|
| function testGetProcessId() {
|
| var webview = document.createElement('webview');
|
| - webview.setAttribute('src', 'data:text/html,trigger navigation');
|
| + webview.setAttribute('src', util.createDataUrl('trigger navigation'));
|
| var firstLoad = function() {
|
| webview.removeEventListener('loadstop', firstLoad);
|
| embedder.test.assertTrue(webview.getProcessId() > 0);
|
| @@ -1006,7 +1013,7 @@ function testLoadAbortIllegalJavaScriptURL() {
|
|
|
| // This test verifies that the reload method on webview functions as expected.
|
| function testReload() {
|
| - var triggerNavUrl = 'data:text/html,trigger navigation';
|
| + var triggerNavUrl = util.createDataUrl('trigger navigation');
|
| var webview = document.createElement('webview');
|
|
|
| var loadCommitCount = 0;
|
| @@ -1035,7 +1042,7 @@ function testReload() {
|
| window.removeWebviewOnExitDoCrash = null;
|
|
|
| function testRemoveWebviewOnExit() {
|
| - var triggerNavUrl = 'data:text/html,trigger navigation';
|
| + var triggerNavUrl = util.createDataUrl('trigger navigation');
|
| var webview = document.createElement('webview');
|
|
|
| webview.addEventListener('loadstop', function(e) {
|
| @@ -1063,7 +1070,7 @@ function testRemoveWebviewOnExit() {
|
| function testRemoveWebviewAfterNavigation() {
|
| var webview = new WebView();
|
| document.body.appendChild(webview);
|
| - webview.src = 'data:text/html,trigger navigation';
|
| + webview.src = util.createDataUrl('trigger navigation');
|
| document.body.removeChild(webview);
|
| setTimeout(function() {
|
| embedder.test.succeed();
|
| @@ -1081,12 +1088,13 @@ function testNavigationToExternalProtocol() {
|
| code: 'window.location.href = "tel:+12223334444";'
|
| }, function(results) {});
|
| });
|
| - webview.setAttribute('src', 'data:text/html,navigate to external protocol');
|
| + webview.setAttribute('src',
|
| + util.createDataUrl('navigate to external protocol'));
|
| document.body.appendChild(webview);
|
| }
|
|
|
| function testResizeWebviewResizesContent() {
|
| - var triggerNavUrl = 'data:text/html,trigger navigation';
|
| + var triggerNavUrl = util.createDataUrl('trigger navigation');
|
| var webview = new WebView();
|
| webview.src = triggerNavUrl;
|
| webview.addEventListener('loadstop', function(e) {
|
|
|