michael@0: /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #include "nsISupports.idl" michael@0: michael@0: interface nsIStreamListener; michael@0: michael@0: /** michael@0: * A channel implementing this interface allows one to intercept its data by michael@0: * inserting intermediate stream listeners. michael@0: */ michael@0: [scriptable, uuid(68167b0b-ef34-4d79-a09a-8045f7c5140e)] michael@0: interface nsITraceableChannel : nsISupports michael@0: { michael@0: /* michael@0: * Replace the channel's listener with a new one, and return the listener michael@0: * the channel used to have. The new listener intercepts OnStartRequest, michael@0: * OnDataAvailable and OnStopRequest calls and must pass them to michael@0: * the original listener after examination. If multiple callers replace michael@0: * the channel's listener, a chain of listeners is created. michael@0: * The caller of setNewListener has no way to control at which place michael@0: * in the chain its listener is placed. michael@0: * michael@0: * Note: The caller of setNewListener must not delay passing michael@0: * OnStartRequest to the original listener. michael@0: * michael@0: * Note2: A channel may restrict when the listener can be replaced. michael@0: * It is not recommended to allow listener replacement after OnStartRequest michael@0: * has been called. michael@0: */ michael@0: nsIStreamListener setNewListener(in nsIStreamListener aListener); michael@0: };