android-components / mozilla.components.browser.engine.system.matcher / UrlMatcher

UrlMatcher

class UrlMatcher (source)

Provides functionality to process categorized URL black/white lists and match URLs against these lists.

Constructors

Name Summary
<init> UrlMatcher(patterns: Array<String>)

Functions

Name Summary
matches fun matches(resourceURI: String, pageURI: String): Pair<Boolean, String?>
fun matches(resourceURI: <ERROR CLASS>, pageURI: <ERROR CLASS>): Pair<Boolean, String?>
Checks if the given page URI is blacklisted for the given resource URI. Returns true if the site (page URI) is allowed to access the resource URI, otherwise false.
setCategoriesEnabled fun setCategoriesEnabled(categories: Set<String>): Unit
Enables the provided categories.

Companion Object Properties

Name Summary
ADVERTISING const val ADVERTISING: String
ANALYTICS const val ANALYTICS: String
CONTENT const val CONTENT: String
CRYPTOMINING const val CRYPTOMINING: String
DEFAULT const val DEFAULT: String
DISCONNECT const val DISCONNECT: String
FINGERPRINTING const val FINGERPRINTING: String
SOCIAL const val SOCIAL: String

Companion Object Functions

Name Summary
createMatcher fun createMatcher(context: <ERROR CLASS>, blackListFile: Int, overrides: IntArray?, whiteListFile: Int, enabledCategories: Set<String> = supportedCategories): UrlMatcher
fun createMatcher(resources: <ERROR CLASS>, blackListFile: Int, overrides: IntArray?, whiteListFile: Int, enabledCategories: Set<String> = supportedCategories): UrlMatcher
fun createMatcher(black: Reader, overrides: List<Reader>?, white: Reader, enabledCategories: Set<String> = supportedCategories): UrlMatcher
Creates a new matcher instance for the provided URL lists.
isWebFont fun isWebFont(uri: <ERROR CLASS>): Boolean
Checks if the given URI points to a Web font.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.