diff --git a/ArkWeb/ProcessWebPageCont/.gitignore b/ArkWeb/ProcessWebPageCont/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/AppScope/app.json5 b/ArkWeb/ProcessWebPageCont/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..4b1ce53f111420364c0803811493cd969dc80603
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.processwebpagecont",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkWeb/ProcessWebPageCont/AppScope/resources/base/element/string.json b/ArkWeb/ProcessWebPageCont/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..4779102effef55e6d1414c9166b60b0783cdc210
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "ProcessWebPageCont"
+ }
+ ]
+}
diff --git a/ArkWeb/ProcessWebPageCont/AppScope/resources/base/media/app_icon.png b/ArkWeb/ProcessWebPageCont/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/AppScope/resources/base/media/app_icon.png differ
diff --git a/ArkWeb/ProcessWebPageCont/README.md b/ArkWeb/ProcessWebPageCont/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..6b2dd9e180656b48df3158145018f040da9db4ee
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/README.md
@@ -0,0 +1,135 @@
+## 使用Web组件打印前端页面
+
+### 介绍
+
+2. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-print.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+### InitiatePrintW3CAPI
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件打印前端页面,通过创建打印适配器,拉起打印应用,并对当前Web页面内容进行渲染,渲染后生成的PDF文件信息通过fd传递给打印框架。W3C标准协议接口window.print()方法用于打印当前页面或弹出打印对话框。该方法没有任何参数,只需要在JavaScript中调用即可。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 点击print按钮,触发window.print()操作,即可对页面内容进行打印。
+
+### InitiatePrintAppAPI
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件打印前端页面,应用侧通过调用createWebPrintDocumentAdapter创建打印适配器,通过将适配器传入打印的print接口调起打印。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 点击createWebPrintDocumentAdapter按钮应用侧会创建打印适配器,并将其传入打印接口,以触发打印操作。
+
+## 使用Web组件的PDF文档预览能力
+
+### 介绍
+
+1. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-pdf-preview.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+### PreviewPDF
+
+#### 介绍
+
+1. 本示例主要介绍使用Web组件的PDF文档预览能力。Web组件提供了在网页中预览PDF的能力。应用可以通过Web组件的src参数和loadUrl()接口中传入PDF文件,来加载PDF文档。根据PDF文档来源不同,可以分为三种常用场景:加载网络PDF文档、加载本地PDF文档、加载应用内resource资源PDF文档。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------- |
+| |
+
+使用说明
+
+1. Web组件创建时指定默认加载的网络PDF文档example.com/test.pdf。
+
+## 网页中安全区域计算和避让适配
+
+### 介绍
+
+### CalcAdjustSafeArea
+
+1. 本工程主要实现了对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-safe-area-insets.md 示例代码片段的工程化,主要目标是实现指南中示例代码需要与sample工程文件同源。
+
+#### 介绍
+
+1. 本示例主要介绍网页中安全区域计算和避让适配。Web组件提供了利用W3C CSS进行安全区域计算并避让适配的能力,用来支持异形屏幕设备在沉浸式效果下页面的正常显示。此时,网页开发者想对重叠元素进行避让,就可以该能力。ArkWeb内核将持续监测Web组件及系统安全区域的位置与尺寸,依据两者的重叠部分,计算出当前Web组件的安全区域,以及在各个方向上所需避让的具体距离。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 通过expandSafeArea来开启沉浸式效果。Web组件根据实际情况对网页元素进行相应的避让,防止与系统的非安全区域发生重叠遮挡。
+
+## 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---|---|---InitiatePrintAppAPI
+|---|---|---InitiatePrintW3CAPI
+|---|---|---PreviewPDF
+|---|---|---CalcAdjustSafeArea
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+
+## 相关权限
+
+[ohos.permission.PRINT](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionprint)
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+## 依赖
+
+不涉及。
+
+## 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+## 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/ProcessWebPageCont > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
+
diff --git a/ArkWeb/ProcessWebPageCont/build-profile.json5 b/ArkWeb/ProcessWebPageCont/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/code-linter.json5 b/ArkWeb/ProcessWebPageCont/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/.gitignore b/ArkWeb/ProcessWebPageCont/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/build-profile.json5 b/ArkWeb/ProcessWebPageCont/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/hvigorfile.ts b/ArkWeb/ProcessWebPageCont/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..98d52319cb1dee60511b5716dba03b76e68a6d8b
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ProcessWebPageCont/entry/obfuscation-rules.txt b/ArkWeb/ProcessWebPageCont/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/oh-package.json5 b/ArkWeb/ProcessWebPageCont/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..82e98bec44d83d2df03deb52508045cb06cc8604
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..29feaca7669174be5c2b0e2366529ee94ab7e726
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/CalcAdjustSafeArea.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/CalcAdjustSafeArea.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a357e5996f55843b6b23feb7dae4b176cba2b0e6
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/CalcAdjustSafeArea.ets
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+// [Start use_expand_safe_area_to_enable_immersive_effect]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.controller })
+ .width('100%').height('100%')
+ .expandSafeArea([SafeAreaType.SYSTEM], [SafeAreaEdge.TOP, SafeAreaEdge.BOTTOM])
+ }
+ }
+}
+// [End use_expand_safe_area_to_enable_immersive_effect]
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/Index.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1def271b5633e957e9dd40c3b9591542f5cae01f
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('InitiatePrintW3CAPI')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/InitiatePrintW3CAPI' });
+ })
+ Button('InitiatePrintAppAPI')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/InitiatePrintAppAPI' });
+ })
+ Button('PreviewPDF')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/PreviewPDF' });
+ })
+ Button('CalcAdjustSafeArea')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/CalcAdjustSafeArea' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintAppAPI.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintAppAPI.ets
new file mode 100644
index 0000000000000000000000000000000000000000..30eecf7173f0c347787a368ec2b185ff925d4e3d
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintAppAPI.ets
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_web_print_document]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { print } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('createWebPrintDocumentAdapter')
+ .onClick(() => {
+ try {
+ let webPrintDocadapter = this.controller.createWebPrintDocumentAdapter('example.pdf');
+ print.print('example_jobid', webPrintDocadapter, null, getContext());
+ } catch (error) {
+ console.error(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller });
+ }
+ }
+}
+// [End create_web_print_document]
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintW3CAPI.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintW3CAPI.ets
new file mode 100644
index 0000000000000000000000000000000000000000..7d1281e593d6ba6c272dcd97a49da7cc006a16c2
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/InitiatePrintW3CAPI.ets
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start w3c_print_html]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct Index {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Row() {
+ Column() {
+ Web({ src: $rawfile('print.html'), controller: this.controller })
+ .javaScriptAccess(true)
+ }
+ .width('100%')
+ }
+ .height('100%')
+ }
+}
+// [End w3c_print_html]
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/PreviewPDF.ets b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/PreviewPDF.ets
new file mode 100644
index 0000000000000000000000000000000000000000..dad0b0ca9293ff918383646cded1535936ae35c1
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/ets/pages/PreviewPDF.ets
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start web_module_create_load_pdf]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({
+ src:
+ $r('app.string.web_path'), // 方式一 加载网络PDF文档
+ // getContext(this).filesDir + '/test.pdf', // 方式二 加载本地应用沙箱内PDF文档
+ // 'resource://rawfile/test.pdf', // 方式三 应用内resource资源PDF文档
+ // $rawfile('test.pdf'), // 方式四 应用内resource资源PDF文档
+ controller: this.controller
+ })
+ .domStorageAccess(true)
+ }
+ }
+}
+// [End web_module_create_load_pdf]
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/module.json5 b/ArkWeb/ProcessWebPageCont/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..70729d262d8e46da160838ad06ca01e2f48b6f46
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/module.json5
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ],
+ // [Start web_module_print_html]
+ // [Start web_module_preview_pdf]
+ "requestPermissions":[
+ // [StartExclude web_module_preview_pdf]
+ {
+ "name" : "ohos.permission.PRINT"
+ },
+ // EndExclude web_module_preview_pdf]
+ // [StartExclude web_module_print_html]
+ {
+ "name" : "ohos.permission.INTERNET"
+ }
+ // [EndExclude web_module_print_html]
+ ],
+ // [End web_module_preview_pdf]
+ // [End web_module_print_html]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/color.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/string.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..1f758cd41cf67e4c769d7526ee83f962d0d865c6
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,20 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ProcessWebPageCont"
+ },
+ {
+ "name": "web_path",
+ "value": "https://www.example.com/test.pdf"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/background.png b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/foreground.png b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/layered_image.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/startIcon.png b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/backup_config.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/main_pages.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..ead1e2c5ae06ebd7246b0a4028b9899b3de9574a
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,9 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/InitiatePrintW3CAPI",
+ "pages/InitiatePrintAppAPI",
+ "pages/PreviewPDF",
+ "pages/CalcAdjustSafeArea"
+ ]
+}
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/en_US/element/string.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..448a2a5210af13626ae587985d80eb8c51800e4d
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ProcessWebPageCont"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/print.html b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/print.html
new file mode 100644
index 0000000000000000000000000000000000000000..7225f16ebc840f16091bc9e7c75380f4c1104470
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/print.html
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ printTest
+
+
+
+
+
+
+
This is a test page for printing
+
+
+
+
+
content content content
+
+
+
+
+
Thing
+
Chairs
+
+
+
+
+
1
+
blue
+
+
+
2
+
green
+
+
+
+
+
content content content
+
content content content
+
+
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/test.pdf b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/test.pdf
new file mode 100644
index 0000000000000000000000000000000000000000..f9dac5633ffc24eea33331035efbdbaffceb0031
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/rawfile/test.pdf differ
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/main/resources/zh_CN/element/string.json b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..88de2d38c7e3b4d9017b102162dee18ed9bc4794
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "ProcessWebPageCont"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/mock/mock-config.json5 b/ArkWeb/ProcessWebPageCont/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..328b7bb43ddfe2b41224a082e95263ec212bc34e
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,149 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用,点击 InitiatePrintW3CAPI 按钮
+ * 触发 window.print 操作对页面内容进行打印
+ */
+ it('InitiatePrintW3CAPI', 0, async (done: Function) => {
+ console.info('uitest: InitiatePrintW3CAPI begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'EntryAbility'
+ }
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
+ await driver.delayMs(3000);
+
+ const button1 = await driver.findComponent(ON.text('InitiatePrintW3CAPI'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.type('button'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('print.html');
+
+ await driver.pressBack();
+ console.info('uitest: InitiatePrintW3CAPI end');
+ done();
+ });
+
+ /*
+ * 点击 InitiatePrintAppAPI 按钮
+ * 创建打印适配器,将适配器传入打印的print接口调起打印
+ */
+ it('InitiatePrintAppAPI', 0, async (done: Function) => {
+ console.info('uitest: InitiatePrintAppAPI begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('InitiatePrintAppAPI'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.type('Button'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('example.com');
+
+ await driver.pressBack();
+ console.info('uitest: InitiatePrintAppAPI end');
+ done();
+ });
+
+ /*
+ * 点击 PreviewPDF 按钮
+ * 使用Web组件的PDF文档预览能力加载PDF文档
+ */
+ it('PreviewPDF', 0, async (done: Function) => {
+ console.info('uitest: PreviewPDF begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('PreviewPDF'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('example.com/test.pdf');
+
+ await driver.pressBack();
+ console.info('uitest: PreviewPDF end');
+ done();
+ });
+
+ /*
+ * 点击 CalcAdjustSafeArea 按钮
+ * 进行安全区域计算并避让适配支持异形屏幕设备在沉浸式效果下页面的正常显示
+ */
+ it('CalcAdjustSafeArea', 0, async (done: Function) => {
+ console.info('uitest: CalcAdjustSafeArea begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('CalcAdjustSafeArea'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('example.com');
+
+ console.info('uitest: CalcAdjustSafeArea end');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/List.test.ets b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/module.json5 b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/test/List.test.ets b/ArkWeb/ProcessWebPageCont/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/entry/src/test/LocalUnit.test.ets b/ArkWeb/ProcessWebPageCont/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/ProcessWebPageCont/hvigor/hvigor-config.json5 b/ArkWeb/ProcessWebPageCont/hvigor/hvigor-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..43beb743cbd25c3507b1cf8a744bf8197b3bf2fb
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/hvigor/hvigor-config.json5
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "dependencies": {
+ },
+ "execution": {
+ // "analyze": "normal", /* Define the build analyze mode. Value: [ "normal" | "advanced" | false ]. Default: "normal" */
+ // "daemon": true, /* Enable daemon compilation. Value: [ true | false ]. Default: true */
+ // "incremental": true, /* Enable incremental compilation. Value: [ true | false ]. Default: true */
+ // "parallel": true, /* Enable parallel compilation. Value: [ true | false ]. Default: true */
+ // "typeCheck": false, /* Enable typeCheck. Value: [ true | false ]. Default: false */
+ },
+ "logging": {
+ // "level": "info" /* Define the log level. Value: [ "debug" | "info" | "warn" | "error" ]. Default: "info" */
+ },
+ "debugging": {
+ // "stacktrace": false /* Disable stacktrace compilation. Value: [ true | false ]. Default: false */
+ },
+ "nodeOptions": {
+ // "maxOldSpaceSize": 8192 /* Enable nodeOptions maxOldSpaceSize compilation. Unit M. Used for the daemon process. Default: 8192*/
+ // "exposeGC": true /* Enable to trigger garbage collection explicitly. Default: true*/
+ }
+}
diff --git a/ArkWeb/ProcessWebPageCont/hvigorfile.ts b/ArkWeb/ProcessWebPageCont/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..1307c03303328d961439d1f6983b09e728b5e8ce
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+* Copyright (c) 2025 Huawei Device Co., Ltd.
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+import { appTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: appTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/ProcessWebPageCont/oh-package.json5 b/ArkWeb/ProcessWebPageCont/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..93f097993a458e967d6d5239ea0580e79b5d6998
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "modelVersion": "5.0.0",
+ "description": "Please describe the basic information.",
+ "dependencies": {
+ },
+ "devDependencies": {
+ "@ohos/hypium": "1.0.19",
+ "@ohos/hamock": "1.0.0"
+ }
+}
diff --git a/ArkWeb/ProcessWebPageCont/ohosTest.md b/ArkWeb/ProcessWebPageCont/ohosTest.md
new file mode 100644
index 0000000000000000000000000000000000000000..a93a5b8216aaab3fa52497aba5b07499e2460066
--- /dev/null
+++ b/ArkWeb/ProcessWebPageCont/ohosTest.md
@@ -0,0 +1,24 @@
+#### InitiatePrintW3CAPI
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ----------------------- | ------------ | --------------------------- | ---------------------- | -------- | -------- |
+| 使用Web组件打印前端页面 | 设备运转正常 | 应用启动成功,点击print按钮 | 触发window.print()操作 | Yes | Pass |
+
+#### InitiatePrintAppAPI
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ----------------------- | ------------ | --------------------------------------------------- | ------------ | -------- | -------- |
+| 使用Web组件打印前端页面 | 设备运转正常 | 应用启动成功,点击createWebPrintDocumentAdapter按钮 | 触发打印操作 | Yes | Pass |
+
+#### PreviewPDF
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ---------------------------- | ------------ | ------------ | -------------------------------------- | -------- | -------- |
+| 使用Web组件的PDF文档预览能力 | 设备运转正常 | 应用启动成功 | Web组件创建时指定默认加载的网络PDF文档 | Yes | Pass |
+
+#### CalcAdjustSafeArea
+
+| 测试功能 | 预置条件 | 输入 | 预期输出 | 是否自动 | 测试结果 |
+| ---------------------------- | ---------------------------- | ------------ | ------------------------------------------- | -------- | -------- |
+| 网页中安全区域计算和避让适配 | 设备运转正常,开启沉浸式效果 | 应用启动成功 | Web组件根据实际情况对网页元素进行相应的避让 | Yes | Pass |
+
diff --git a/ArkWeb/ProcessWebPageCont/screenshots/CalcAdjustSafeArea.png b/ArkWeb/ProcessWebPageCont/screenshots/CalcAdjustSafeArea.png
new file mode 100644
index 0000000000000000000000000000000000000000..bacf76e4cca730d6869a641b88c9ab43a1c654c6
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/screenshots/CalcAdjustSafeArea.png differ
diff --git a/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintAppAPI.png b/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintAppAPI.png
new file mode 100644
index 0000000000000000000000000000000000000000..f3e5eb8f67cca636ea0608cd5af117cc0e8f6542
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintAppAPI.png differ
diff --git a/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintW3CAPI.png b/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintW3CAPI.png
new file mode 100644
index 0000000000000000000000000000000000000000..6e8241f75e8b4701ee18405f97b5b9f7e65efa87
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/screenshots/InitiatePrintW3CAPI.png differ
diff --git a/ArkWeb/ProcessWebPageCont/screenshots/PreviewPDF.png b/ArkWeb/ProcessWebPageCont/screenshots/PreviewPDF.png
new file mode 100644
index 0000000000000000000000000000000000000000..979eb15ac49c64537b600b4fe1e1e4c03b931c52
Binary files /dev/null and b/ArkWeb/ProcessWebPageCont/screenshots/PreviewPDF.png differ
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/.gitignore b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..d2ff20141ceed86d87c0ea5d99481973005bab2b
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/.gitignore
@@ -0,0 +1,12 @@
+/node_modules
+/oh_modules
+/local.properties
+/.idea
+**/build
+/.hvigor
+.cxx
+/.clangd
+/.clang-format
+/.clang-tidy
+**/.test
+/.appanalyzer
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/app.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/app.json5
new file mode 100644
index 0000000000000000000000000000000000000000..0f85c5557290b6c5fe654a0173b9db71c296633d
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/app.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "bundleName": "com.samples.setbasicattrsevtsone",
+ "vendor": "example",
+ "versionCode": 1000000,
+ "versionName": "1.0.0",
+ "icon": "$media:app_icon",
+ "label": "$string:app_name"
+ }
+}
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/element/string.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..f3bc9e64fec3aceeac9b80739ca1dae60be59090
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/element/string.json
@@ -0,0 +1,8 @@
+{
+ "string": [
+ {
+ "name": "app_name",
+ "value": "SetBasicAttrsEvtsOne"
+ }
+ ]
+}
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/media/app_icon.png b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/media/app_icon.png
new file mode 100644
index 0000000000000000000000000000000000000000..a39445dc87828b76fed6d2ec470dd455c45319e3
Binary files /dev/null and b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/AppScope/resources/base/media/app_icon.png differ
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/README.md b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/README.md
new file mode 100644
index 0000000000000000000000000000000000000000..8d3025b20958141d60fe87b2fbecb9699b1ca92f
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/README.md
@@ -0,0 +1,318 @@
+# 使用隐私模式
+
+### 介绍
+
+1. 实现对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-incognito-mode.md 示例代码片段的工程化,保证指南中示例代码与sample工程文件同源。
+
+### AllowGeolocation
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过allowGeolocation设置隐私模式下的Web组件允许指定来源使用地理位置。
+
+#### 效果预览
+
+| 主页 |
+| ----------------------------------------------------------- |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式
+2. 点击按钮通过allowGeolocation设置隐私模式下的Web组件允许指定来源使用地理位置。
+
+### ClearAllCookiesSync
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过clearAllCookiesSync清除隐私模式下所有cookie。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+1. 点击按钮通过clearAllCookiesSync清除隐私模式下所有cookie。
+
+### ConfigCookieSync
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过configCookieSync设置隐私模式下指定url的单个cookie的值。
+
+#### 效果预览
+
+| 主页 |
+| ----------------------------------------------------------- |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+2. 点击按钮通过configCookieSync设置隐私模式下指定url的单个cookie的值。
+
+### DeleteAllData
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过deleteAllData清除隐私模式下Web SQL当前使用的所有存储。
+
+#### 效果预览
+
+| 主页 |
+| -------------------------------------------------------- |
+| |
+
+使用说明
+
+1,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+
+2 , 点击按钮通过deleteAllData清除隐私模式下Web SQL当前使用的所有存储。
+
+### DeleteGeolocation
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过deleteGeolocation清除隐私模式下指定来源的地理位置权限状态。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+2. 点击按钮通过deleteGeolocation清除隐私模式下指定来源的地理位置权限状态。
+
+### ExistCookie
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过existCookie查询隐私模式下是否存在cookie。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+2. 点击按钮通过existCookie查询隐私模式下是否存在cookie。
+
+### FetchCookieSync
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过fetchCookieSync获取隐私模式下指定url对应cookie的值。
+
+#### 效果预览
+
+| 主页 |
+| ---------------------------------------------------------- |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+2. 点击按钮通过fetchCookieSync获取隐私模式下指定url对应cookie的值。
+
+### GetAccessibleGeolocation
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,通过getAccessibleGeolocation以回调方式异步获取隐私模式下指定源的地理位置权限状态。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,来开启Web组件的隐私模式。
+2. 点击按钮通过getAccessibleGeolocation以回调方式异步获取隐私模式下指定源的地理位置权限状态。
+
+### IncognitoMode_one
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,将可选参数incognitoMode设置为true,来开启Web组件的隐私模式,当使用隐私模式时,浏览网页时的Cookie、 Cache Data等数据不会保存在本地的持久化文件,当隐私模式的Web组件被销毁时,Cookie、 Cache Data等数据将不被记录下来。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 将可选参数incognitoMode设置为true,创建隐私模式的Web组件。
+
+### IncognitoMode_two
+
+#### 介绍
+
+1. 本示例主要介绍使用隐私模式,通过isIncogntoMode判断当前Web组件是否是隐私模式。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------------ |
+| |
+
+使用说明
+
+1. 点击按钮通过isIncogntoMode判断当前Web组件是否是隐私模式。
+
+# 在新窗口中打开页面
+
+### OpenPageNewWin
+
+#### 介绍
+
+1. 本示例主要介绍在新窗口中打开页面,通过multiWindowAccess()接口来设置是否允许网页在新窗口打开。
+2. 实现对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-open-in-new-window.md 示例代码片段的工程化,保证指南中示例代码与sample工程文件同源。
+
+#### 效果预览
+
+| 主页 | 新窗口页面 |
+| ----------------------------------------------------------- | ----------------------------------------------------------- |
+| | |
+
+使用说明
+
+1. 通过multiWindowAccess()接口来设置是否允许网页在新窗口打开。
+1. 点击按钮在新窗口打开网页。
+
+# 管理位置权限
+
+### ManageLocPerms
+
+#### 介绍
+
+1. 本示例主要介绍管理位置权限,可以通过onGeolocationShow()接口对某个网站进行位置权限管理。Web组件根据接口响应结果,决定是否赋予前端页面权限。
+2. 实现对以下指南文档中 https://gitee.com/openharmony/docs/blob/OpenHarmony-5.0.1-Release/zh-cn/application-dev/web/web-geolocation-permission.md 示例代码片段的工程化,保证指南中示例代码与sample工程文件同源。
+
+#### 效果预览
+
+| 主页 | 提示框 |
+| ----------------------------------------------------------- | ----------------------------------------------------------- |
+| | |
+
+使用说明
+
+1. 通过onGeolocationShow()接口对某个网站进行位置权限管理。
+1. 点击按钮,Web组件通过弹窗的形式通知应用侧位置权限请求消息。
+
+# 设置深色模式
+
+### 介绍
+
+1. 实现对以下指南文档中 https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/web/web-set-dark-mode.md 示例代码片段的工程化,保证指南中示例代码与sample工程文件同源。
+
+### DarkMode_one
+
+#### 介绍
+
+1. 本示例主要介绍对前端页面进行深色模式配置,使用darkMode()接口可以配置不同的深色模式。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------- |
+| |
+
+使用说明
+
+1. 使用darkMode()接口将页面深色模式配置为跟随系统。
+
+### DarkMode_two
+
+#### 介绍
+
+1. 本示例主要介绍对前端页面进行深色模式配置,通过forceDarkAccess()接口可将前端页面强制配置深色模式。
+
+#### 效果预览
+
+| 主页 |
+| ------------------------------------------------------- |
+| |
+
+使用说明
+
+1. 将深色模式配置成WebDarkMode.On,并通过forceDarkAccess()接口将页面强制配置为深色模式。
+
+## 工程目录
+
+```
+entry/src/main/
+|---ets
+|---|---entryability
+|---|---|---EntryAbility.ets
+|---|---pages
+|---|---|---Index.ets // 首页
+|---|---|---DarkMode_one.ets
+|---|---|---DarkMode_two.ets
+|---|---|---AllowGeolocation
+|---|---|---ClearAllCookiesSync
+|---|---|---ConfigCookieSync
+|---|---|---DeleteAllData
+|---|---|---DeleteGeolocation
+|---|---|---ExistCookie
+|---|---|---FetchCookieSync
+|---|---|---GetAccessibleGeolocation
+|---|---|---IncognitoMode_one
+|---|---|---IncognitoMode_two
+|---|---|---OpenPageNewWin.ets
+|---|---|---ManageLocPerms.ets
+|---resources // 静态资源
+|---ohosTest
+|---|---ets
+|---|---|---tests
+|---|---|---|---Ability.test.ets // 自动化测试用例
+```
+
+## 相关权限
+
+[ohos.permission.INTERNET](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissioninternet)
+
+[ohos.permission.LOCATION](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionlocation)
+
+[ohos.permission.APPROXIMATELY_LOCATION](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionapproximatelylocation)
+
+[ohos.permission.LOCATION_IN_BACKGROUND](https://docs.openharmony.cn/pages/v5.0/zh-cn/application-dev/security/AccessToken/permissions-for-all.md#ohospermissionlocationinbackground)
+
+## 依赖
+
+不涉及。
+
+## 约束与限制
+
+1. 本示例仅支持标准系统上运行,支持设备:华为手机。
+
+2. HarmonyOS系统:HarmonyOS 5.0.2 Release及以上。
+
+3. DevEco Studio版本:DevEco Studio 5.0.2 Release及以上。
+
+4. HarmonyOS SDK版本:HarmonyOS 5.0.2 Release及以上。
+
+## 下载
+
+如需单独下载本工程,执行如下命令:
+
+```
+git init
+git config core.sparsecheckout true
+echo ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne > .git/info/sparse-checkout
+git remote add origin https://gitee.com/harmonyos_samples/guide-snippets.git
+git pull origin master
+```
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/build-profile.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..9c284a291dc2cd15abf8025431e67aa253f01b81
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/build-profile.json5
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "app": {
+ "signingConfigs": [],
+ "products": [
+ {
+ "name": "default",
+ "signingConfig": "default",
+ "compatibleSdkVersion": "5.0.2(14)",
+ "targetSdkVersion": "5.0.2(14)",
+ "runtimeOS": "HarmonyOS",
+ }
+ ],
+ "buildModeSet": [
+ {
+ "name": "debug",
+ },
+ {
+ "name": "release"
+ }
+ ]
+ },
+ "modules": [
+ {
+ "name": "entry",
+ "srcPath": "./entry",
+ "targets": [
+ {
+ "name": "default",
+ "applyToProducts": [
+ "default"
+ ]
+ }
+ ]
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/code-linter.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/code-linter.json5
new file mode 100644
index 0000000000000000000000000000000000000000..28586467ee7a761c737d8654a73aed6fddbc3c71
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/code-linter.json5
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "files": [
+ "**/*.ets"
+ ],
+ "ignore": [
+ "**/src/ohosTest/**/*",
+ "**/src/test/**/*",
+ "**/src/mock/**/*",
+ "**/node_modules/**/*",
+ "**/oh_modules/**/*",
+ "**/build/**/*",
+ "**/.preview/**/*"
+ ],
+ "ruleSet": [
+ "plugin:@performance/recommended",
+ "plugin:@typescript-eslint/recommended"
+ ],
+ "rules": {
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/.gitignore b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/build-profile.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/hvigorfile.ts b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/obfuscation-rules.txt b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/oh-package.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c9cb6c8174858277c9b0d465a51547dcab16d5ff
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entryability/EntryAbility.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entryability/EntryAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0f2f8b94aa24b0a50e272270e4e18b6df93ac5fd
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entryability/EntryAbility.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class EntryAbility extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b1e212947256c5533c7b06285a597c94f840a6e3
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/entrybackupability/EntryBackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class EntryBackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/AllowGeolocation.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/AllowGeolocation.ets
new file mode 100644
index 0000000000000000000000000000000000000000..96167cf5d798feae39d86710b5ee195f507eaed6
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/AllowGeolocation.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start setting_the_web_component_in_privacy_mode_allows_specifying_the_geolocation_of_the_source_used]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ origin: string = 'file:///';
+
+ build() {
+ Column() {
+ Button('allowGeolocation')
+ .onClick(() => {
+ try {
+ // allowGeolocation第二个参数表示隐私模式(true)或非隐私模式(false)下,允许指定来源使用地理位置。
+ webview.GeolocationPermissions.allowGeolocation(this.origin, true);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End setting_the_web_component_in_privacy_mode_allows_specifying_the_geolocation_of_the_source_used]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ClearAllCookiesSync.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ClearAllCookiesSync.ets
new file mode 100644
index 0000000000000000000000000000000000000000..dde1aa7d0bd4b8e9ab501690b47459063e6cdaf0
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ClearAllCookiesSync.ets
@@ -0,0 +1,35 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start clear_all_cookies_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('clearAllCookiesSync')
+ .onClick(() => {
+ // clearAllCookiesSync参数表示清除隐私模式(true)或非隐私模式(false)下,webview的所有内存cookies。
+ webview.WebCookieManager.clearAllCookiesSync(true);
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End clear_all_cookies_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ConfigCookieSync.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ConfigCookieSync.ets
new file mode 100644
index 0000000000000000000000000000000000000000..3c5e72cd0afd6e4dfc6d002d7e28532b1adb1b75
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ConfigCookieSync.ets
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start set_the_value_of_a_single_cookie_for_a_specified_url_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('configCookieSync')
+ .onClick(() => {
+ try {
+ // configCookieSync第三个参数表示获取隐私模式(true)或非隐私模式(false)下,对应url的cookies。
+ webview.WebCookieManager.configCookieSync('www.example.com', 'a=b', true);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End set_the_value_of_a_single_cookie_for_a_specified_url_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_one.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9fad13e49ed848122a37294eca902ba3b8b61ade
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_one.ets
@@ -0,0 +1,32 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start configure_page_dark_mode_to_follow_the_system]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ @State mode: WebDarkMode = WebDarkMode.Auto;
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('darkModePage.html'), controller: this.controller })
+ .darkMode(this.mode)
+ }
+ }
+}
+// [End configure_page_dark_mode_to_follow_the_system]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_two.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_two.ets
new file mode 100644
index 0000000000000000000000000000000000000000..cd0dc35bcea348c0186915a71879e92829fbbeb6
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DarkMode_two.ets
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start force_the_page_to_be_configured_to_dark_mode]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ @State mode: WebDarkMode = WebDarkMode.On;
+ @State access: boolean = true;
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('darkModePage.html'), controller: this.controller })
+ .darkMode(this.mode)
+ .forceDarkAccess(this.access)
+ }
+ }
+}
+// [End force_the_page_to_be_configured_to_dark_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteAllData.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteAllData.ets
new file mode 100644
index 0000000000000000000000000000000000000000..eba8a6b93ec17492b001acb0d90fd90f7f8248d8
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteAllData.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start clear_all_storage_currently_used_by_web_sql_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('deleteAllData')
+ .onClick(() => {
+ try {
+ // deleteAllData参数表示删除所有隐私模式(true)或非隐私模式(false)下,内存中的web数据。
+ webview.WebStorage.deleteAllData(true);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index.html'), controller: this.controller, incognitoMode: true })
+ .databaseAccess(true)
+ }
+ }
+}
+// [End clear_all_storage_currently_used_by_web_sql_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteGeolocation.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteGeolocation.ets
new file mode 100644
index 0000000000000000000000000000000000000000..9b38112ff6ea0c1a3c4b6d373614aa6f9fdede9a
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/DeleteGeolocation.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start clear_the_geolocation_permission_status_of_the_specified_source_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ origin: string = 'file:///';
+
+ build() {
+ Column() {
+ Button('deleteGeolocation')
+ .onClick(() => {
+ try {
+ // deleteGeolocation第二个参数表示隐私模式(true)或非隐私模式(false)下,清除指定来源的地理位置权限状态。
+ webview.GeolocationPermissions.deleteGeolocation(this.origin, true);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End clear_the_geolocation_permission_status_of_the_specified_source_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ExistCookie.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ExistCookie.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a4f870530753c4ccb924457eb929bfb9d7e85411
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ExistCookie.ets
@@ -0,0 +1,36 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start check_whether_cookies_exist_in_mode]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('existCookie')
+ .onClick(() => {
+ // existCookie参数表示隐私模式(true)或非隐私模式(false)下,查询是否存在cookies。
+ let result = webview.WebCookieManager.existCookie(true);
+ console.log('result: ' + result);
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End check_whether_cookies_exist_in_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/FetchCookieSync.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/FetchCookieSync.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a17ed3b40343d58092b9156b79a9d82df1c5f549
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/FetchCookieSync.ets
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start obtain_the_value_of_the_cookie_corresponding_to_the_specified_url_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('fetchCookieSync')
+ .onClick(() => {
+ try {
+ // fetchCookieSync第二个参数表示获取隐私模式(true)或非隐私模式(false)下,webview的内存cookies。
+ let value = webview.WebCookieManager.fetchCookieSync('www.example.com', true);
+ console.log('fetchCookieSync cookie = ' + value);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End obtain_the_value_of_the_cookie_corresponding_to_the_specified_url_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/GetAccessibleGeolocation.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/GetAccessibleGeolocation.ets
new file mode 100644
index 0000000000000000000000000000000000000000..1e37fd79fcd073ea9a487421899fcec2ffdd42aa
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/GetAccessibleGeolocation.ets
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start asynchronously_obtains_the_geolocation_permission_status_of_the_specified_source_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ origin: string = 'file:///';
+
+ build() {
+ Column() {
+ Button('getAccessibleGeolocation')
+ .onClick(() => {
+ try {
+ // getAccessibleGeolocation第三个参数表示隐私模式(true)或非隐私模式(false)下
+ // 以回调方式异步获取指定源的地理位置权限状态。
+ webview.GeolocationPermissions.getAccessibleGeolocation(this.origin, (error, result) => {
+ if (error) {
+ console.log('getAccessibleGeolocationAsync error: ' + JSON.stringify(error));
+ return;
+ }
+ console.log('getAccessibleGeolocationAsync result: ' + result);
+ }, true);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End asynchronously_obtains_the_geolocation_permission_status_of_the_specified_source_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_one.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..95d05d45a2a3d9ac1a635dc9f47c5dcdcc9b3080
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_one.ets
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_a_web_component_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: 'www.example.com', controller: this.controller, incognitoMode: true });
+ }
+ }
+}
+// [End create_a_web_component_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_two.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_two.ets
new file mode 100644
index 0000000000000000000000000000000000000000..45893f00c020b4a179eae6575e9bed4dc899b280
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/IncognitoMode_two.ets
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start determine_whether_the_current_web_component_is_in_privacy_mode]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Button('isIncognitoMode')
+ .onClick(() => {
+ try {
+ let result = this.controller.isIncognitoMode();
+ console.log('isIncognitoMode' + result);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: 'www.example.com', controller: this.controller });
+ }
+ }
+}
+// [End determine_whether_the_current_web_component_is_in_privacy_mode]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/Index.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..420f733900a18591c4b182d382f7b6e6bede3d61
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/Index.ets
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('DarkMode_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/DarkMode_one' });
+ })
+ Button('DarkMode_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/DarkMode_two' });
+ })
+ Button('AllowGeolocation')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/AllowGeolocation' });
+ })
+ Button('ClearAllCookiesSync')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/ClearAllCookiesSync' });
+ })
+ Button('ConfigCookieSync')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/ConfigCookieSync' });
+ })
+ Button('DeleteAllData')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/DeleteAllData' });
+ })
+ Button('DeleteGeolocation')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/DeleteGeolocation' });
+ })
+ Button('ExistCookie')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/ExistCookie' });
+ })
+ Button('FetchCookieSync')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/FetchCookieSync' });
+ })
+ Button('GetAccessibleGeolocation')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/GetAccessibleGeolocation' });
+ })
+ Button('IncognitoMode_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/IncognitoMode_one' });
+ })
+ Button('IncognitoMode_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/IncognitoMode_two' });
+ })
+ Button('OpenPageNewWin')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/OpenPageNewWin' });
+ })
+ Button('ManageLocPerms')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/ManageLocPerms' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ManageLocPerms.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ManageLocPerms.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b39a2cf2be2b6dc0d11af46a87c698b4a7b20ac2
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/ManageLocPerms.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start a_pop_up_window_is_used_to_notify_the_app_side_location_permission_request_message]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+import { abilityAccessCtrl, common } from '@kit.AbilityKit';
+
+let context = getContext(this) as common.UIAbilityContext;
+let atManager = abilityAccessCtrl.createAtManager();
+
+// 向用户请求位置权限设置。
+atManager.requestPermissionsFromUser(context, ['ohos.permission.APPROXIMATELY_LOCATION']).then((data) => {
+ console.info('data:' + JSON.stringify(data));
+ console.info('data permissions:' + data.permissions);
+ console.info('data authResults:' + data.authResults);
+}).catch((error: BusinessError) => {
+ console.error(`Failed to request permissions from user. Code is ${error.code}, message is ${error.message}`);
+})
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('getLocation.html'), controller: this.controller })
+ .geolocationAccess(true)
+ .onGeolocationShow((event) => { // 地理位置权限申请通知
+ AlertDialog.show({
+ title: 'Location permission requests',
+ message: 'Whether to allow access to location information',
+ primaryButton: {
+ value: 'cancel',
+ action: () => {
+ if (event) {
+ event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
+ }
+ }
+ },
+ secondaryButton: {
+ value: 'ok',
+ action: () => {
+ if (event) {
+ event.geolocation.invoke(event.origin, true, false); // 允许此站点地理位置权限请求
+ }
+ }
+ },
+ cancel: () => {
+ if (event) {
+ event.geolocation.invoke(event.origin, false, false); // 不允许此站点地理位置权限请求
+ }
+ }
+ })
+ })
+ }
+ }
+}
+// [End a_pop_up_window_is_used_to_notify_the_app_side_location_permission_request_message]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/OpenPageNewWin.ets b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/OpenPageNewWin.ets
new file mode 100644
index 0000000000000000000000000000000000000000..af16dd1c6edf119f9f6da7d80d8d45517e3a7f0a
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/ets/pages/OpenPageNewWin.ets
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start receive_a_web_component_new_window_event]
+import { webview } from '@kit.ArkWeb';
+
+// 在同一page页有两个Web组件。在WebComponent新开窗口时,会跳转到NewWebViewComp。
+@CustomDialog
+struct NewWebViewComp {
+ controller?: CustomDialogController;
+ webviewController1: webview.WebviewController = new webview.WebviewController();
+
+ build() {
+ Column() {
+ Web({ src: '', controller: this.webviewController1 })
+ .javaScriptAccess(true)
+ .multiWindowAccess(false)
+ .onWindowExit(() => {
+ console.info('NewWebViewComp onWindowExit');
+ if (this.controller) {
+ this.controller.close();
+ }
+ })
+ }
+ }
+}
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ dialogController: CustomDialogController | null = null;
+
+ build() {
+ Column() {
+ Web({ src: $rawfile('window.html'), controller: this.controller })
+ .javaScriptAccess(true)
+ // 需要使能multiWindowAccess
+ .multiWindowAccess(true)
+ .allowWindowOpenMethod(true)
+ .onWindowNew((event) => {
+ if (this.dialogController) {
+ this.dialogController.close();
+ }
+ let popController: webview.WebviewController = new webview.WebviewController();
+ this.dialogController = new CustomDialogController({
+ builder: NewWebViewComp({ webviewController1: popController })
+ });
+ this.dialogController.open();
+ // 将新窗口对应WebviewController返回给Web内核。
+ // 如果不需要打开新窗口请调用event.handler.setWebController接口设置成null。
+ // 若不调用event.handler.setWebController接口,会造成render进程阻塞。
+ event.handler.setWebController(popController);
+ })
+ }
+ }
+}
+// [End receive_a_web_component_new_window_event]
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/module.json5 b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..394d2a4703ff31b1662e4f09fba46876e701c984
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/module.json5
@@ -0,0 +1,98 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "EntryAbility",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "EntryAbility",
+ "srcEntry": "./ets/entryability/EntryAbility.ets",
+ "description": "$string:EntryAbility_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:EntryAbility_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "EntryBackupAbility",
+ "srcEntry": "./ets/entrybackupability/EntryBackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ },
+ {
+ "name" : "ohos.permission.LOCATION",
+ "reason": "$string:EntryAbility_desc",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ }
+ },
+ {
+ "name" : "ohos.permission.APPROXIMATELY_LOCATION",
+ "reason": "$string:EntryAbility_desc",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ }
+ },
+ {
+ "name" : "ohos.permission.LOCATION_IN_BACKGROUND",
+ "reason": "$string:EntryAbility_desc",
+ "usedScene": {
+ "abilities": [
+ "EntryAbility"
+ ],
+ }
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/color.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/string.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..18d4ec70763241b2e4e8ece71a5a37f56c0d74c8
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/element/string.json
@@ -0,0 +1,20 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "SetBasicAttrsEvtsOne"
+ },
+ {
+ "name": "use_is_permitted",
+ "value": "本次使用允许"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/background.png b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/foreground.png b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/layered_image.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/startIcon.png b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/backup_config.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/main_pages.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..873e2af741f7145ca994ad97abad48f571d63589
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,19 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/DarkMode_one",
+ "pages/DarkMode_two",
+ "pages/AllowGeolocation",
+ "pages/ClearAllCookiesSync",
+ "pages/ConfigCookieSync",
+ "pages/DeleteAllData",
+ "pages/DeleteGeolocation",
+ "pages/ExistCookie",
+ "pages/FetchCookieSync",
+ "pages/GetAccessibleGeolocation",
+ "pages/IncognitoMode_one",
+ "pages/IncognitoMode_two",
+ "pages/OpenPageNewWin",
+ "pages/ManageLocPerms"
+ ]
+}
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/en_US/element/string.json b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/en_US/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..80f7dd956c3a63524e9bc87f25a1567069ce3176
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/en_US/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "SetBasicAttrsEvtsOne"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/darkModePage.html b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/darkModePage.html
new file mode 100644
index 0000000000000000000000000000000000000000..43497f5df3fabd7205aa28942e6dc63e24892b4a
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/darkModePage.html
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+
+
Dark mode debug page
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/getLocation.html b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/getLocation.html
new file mode 100644
index 0000000000000000000000000000000000000000..4ae442f92a0e6145b5979fd8f571722c6ca83d10
--- /dev/null
+++ b/ArkWeb/SetBasicAttrsEvts/SetBasicAttrsEvtsOne/entry/src/main/resources/rawfile/getLocation.html
@@ -0,0 +1,34 @@
+
+
+
+
+
+
+
+
+
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/main/resources/zh_CN/element/string.json b/ArkWeb/UseFrontendJSApp/entry/src/main/resources/zh_CN/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..b060b52e82b9cbdf9b4cf441b8ebc77053cda9f4
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/main/resources/zh_CN/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "模块描述"
+ },
+ {
+ "name": "EntryAbility_desc",
+ "value": "description"
+ },
+ {
+ "name": "EntryAbility_label",
+ "value": "UseFrontendJSApp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/mock/mock-config.json5 b/ArkWeb/UseFrontendJSApp/entry/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..529c502db25b8b7edfc5ea420457241b8d374b9f
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用
+ * 通过 runJavaScript 和 runJavaScriptExt 方法调用前端页面的JavaScript相关函数
+ */
+ it('testUiExample',0, async (done: Function) => {
+ console.info('uitest: TestUiExample begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'EntryAbility'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('EntryAbility');
+ await driver.delayMs(5000);
+
+ const button1 = await driver.findComponent(ON.text('runJavaScript'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('runJavaScriptCodePassed'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const webButton = await driver.findComponent(ON.type('button'));
+ await webButton.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index.html');
+
+ console.info('uitest: TestUiExample end');
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/module.json5 b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..c3fd9dda3040d888d9d8b0b62bcb5d3b6fbeb614
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry/src/test/LocalUnit.test.ets b/ArkWeb/UseFrontendJSApp/entry/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/.gitignore b/ArkWeb/UseFrontendJSApp/entry2/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/build-profile.json5 b/ArkWeb/UseFrontendJSApp/entry2/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/hvigorfile.ts b/ArkWeb/UseFrontendJSApp/entry2/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry2/obfuscation-rules.txt b/ArkWeb/UseFrontendJSApp/entry2/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/oh-package.json5 b/ArkWeb/UseFrontendJSApp/entry2/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..6f8ebfffe80a99a9743e76a638cdd63c2b6ec72f
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry2",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2ability/Entry2Ability.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2ability/Entry2Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..dab8f3ea7260551b9dc6606eb397e396d241e701
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2ability/Entry2Ability.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class Entry2Ability extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2backupability/Entry2BackupAbility.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2backupability/Entry2BackupAbility.ets
new file mode 100644
index 0000000000000000000000000000000000000000..213e60d6187ea841335f6263f3072b8e1c20e395
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/entry2backupability/Entry2BackupAbility.ets
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { BackupExtensionAbility, BundleVersion } from '@kit.CoreFileKit';
+
+export default class Entry2BackupAbility extends BackupExtensionAbility {
+ async onBackup() {
+ hilog.info(0x0000, 'testTag', 'onBackup ok');
+ }
+
+ async onRestore(bundleVersion: BundleVersion) {
+ hilog.info(0x0000, 'testTag', 'onRestore ok %{public}s', JSON.stringify(bundleVersion));
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Index.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..730f850ab03976dfd6e0c92ad1dffdeacf6cad03
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Index.ets
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { router } from '@kit.ArkUI';
+
+@Entry
+@Component
+struct Index {
+ build() {
+ Column({ space: 10 }) {
+ Button('JavaScriptProxy')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/JavaScriptProxy' });
+ })
+ Button('Promise_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/Promise_one' });
+ })
+ Button('Promise_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/Promise_two' });
+ })
+ Button('RegisterJavaScriptProxy')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/RegisterJavaScriptProxy' });
+ })
+ Button('UsageOfComplexTypes_one')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/UsageOfComplexTypes_one' });
+ })
+ Button('UsageOfComplexTypes_two')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/UsageOfComplexTypes_two' });
+ })
+ Button('UsageOfComplexTypes_three')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/UsageOfComplexTypes_three' });
+ })
+ Button('UsageOfComplexTypes_four')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/UsageOfComplexTypes_four' });
+ })
+ Button('UsageOfComplexTypes_five')
+ .onClick(() => {
+ router.pushUrl({ url: 'pages/UsageOfComplexTypes_five' });
+ })
+ }.height('100%')
+ .width('100%')
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/JavaScriptProxy.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/JavaScriptProxy.ets
new file mode 100644
index 0000000000000000000000000000000000000000..a1cd4cc07f1b04d30dc9cf8918b25cf8da7746eb
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/JavaScriptProxy.ets
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start functions_that_trigger_a_run_on_the_front_end_page_are_registered_in_the_front_end_page]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(): string {
+ return 'ArkTS Hello World!';
+ }
+}
+
+@Entry
+@Component
+struct WebComponent {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ // 声明需要注册的对象
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ // Web组件加载本地index.html页面
+ Web({ src: $rawfile('index1.html'), controller: this.webviewController})
+ // 将对象注入到web端
+ .javaScriptProxy({
+ object: this.testObj,
+ name: 'testObjName',
+ methodList: ['test'],
+ controller: this.webviewController,
+ // 可选参数
+ asyncMethodList: [],
+ permission: '{"javascriptProxyPermission":{"urlPermissionList":' +
+ '[{"scheme":"resource","host":"rawfile","port":"","path":""},' +
+ '{"scheme":"e","host":"f","port":"g","path":"h"}],"methodList":' +
+ '[{"methodName":"test","urlPermissionList":' +
+ '[{"scheme":"https","host":"xxx.com","port":"","path":""},' +
+ '{"scheme":"resource","host":"rawfile","port":"","path":""}]},' +
+ '{"methodName":"test11","urlPermissionList":' +
+ '[{"scheme":"q","host":"r","port":"","path":"t"},' +
+ '{"scheme":"u","host":"v","port":"","path":""}]}]}}'
+ })
+ }
+ }
+}
+// [End functions_that_trigger_a_run_on_the_front_end_page_are_registered_in_the_front_end_page]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_one.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..df576803c18cdb35e48140459f394c0ad41faf46
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_one.ets
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start on_the_application_side_of_new_promise]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(): Promise {
+ let p: Promise = new Promise((resolve, reject) => {
+ setTimeout(() => {
+ console.log('Execute Finished');
+ reject('fail');
+ }, 10000);
+ });
+ return p;
+ }
+
+ toString(param: String): void {
+ console.log(' ' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index2.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End on_the_application_side_of_new_promise]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_two.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_two.ets
new file mode 100644
index 0000000000000000000000000000000000000000..67fdec8c5f3d40c406ceeac6190168faad1119a7
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/Promise_two.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start on_the_front_end_page_new_promise]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(param:Function): void {
+ setTimeout( () => { param('suc') }, 10000)
+ }
+
+ toString(param:String): void {
+ console.log(' ' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index3.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End on_the_front_end_page_new_promise]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/RegisterJavaScriptProxy.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/RegisterJavaScriptProxy.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e69d1c30cccae8cbb61c9ef8072d23481eca3030
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/RegisterJavaScriptProxy.ets
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start application_side_api_registration]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(): string {
+ return 'ArkUI Web Component';
+ }
+
+ toString(): void {
+ console.log('Web Component toString');
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString'],
+ // 可选参数, asyncMethodList
+ [],
+ // 可选参数, permission
+ '{"javascriptProxyPermission":{"urlPermissionList":' +
+ '[{"scheme":"resource","host":"rawfile","port":"","path":""},' +
+ '{"scheme":"e","host":"f","port":"g","path":"h"}],"methodList":' +
+ '[{"methodName":"test","urlPermissionList":' +
+ '[{"scheme":"https","host":"xxx.com","port":"","path":""},' +
+ '{"scheme":"resource","host":"rawfile","port":"","path":""}]},' +
+ '{"methodName":"test11","urlPermissionList":[{"scheme":"q","host":"r","port":"","path":"t"},' +
+ '{"scheme":"u","host":"v","port":"","path":""}]}]}}'
+ );
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index4.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End application_side_api_registration]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_five.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_five.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8d284f5ddc539a42864c2a7fe68bc10be95c4ad6
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_five.ets
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_front_end_page_calls_the_function_in_the_object_on_the_application_side]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class ObjOther {
+ public methodNameListForJsProxy: string[];
+
+ constructor(list: string[]) {
+ this.methodNameListForJsProxy = list;
+ }
+
+ testOther(json: string): void {
+ console.info(json);
+ }
+}
+
+class TestClass {
+public objReturn: ObjOther
+
+ constructor() {
+ this.objReturn = new ObjOther(['testOther']);
+ }
+
+ test(): ESObject {
+ return this.objReturn
+ }
+
+ toString(param: string): void {
+ console.log('Web Component toString' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index5.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End the_front_end_page_calls_the_function_in_the_object_on_the_application_side]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_four.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_four.ets
new file mode 100644
index 0000000000000000000000000000000000000000..046d6e1c60674e9d5ca76fb13044fccb9b6c3388
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_four.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start call_the_function_in_the_object_of_the_front_end_page_on_the_application_side]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(param: ESObject): void {
+ param.hello('call obj func');
+ }
+
+ toString(param: String): void {
+ console.log('Web Component toString' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index6.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End call_the_function_in_the_object_of_the_front_end_page_on_the_application_side]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_one.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_one.ets
new file mode 100644
index 0000000000000000000000000000000000000000..2f115540320bebd5d2a69fc9c90e89ef13f76e9b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_one.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start pass_an_array_between_the_application_side_and_the_front_end_page]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(): Array {
+ return [1, 2, 3, 4];
+ }
+
+ toString(param: String): void {
+ console.log('Web Component toString' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index7.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End pass_an_array_between_the_application_side_and_the_front_end_page]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_three.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_three.ets
new file mode 100644
index 0000000000000000000000000000000000000000..32d9ef6c5bee7edbda4c4e2ee6326717eddfbe3c
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_three.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_application_side_calls_the_callback_of_the_front_end_page]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class TestClass {
+ constructor() {
+ }
+
+ test(param: Function): void {
+ param('call callback');
+ }
+
+ toString(param: String): void {
+ console.log('Web Component toString' + param);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index8.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End the_application_side_calls_the_callback_of_the_front_end_page]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_two.ets b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_two.ets
new file mode 100644
index 0000000000000000000000000000000000000000..ee4d7cbb90d72f446f6787797845c48ac385242a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/ets/pages/UsageOfComplexTypes_two.ets
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_base_type_is_passed_between_the_app_side_and_front_end_pages]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+class Student {
+ public name: string = '';
+ public age: string = '';
+}
+
+class TestClass {
+ constructor() {
+ }
+
+ // 传递的基础类型name:'jeck', age:'12'。
+ test(): Student {
+ let st: Student = { name: 'jeck', age: '12' };
+ return st;
+ }
+
+ toString(param: ESObject): void {
+ console.log('Web Component toString' + param['name']);
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ webviewController: webview.WebviewController = new webview.WebviewController();
+ @State testObj: TestClass = new TestClass();
+
+ build() {
+ Column() {
+ Button('refresh')
+ .onClick(() => {
+ try {
+ this.webviewController.refresh();
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('Register JavaScript To Window')
+ .onClick(() => {
+ try {
+ this.webviewController.registerJavaScriptProxy(this.testObj, 'testObjName', ['test', 'toString']);
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Button('deleteJavaScriptRegister')
+ .onClick(() => {
+ try {
+ this.webviewController.deleteJavaScriptRegister('testObjName');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index9.html'), controller: this.webviewController })
+ }
+ }
+}
+// [End the_base_type_is_passed_between_the_app_side_and_front_end_pages]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/module.json5 b/ArkWeb/UseFrontendJSApp/entry2/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..90a4604809422135bc23f5a1d55f88ba15ad078d
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/module.json5
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry2",
+ "type": "entry",
+ "description": "$string:module_desc",
+ "mainElement": "Entry2Ability",
+ "deviceTypes": [
+ "default"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "Entry2Ability",
+ "srcEntry": "./ets/entry2ability/Entry2Ability.ets",
+ "description": "$string:Entry2Ability_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:Entry2Ability_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true,
+ "skills": [
+ {
+ "entities": [
+ "entity.system.home"
+ ],
+ "actions": [
+ "action.system.home"
+ ]
+ }
+ ]
+ }
+ ],
+ "extensionAbilities": [
+ {
+ "name": "Entry2BackupAbility",
+ "srcEntry": "./ets/entry2backupability/Entry2BackupAbility.ets",
+ "type": "backup",
+ "exported": false,
+ "metadata": [
+ {
+ "name": "ohos.extension.backup",
+ "resource": "$profile:backup_config"
+ }
+ ]
+ }
+ ],
+ "requestPermissions": [
+ {
+ "name": "ohos.permission.INTERNET"
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/color.json b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/string.json b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..7c88d8349f6a73dadf4933bc4f150cb016a226fe
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "Entry2Ability_desc",
+ "value": "description"
+ },
+ {
+ "name": "Entry2Ability_label",
+ "value": "UseFrontendJSApp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/background.png b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/foreground.png b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/layered_image.json b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/startIcon.png b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/backup_config.json b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/backup_config.json
new file mode 100644
index 0000000000000000000000000000000000000000..78f40ae7c494d71e2482278f359ec790ca73471a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/backup_config.json
@@ -0,0 +1,3 @@
+{
+ "allowToBackupRestore": true
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/main_pages.json b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..85f81c85c48178478853558030d3f675380df813
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,14 @@
+{
+ "src": [
+ "pages/Index",
+ "pages/JavaScriptProxy",
+ "pages/RegisterJavaScriptProxy",
+ "pages/Promise_one",
+ "pages/Promise_two",
+ "pages/UsageOfComplexTypes_one",
+ "pages/UsageOfComplexTypes_two",
+ "pages/UsageOfComplexTypes_three",
+ "pages/UsageOfComplexTypes_four",
+ "pages/UsageOfComplexTypes_five"
+ ]
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index1.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index1.html
new file mode 100644
index 0000000000000000000000000000000000000000..f191e18ba4a95fff3e0c00a06b8efc58042bed0e
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index1.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index2.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index2.html
new file mode 100644
index 0000000000000000000000000000000000000000..7ce3b4e0f6e7224d2d374d758218d12762074285
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index2.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index3.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index3.html
new file mode 100644
index 0000000000000000000000000000000000000000..e8d5f8a4bc6bb2a5e7c71dd1755b2163640762d4
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index3.html
@@ -0,0 +1,30 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index4.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index4.html
new file mode 100644
index 0000000000000000000000000000000000000000..f191e18ba4a95fff3e0c00a06b8efc58042bed0e
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index4.html
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index5.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index5.html
new file mode 100644
index 0000000000000000000000000000000000000000..39411f1290bcb77735a74018e21440838badf590
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index5.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index6.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index6.html
new file mode 100644
index 0000000000000000000000000000000000000000..139cccc5c8e66579033566092b69e28f256fc329
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index6.html
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index7.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index7.html
new file mode 100644
index 0000000000000000000000000000000000000000..a40f4ca5f942a89dd8b4fc5867302f142e3c53dd
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index7.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index8.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index8.html
new file mode 100644
index 0000000000000000000000000000000000000000..b7092a6123176ec10e701a02f16b038a80db4fc3
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index8.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index9.html b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index9.html
new file mode 100644
index 0000000000000000000000000000000000000000..a40f4ca5f942a89dd8b4fc5867302f142e3c53dd
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/main/resources/rawfile/index9.html
@@ -0,0 +1,27 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/mock/mock-config.json5 b/ArkWeb/UseFrontendJSApp/entry2/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fe6e745d6402255deda1eb8eaae4ead04782fd0c
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,378 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用,点击 JavaScriptProxy 按钮
+ * 在Web组件初始化使用 javaScriptProxy 接口注册应用侧代码
+ */
+ it('JavaScriptProxy', 0, async (done: Function) => {
+ console.info('uitest: JavaScriptProxy begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'Entry2Ability'
+ };
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('Entry2Ability');
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('JavaScriptProxy'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.type('Button'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.type('button'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index1.html');
+
+ await driver.pressBack();
+ console.info('uitest: JavaScriptProxy end');
+ done();
+ });
+
+ /*
+ * 点击 Promise_one 按钮
+ * 使用Promise使用场景
+ */
+ it('Promise_one', 0, async (done: Function) => {
+ console.info('uitest: Promise_one begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('Promise_one'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ await driver.pressBack();
+ console.info('uitest: Promise_one end');
+ done();
+ });
+
+ /*
+ * 点击 Promise_two 按钮
+ * 使用Promise使用场景
+ */
+ it('Promise_two', 0, async (done: Function) => {
+ console.info('uitest: Promise_two begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('Promise_two'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ await driver.pressBack();
+ console.info('uitest: Promise_two end');
+ done();
+ });
+
+ /*
+ * 点击 RegisterJavaScriptProxy 按钮
+ * 使用 registerJavaScriptProxy 接口注册应用侧代码
+ */
+ it('RegisterJavaScriptProxy', 0, async (done: Function) => {
+ console.info('uitest: RegisterJavaScriptProxy begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('RegisterJavaScriptProxy'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index4.html');
+
+ await driver.pressBack();
+ console.info('uitest: RegisterJavaScriptProxy end');
+ done();
+ });
+
+ /*
+ * 点击 UsageOfComplexTypes_one 按钮
+ * 在应用侧和前端页面之间传递Array
+ */
+ it('UsageOfComplexTypes_one', 0, async (done: Function) => {
+ console.info('uitest: UsageOfComplexTypes_one begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('UsageOfComplexTypes_one'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index7.html');
+
+ await driver.pressBack();
+ console.info('uitest: UsageOfComplexTypes_one end');
+ done();
+ });
+
+ /*
+ * 点击 UsageOfComplexTypes_two 按钮
+ * 应用侧和前端页面之间传递基础类型,非Function等复杂类型
+ */
+ it('UsageOfComplexTypes_two', 0, async (done: Function) => {
+ console.info('uitest: UsageOfComplexTypes_two begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('UsageOfComplexTypes_two'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index9.html');
+
+ await driver.pressBack();
+ console.info('uitest: UsageOfComplexTypes_two end');
+ done();
+ });
+
+ /*
+ * 点击 UsageOfComplexTypes_three 按钮
+ * 使用应用侧调用前端页面的Callback
+ */
+ it('UsageOfComplexTypes_three', 0, async (done: Function) => {
+ console.info('uitest: UsageOfComplexTypes_three begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('UsageOfComplexTypes_three'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index8.html');
+
+ await driver.pressBack();
+ console.info('uitest: UsageOfComplexTypes_three end');
+ done();
+ });
+
+ /*
+ * 点击 UsageOfComplexTypes_four 按钮
+ * 应用侧调用前端页面Object里的Function
+ */
+ it('UsageOfComplexTypes_four', 0, async (done: Function) => {
+ console.info('uitest: UsageOfComplexTypes_four begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('UsageOfComplexTypes_four'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index6.html');
+
+ await driver.pressBack();
+ console.info('uitest: UsageOfComplexTypes_four end');
+ done();
+ });
+
+ /*
+ * 点击 UsageOfComplexTypes_five 按钮
+ * 前端页面调用应用侧Object里的Function
+ */
+ it('UsageOfComplexTypes_five', 0, async (done: Function) => {
+ console.info('uitest: UsageOfComplexTypes_five begin');
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+
+ const button1 = await driver.findComponent(ON.text('UsageOfComplexTypes_five'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('refresh'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const button3 = await driver.findComponent(ON.text('Register JavaScript To Window'));
+ await button3.click();
+ await driver.delayMs(1000);
+
+ const button4 = await driver.findComponent(ON.text('deleteJavaScriptRegister'));
+ await button4.click();
+ await driver.delayMs(1000);
+
+ const button5 = await driver.findComponent(ON.type('button'));
+ await button5.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index5.html');
+
+ console.info('uitest: UsageOfComplexTypes_five end');
+ done();
+ });
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/module.json5 b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..17410acb16bcc114982071879ee6b1f000794e19
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/ohosTest/module.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry2_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry2/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry2/src/test/LocalUnit.test.ets b/ArkWeb/UseFrontendJSApp/entry2/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry2/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/.gitignore b/ArkWeb/UseFrontendJSApp/entry3/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/build-profile.json5 b/ArkWeb/UseFrontendJSApp/entry3/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..e7569e3056e27af38e9991b7ea73ec10f3ba8a05
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/build-profile.json5
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/hvigorfile.ts b/ArkWeb/UseFrontendJSApp/entry3/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry3/obfuscation-rules.txt b/ArkWeb/UseFrontendJSApp/entry3/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/oh-package.json5 b/ArkWeb/UseFrontendJSApp/entry3/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..655d244a4ec5c8e387d7ebfb66967132c8c952f6
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/oh-package.json5
@@ -0,0 +1,25 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry3",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {}
+}
+
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/entry3ability/Entry3Ability.ets b/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/entry3ability/Entry3Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..e62e0723b2780a459f90447d95ff110ba058fc00
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/entry3ability/Entry3Ability.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class Entry3Ability extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/pages/Index.ets b/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..fbd0bd1bab826fdc2c0ad69c882481ee047fe643
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/ets/pages/Index.ets
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start create_a_message_port_to_implement_communication_between_the_two_ends]
+import { webview } from '@kit.ArkWeb';
+import { BusinessError } from '@kit.BasicServicesKit';
+
+@Entry
+@Component
+struct WebComponent {
+ controller: webview.WebviewController = new webview.WebviewController();
+ ports: webview.WebMessagePort[] = [];
+ @State sendFromEts: string = 'Send this message from ets to HTML';
+ @State receivedFromHtml: string = 'Display received message send from HTML';
+
+ build() {
+ Column() {
+ // Display the content received from the HTML side.
+ Text(this.receivedFromHtml)
+ // Send the content in the text box to the HTML side.
+ TextInput({ placeholder: 'Send this message from ets to HTML' })
+ .onChange((value: string) => {
+ this.sendFromEts = value;
+ })
+
+ // The following can be called in the onPageEnd lifecycle callback.
+ Button('postMessage')
+ .onClick(() => {
+ try {
+ // 1. Create two message ports.
+ this.ports = this.controller.createWebMessagePorts();
+ // 2. Register a callback for the message port (for example, port 1) on the application.
+ this.ports[1].onMessageEvent((result: webview.WebMessage) => {
+ let msg = 'Got msg from HTML:';
+ if (typeof (result) === 'string') {
+ console.info(`received string message from html5, string is: ${result}`);
+ msg = msg + result;
+ } else if (typeof (result) === 'object') {
+ if (result instanceof ArrayBuffer) {
+ console.info(`received arraybuffer from html5, length is: ${result.byteLength}`);
+ msg = msg + 'length is ' + result.byteLength;
+ } else {
+ console.info('not support');
+ }
+ } else {
+ console.info('not support');
+ }
+ this.receivedFromHtml = msg;
+ })
+ // 3. Send the other message port (for example, port 0) to
+ // the HTML side, which then saves the message port.
+ this.controller.postMessage('__init_port__', [this.ports[0]], '*');
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+
+ // 4. Use the message port on the application to send messages to
+ // the message port that has been sent to the HTML side.
+ Button('SendDataToHTML')
+ .onClick(() => {
+ try {
+ if (this.ports && this.ports[1]) {
+ this.ports[1].postMessageEvent(this.sendFromEts);
+ } else {
+ console.error(`ports is null, Please initialize first`);
+ }
+ } catch (error) {
+ console.error(
+ `ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
+ }
+ })
+ Web({ src: $rawfile('index.html'), controller: this.controller })
+ }
+ }
+}
+// [End create_a_message_port_to_implement_communication_between_the_two_ends]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/module.json5 b/ArkWeb/UseFrontendJSApp/entry3/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..a9345ab1e0f0dbf59e896cd74d2ced8094e7fb9b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/module.json5
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry3",
+ "type": "feature",
+ "description": "$string:module_desc",
+ "mainElement": "Entry3Ability",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "Entry3Ability",
+ "srcEntry": "./ets/entry3ability/Entry3Ability.ets",
+ "description": "$string:Entry3Ability_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:Entry3Ability_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/color.json b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/string.json b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..1253ae78eed82312b6c4db8b1a11dc6baee5f27c
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "Entry3Ability_desc",
+ "value": "description"
+ },
+ {
+ "name": "Entry3Ability_label",
+ "value": "UseFrontendJSApp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/background.png b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/foreground.png b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/layered_image.json b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/startIcon.png b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/profile/main_pages.json b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/rawfile/index.html b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/rawfile/index.html
new file mode 100644
index 0000000000000000000000000000000000000000..7e67007432b4e000fab6254a4fd81bd071066193
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/main/resources/rawfile/index.html
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+ WebView Message Port Demo
+
+
+
WebView Message Port Demo
+
+
+
+
+
display received message send from ets
+
+
+
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/mock/mock-config.json5 b/ArkWeb/UseFrontendJSApp/entry3/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b9a78e201535765168a92d3543c690273ecdc019
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/mock/mock-config.json5
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..909b4cebec67c5b9af51626c88043ac152a69906
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用
+ * 建立应用侧与前端页面数据通道
+ */
+ it('testUiExample',0, async (done: Function) => {
+ console.info('uitest: TestUiExample begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'Entry3Ability'
+ }
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('Entry3Ability');
+ await driver.delayMs(5000);
+
+ const button1 = await driver.findComponent(ON.text('postMessage'));
+ await button1.click();
+ await driver.delayMs(1000);
+
+ const button2 = await driver.findComponent(ON.text('SendDataToHTML'));
+ await button2.click();
+ await driver.delayMs(1000);
+
+ const webButton = await driver.findComponent(ON.type('button'));
+ await webButton.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('index.html');
+
+ console.info('uitest: TestUiExample end');
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/module.json5 b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..edaba8aaabfc3819914b5d624d6d0143e85b5b86
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry3_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry3/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry3/src/test/LocalUnit.test.ets b/ArkWeb/UseFrontendJSApp/entry3/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry3/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/.gitignore b/ArkWeb/UseFrontendJSApp/entry4/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/build-profile.json5 b/ArkWeb/UseFrontendJSApp/entry4/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..fea31f4580540c7c560b62bf531292c471c410f1
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/build-profile.json5
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": ["arm64-v8a", "x86_64"]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/hvigorfile.ts b/ArkWeb/UseFrontendJSApp/entry4/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry4/obfuscation-rules.txt b/ArkWeb/UseFrontendJSApp/entry4/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/oh-package.json5 b/ArkWeb/UseFrontendJSApp/entry4/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..00f4289f03ded4fc5b05708a28cd06c44a0ad53e
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry4",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry4.so": "file:./src/main/cpp/types/libentry4"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/CMakeLists.txt b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..14607faba853fe717a19495cfc2364bc8be66216
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,24 @@
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.4.1)
+project(NDKJSBridg)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED hello.cpp jsbridge_object.cpp)
+
+find_library(
+ # Sets the name of the path variable.
+ hilog-lib
+ # Specifies the name of the NDK library that
+ # you want CMake to locate.
+ hilog_ndk.z
+)
+
+target_link_libraries(entry PUBLIC libace_napi.z.so ${hilog-lib} libohweb.so)
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/hello.cpp b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/hello.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..096575c6a7109a5cb714c7a936f28dfc0019aebb
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/hello.cpp
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start node_api_layer_code]
+#include "napi/native_api.h"
+#include
+#include
+#include
+#include
+#include
+
+#include "hilog/log.h"
+#include "web/arkweb_interface.h"
+#include "jsbridge_object.h"
+
+constexpr unsigned int LOG_PRINT_DOMAIN = 0xFF00;
+std::shared_ptr jsbridge_object_ptr = nullptr;
+static ArkWeb_ControllerAPI *controller = nullptr;
+static ArkWeb_ComponentAPI *component = nullptr;
+
+// 发送JS脚本到H5侧执行,该方法为执行结果的回调。
+static void RunJavaScriptCallback(const char *webTag, const char *result, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit RunJavaScriptCallback webTag:%{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit RunJavaScriptCallback userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->RunJavaScriptCallback(result);
+ } else {
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit RunJavaScriptCallback jsb_weak_ptr lock failed");
+ }
+}
+
+// 示例代码 ,注册了1个对象,2个方法
+static void ProxyMethod1(
+ const char *webTag, const ArkWeb_JavaScriptBridgeData *dataArray, size_t arraySize, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod1 webTag:%{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod1 userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->ProxyMethod1(dataArray, arraySize);
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod1 jsb_weak_ptr lock failed");
+ }
+}
+
+static void ProxyMethod2(
+ const char *webTag, const ArkWeb_JavaScriptBridgeData *dataArray, size_t arraySize, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod2 webTag:%{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod2 userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+
+ std::string jsCode = "runJSRetStr()";
+ ArkWeb_JavaScriptObject object = {
+ (uint8_t *)jsCode.c_str(), jsCode.size(),
+ &JSBridgeObject::StaticRunJavaScriptCallback,
+ static_cast(jsbridge_object_ptr->GetWeakPtr())
+ };
+ controller->runJavaScript(webTag, &object);
+
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->ProxyMethod2(dataArray, arraySize);
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ProxyMethod2 JsWeakPtr lock failed");
+ }
+}
+
+void ValidCallback(const char *webTag, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ValidCallback webTag: %{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ValidCallback userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->SaySomething("ValidCallback");
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit ValidCallback jsb_weak_ptr lock failed");
+ }
+
+ // [Start the_front_end_page_calls_application_side_functions]
+ // 注册对象
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "Native Development Kit RegisterJavaScriptProxy begin");
+ ArkWeb_ProxyMethod method1 = {"method1", ProxyMethod1, static_cast(jsbridge_object_ptr->GetWeakPtr())};
+ ArkWeb_ProxyMethod method2 = {"method2", ProxyMethod2, static_cast(jsbridge_object_ptr->GetWeakPtr())};
+ ArkWeb_ProxyMethod methodList[2] = {method1, method2};
+ // 调用Native Development Kit接口注册对象
+ // 如此注册的情况下,在H5页面就可以使用proxy.method1、proxy.method1调用此文件下的ProxyMethod1和ProxyMethod2方法了
+ ArkWeb_ProxyObject proxyObject = {"ndkProxy", methodList, 2};
+ controller->registerJavaScriptProxy(webTag, &proxyObject);
+ // [End the_front_end_page_calls_application_side_functions]
+
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "Native Development Kit RegisterJavaScriptProxy end");
+}
+
+void LoadStartCallback(const char *webTag, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit LoadStartCallback webTag: %{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit LoadStartCallback userData is null");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->SaySomething("LoadStartCallback");
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN,
+ "ArkWeb", "Native Development Kit LoadStartCallback jsb_weak_ptr lock failed");
+ }
+}
+
+void LoadEndCallback(const char *webTag, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit LoadEndCallback webTag: %{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit LoadEndCallback userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->SaySomething("LoadEndCallback");
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit LoadEndCallback jsb_weak_ptr lock failed");
+ }
+}
+
+void DestroyCallback(const char *webTag, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit DestoryCallback webTag: %{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit DestroyCallback userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ jsb_ptr->SaySomething("DestroyCallback");
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit DestroyCallback jsb_weak_ptr lock failed");
+ }
+}
+
+void SetComponentCallback(ArkWeb_ComponentAPI * component, const char* webTagValue)
+{
+ // [Start the_native_side_registers_the_callback_of_the_component_lifecycle]
+ if (!ARKWEB_MEMBER_MISSING(component, onControllerAttached)) {
+ component->onControllerAttached(
+ webTagValue, ValidCallback, static_cast(jsbridge_object_ptr->GetWeakPtr()));
+ } else {
+ OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ArkWeb", "component onControllerAttached func not exist");
+ }
+
+ if (!ARKWEB_MEMBER_MISSING(component, onPageBegin)) {
+ component->onPageBegin(webTagValue, LoadStartCallback, static_cast(jsbridge_object_ptr->GetWeakPtr()));
+ } else {
+ OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ArkWeb", "component onPageBegin func not exist");
+ }
+
+ if (!ARKWEB_MEMBER_MISSING(component, onPageEnd)) {
+ component->onPageEnd(webTagValue, LoadEndCallback, static_cast(jsbridge_object_ptr->GetWeakPtr()));
+ } else {
+ OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ArkWeb", "component onPageEnd func not exist");
+ }
+
+ if (!ARKWEB_MEMBER_MISSING(component, onDestroy)) {
+ component->onDestroy(webTagValue, DestroyCallback, static_cast(jsbridge_object_ptr->GetWeakPtr()));
+ } else {
+ OH_LOG_Print(LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ArkWeb", "component onDestroy func not exist");
+ }
+ // [End the_native_side_registers_the_callback_of_the_component_lifecycle]
+}
+
+// [Start parse_and_store_webtags]
+// 解析存储webTag
+static napi_value NativeWebInit(napi_env env, napi_callback_info info)
+{
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "Native Development Kit NativeWebInit start");
+ size_t argc = 1;
+ napi_value args[1] = {nullptr};
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+ // 获取第一个参数webTag
+ size_t webTagSize = 0;
+ napi_get_value_string_utf8(env, args[0], nullptr, 0, &webTagSize);
+ char *webTagValue = new (std::nothrow) char[webTagSize + 1];
+ size_t webTagLength = 0;
+ napi_get_value_string_utf8(env, args[0], webTagValue, webTagSize + 1, &webTagLength);
+ OH_LOG_Print(
+ LOG_APP, LOG_ERROR, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit NativeWebInit webTag:%{public}s", webTagValue);
+
+ // 将webTag保存在实例对象中
+ jsbridge_object_ptr = std::make_shared(webTagValue);
+ if (jsbridge_object_ptr)
+ jsbridge_object_ptr->Init();
+// [End parse_and_store_webtags]
+
+ controller = reinterpret_cast(OH_ArkWeb_GetNativeAPI(ARKWEB_NATIVE_CONTROLLER));
+ component = reinterpret_cast(OH_ArkWeb_GetNativeAPI(ARKWEB_NATIVE_COMPONENT));
+ SetComponentCallback(component, webTagValue);
+
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "Native Development Kit NativeWebInit end");
+ return nullptr;
+}
+
+// 发送JS脚本到H5侧执行
+static napi_value RunJavaScript(napi_env env, napi_callback_info info)
+{
+ size_t argc = 2;
+ napi_value args[2] = {nullptr};
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ // 获取第一个参数webTag
+ size_t webTagSize = 0;
+ napi_get_value_string_utf8(env, args[0], nullptr, 0, &webTagSize);
+ char *webTagValue = new (std::nothrow) char[webTagSize + 1];
+ size_t webTagLength = 0;
+ napi_get_value_string_utf8(env, args[0], webTagValue, webTagSize + 1, &webTagLength);
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit OH_NativeArkWeb_RunJavaScript webTag:%{public}s", webTagValue);
+
+ // 获取第二个参数 jsCode
+ size_t bufferSize = 0;
+ napi_get_value_string_utf8(env, args[1], nullptr, 0, &bufferSize);
+ char *jsCode = new (std::nothrow) char[bufferSize + 1];
+ size_t byteLength = 0;
+ napi_get_value_string_utf8(env, args[1], jsCode, bufferSize + 1, &byteLength);
+
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "Native Development Kit OH_NativeArkWeb_RunJavaScript jsCode len:%{public}zu", strlen(jsCode));
+
+ // 构造runJS执行的结构体
+ ArkWeb_JavaScriptObject object = {(uint8_t *)jsCode, bufferSize, &JSBridgeObject::StaticRunJavaScriptCallback,
+ static_cast(jsbridge_object_ptr->GetWeakPtr())};
+ controller->runJavaScript(webTagValue, &object);
+ return nullptr;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ {"nativeWebInit", nullptr, NativeWebInit, nullptr, nullptr, nullptr, napi_default, nullptr},
+ {"runJavaScript", nullptr, RunJavaScript, nullptr, nullptr, nullptr, napi_default, nullptr},
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void *)0),
+ .reserved = {0},
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void) { napi_module_register(&demoModule); }
+// [End node_api_layer_code]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.cpp b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..b35bebbf50225c26290f8e4bc93d2feffa358523
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.cpp
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start handles_javascript_calls_from_webview]
+#include "jsbridge_object.h"
+
+#include "hilog/log.h"
+
+constexpr unsigned int LOG_PRINT_DOMAIN = 0xFF00;
+
+JSBridgeObject::JSBridgeObject(const char *webTag) : webTag_(webTag) {}
+
+void JSBridgeObject::Init() { weak_ptr_ = shared_from_this(); }
+
+std::weak_ptr *JSBridgeObject::GetWeakPtr() { return &weak_ptr_; }
+
+void JSBridgeObject::StaticRunJavaScriptCallback(
+ const char *webTag, const ArkWeb_JavaScriptBridgeData *data, void *userData)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject StaticRunJavaScriptCallback webTag:%{public}s", webTag);
+ if (!userData) {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject StaticRunJavaScriptCallback userData is nullptr");
+ return;
+ }
+ std::weak_ptr jsb_weak_ptr = *static_cast *>(userData);
+ if (auto jsb_ptr = jsb_weak_ptr.lock()) {
+ std::string result((char *)data->buffer, data->size);
+ jsb_ptr->RunJavaScriptCallback(result.c_str());
+ } else {
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject StaticRunJavaScriptCallback jsb_weak_ptr lock failed");
+ }
+}
+
+void JSBridgeObject::RunJavaScriptCallback(const char *result)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject OH_NativeArkWeb_RunJavaScript result:%{public}s", result);
+}
+
+void JSBridgeObject::ProxyMethod1(const ArkWeb_JavaScriptBridgeData *dataArray, int32_t arraySize)
+{
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "JSBridgeObject ProxyMethod1 argc:%{public}d",
+ arraySize);
+ for (int i = 0; i < arraySize; i++) {
+ std::string result((char *)dataArray[i].buffer, dataArray[i].size);
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject ProxyMethod1 argv[%{public}d]:%{public}s, size:%{public}d",
+ i, result.c_str(), dataArray[i].size);
+ }
+}
+
+void JSBridgeObject::ProxyMethod2(const ArkWeb_JavaScriptBridgeData *dataArray, int32_t arraySize)
+{
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject ProxyMethod2 argc:%{public}d", arraySize);
+ for (int i = 0; i < arraySize; i++) {
+ std::string result((char *)dataArray[i].buffer, dataArray[i].size);
+ OH_LOG_Print(
+ LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb",
+ "JSBridgeObject ProxyMethod2 argv[%{public}d]:%{public}s, size:%{public}d",
+ i, result.c_str(), dataArray[i].size);
+ }
+}
+
+void JSBridgeObject::SaySomething(const char *say)
+{
+ OH_LOG_Print(LOG_APP, LOG_INFO, LOG_PRINT_DOMAIN, "ArkWeb", "JSBridgeObject SaySomething argc:%{public}s", say);
+}
+// [End handles_javascript_calls_from_webview]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.h b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.h
new file mode 100644
index 0000000000000000000000000000000000000000..68d1e15bdcdbce0885d887cba00ee53264ed9edb
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/jsbridge_object.h
@@ -0,0 +1,40 @@
+#ifndef HEADER_GUARD_H
+#define HEADER_GUARD_H
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_service_code_on_the_native_side]
+#include "web/arkweb_type.h"
+#include
+
+class JSBridgeObject : public std::enable_shared_from_this {
+public:
+ explicit JSBridgeObject(const char* webTag);
+ ~JSBridgeObject() = default;
+ void Init();
+ std::weak_ptr* GetWeakPtr();
+ static void StaticRunJavaScriptCallback(const char *webTag, const ArkWeb_JavaScriptBridgeData *data,
+ void *userData);
+ void RunJavaScriptCallback(const char *result);
+ void ProxyMethod1(const ArkWeb_JavaScriptBridgeData *dataArray, int32_t arraySize);
+ void ProxyMethod2(const ArkWeb_JavaScriptBridgeData *dataArray, int32_t arraySize);
+ void SaySomething(const char* say);
+
+private:
+ std::string webTag_;
+ std::weak_ptr weak_ptr_;
+};
+// [End the_service_code_on_the_native_side]
+#endif // HEADER_GUARD_H
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/napi_init.cpp b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/napi_init.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..820107b7d23aac8e97b4f6ce2d6517ea2eea824b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/napi_init.cpp
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "napi/native_api.h"
+
+static napi_value Add(napi_env env, napi_callback_info info)
+{
+ size_t argc = 2;
+ napi_value args[2] = {nullptr};
+
+ napi_get_cb_info(env, info, &argc, args, nullptr, nullptr);
+
+ napi_valuetype valuetype0;
+ napi_typeof(env, args[0], &valuetype0);
+
+ napi_valuetype valuetype1;
+ napi_typeof(env, args[1], &valuetype1);
+
+ double value0;
+ napi_get_value_double(env, args[0], &value0);
+
+ double value1;
+ napi_get_value_double(env, args[1], &value1);
+
+ napi_value sum;
+ napi_create_double(env, value0 + value1, &sum);
+
+ return sum;
+}
+
+EXTERN_C_START
+static napi_value Init(napi_env env, napi_value exports)
+{
+ napi_property_descriptor desc[] = {
+ { "add", nullptr, Add, nullptr, nullptr, nullptr, napi_default, nullptr }
+ };
+ napi_define_properties(env, exports, sizeof(desc) / sizeof(desc[0]), desc);
+ return exports;
+}
+EXTERN_C_END
+
+static napi_module demoModule = {
+ .nm_version = 1,
+ .nm_flags = 0,
+ .nm_filename = nullptr,
+ .nm_register_func = Init,
+ .nm_modname = "entry",
+ .nm_priv = ((void*)0),
+ .reserved = { 0 },
+};
+
+extern "C" __attribute__((constructor)) void RegisterEntryModule(void)
+{
+ napi_module_register(&demoModule);
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/Index.d.ts b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/Index.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..a12836b52e43cb6d1b8cff089e191a95b44f40a8
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/Index.d.ts
@@ -0,0 +1,19 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_arkts_interface_is_exposed_on_the_node_api_side]
+export const nativeWebInit: (webName: string) => void;
+export const runJavaScript: (webName: string, jsCode: string) => void;
+// [End the_arkts_interface_is_exposed_on_the_node_api_side]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/oh-package.json5 b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..1228596cfe7eb84f89b7125abb95de5246a5829c
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/cpp/types/libentry4/oh-package.json5
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "libentry4.so",
+ "types": "./Index.d.ts",
+ "version": "1.0.0",
+ "description": "Please describe the basic information."
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/entry4ability/Entry4Ability.ets b/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/entry4ability/Entry4Ability.ets
new file mode 100644
index 0000000000000000000000000000000000000000..84e3ab74f2a987f3a4cf9c6e380c5901b3491478
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/entry4ability/Entry4Ability.ets
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { AbilityConstant, UIAbility, Want } from '@kit.AbilityKit';
+import { hilog } from '@kit.PerformanceAnalysisKit';
+import { window } from '@kit.ArkUI';
+
+export default class Entry4Ability extends UIAbility {
+ onCreate(want: Want, launchParam: AbilityConstant.LaunchParam): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onCreate');
+ }
+
+ onDestroy(): void {
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy');
+ }
+
+ onWindowStageCreate(windowStage: window.WindowStage): void {
+ // Main window is created, set main page for this ability
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
+
+ windowStage.loadContent('pages/Index', (err) => {
+ if (err.code) {
+ hilog.error(0x0000, 'testTag', 'Failed to load the content. Cause: %{public}s', JSON.stringify(err) ?? '');
+ return;
+ }
+ hilog.info(0x0000, 'testTag', 'Succeeded in loading the content.');
+ });
+ }
+
+ onWindowStageDestroy(): void {
+ // Main window is destroyed, release UI related resources
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageDestroy');
+ }
+
+ onForeground(): void {
+ // Ability has brought to foreground
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onForeground');
+ }
+
+ onBackground(): void {
+ // Ability has back to background
+ hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onBackground');
+ }
+};
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/pages/Index.ets b/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/pages/Index.ets
new file mode 100644
index 0000000000000000000000000000000000000000..8a21a25554a682bc942ffee2a5b9a2beb088123a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/ets/pages/Index.ets
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start interact_with_the_webview_via_the_native_api]
+// [Start use_the_native_interface_to_bind_arkweb]
+import testNapi from 'libentry.so';
+import { webview } from '@kit.ArkWeb';
+
+class testObj {
+ constructor() {
+ }
+
+ test(): string {
+ console.log('ArkUI Web Component');
+ return 'ArkUI Web Component';
+ }
+
+ toString(): void {
+ console.log('Web Component toString');
+ }
+}
+
+@Entry
+@Component
+struct Index {
+ // [Start customize_a_webtag_and_send_it_to_the_native_side_of_the_application]
+ webTag: string = 'ArkWeb1';
+ controller: webview.WebviewController = new webview.WebviewController(this.webTag);
+ @State testObjtest: testObj = new testObj();
+
+ aboutToAppear() {
+ console.info('aboutToAppear');
+ //初始化web Native Development Kit
+ testNapi.nativeWebInit(this.webTag);
+ // [End customize_a_webtag_and_send_it_to_the_native_side_of_the_application]
+ }
+ // [End use_the_native_interface_to_bind_arkweb]
+
+ build() {
+ Column() {
+ Row() {
+ Button('runJS hello')
+ .fontSize(12)
+ .onClick(() => {
+ testNapi.runJavaScript(this.webTag, 'runJSRetStr(\"" + "hello" + "\")');
+ })
+ }.height('20%')
+
+ Row() {
+ Web({ src: $rawfile('runJS.html'), controller: this.controller })
+ .javaScriptAccess(true)
+ .fileAccess(true)
+ .onControllerAttached(() => {
+ console.error('Native Development Kit onControllerAttached webId: ' + this.controller.getWebId());
+ })
+ }.height('80%')
+ }
+ }
+}
+// [End interact_with_the_webview_via_the_native_api]
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/module.json5 b/ArkWeb/UseFrontendJSApp/entry4/src/main/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..afa13b4ebdc29a9cb812bfbb16d66e97039a14e5
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/module.json5
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry4",
+ "type": "feature",
+ "description": "$string:module_desc",
+ "mainElement": "Entry4Ability",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false,
+ "pages": "$profile:main_pages",
+ "abilities": [
+ {
+ "name": "Entry4Ability",
+ "srcEntry": "./ets/entry4ability/Entry4Ability.ets",
+ "description": "$string:Entry4Ability_desc",
+ "icon": "$media:layered_image",
+ "label": "$string:Entry4Ability_label",
+ "startWindowIcon": "$media:startIcon",
+ "startWindowBackground": "$color:start_window_background",
+ "exported": true
+ }
+ ]
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/color.json b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/color.json
new file mode 100644
index 0000000000000000000000000000000000000000..3c712962da3c2751c2b9ddb53559afcbd2b54a02
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/color.json
@@ -0,0 +1,8 @@
+{
+ "color": [
+ {
+ "name": "start_window_background",
+ "value": "#FFFFFF"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/string.json b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/string.json
new file mode 100644
index 0000000000000000000000000000000000000000..12e68f45a4cdb0af57c32b313a820ea8d23af66b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/element/string.json
@@ -0,0 +1,16 @@
+{
+ "string": [
+ {
+ "name": "module_desc",
+ "value": "module description"
+ },
+ {
+ "name": "Entry4Ability_desc",
+ "value": "description"
+ },
+ {
+ "name": "Entry4Ability_label",
+ "value": "UseFrontendJSApp"
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/background.png b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/background.png
new file mode 100644
index 0000000000000000000000000000000000000000..f939c9fa8cc8914832e602198745f592a0dfa34d
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/background.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/foreground.png b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/foreground.png
new file mode 100644
index 0000000000000000000000000000000000000000..4483ddad1f079e1089d685bd204ee1cfe1d01902
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/foreground.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/layered_image.json b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/layered_image.json
new file mode 100644
index 0000000000000000000000000000000000000000..fb49920440fb4d246c82f9ada275e26123a2136a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/layered_image.json
@@ -0,0 +1,7 @@
+{
+ "layered-image":
+ {
+ "background" : "$media:background",
+ "foreground" : "$media:foreground"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/startIcon.png b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/startIcon.png
new file mode 100644
index 0000000000000000000000000000000000000000..205ad8b5a8a42e8762fbe4899b8e5e31ce822b8b
Binary files /dev/null and b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/media/startIcon.png differ
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/profile/main_pages.json b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/profile/main_pages.json
new file mode 100644
index 0000000000000000000000000000000000000000..1898d94f58d6128ab712be2c68acc7c98e9ab9ce
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/base/profile/main_pages.json
@@ -0,0 +1,5 @@
+{
+ "src": [
+ "pages/Index"
+ ]
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/rawfile/runJS.html b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/rawfile/runJS.html
new file mode 100644
index 0000000000000000000000000000000000000000..a6ebe9e4665f309fd2ecbe9b256af033154bb055
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/main/resources/rawfile/runJS.html
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+ run javascript demo
+
+
+
run JavaScript Ext demo
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/mock/Libentry4.mock.ets b/ArkWeb/UseFrontendJSApp/entry4/src/mock/Libentry4.mock.ets
new file mode 100644
index 0000000000000000000000000000000000000000..37c4693badee0bced9f50f020403147ada0e8d44
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/mock/Libentry4.mock.ets
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+const nativeMock: Record = {
+ 'add': (a: number, b: number) => {
+ return a + b;
+ },
+};
+
+export default nativeMock;
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/mock/mock-config.json5 b/ArkWeb/UseFrontendJSApp/entry4/src/mock/mock-config.json5
new file mode 100644
index 0000000000000000000000000000000000000000..cccc61410df447034f1a89e4dae104448202f02a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/mock/mock-config.json5
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "libentry4.so": {
+ "source": "src/mock/Libentry4.mock.ets"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/Ability.test.ets b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/Ability.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f9be87be5508277dddc4e036c2c687d47c3f302a
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/Ability.test.ets
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+import { abilityDelegatorRegistry, Driver, ON } from '@kit.TestKit';
+import { UIAbility, Want } from '@kit.AbilityKit';
+
+const delegator: abilityDelegatorRegistry.AbilityDelegator = abilityDelegatorRegistry.getAbilityDelegator();
+const bundleName = abilityDelegatorRegistry.getArguments().bundleName;
+export default function abilityTest() {
+ describe('ActsAbilityTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ })
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ })
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ })
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ })
+
+ /*
+ * 打开应用
+ * 使用应用侧与前端页面的相互调用
+ */
+ it('testUiExample',0, async (done: Function) => {
+ console.info('uitest: TestUiExample begin');
+ const want: Want = {
+ bundleName: bundleName,
+ abilityName: 'Entry4Ability'
+ }
+ await delegator.startAbility(want);
+ const driver = Driver.create();
+ await driver.delayMs(1000);
+ const ability: UIAbility = await delegator.getCurrentTopAbility();
+ console.info('get top ability');
+ expect(ability.context.abilityInfo.name).assertEqual('Entry4Ability');
+ await driver.delayMs(5000);
+
+ const indexButton = await driver.findComponent(ON.type('Button'));
+ const webButton = await driver.findComponent(ON.type('button'));
+
+ await webButton.click();
+ await driver.delayMs(1000);
+
+ await indexButton.click();
+ await driver.delayMs(1000);
+
+ const web1 = await driver.findComponent(ON.type('Web'));
+ let src: string = await web1.getText();
+ expect(src).assertContain('runJS.html');
+
+ console.info('uitest: TestUiExample end');
+ done();
+ })
+ })
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..f40533d1374f4046f8af1e7df6aa90157cb361d8
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/ets/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import abilityTest from './Ability.test';
+
+export default function testsuite() {
+ abilityTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/module.json5 b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/module.json5
new file mode 100644
index 0000000000000000000000000000000000000000..12ba91e94655586fb5e48c90b290e66be7e85db2
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/ohosTest/module.json5
@@ -0,0 +1,27 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "module": {
+ "name": "entry4_test",
+ "type": "feature",
+ "deviceTypes": [
+ "default",
+ "tablet"
+ ],
+ "deliveryWithInstall": true,
+ "installationFree": false
+ }
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/test/List.test.ets b/ArkWeb/UseFrontendJSApp/entry4/src/test/List.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..0ce5a4e436790deecb880ddf871876bd2a7f7b07
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/test/List.test.ets
@@ -0,0 +1,20 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import localUnitTest from './LocalUnit.test';
+
+export default function testsuite() {
+ localUnitTest();
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry4/src/test/LocalUnit.test.ets b/ArkWeb/UseFrontendJSApp/entry4/src/test/LocalUnit.test.ets
new file mode 100644
index 0000000000000000000000000000000000000000..b7b035e9b66997b8cac57382753074ff60c3f5ee
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry4/src/test/LocalUnit.test.ets
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { describe, beforeAll, beforeEach, afterEach, afterAll, it, expect } from '@ohos/hypium';
+
+export default function localUnitTest() {
+ describe('localUnitTest', () => {
+ // Defines a test suite. Two parameters are supported: test suite name and test suite function.
+ beforeAll(() => {
+ // Presets an action, which is performed only once before all test cases of the test suite start.
+ // This API supports only one parameter: preset action function.
+ });
+ beforeEach(() => {
+ // Presets an action, which is performed before each unit test case starts.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: preset action function.
+ });
+ afterEach(() => {
+ // Presets a clear action, which is performed after each unit test case ends.
+ // The number of execution times is the same as the number of test cases defined by **it**.
+ // This API supports only one parameter: clear action function.
+ });
+ afterAll(() => {
+ // Presets a clear action, which is performed after all test cases of the test suite end.
+ // This API supports only one parameter: clear action function.
+ });
+ it('assertContain', 0, () => {
+ // Defines a test case. This API supports three parameters: test case name, filter parameter, and test case function.
+ let a = 'abc';
+ let b = 'b';
+ // Defines a variety of assertion methods, which are used to declare expected boolean conditions.
+ expect(a).assertContain(b);
+ expect(a).assertEqual(a);
+ });
+ });
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry5/.gitignore b/ArkWeb/UseFrontendJSApp/entry5/.gitignore
new file mode 100644
index 0000000000000000000000000000000000000000..e2713a2779c5a3e0eb879efe6115455592caeea5
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/.gitignore
@@ -0,0 +1,6 @@
+/node_modules
+/oh_modules
+/.preview
+/build
+/.cxx
+/.test
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry5/build-profile.json5 b/ArkWeb/UseFrontendJSApp/entry5/build-profile.json5
new file mode 100644
index 0000000000000000000000000000000000000000..fea31f4580540c7c560b62bf531292c471c410f1
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/build-profile.json5
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "apiType": "stageMode",
+ "buildOption": {
+ "externalNativeOptions": {
+ "path": "./src/main/cpp/CMakeLists.txt",
+ "arguments": "",
+ "cppFlags": "",
+ "abiFilters": ["arm64-v8a", "x86_64"]
+ }
+ },
+ "buildOptionSet": [
+ {
+ "name": "release",
+ "arkOptions": {
+ "obfuscation": {
+ "ruleOptions": {
+ "enable": false,
+ "files": [
+ "./obfuscation-rules.txt"
+ ]
+ }
+ }
+ },
+ "nativeLib": {
+ "debugSymbol": {
+ "strip": true,
+ "exclude": []
+ }
+ }
+ },
+ ],
+ "targets": [
+ {
+ "name": "default"
+ },
+ {
+ "name": "ohosTest",
+ }
+ ]
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry5/hvigorfile.ts b/ArkWeb/UseFrontendJSApp/entry5/hvigorfile.ts
new file mode 100644
index 0000000000000000000000000000000000000000..e4f43d54667f8327c367c8096bd08bb8c75aff54
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/hvigorfile.ts
@@ -0,0 +1,21 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import { hapTasks } from '@ohos/hvigor-ohos-plugin';
+
+export default {
+ system: hapTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
+ plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
+}
diff --git a/ArkWeb/UseFrontendJSApp/entry5/obfuscation-rules.txt b/ArkWeb/UseFrontendJSApp/entry5/obfuscation-rules.txt
new file mode 100644
index 0000000000000000000000000000000000000000..272efb6ca3f240859091bbbfc7c5802d52793b0b
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/obfuscation-rules.txt
@@ -0,0 +1,23 @@
+# Define project specific obfuscation rules here.
+# You can include the obfuscation configuration files in the current module's build-profile.json5.
+#
+# For more details, see
+# https://developer.huawei.com/consumer/cn/doc/harmonyos-guides-V5/source-obfuscation-V5
+
+# Obfuscation options:
+# -disable-obfuscation: disable all obfuscations
+# -enable-property-obfuscation: obfuscate the property names
+# -enable-toplevel-obfuscation: obfuscate the names in the global scope
+# -compact: remove unnecessary blank spaces and all line feeds
+# -remove-log: remove all console.* statements
+# -print-namecache: print the name cache that contains the mapping from the old names to new names
+# -apply-namecache: reuse the given cache file
+
+# Keep options:
+# -keep-property-name: specifies property names that you want to keep
+# -keep-global-name: specifies names that you want to keep in the global scope
+
+-enable-property-obfuscation
+-enable-toplevel-obfuscation
+-enable-filename-obfuscation
+-enable-export-obfuscation
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry5/oh-package.json5 b/ArkWeb/UseFrontendJSApp/entry5/oh-package.json5
new file mode 100644
index 0000000000000000000000000000000000000000..b58415e4585a7d2d30f02bba160d4401c9575b19
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/oh-package.json5
@@ -0,0 +1,26 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+{
+ "name": "entry5",
+ "version": "1.0.0",
+ "description": "Please describe the basic information.",
+ "main": "",
+ "author": "",
+ "license": "",
+ "dependencies": {
+ "libentry5.so": "file:./src/main/cpp/types/libentry5"
+ }
+}
\ No newline at end of file
diff --git a/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/CMakeLists.txt b/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/CMakeLists.txt
new file mode 100644
index 0000000000000000000000000000000000000000..46be202fc230d85a6eade7ed2cedec2ad189af17
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/CMakeLists.txt
@@ -0,0 +1,25 @@
+# entry/src/main/cpp/CMakeLists.txt
+# the minimum version of CMake.
+cmake_minimum_required(VERSION 3.4.1)
+project(NDKPostMessage)
+
+set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
+
+if(DEFINED PACKAGE_FIND_FILE)
+ include(${PACKAGE_FIND_FILE})
+endif()
+
+include_directories(${NATIVERENDER_ROOT_PATH}
+ ${NATIVERENDER_ROOT_PATH}/include)
+
+add_library(entry SHARED hello.cpp)
+
+find_library(
+ # Sets the name of the path variable.
+ hilog-lib
+ # Specifies the name of the NDK library that
+ # you want CMake to locate.
+ hilog_ndk.z
+)
+
+target_link_libraries(entry PUBLIC libace_napi.z.so ${hilog-lib} libohweb.so)
diff --git a/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/hello.cpp b/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/hello.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..cde6ffb2e4639d3818c096981f9a6a07ecb74453
--- /dev/null
+++ b/ArkWeb/UseFrontendJSApp/entry5/src/main/cpp/hello.cpp
@@ -0,0 +1,469 @@
+/*
+ * Copyright (c) 2025 Huawei Device Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+// [Start the_node_api_layer_code_for_the_data_channel_between_the_application_side_and_the_frontend_page]
+#include "napi/native_api.h"
+#include
+#include
+#include
+#include
+#include
+#include