Commit d18bad64 authored by danakj's avatar danakj Committed by Commit Bot

Fix the http/tests/devtools/console-cross-origin-iframe-logging.js test

This test wants to verify that an error is seen when using a frame in
another origin. It was using a different site, where the frame's
contents is not visible at all when site-isolated. Instead, put the
frame in another origin in the same site so that the main frame can see
the contents of the iframe.

R=caseq@chromium.org

Bug: 623268
Change-Id: Ib4ab03229f1033fc01717e561eb35b3c6d047e2c
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218373
Commit-Queue: danakj <danakj@chromium.org>
Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Cr-Commit-Position: refs/heads/master@{#772769}
parent 418743b1
...@@ -4708,9 +4708,6 @@ crbug.com/904389 http/tests/preload/delaying_onload_link_preload_after_discovery ...@@ -4708,9 +4708,6 @@ crbug.com/904389 http/tests/preload/delaying_onload_link_preload_after_discovery
crbug.com/906952 editing/pasteboard/file-drag-to-editable.html [ Pass Crash ] crbug.com/906952 editing/pasteboard/file-drag-to-editable.html [ Pass Crash ]
#Sheriff 2018-11-21 #Sheriff 2018-11-21
# See also crbug.com/907150
crbug.com/667560 http/tests/devtools/console-cross-origin-iframe-logging.js [ Pass Failure Timeout ]
crbug.com/907412 external/wpt/domxpath/xml_xpath_runner.html [ Pass Timeout ] crbug.com/907412 external/wpt/domxpath/xml_xpath_runner.html [ Pass Timeout ]
#Sheriff 2018-11-22 #Sheriff 2018-11-22
......
Tests that cross origin errors are logged with source url and line number. Tests that cross origin errors are logged with source url and line number.
console-cross-origin…frame-logging.js:25 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://127.0.0.1:8000') does not match the recipient window's origin ('http://localhost:8000'). console-cross-origin…frame-logging.js:29 Failed to execute 'postMessage' on 'DOMWindow': The target origin provided ('http://example.test:8000') does not match the recipient window's origin ('http://other.origin.example.test:8000').
accessFrame @ console-cross-origin…frame-logging.js:25 (anonymous) @ console-cross-origin…frame-logging.js:29
(anonymous) @ console-cross-origin…frame-logging.js:31
...@@ -5,30 +5,29 @@ ...@@ -5,30 +5,29 @@
(async function() { (async function() {
TestRunner.addResult(`Tests that cross origin errors are logged with source url and line number.\n`); TestRunner.addResult(`Tests that cross origin errors are logged with source url and line number.\n`);
await TestRunner.loadModule('console_test_runner'); await TestRunner.loadModule('console_test_runner');
await TestRunner.loadHTML(` await TestRunner.navigatePromise("http://example.test:8000/devtools/resources/empty.html");
<iframe src="http://localhost:8000/devtools/resources/cross-origin-iframe.html"></iframe>
`);
await TestRunner.evaluateInPagePromise(` await TestRunner.evaluateInPagePromise(`
function accessFrame() const frame = document.createElement('iframe');
{ frame.src = 'http://other.origin.example.test:8000/devtools/resources/cross-origin-iframe.html';
// Should fail. document.body.appendChild(frame);
try {
var host = frames[0].location.host;
} catch (e) {}
// Should fail.
try {
frames[0].location.reload();
} catch (e) {}
// Should fail.
frames[0].postMessage("fail", "http://127.0.0.1:8000");
}
`); `);
ConsoleTestRunner.addConsoleSniffer(finish); ConsoleTestRunner.addConsoleSniffer(finish);
Common.settingForTest('monitoringXHREnabled').set(true); Common.settingForTest('monitoringXHREnabled').set(true);
TestRunner.evaluateInPage('accessFrame()'); await TestRunner.evaluateInPagePromise(`
// Should fail.
try {
var host = frames[0].location.host;
} catch (e) {}
// Should fail.
try {
frames[0].location.reload();
} catch (e) {}
// Should fail.
frames[0].postMessage("fail", "http://example.test:8000");
`);
async function finish() { async function finish() {
Common.settingForTest('monitoringXHREnabled').set(false); Common.settingForTest('monitoringXHREnabled').set(false);
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
const frame = document.createElement('iframe'); const frame = document.createElement('iframe');
frame.src = 'http://other.domain.example.test:8000/devtools/resources/iframe-from-different-domain-data.html'; frame.src = 'http://other.domain.example.test:8000/devtools/resources/iframe-from-different-domain-data.html';
document.body.appendChild(frame); document.body.appendChild(frame);
new Promise(f => frame.onload = f)
`); `);
ElementsTestRunner.selectNodeAndWaitForStyles('iframe-body', step1); ElementsTestRunner.selectNodeAndWaitForStyles('iframe-body', step1);
......
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