mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
f9c87527fa
Also set network.disable.ipc.security to true and leave it that way. This prevents security errors in the tests which happen when we pop the pref. --HG-- extra : rebase_source : 95f7ca7c3b71cdc0e3e6fd1cfb663a5653f3ab6f
60 lines
1.5 KiB
JavaScript
60 lines
1.5 KiB
JavaScript
/* 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');
|
|
SpecialPowers.wrap(iframe).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);
|