Commit 18dc594f authored by danakj's avatar danakj Committed by Commit Bot

Reland "Fix the http/tests/devtools/inspect-iframe-from-different-domain.js test"

This is a reland of 002510a0

This changes evaluateInPagePromise() to be evaluateInPageAsync() instead
as the latter waits on the promise returned from eval()'ing the code
before resolving the promise from the TestRunner.

Original change's description:
> Fix the http/tests/devtools/inspect-iframe-from-different-domain.js test
>
> This test wants to verify devtools inspect works with an iframe in
> another domain. It was putting the iframe in another site, which causes
> it to become detached from the local root in site isolation. Instead,
> put both the main frame and iframe into the example.test domain, with
> the iframe in a subdomain.
>
> This test was originally added for webkit bug 31587 which is found at
> https://bugs.webkit.org/show_bug.cgi?id=31587.
>
> It said:
> > If you try to inspect elements located inside an IFRAME that was
> > loaded from a different domain, not satisfying the same origin
> > policy, Web Inpector in recent WebKit nightly builds cannot show
> > style information. Works in Safari 4.0.4.
>
> R=yangguo@chromium.org
>
> Bug: 623268
> Change-Id: I842bf835e49ee79e60e423fd36a5d3cedb8a8cfa
> Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2218765
> Commit-Queue: danakj <danakj@chromium.org>
> Reviewed-by: Andrey Kosyakov <caseq@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#772743}

Bug: 623268
Change-Id: I05b8d89d51ec29d536677f9894937531592a249e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2220748Reviewed-by: default avatarAndrey Kosyakov <caseq@chromium.org>
Commit-Queue: danakj <danakj@chromium.org>
Cr-Commit-Position: refs/heads/master@{#773324}
parent 359a4346
......@@ -4261,7 +4261,6 @@ crbug.com/774463 [ Win7 Debug ] fast/events/autoscroll-should-not-stop-on-keypre
# Sheriff failures 2017-10-23
crbug.com/772411 http/tests/media/autoplay-crossorigin.html [ Timeout Failure Pass ]
crbug.com/777222 http/tests/devtools/inspect-iframe-from-different-domain.js [ Pass Failure Timeout ]
# Sheriff failures 2017-10-24
crbug.com/773122 crbug.com/777813 [ Win ] virtual/text-antialias/font-ascent-mac.html [ Failure Pass ]
......
......@@ -6,16 +6,15 @@
TestRunner.addResult(
`Tests that style properties of elements in iframes loaded from domain different from the main document domain can be inspected. See bug 31587.\n`);
await TestRunner.loadModule('elements_test_runner');
await TestRunner.loadHTML(`
<iframe src="http://localhost:8000/devtools/resources/iframe-from-different-domain-data.html" id="receiver" onload="onIFrameLoad()"></iframe>
`);
await TestRunner.evaluateInPagePromise(`
var onIFrameLoadCalled = false;
function onIFrameLoad()
{
if (onIFrameLoadCalled)
return;
onIFrameLoadCalled = true; }
await TestRunner.navigatePromise("http://example.test:8000/devtools/resources/empty.html");
// NOTE: evaluateInPageAsync() waits on the promise at the end of block before
// resolving the promise it returned. Other forms of the evaluate including
// evaluateInPagePromise() do not do this.
await TestRunner.evaluateInPageAsync(`
const frame = document.createElement('iframe');
frame.src = 'http://other.domain.example.test:8000/devtools/resources/iframe-from-different-domain-data.html';
document.body.appendChild(frame);
new Promise(f => frame.onload = f);
`);
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