Bug 877961 - PrivateBrowsingChannel: Allow SetPrivate on a channel with a load group but no load context; r=ehsan, r=jduell

This commit is contained in:
Mook 2013-06-06 19:46:06 -07:00
Родитель 7ea082d4cc
Коммит be1d4ceb3b
2 изменённых файлов: 6 добавлений и 8 удалений

Просмотреть файл

@ -29,17 +29,14 @@ public:
NS_IMETHOD SetPrivate(bool aPrivate)
{
// Make sure that we don't have a load group or a load context
// Make sure that we don't have a load context
// This is a fatal error in debug builds, and a runtime error in release
// builds.
nsILoadGroup* loadGroup = static_cast<Channel*>(this)->mLoadGroup;
nsCOMPtr<nsILoadContext> loadContext;
if (!loadGroup) {
NS_QueryNotificationCallbacks(static_cast<Channel*>(this), loadContext);
}
MOZ_ASSERT(!loadGroup && !loadContext);
if (loadGroup || loadContext) {
return NS_ERROR_FAILURE;
NS_QueryNotificationCallbacks(static_cast<Channel*>(this), loadContext);
MOZ_ASSERT(!loadContext);
if (loadContext) {
return NS_ERROR_FAILURE;
}
mPrivateBrowsingOverriden = true;

Просмотреть файл

@ -24,6 +24,7 @@ function run_test() {
httpserver.start(4444);
var channel = setupChannel(testpath);
channel.loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance();
channel.QueryInterface(Ci.nsIPrivateBrowsingChannel);
channel.setPrivate(true);