summaryrefslogtreecommitdiffstats
path: root/toolkit/components/antitracking/nsIURLQueryStrippingListService.idl
blob: d8b10943cda6ff4a165f6790e65198b03c56839e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* 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 "nsISupports.idl"

/**
 * Observer for query stripping list updates.
 */
[scriptable, function, uuid(ef56ae12-b1bb-43e6-b1d8-16459cb98dfd)]
interface nsIURLQueryStrippingListObserver : nsISupports
{
  /**
   * Called by nsIQueryStrippingListService when the list of query stripping
   * changes and when the observer is first registered. Note that the lists
   * could have duplicate entries because we would combine the lists from the
   * pref and remote settings.
   *
   * @param aStripList
   *        A space-separated list of query parameters that will be stripped.
   * @param aAllowList
   *        A comma-separated list of hosts (eTLD+1) that are exempt from query
   *        stripping.
   */
  void onQueryStrippingListUpdate(in AString aStripList, in ACString aAllowList);
};

/**
 * A service that monitors updates to the query stripping list from sources such
 * as a local pref and remote settings updates.
 */
[scriptable, uuid(afff16f0-3fd2-4153-9ccd-c6d9abd879e4)]
interface nsIURLQueryStrippingListService : nsISupports
{
  /**
   * Register a new observer to query stripping list updates. When the observer
   * is registered it is called immediately once. Afterwards it will be called
   * whenever the specified pref changes or when remote settings for
   * partitioning updates.
   *
   * @param aObserver
   *        An nsIURLQueryStrippingListObserver object or function that
   *        will receive updates to the strip list and the allow list. Will be
   *        called immediately with the current list value.
   */
  void registerAndRunObserver(in nsIURLQueryStrippingListObserver aObserver);

  /**
   * Unregister an observer.
   *
   * @param aObserver
   *        The nsIURLQueryStrippingListObserver object to unregister.
   */
  void unregisterObserver(in nsIURLQueryStrippingListObserver aObserver);

  /**
   * Clear all Lists.
   *
   * Note that this is for testing purpose.
   */
  void clearLists();

  /**
   * Test-only method used to wait for the list service to initialize fully.
   * Resolves once the service has reached a fully disabled (false) or fully
   * enabled state (true).
   * May also be called when the service is already fully initialized or
   * disabled, in this case it will resolve immediately.
   */
  Promise testWaitForInit();
};