nsIUrlClassifierExceptionListEntry.idl (3890B)
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 5 #include "nsISupports.idl" 6 #include "nsIURI.idl" 7 8 /** 9 * Represents a single exception list entry for the url classifier exception list. 10 * Needs to be initialized with init() before use. 11 * 12 * @see nsIUrlClassifierExceptionList 13 */ 14 [scriptable, uuid(8753A413-3ED6-4A61-A1DC-B31A7E69B796)] 15 interface nsIUrlClassifierExceptionListEntry : nsISupports 16 { 17 cenum Category : 8 { 18 // Used for allow-list entries set via prefs. These entries always 19 // apply, independently of the user's category selection. 20 CATEGORY_INTERNAL_PREF, 21 // Allow-list for fixing severe site breakage (e.g. blank page). 22 CATEGORY_BASELINE, 23 // Allow-list for less severe site breakage (e.g. embeds or images 24 // missing). 25 CATEGORY_CONVENIENCE, 26 }; 27 28 /** 29 * Initialize all fields of the exception list entry. 30 * @param aCategory - The category of this exception entry. 31 * @param aUrlPattern - The urlPattern for the url to be loaded. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Match_patterns for more info. 32 * @param aTopLevelUrlPattern - Optional top-level url pattern to filter for this exception. If not set the exception applies to all top level sites. 33 * @param aIsPrivateBrowsingOnly - Whether this applies only to private browsing 34 * @param aFilterContentBlockingCategories - The content blocking categories to filter for this exception. 35 * @param aClassifierFeatures - The list of url classifier features to apply this exception to. 36 37 */ 38 void init(in nsIUrlClassifierExceptionListEntry_Category aCategory, 39 in ACString aUrlPattern, 40 in ACString aTopLevelUrlPattern, 41 in boolean aIsPrivateBrowsingOnly, 42 in Array<ACString> aFilterContentBlockingCategories, 43 in Array<ACString> aClassifierFeatures); 44 45 /** 46 * Check if the exception list entry matches the given load. 47 * @param aURI The URI to check 48 * @param aTopLevelURI The top-level URI to check 49 * @param aIsPrivateBrowsing Whether the load is in private browsing mode 50 * @return True if the exception list entry matches the given load and it 51 * should be skipped from classification, false otherwise 52 */ 53 boolean matches(in nsIURI aURI, in nsIURI aTopLevelURI, in boolean aIsPrivateBrowsing); 54 55 /** 56 * The category of this exception entry. 57 * This is used for filtering exception list entries based on user configuration. 58 */ 59 readonly attribute nsIUrlClassifierExceptionListEntry_Category category; 60 61 /** 62 * The urlPattern name for this exception entry. 63 */ 64 readonly attribute ACString urlPattern; 65 66 /** 67 * Optional top-level url pattern to filter for this exception. If not set 68 * the exception applies to all top level sites. 69 */ 70 readonly attribute ACString topLevelUrlPattern; 71 72 /** 73 * Whether this exception only applies in private browsing mode. 74 */ 75 readonly attribute boolean isPrivateBrowsingOnly; 76 77 /** 78 * Optional array of content blocking categories to filter for this 79 * exception. If not set the exception applies to all content blocking 80 * categories. 81 */ 82 readonly attribute Array<ACString> filterContentBlockingCategories; 83 84 /** 85 * The list of url classifier features to apply this exception to. 86 */ 87 readonly attribute Array<ACString> classifierFeatures; 88 89 /** 90 * Returns a string containing all attributes of this exception list entry. 91 * This is intended for logging purposes only. 92 * @return A string containing all attributes 93 */ 94 [noscript] ACString describe(); 95 };