Bug 541155 - test_loadflags.html doesn't reset prefs properly (manifests as a failure in modules/plugin/test/test_cookies.html), r=dwitte

--HG--
extra : transplant_source : VM%EB%A5.b%EC%CB1%1FGB%C2%A0%0E%C4%60%B0r4
This commit is contained in:
Benjamin Smedberg 2010-01-21 14:11:49 -05:00
parent d33bbbf8cd
commit 178a0bbb4b
3 changed files with 26 additions and 8 deletions

View File

@ -29,6 +29,15 @@ function setupTest(uri, cookies, loads) {
gPopup = window.open(uri, 'hai', 'width=100,height=100');
}
function finishTest()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch)
.clearUserPref("network.cookie.cookieBehavior");
SimpleTest.finish();
}
/** Receives MessageEvents to this window. */
// Count and check loads.
@ -39,7 +48,7 @@ function messageReceiver(evt)
gPopup.close();
window.removeEventListener("message", messageReceiver, false);
SimpleTest.finish();
finishTest();
return;
}
@ -68,5 +77,5 @@ function runTest() {
is(count, gExpectedCookies, "total number of cookies");
cs.removeAll();
SimpleTest.finish();
finishTest();
}

View File

@ -37,6 +37,18 @@ function setupTest(uri, domain, cookies, loads, headers) {
gPopup = window.open(uri, 'hai', 'width=100,height=100');
}
function finishTest()
{
gObs.remove();
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefBranch)
.clearUserPref("network.cookie.cookieBehavior");
SimpleTest.finish();
}
// Count headers.
function obs () {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -79,8 +91,7 @@ function messageReceiver(evt)
gPopup.close();
window.removeEventListener("message", messageReceiver, false);
gObs.remove();
SimpleTest.finish();
finishTest();
return;
}
@ -99,8 +110,6 @@ function runTest() {
// set a cookie from a domain of "localhost"
document.cookie = "o=noes";
gObs.remove();
is(gHeaders, gExpectedHeaders, "number of observed request headers");
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -113,5 +122,5 @@ function runTest() {
is(count, gExpectedCookies, "total number of cookies");
cs.removeAll();
SimpleTest.finish();
finishTest();
}

View File

@ -12,7 +12,7 @@
function runTests() {
var pluginElement = document.getElementById("plugin1");
pluginElement.setCookie("foo");
ok(pluginElement.getCookie() == "foo", "Cookie was set and retrieved correctly via NPAPI.");
is(pluginElement.getCookie(), "foo", "Cookie was set and retrieved correctly via NPAPI.");
SimpleTest.finish();
}
</script>