3 if (window
.testRunner
) {
4 testRunner
.dumpAsText();
5 testRunner
.waitUntilDone();
6 window
.onload = function() {
7 testRunner
.layoutAndPaintAsyncThen(function() {
9 testRunner
.layoutAndPaintAsyncThen(function() {
10 testRunner
.notifyDone();
15 window
.onload = function() { setTimeout(mutateTree
, 100); };
17 const svgNs
= 'http://www.w3.org/2000/svg';
18 function buildPattern(patternId
, refId
) {
19 var pattern
= document
.createElementNS(svgNs
, 'pattern');
20 var rect
= pattern
.appendChild(document
.createElementNS(svgNs
, 'rect'));
21 pattern
.setAttribute('id', patternId
);
22 pattern
.setAttribute('width', 1);
23 pattern
.setAttribute('height', 1);
24 rect
.setAttribute('width', 100);
25 rect
.setAttribute('height', 100);
26 rect
.setAttribute('fill', 'url(#' + refId
+ ')');
29 function mutateTree() {
30 // Build a three-step pattern cycle in a detached
31 // subtree and then insert it at load.
32 var defs
= document
.createElementNS(svgNs
, 'defs');
33 defs
.appendChild(buildPattern('p3', 'p1'));
34 defs
.appendChild(buildPattern('p2', 'p3'));
35 defs
.appendChild(buildPattern('p1', 'p2'));
36 document
.querySelector('svg').appendChild(defs
);
39 <p>PASS if no crash (stack overflow).
</p>
40 <svg width=
"100" height=
"100">
41 <rect width=
"100" height=
"100" fill=
"url(#p1)"/>