Fix null dereference in HTMLAnchorElement::sendPings when frame is not attached to...
[WebKit-https.git] / LayoutTests / fast / html / detach-frame-while-clicking-on-anchor-with-ping.html
1 <!DOCTYPE html>
2 <html>
3 <body>
4 <p id="description">This tests detaching a frame while clicking on an anchor element with ping attribute in the frame.<br>
5 WebKit should not crash.</p>
6 <script>
7
8 if (window.testRunner)
9     testRunner.dumpAsText();
10
11 var iframe = document.createElement('iframe');
12 document.body.appendChild(iframe);
13 var anchorElement = iframe.contentDocument.createElement('a');
14 anchorElement.setAttribute('href', 'javascript:parent.remove(event);');
15 anchorElement.setAttribute('ping', 'https://webkit.org/');
16 iframe.contentDocument.body.appendChild(anchorElement);
17
18 function remove(event) {
19     iframe.parentNode.removeChild(iframe);
20     event.preventDefault();
21 }
22
23 anchorElement.click();
24 document.write('PASS. WebKit did not crash.');
25
26 </script>
27 </body>
28 </html>