summaryrefslogtreecommitdiff
path: root/dom/browser-element/mochitest/browserElement_Stop.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /dom/browser-element/mochitest/browserElement_Stop.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloaduxp-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/browser-element/mochitest/browserElement_Stop.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_Stop.js52
1 files changed, 52 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_Stop.js b/dom/browser-element/mochitest/browserElement_Stop.js
new file mode 100644
index 0000000000..67720c148d
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_Stop.js
@@ -0,0 +1,52 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 709759 - Test the stop ability of <iframe mozbrowser>.
+
+// The img that is loaded will never be returned and will block
+// the page from loading, the timeout ensures that the page is
+// actually blocked from loading, once stop is called the
+// image load will be cancaelled and mozbrowserloadend should be called.
+
+"use strict";
+SimpleTest.waitForExplicitFinish();
+SimpleTest.requestFlakyTimeout("untriaged");
+browserElementTestHelpers.setEnabledPref(true);
+
+var iframe;
+var stopped = false;
+var imgSrc = 'http://test/tests/dom/browser-element/mochitest/file_bug709759.sjs';
+
+function runTest() {
+ iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', 'true');
+ // FIXME: Bug 1270790
+ iframe.setAttribute('remote', 'true');
+ iframe.addEventListener('mozbrowserloadend', loadend);
+ iframe.src = 'data:text/html,<html>' +
+ '<body><img src="' + imgSrc + '" /></body></html>';
+
+ document.body.appendChild(iframe);
+
+ setTimeout(function() {
+ stopped = true;
+ iframe.stop();
+ }, 200);
+}
+
+function loadend() {
+ ok(stopped, 'Iframes network connections were stopped');
+
+ // Wait 1 second and make sure there isn't a mozbrowsererror after stop();
+ iframe.addEventListener('mozbrowsererror', handleError);
+ window.setTimeout(function() {
+ iframe.removeEventListener('mozbrowsererror', handleError);
+ SimpleTest.finish();
+ }, 1000);
+}
+
+function handleError() {
+ ok(false, "mozbrowsererror should not be fired");
+}
+
+addEventListener('testready', runTest);