From 20234e1e48c582946944d2271602ec5938ec1aea Mon Sep 17 00:00:00 2001 From: xiyupeng Date: Thu, 9 May 2024 10:34:57 +0800 Subject: [PATCH] =?UTF-8?q?scheme=20handler=E7=BD=91=E7=BB=9C=E6=8B=A6?= =?UTF-8?q?=E6=88=AA=E6=96=B0=E5=A2=9EgetRequestResourceType=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: xiyupeng --- api/@ohos.web.webview.d.ts | 176 ++++++++++++++++++ .../plugin/dictionaries_supplementary.txt | 1 + 2 files changed, 177 insertions(+) diff --git a/api/@ohos.web.webview.d.ts b/api/@ohos.web.webview.d.ts index d9adb21b5..6fa996899 100644 --- a/api/@ohos.web.webview.d.ts +++ b/api/@ohos.web.webview.d.ts @@ -5291,6 +5291,174 @@ declare namespace webview { isInMemory(): boolean; } + /** + * Defines the resource type of request. + * @enum {number} + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + enum WebResourceType { + /** + * Top level page. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + MAIN_FRAME = 0, + + /** + * Frame or Iframe. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + SUB_FRAME = 1, + + /** + * CSS stylesheet. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + STYLE_SHEET = 2, + + /** + * External script. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + SCRIPT = 3, + + /** + * Image (jpg/gif/png/etc). + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + IMAGE = 4, + + /** + * Font. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + FONT_RESOURCE = 5, + + /** + * Some other subresource. This is the default type if the actual type is unknown. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + SUB_RESOURCE = 6, + + /** + * Object (or embed) tag for a plugin, or a resource that a plugin requested. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + OBJECT = 7, + + /** + * Media resource. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + MEDIA = 8, + + /** + * Main resource of a dedicated worker. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + WORKER = 9, + + /** + * Main resource of a shared worker. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + SHARED_WORKER = 10, + + /** + * Explicitly requested prefetch. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + PREFETCH = 11, + + /** + * Favicon. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + FAVICON = 12, + + /** + * XMLHttpRequest. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + XHR = 13, + + /** + * Ping request for /sendBeacon. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + PING = 14, + + /** + * The main resource of a service worker. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + SERVICE_WORKER = 15, + + /** + * Report of Content Security Policy violations. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + CSP_REPORT = 16, + + /** + * Resource that a plugin requested. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + PLUGIN_RESOURCE = 17, + + /** + * A main-frame service worker navigation preload request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + NAVIGATION_PRELOAD_MAIN_FRAME = 19, + + /** + * A sub-frame service worker navigation preload request. + * + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + NAVIGATION_PRELOAD_SUB_FRAME = 20, + } + /** * Defines the Web resource request used for scheme handler. * @@ -5362,6 +5530,14 @@ declare namespace webview { * @since 12 */ getHttpBodyStream(): WebHttpBodyStream | null; + /** + * Get request's resource type. + * + * @returns { WebResourceType } Return the request's resource type. + * @syscap SystemCapability.Web.Webview.Core + * @since 12 + */ + getRequestResourceType(): WebResourceType; } /** diff --git a/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt b/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt index 07ce5a901..bfaebb50d 100644 --- a/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt +++ b/build-tools/api_check_plugin/plugin/dictionaries_supplementary.txt @@ -1126,3 +1126,4 @@ gbk ocsp encipherment reconfirmed +subresource