nsIRedirectChannelRegistrar.idl 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* This Source Code Form is subject to the terms of the Mozilla Public
  2. * License, v. 2.0. If a copy of the MPL was not distributed with this
  3. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  4. #include "nsISupports.idl"
  5. interface nsIChannel;
  6. interface nsIParentChannel;
  7. /**
  8. * Used on the chrome process as a service to join channel implementation
  9. * and parent IPC protocol side under a unique id. Provides this way a generic
  10. * communication while redirecting to various protocols.
  11. *
  12. * See also nsIChildChannel and nsIParentChannel.
  13. */
  14. [scriptable, uuid (efa36ea2-5b07-46fc-9534-a5acb8b77b72)]
  15. interface nsIRedirectChannelRegistrar : nsISupports
  16. {
  17. /**
  18. * Register the redirect target channel and obtain a unique ID for that
  19. * channel.
  20. *
  21. * Primarily used in HttpChannelParentListener::AsyncOnChannelRedirect to get
  22. * a channel id sent to the HttpChannelChild being redirected.
  23. */
  24. uint32_t registerChannel(in nsIChannel channel);
  25. /**
  26. * First, search for the channel registered under the id. If found return
  27. * it. Then, register under the same id the parent side of IPC protocol
  28. * to let it be later grabbed back by the originator of the redirect and
  29. * notifications from the real channel could be forwarded to this parent
  30. * channel.
  31. *
  32. * Primarily used in parent side of an IPC protocol implementation
  33. * in reaction to nsIChildChannel.connectParent(id) called from the child
  34. * process.
  35. */
  36. nsIChannel linkChannels(in uint32_t id, in nsIParentChannel channel);
  37. /**
  38. * Returns back the channel previously registered under the ID with
  39. * registerChannel method.
  40. *
  41. * Primarilly used in chrome IPC side of protocols when attaching a redirect
  42. * target channel to an existing 'real' channel implementation.
  43. */
  44. nsIChannel getRegisteredChannel(in uint32_t id);
  45. /**
  46. * Returns the stream listener that shall be attached to the redirect target
  47. * channel, all notification from the redirect target channel will be
  48. * forwarded to this stream listener.
  49. *
  50. * Primarilly used in HttpChannelParentListener::OnRedirectResult callback
  51. * to grab the created parent side of the channel and forward notifications
  52. * to it.
  53. */
  54. nsIParentChannel getParentChannel(in uint32_t id);
  55. /**
  56. * To not force all channel implementations to support weak reference
  57. * consumers of this service must ensure release of registered channels them
  58. * self. This releases both the real and parent channel registered under
  59. * the id.
  60. *
  61. * Primarilly used in HttpChannelParentListener::OnRedirectResult callback.
  62. */
  63. void deregisterChannels(in uint32_t id);
  64. };