0

Fix flaky LayoutTest: adopt-iframe-src-attr-after-remove.html

This test was:
  1) using non valid HTML syntax (line 3).
  2) using (for no reason) named access on the window object
     https://html.spec.whatwg.org/#named-access-on-the-window-object
     The iframe with id "iframe" is globally accessible using
     "window.iframe" (or implicitly "iframe"). This is more or less
     deprecated in favor of using document.getElementById("iframe"). It
     causes the test to be flaky (see below for understanding why).

This CL removes 1) and 2).

Why this test is flaky?
---------------------------
Line 37 in DOMContentLoaded handler, adoptAfterLoaded is executed after a 1ms
timeout. If the 'load' event is fired before 1ms, the iframe is removed
and window.iframe is now undefined. Then in adoptAfterLoaded, 'ifr' is
undefined and is dereferenced line 24, the script fails just before calling
testRunner.notifyDone().

Bug: 831155, 861808
Change-Id: I131dfb3b74c6d3fea1c412b219008a1be544a4f7
Reviewed-on: https://chromium-review.googlesource.com/1202282
Reviewed-by: Camille Lamy <clamy@chromium.org>
Commit-Queue: Arthur Sonzogni <arthursonzogni@chromium.org>
Cr-Commit-Position: refs/heads/master@{#588546}
This commit is contained in:
Arthur Sonzogni
2018-09-04 16:49:09 +00:00
committed by Commit Bot
parent e695110c80
commit 2c76a0fac8

@ -1,12 +1,13 @@
<!DOCTYPE html>
We pass if we don't crash under ASAN.
<iframe id=iframe src="../navigation/resources/blank.txt"></iframe>
<iframe id="iframe" src="../navigation/resources/blank.txt"></iframe>
<script>
if (window.testRunner) {
testRunner.dumpAsText();
testRunner.waitUntilDone();
}
var iframe = document.getElementById("iframe");
var onload_completed = false;
function runGC() {