Class: Policy

Policy()

new Policy()

Public policy checking functions and auxiliary objects
Source:

Members

(static) contentTypes :Map.<string, string>

Map of content types reported by Firefox to the respecitve content types used by Adblock Plus. Other content types are simply mapped to OTHER.
Type:
  • Map.<string, string>
Source:

(static) nonVisualTypes :Set.<string>

Set of content types that aren't associated with a visual document area
Type:
  • Set.<string>
Source:

(static) whitelistSchemes :Set.<string>

Map containing all schemes that should be ignored by content policy.
Type:
  • Set.<string>
Source:

Methods

(static) deleteNodes(id)

Deletes nodes that were previously stored with a RequestNotifier.storeNodesForEntries() call or similar.
Parameters:
Name Type Description
id string unique ID of the nodes
Source:

(static) init()

Called on module startup, initializes various exported properties.
Source:

(static) isBlockableScheme(location) → {Boolean}

Checks whether the location's scheme is blockable.
Parameters:
Name Type Description
location nsIURI | String
Source:
Returns:
Type
Boolean

(static) isFrameWhitelisted(frames, isElemHide) → (nullable) {Array}

Checks whether a frame is whitelisted.
Parameters:
Name Type Description
frames Array frame structure as returned by getFrames() in child/utils module.
isElemHide boolean true if element hiding whitelisting should be considered
Source:
Returns:
An array with the hit parameters: frameIndex, contentType, docDomain, thirdParty, location, filter. Note that the filter could be a genericblock/generichide exception rule. If nothing matched null is returned.
Type
Array

(static) isWhitelisted(url) → (nullable) {WhitelistFilter}

Checks whether a top-level window is whitelisted.
Parameters:
Name Type Description
url String URL of the document loaded into the window
Source:
Returns:
exception rule that matched the URL if any
Type
WhitelistFilter

(static) refilterNodes(id, entry)

Asynchronously re-checks filters for nodes given by an ID previously returned by a RequestNotifier.storeNodesForEntries() call or similar.
Parameters:
Name Type Description
id string unique ID of the nodes
entry RequestEntry
Source:

(static) shouldAllow(data) → {Object}

Checks whether a node should be blocked, hides it if necessary
Parameters:
Name Type Description
data Object request data
Properties
Name Type Description
contentType String
location String location of the request
frames Array.<Object>
isPrivate Boolean true if the request belongs to a private browsing window
Source:
Returns:
An object containing properties allow, collapse and hits indicating how this request should be handled.
Type
Object