!11517 广告过滤

Merge pull request !11517 from jianglinyang/adblock-0524
This commit is contained in:
openharmony_ci 2024-05-25 14:01:00 +00:00 committed by Gitee
commit 118334f753
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 159 additions and 45 deletions

View File

@ -4829,6 +4829,37 @@ declare namespace webview {
* @since 12
*/
injectOfflineResources(resourceMaps: Array<OfflineResourceMap>): void;
/**
* Enable the ability to block Ads, disabled by default.
*
* @param { boolean } enable {@code true} Enable Ads block; {@code false} otherwise.
* @throws { BusinessError } 401 - Invalid input parameter.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
enableAdsBlock(enable: boolean): void;
/**
* Get whether Ads block is enabled.
*
* @returns { boolean } True if the ability of AdsBlock is enabled; else false.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
isAdsBlockEnabled(): boolean;
/**
* Get whether Ads block is enabled for current Webpage.
*
* @returns { boolean } True if the ability of AdsBlock is enabled for current Webpage; else false.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
isAdsBlockEnabledForCurPage(): boolean;
}
/**
@ -6650,6 +6681,84 @@ declare namespace webview {
*/
type CreateNativeMediaPlayerCallback =
(handler: NativeMediaPlayerHandler, mediaInfo: MediaInfo) => NativeMediaPlayerBridge
/**
* This class is used to set adblock config.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
class AdsBlockManager {
/**
* set Ads Block ruleset file, containing easylist rules.
* @param {string} rulesFile: absolute file path contains app customized ads block rules.
* @param {boolean} replace: (@code true)replace internal rules;(@code false) add to internal rules.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static setAdsBlockRules(rulesFile: string, replace: boolean): void;
/**
* Add items to Ads Block Disallow list.
* @param {Array<string>} domainSuffixes: list of domain suffix, if web page url matches someone in the list,
* Ads Block will be disallowed for the web page.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static addAdsBlockDisallowedList(domainSuffixes: Array<string>): void;
/**
* Add items to Ads Block Allow list.
* By default, ads block is allowed for all pages unless they are added to the
* disallow list. The priority of allowlist is higher than the disallowlist. It is
* used to re-enable ads block on the page that matches disallow list.
* @param {Array<string>} domainSuffixes: list of domain suffix, if web page url matches someone in the list,
* Ads Block will be allowed for the web page.
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static addAdsBlockAllowedList(domainSuffixes: Array<string>): void;
/**
* remove items from Ads Block Disallowed list.
* @param {Array<string>} domainSuffixes: list of domain suffix needed be removed from disallow list
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static removeAdsBlockDisallowedList(domainSuffixes: Array<string>): void;
/**
* remove items from Ads Block Allowed list.
* @param {Array<string>} domainSuffixes: list of domain suffix needed be removed from allow list
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static removeAdsBlockAllowedList(domainSuffixes: Array<string>): void;
/**
* remove items from Ads Block Allowed list.
* @param {Array<string>} domainSuffixes: list of domain suffix needed be removed from allow list
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static clearAdsBlockDisallowedList(domainSuffixes: Array<string>): void;
/**
* remove items from Ads Block Allowed list.
* @param {Array<string>} domainSuffixes: list of domain suffix needed be removed from allow list
* @syscap SystemCapability.Web.Webview.Core
* @atomicservice
* @since 12
*/
static clearAdsBlockAllowedList(domainSuffixes: Array<string>): void;
}
}
export default webview;

View File

@ -1134,4 +1134,9 @@ encipherment
reconfirmed
subresource
euc
ruleset
easylist
allowlist
disallowlist
adblock