zy.PrivateBrowsingUtils.isBrowserPrivate(browser) ? "trackingprotection-pb" : "trackingprotection"; }, _expiryFor(browser) { return lazy.PrivateBrowsingUtils.isBrowserPrivate(browser) ? Ci.nsIPermissionManager.EXPIRE_SESSION : Ci.nsIPermissionManager.EXPIRE_NEVER; }, /** * Returns false if this module cannot handle the current document loaded in * the browser object. This can happen for example for about: or file: * documents. */ canHandle(browser) { return this._basePrincipalForAntiTrackingCommon(browser) != null; }, /** * Add the given browser object to the Content Blocking allow list. */ add(browser) { // Start observing PB last-context-exit notification to do the needed cleanup. this._maybeSetupLastPBContextObserver(); let prin = this._basePrincipalForAntiTrackingCommon(browser); let type = this._permissionTypeFor(browser); let expire = this._expiryFor(browser); Services.perms.addFromPrincipal( prin, type, Services.perms.ALLOW_ACTION, expire ); }, /** * Remove the given browser object from the Content Blocking allow list. */ remove(browser) { let prin = this._basePrincipalForAntiTrackingCommon(browser); let type = this._permissionTypeFor(browser); Services.perms.removeFromPrincipal(prin, type); }, /** * Returns true if the current browser has loaded a document that is on the * Content Blocking allow list. */ includes(browser) { let prin = this._basePrincipalForAntiTrackingCommon(browser); let type = this._permissionTypeFor(browser); return ( Services.perms.testExactPermissionFromPrincipal(prin, type) == Services.perms.ALLOW_ACTION ); }, }; PK