summaryrefslogtreecommitdiffstats
path: root/dom/browser-element/mochitest/browserElement_Reload.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_Reload.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'dom/browser-element/mochitest/browserElement_Reload.js')
-rw-r--r--dom/browser-element/mochitest/browserElement_Reload.js59
1 files changed, 59 insertions, 0 deletions
diff --git a/dom/browser-element/mochitest/browserElement_Reload.js b/dom/browser-element/mochitest/browserElement_Reload.js
new file mode 100644
index 000000000..9ef6d8e7e
--- /dev/null
+++ b/dom/browser-element/mochitest/browserElement_Reload.js
@@ -0,0 +1,59 @@
+/* Any copyright is dedicated to the public domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Bug 741717 - Test the reload ability of <iframe mozbrowser>.
+
+"use strict";
+SimpleTest.waitForExplicitFinish();
+browserElementTestHelpers.setEnabledPref(true);
+browserElementTestHelpers.addPermission();
+
+var iframeScript = function() {
+ sendAsyncMessage('test:innerHTML', {
+ data: XPCNativeWrapper.unwrap(content).document.body.innerHTML
+ });
+}
+
+var mm;
+var iframe;
+var loadedEvents = 0;
+var countAcc;
+
+function runTest() {
+ iframe = document.createElement('iframe');
+ iframe.setAttribute('mozbrowser', 'true');
+
+ iframe.addEventListener('mozbrowserloadend', mozbrowserLoaded);
+
+ iframe.src = 'file_bug741717.sjs';
+ document.body.appendChild(iframe);
+}
+
+function iframeBodyRecv(data) {
+ data = SpecialPowers.wrap(data);
+ var previousCount = countAcc;
+ var currentCount = parseInt(data.json.data, 10);
+ countAcc = currentCount;
+ switch (loadedEvents) {
+ case 1:
+ iframe.reload();
+ break;
+ case 2:
+ ok(true, 'reload was triggered');
+ ok(previousCount === currentCount, 'reload was a soft reload');
+ iframe.reload(true);
+ break;
+ case 3:
+ ok(currentCount > previousCount, 'reload was a hard reload');
+ SimpleTest.finish();
+ }
+}
+
+function mozbrowserLoaded() {
+ loadedEvents++;
+ mm = SpecialPowers.getBrowserFrameMessageManager(iframe);
+ mm.addMessageListener('test:innerHTML', iframeBodyRecv);
+ mm.loadFrameScript('data:,(' + iframeScript.toString() + ')();', false);
+}
+
+addEventListener('testready', runTest);