mirror of
https://github.com/roytam1/palemoon27.git
synced 2026-05-26 14:18:48 +00:00
9938fac30a
- Bug 1212279 - Fix uninitialized boolean in Fprinter. r=h4writer (105d3c6507) - Bug 1223007 - Fix eval redeclaration check for Debugger.Frame.eval. (r=efaust) (a3fddcc2b8) - cleanup, rearrange (88d8fc8ced) - Bug 1211956: Check result of EmptyShape::getInitialShape; r=h4writer (41aee681c0) - Bug 1193102 - Deal with OOM in NewObjectCache::invalidateEntriesForShape. r=bhackett (4c2b2a3bb9) - Bug 1208747 - Fix self-comparison compiler warnings. r=Yoric over IRC (d64cc9500c) - Bug 1208747 - Fix include files for the stopwatch. r=jandem (a146b10267) - Bug 1207843 - Part 1/3 - Clean up ma_b(void* target). r=h4writer (238615768e) - Bug 1207843 - Part 2/3 - Clean up MacroAssemblerARM spacing. r=h4writer (a316b5bdac) - Bug 1207843 - Part 3/3 - Clean up ARM Imm8::EncodeImm(). r=h4writer (c24cda23ef) - Bug 939157 - RotateLeft with shift of zero gives undefined behavior. r=Waldo (36e1324c16) - Bug 1224041 - Use stable hashing for CloneMemory r=terrence (9c2f5db9e3) - Bug 1177122 - handle OOM in JSStructuredCloneWriter destructor. r=evilpie (d4fd3d8fd9) - Bug 1225298 - Use GC policy mechanism for sweeping hashtable-based collections. r=terrence (5369de6951) - Bug 1200642 - Add OOM simulation to Vector r=Waldo (325c17a5c4) - Bug 1221680 - Avoid hard errors when testing convertibility using the IsConvertible type trait. r=froydnj (c4220f1a1c) - Bug 1108017: Loosen third-party restrictions for tracking protection checks (r=sworkman) (2997474d59) - Bug 1205138 - Cleanup tracking protection warnings and logs. r=gcp (fb61d17b01) - Bug 1197000 - Better debugging output for Safe Browsing list updates. r=gcp (727005eb8f) - Bug 1208285 - Improve TP debug logging. r=gcp (72d7561c76) - Bug 1214122 - Check if addon ProtocolHandler actually provide nsHttpChannel. r=sicking r=mayhemer (07bf8afb12) - Bug 1214786 - Channelwrapper: Fix up maybeWrapChannel to wrap if not gecko internal channel (r=mayhemer,sicking) (8adb832a11) - Bug 1158404 - part 1 - DataChannelShutdown should instead observe xpcom-will-shutdown. r=jesup (ad4be087ea) - Bug 1158404 - Part 2 - Don't hold alive DataChannelShutdown with a global. r=jesup (4b9a0e9b5c) - bug 1219466 - convert netwerk to LazyLogModule r=valentin.gosu (2a85aa4068) - Bug 1125947 - Fix clang warnings in netwerk/sctp/datachannel. r=jesup (247ab6dc09)
192 lines
6.4 KiB
C++
192 lines
6.4 KiB
C++
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
#include "mozilla/DebugOnly.h"
|
|
|
|
#include "nscore.h"
|
|
#include "nsRequestObserverProxy.h"
|
|
#include "nsIRequest.h"
|
|
#include "nsAutoPtr.h"
|
|
#include "mozilla/Logging.h"
|
|
|
|
using namespace mozilla;
|
|
|
|
static LazyLogModule gRequestObserverProxyLog("nsRequestObserverProxy");
|
|
|
|
#undef LOG
|
|
#define LOG(args) MOZ_LOG(gRequestObserverProxyLog, mozilla::LogLevel::Debug, args)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsARequestObserverEvent internal class...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
nsARequestObserverEvent::nsARequestObserverEvent(nsIRequest *request)
|
|
: mRequest(request)
|
|
{
|
|
NS_PRECONDITION(mRequest, "null pointer");
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsOnStartRequestEvent internal class...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class nsOnStartRequestEvent : public nsARequestObserverEvent
|
|
{
|
|
RefPtr<nsRequestObserverProxy> mProxy;
|
|
public:
|
|
nsOnStartRequestEvent(nsRequestObserverProxy *proxy,
|
|
nsIRequest *request)
|
|
: nsARequestObserverEvent(request)
|
|
, mProxy(proxy)
|
|
{
|
|
NS_PRECONDITION(mProxy, "null pointer");
|
|
}
|
|
|
|
virtual ~nsOnStartRequestEvent() {}
|
|
|
|
NS_IMETHOD Run()
|
|
{
|
|
LOG(("nsOnStartRequestEvent::HandleEvent [req=%x]\n", mRequest.get()));
|
|
|
|
if (!mProxy->mObserver) {
|
|
NS_NOTREACHED("already handled onStopRequest event (observer is null)");
|
|
return NS_OK;
|
|
}
|
|
|
|
LOG(("handle startevent=%p\n", this));
|
|
nsresult rv = mProxy->mObserver->OnStartRequest(mRequest, mProxy->mContext);
|
|
if (NS_FAILED(rv)) {
|
|
LOG(("OnStartRequest failed [rv=%x] canceling request!\n", rv));
|
|
rv = mRequest->Cancel(rv);
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "Cancel failed for request!");
|
|
}
|
|
|
|
return NS_OK;
|
|
}
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsOnStopRequestEvent internal class...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
class nsOnStopRequestEvent : public nsARequestObserverEvent
|
|
{
|
|
RefPtr<nsRequestObserverProxy> mProxy;
|
|
public:
|
|
nsOnStopRequestEvent(nsRequestObserverProxy *proxy,
|
|
nsIRequest *request)
|
|
: nsARequestObserverEvent(request)
|
|
, mProxy(proxy)
|
|
{
|
|
NS_PRECONDITION(mProxy, "null pointer");
|
|
}
|
|
|
|
virtual ~nsOnStopRequestEvent() {}
|
|
|
|
NS_IMETHOD Run()
|
|
{
|
|
LOG(("nsOnStopRequestEvent::HandleEvent [req=%x]\n", mRequest.get()));
|
|
|
|
nsMainThreadPtrHandle<nsIRequestObserver> observer = mProxy->mObserver;
|
|
if (!observer) {
|
|
NS_NOTREACHED("already handled onStopRequest event (observer is null)");
|
|
return NS_OK;
|
|
}
|
|
// Do not allow any more events to be handled after OnStopRequest
|
|
mProxy->mObserver = 0;
|
|
|
|
nsresult status = NS_OK;
|
|
DebugOnly<nsresult> rv = mRequest->GetStatus(&status);
|
|
NS_ASSERTION(NS_SUCCEEDED(rv), "GetStatus failed for request!");
|
|
|
|
LOG(("handle stopevent=%p\n", this));
|
|
(void) observer->OnStopRequest(mRequest, mProxy->mContext, status);
|
|
|
|
return NS_OK;
|
|
}
|
|
};
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsRequestObserverProxy::nsISupports implementation...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
NS_IMPL_ISUPPORTS(nsRequestObserverProxy,
|
|
nsIRequestObserver,
|
|
nsIRequestObserverProxy)
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsRequestObserverProxy::nsIRequestObserver implementation...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
nsRequestObserverProxy::OnStartRequest(nsIRequest *request,
|
|
nsISupports *context)
|
|
{
|
|
MOZ_ASSERT(!context || context == mContext);
|
|
LOG(("nsRequestObserverProxy::OnStartRequest [this=%p req=%x]\n", this, request));
|
|
|
|
nsOnStartRequestEvent *ev =
|
|
new nsOnStartRequestEvent(this, request);
|
|
if (!ev)
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
LOG(("post startevent=%p\n", ev));
|
|
nsresult rv = FireEvent(ev);
|
|
if (NS_FAILED(rv))
|
|
delete ev;
|
|
return rv;
|
|
}
|
|
|
|
NS_IMETHODIMP
|
|
nsRequestObserverProxy::OnStopRequest(nsIRequest *request,
|
|
nsISupports *context,
|
|
nsresult status)
|
|
{
|
|
MOZ_ASSERT(!context || context == mContext);
|
|
LOG(("nsRequestObserverProxy: OnStopRequest [this=%p req=%x status=%x]\n",
|
|
this, request, status));
|
|
|
|
// The status argument is ignored because, by the time the OnStopRequestEvent
|
|
// is actually processed, the status of the request may have changed :-(
|
|
// To make sure that an accurate status code is always used, GetStatus() is
|
|
// called when the OnStopRequestEvent is actually processed (see above).
|
|
|
|
nsOnStopRequestEvent *ev =
|
|
new nsOnStopRequestEvent(this, request);
|
|
if (!ev)
|
|
return NS_ERROR_OUT_OF_MEMORY;
|
|
|
|
LOG(("post stopevent=%p\n", ev));
|
|
nsresult rv = FireEvent(ev);
|
|
if (NS_FAILED(rv))
|
|
delete ev;
|
|
return rv;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsRequestObserverProxy::nsIRequestObserverProxy implementation...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
NS_IMETHODIMP
|
|
nsRequestObserverProxy::Init(nsIRequestObserver *observer, nsISupports *context)
|
|
{
|
|
NS_ENSURE_ARG_POINTER(observer);
|
|
mObserver = new nsMainThreadPtrHolder<nsIRequestObserver>(observer);
|
|
mContext = new nsMainThreadPtrHolder<nsISupports>(context);
|
|
|
|
return NS_OK;
|
|
}
|
|
|
|
//-----------------------------------------------------------------------------
|
|
// nsRequestObserverProxy implementation...
|
|
//-----------------------------------------------------------------------------
|
|
|
|
nsresult
|
|
nsRequestObserverProxy::FireEvent(nsARequestObserverEvent *event)
|
|
{
|
|
nsCOMPtr<nsIEventTarget> mainThread(do_GetMainThread());
|
|
return mainThread->Dispatch(event, NS_DISPATCH_NORMAL);
|
|
}
|