12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <!DOCTYPE HTML>
- <html>
- <!-- Any copyright is dedicated to the Public Domain.
- - http://creativecommons.org/publicdomain/zero/1.0/ -->
- <head>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- </head>
- <body>
- <iframe id="f" src="http://example.com"></iframe>
- <script type="text/javascript">
- SimpleTest.waitForExplicitFinish();
- var script = SpecialPowers.loadChromeScript(() => {
- const Ci = Components.interfaces;
- const Cc = Components.classes;
- const Cu = Components.utils;
- Cu.import('resource://gre/modules/Services.jsm');
- Services.obs.addObserver(function onExamResp(subject, topic, data) {
- let channel = subject.QueryInterface(Ci.nsIHttpChannel);
- if (!channel.URI.spec.startsWith("http://example.org")) {
- return;
- }
- Services.obs.removeObserver(onExamResp, 'http-on-examine-response');
- channel.suspend();
- Promise.resolve().then(() => {
- channel.resume();
- });
- }, 'http-on-examine-response');
- sendAsyncMessage('start-test');
- });
- script.addMessageListener('start-test', () => {
- const iframe = document.getElementById('f');
- iframe.contentWindow.onunload = function () {
- xhr = new XMLHttpRequest();
- xhr.open('GET', window.location, false);
- xhr.send(null);
- ok(true, 'complete without crash');
- script.destroy();
- SimpleTest.finish();
- }
- iframe.src = 'http://example.org';
- });
- </script>
- </body>
- </html>
|