commit ca550a675221d9ba885c0dace227ec40671a52b5
parent 97c5ed3c963f0b43775a008d9120779b31dda96d
Author: Daniel Holbert <dholbert@cs.stanford.edu>
Date: Sun, 4 Jan 2026 23:57:36 +0000
Bug 1963876: Fix race condition in reftest 1330051.svg. r=layout-reviewers,hiro
This reftest intermittently timed out on our Samsung A55 test platform, and I
suspect the reason for this was that the iframe's "load" event was firing
before the test managed to dynamically set up a load handler (which meant the
load handler would never get invoked).
This patch reorders things to define the load handler up-front at the same time
that we define the iframe's srcdoc (declaratively in the element's markup).
That should fix the race condition and prevent the intermittent timeout; it
seems to on Try, at least.
While we're at it, this patch also removes the skip-on-Windows-debug annotation
which seems to no longer be necessary based on my testing (it may even have
been working around a version of this same race condition being fixed here).
Differential Revision: https://phabricator.services.mozilla.com/D277818
Diffstat:
2 files changed, 16 insertions(+), 15 deletions(-)
diff --git a/layout/reftests/bugs/1330051.svg b/layout/reftests/bugs/1330051.svg
@@ -1,17 +1,19 @@
-<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500" class="reftest-wait">
- <foreignObject width="500" height="500">
- <iframe xmlns="http://www.w3.org/1999/xhtml"
- srcdoc="A test">
- </iframe>
- <div xmlns="http://www.w3.org/1999/xhtml"
- style="color: green" id="myDiv">This should remain green</div>
- </foreignObject>
+<svg xmlns="http://www.w3.org/2000/svg" width="500" height="500"
+ class="reftest-wait">
<script>
- let el = document.getElementById('myDiv');
- frames[0].onload = function() {
- var doc = frames[0].document;
- doc.body.appendChild(el);
+ // Load-handler that will adopt elem from outer doc:
+ function go() {
+ let el = document.getElementById('myDiv');
+ var innerDoc = frames[0].document;
+ innerDoc.body.appendChild(el);
document.documentElement.removeAttribute("class");
}
</script>
-</svg>
-\ No newline at end of file
+ <foreignObject width="500" height="500">
+ <div xmlns="http://www.w3.org/1999/xhtml">
+ <iframe onload="go()" srcdoc="A test">
+ </iframe>
+ <div style="color: green" id="myDiv">This should remain green</div>
+ </div>
+ </foreignObject>
+</svg>
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list
@@ -1935,7 +1935,7 @@ fuzzy(0-13,0-40000) fuzzy-if(winWidget,0-13,0-40000) == 1316719-1b.html 1316719-
fuzzy(0-13,0-40000) fuzzy-if(winWidget,0-13,0-40000) == 1316719-1c.html 1316719-1-ref.html
!= 1318769-1.html 1318769-1-ref.html
== 1322512-1.html 1322512-1-ref.html
-skip-if(winWidget&&isDebugBuild) == 1330051.svg 1330051-ref.svg
+== 1330051.svg 1330051-ref.svg
!= 1336591-1.html 1336591-1-ref.html
== 1348481-1.html 1348481-ref.html
== 1348481-2.html 1348481-ref.html