mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 713747 - Fix funky tests. r=bz
The conversion of checks for UniversalBrowserWrite to UniversalXPConnect caused these test fail, because they acquire UniversalXPConnect and actually doesn't want the results. In particular, they pass the security check in nsWindowWatcher::CalculateChromeFlags, which causes them to fail. The first test doesn't actually need UniversalXPConnect, so we can remove it for free. The second one needs it, so we add some SpecialPowers goop to make it possible. It's not ideal, but it can go away when the wrapper in bug 702353 lands.
This commit is contained in:
parent
3d280d317c
commit
228e78b8ef
@ -23,11 +23,9 @@ var rv = { tests: null };
|
||||
var testCheckInterval = null;
|
||||
|
||||
function startTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
var url = window.location.href.replace(/test_feed_discovery\.html/,
|
||||
'feed_discovery.html');
|
||||
window.openDialog(url, '', 'dialog=no,width=10,height=10', rv);
|
||||
SpecialPowers.openDialog(window, [url, '', 'dialog=no,width=10,height=10', rv]);
|
||||
testCheckInterval = window.setInterval(tryIfTestIsFinished, 500);
|
||||
}
|
||||
|
||||
|
@ -6,41 +6,43 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=437361
|
||||
<head>
|
||||
<title>Test for Bug 437361</title>
|
||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<script type="text/javascript" src="/mozprefs.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
||||
|
||||
<script class="testbody" type="text/javascript">
|
||||
|
||||
/** Test for Bug 437361 **/
|
||||
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
|
||||
function testModalDialogBlockedCleanly() {
|
||||
is(true, pref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
is(true, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
var rv = window.showModalDialog( // should be blocked without exception
|
||||
"data:text/html,<html><body onload='close(); returnValue = 1;' /></html>");
|
||||
is(rv, null, "Modal dialog opened unexpectedly.");
|
||||
}
|
||||
|
||||
function testModalDialogAllowed() {
|
||||
is(false, pref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
var rv = window.showModalDialog( // should not be blocked this time
|
||||
"data:text/html,<html><body onload='close(); returnValue = 1;' /></html>");
|
||||
is(rv, 1, "Problem with modal dialog returnValue.");
|
||||
}
|
||||
|
||||
function testOtherExceptionsNotTrapped() {
|
||||
is(false, pref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
is(false, SpecialPowers.getBoolPref("dom.disable_open_during_load"), "mozprefs sanity check");
|
||||
window.showModalDialog('about:config'); // forbidden by SecurityCheckURL
|
||||
}
|
||||
|
||||
function test(disableOpen, exceptionExpected, testFn, errorMsg) {
|
||||
var oldPrefVal = SpecialPowers.getBoolPref("dom.disable_open_during_load");
|
||||
try {
|
||||
pref("dom.disable_open_during_load", disableOpen, testFn);
|
||||
SpecialPowers.setBoolPref("dom.disable_open_during_load", disableOpen);
|
||||
testFn();
|
||||
ok(!exceptionExpected, errorMsg);
|
||||
} catch (_) {
|
||||
ok(exceptionExpected, errorMsg);
|
||||
}
|
||||
finally {
|
||||
SpecialPowers.setBoolPref("dom.disable_open_during_load", oldPrefVal);
|
||||
}
|
||||
}
|
||||
|
||||
test(true, false, testModalDialogBlockedCleanly,
|
||||
|
@ -20,11 +20,8 @@ function onMsgRcv(event)
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
|
||||
window.addEventListener("message", onMsgRcv, false);
|
||||
|
||||
var subsequentDlg = "data:text/html,<html><body onload='opener.is(window.dialogArguments, \'my args\', \'subsequent dialog document did not get the right arguments.\'); close();'>";
|
||||
|
||||
var result = window.showModalDialog("file_bug504862.html", "my args");
|
||||
is(result, null, "window sees previous dialog documents return value.");
|
||||
|
||||
|
@ -641,6 +641,10 @@ SpecialPowersAPI.prototype = {
|
||||
copyString(str);
|
||||
},
|
||||
|
||||
openDialog: function(win, args) {
|
||||
return win.openDialog.apply(win, args);
|
||||
},
|
||||
|
||||
// :jdm gets credit for this. ex: getPrivilegedProps(window, 'location.href');
|
||||
getPrivilegedProps: function(obj, props) {
|
||||
parts = props.split('.');
|
||||
|
Loading…
Reference in New Issue
Block a user