mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-10 03:45:46 +00:00
Bug 1186783 (part 4) - Replace nsBaseHashtable::EnumerateRead() calls in netwerk/ with iterators. r=valentin.
This commit is contained in:
parent
5fd362d4cf
commit
4a7f327575
@ -23,16 +23,6 @@
|
||||
#include "nsContentSecurityManager.h"
|
||||
#include "LoadInfo.h"
|
||||
|
||||
static PLDHashOperator
|
||||
CopyProperties(const nsAString &key, nsIVariant *data, void *closure)
|
||||
{
|
||||
nsIWritablePropertyBag *bag =
|
||||
static_cast<nsIWritablePropertyBag *>(closure);
|
||||
|
||||
bag->SetProperty(key, data);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
// This class is used to suspend a request across a function scope.
|
||||
class ScopedRequestSuspender {
|
||||
public:
|
||||
@ -121,8 +111,11 @@ nsBaseChannel::Redirect(nsIChannel *newChannel, uint32_t redirectFlags,
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIWritablePropertyBag> bag = ::do_QueryInterface(newChannel);
|
||||
if (bag)
|
||||
mPropertyHash.EnumerateRead(CopyProperties, bag.get());
|
||||
if (bag) {
|
||||
for (auto iter = mPropertyHash.Iter(); !iter.Done(); iter.Next()) {
|
||||
bag->SetProperty(iter.Key(), iter.UserData());
|
||||
}
|
||||
}
|
||||
|
||||
// Notify consumer, giving chance to cancel redirect. For backwards compat,
|
||||
// we support nsIHttpEventSink if we are an HTTP channel and if this is not
|
||||
|
@ -2530,15 +2530,6 @@ HttpBaseChannel::AddCookiesToRequest()
|
||||
SetRequestHeader(nsDependentCString(nsHttp::Cookie), cookie, false);
|
||||
}
|
||||
|
||||
static PLDHashOperator
|
||||
CopyProperties(const nsAString& aKey, nsIVariant *aData, void *aClosure)
|
||||
{
|
||||
nsIWritablePropertyBag* bag = static_cast<nsIWritablePropertyBag*>
|
||||
(aClosure);
|
||||
bag->SetProperty(aKey, aData);
|
||||
return PL_DHASH_NEXT;
|
||||
}
|
||||
|
||||
bool
|
||||
HttpBaseChannel::ShouldRewriteRedirectToGET(uint32_t httpStatus,
|
||||
nsHttpRequestHead::ParsedMethodType method)
|
||||
@ -2734,8 +2725,11 @@ HttpBaseChannel::SetupReplacementChannel(nsIURI *newURI,
|
||||
|
||||
// transfer any properties
|
||||
nsCOMPtr<nsIWritablePropertyBag> bag(do_QueryInterface(newChannel));
|
||||
if (bag)
|
||||
mPropertyHash.EnumerateRead(CopyProperties, bag.get());
|
||||
if (bag) {
|
||||
for (auto iter = mPropertyHash.Iter(); !iter.Done(); iter.Next()) {
|
||||
bag->SetProperty(iter.Key(), iter.UserData());
|
||||
}
|
||||
}
|
||||
|
||||
// Transfer the timing data (if we are dealing with an nsITimedChannel).
|
||||
nsCOMPtr<nsITimedChannel> newTimedChannel(do_QueryInterface(newChannel));
|
||||
|
Loading…
Reference in New Issue
Block a user