nsILoadGroup.idl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
  2. /* This Source Code Form is subject to the terms of the Mozilla Public
  3. * License, v. 2.0. If a copy of the MPL was not distributed with this
  4. * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
  5. #include "nsIRequest.idl"
  6. interface nsISimpleEnumerator;
  7. interface nsIRequestObserver;
  8. interface nsIInterfaceRequestor;
  9. interface nsIRequestContext;
  10. /**
  11. * A load group maintains a collection of nsIRequest objects.
  12. * This is used in lots of places where groups of requests need to be tracked.
  13. * For example, nsIDocument::mDocumentLoadGroup is used to track all requests
  14. * made for subdocuments in order to track page load progress and allow all
  15. * requests made on behalf of the document to be stopped, etc.
  16. */
  17. [scriptable, uuid(f0c87725-7a35-463c-9ceb-2c07f23406cc)]
  18. interface nsILoadGroup : nsIRequest
  19. {
  20. /**
  21. * The group observer is notified when requests are added to and removed
  22. * from this load group. The groupObserver is weak referenced.
  23. */
  24. attribute nsIRequestObserver groupObserver;
  25. /**
  26. * Accesses the default load request for the group. Each time a number
  27. * of requests are added to a group, the defaultLoadRequest may be set
  28. * to indicate that all of the requests are related to a base request.
  29. *
  30. * The load group inherits its load flags from the default load request.
  31. * If the default load request is NULL, then the group's load flags are
  32. * not changed.
  33. */
  34. attribute nsIRequest defaultLoadRequest;
  35. /**
  36. * Adds a new request to the group. This will cause the default load
  37. * flags to be applied to the request. If this is a foreground
  38. * request then the groupObserver's onStartRequest will be called.
  39. *
  40. * If the request is the default load request or if the default load
  41. * request is null, then the load group will inherit its load flags from
  42. * the request.
  43. */
  44. void addRequest(in nsIRequest aRequest,
  45. in nsISupports aContext);
  46. /**
  47. * Removes a request from the group. If this is a foreground request
  48. * then the groupObserver's onStopRequest will be called.
  49. *
  50. * By the time this call ends, aRequest will have been removed from the
  51. * loadgroup, even if this function throws an exception.
  52. */
  53. void removeRequest(in nsIRequest aRequest,
  54. in nsISupports aContext,
  55. in nsresult aStatus);
  56. /**
  57. * Returns the requests contained directly in this group.
  58. * Enumerator element type: nsIRequest.
  59. */
  60. readonly attribute nsISimpleEnumerator requests;
  61. /**
  62. * Returns the count of "active" requests (ie. requests without the
  63. * LOAD_BACKGROUND bit set).
  64. */
  65. readonly attribute unsigned long activeCount;
  66. /**
  67. * Notification callbacks for the load group.
  68. */
  69. attribute nsIInterfaceRequestor notificationCallbacks;
  70. /**
  71. * Context for managing things like js/css connection blocking,
  72. * and per-tab connection grouping.
  73. */
  74. [noscript] readonly attribute nsID requestContextID;
  75. /**
  76. * The set of load flags that will be added to all new requests added to
  77. * this group. Any existing requests in the load group are not modified,
  78. * so it is expected these flags will be added before requests are added
  79. * to the group - typically via nsIDocShell::defaultLoadFlags on a new
  80. * docShell.
  81. * Note that these flags are *not* added to the default request for the
  82. * load group; it is expected the default request will already have these
  83. * flags (again, courtesy of setting nsIDocShell::defaultLoadFlags before
  84. * the docShell has created the default request.)
  85. */
  86. attribute nsLoadFlags defaultLoadFlags;
  87. };