Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Xts Acts
提交
6edaadd2
X
Xts Acts
项目概览
OpenHarmony
/
Xts Acts
1 年多 前同步成功
通知
9
Star
22
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
X
Xts Acts
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
6edaadd2
编写于
5月 29, 2023
作者:
O
openharmony_ci
提交者:
Gitee
5月 29, 2023
浏览文件
操作
浏览文件
下载
差异文件
!8805 【OpenHarmony 4.0.7.3】【Master】【ARKUI子系统】【TOD】【rk3568】【必现】api接口,属性覆盖setError,getError
Merge pull request !8805 from 边鑫博/master
上级
7a58b418
49885b36
变更
3
显示空白变更内容
内联
并排
Showing
3 changed file
with
76 addition
and
10 deletion
+76
-10
arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
...eb_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
+42
-0
arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
..._web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
+22
-1
arkui/ace_ets_web_dev_three/entry/src/main/resources/rawfile/index.js
...s_web_dev_three/entry/src/main/resources/rawfile/index.js
+12
-9
未找到文件。
arkui/ace_ets_web_dev_three/entry/src/main/ets/MainAbility/pages/web.ets
浏览文件 @
6edaadd2
...
...
@@ -818,6 +818,44 @@ struct Index {
}
break;
}
case "emitWebMessExtSetError":{
try {
console.log("URL Error");
throw new URIError("URI seq")
}
catch (e) {
console.log("hwd URIError:"+(e instanceof SyntaxError));
console.log("hwd URIError:"+e.message);
console.log("hwd URIError:"+e.name);
if (this.nativePort) {
setTimeout(()=>{
var message =new web_webview.WebMessageExt();
message.setType(web_webview.WebMessageType.ERROR)
this.message.setError(e);
this.nativePort.postMessageEventExt(message);
},2000)
}
}
setTimeout(()=>{
this.controller.runJavaScript("postErrorToHtml()",(error, result) => {
console.log(`The emitWebMessExtSetError() return value is: ${result}`);
Utils.emitEvent(result,515)
})
},3000)
break;
}
case "emitWebMessExtGetError":{
try {
this.controller.loadUrl($rawfile('webMessageExt.html'));
this.controller.runJavaScript("postErrorToApp()",(error, result) => {
console.log(`The emitWebMessExtGetError() return value is: ${result}`);
})
}
catch (error) {
console.log("In eTS side send message catch error:" + error.code + ", msg:" + error.message);
}
break;
}
...
...
@@ -993,6 +1031,10 @@ struct Index {
this.msg1 = "result getArrayBuffer byteLength:" + ((result.getArrayBuffer().byteLength));
Utils.emitEvent(this.msg1,514)
}
if(this.type == web_webview.WebMessageType.ERROR){
this.msg1 = "result type:" + typeof (result.getError());
Utils.emitEvent(this.msg1,516)
}
}
catch (resError) {
console.log(`log error code: ${resError.code}, Message: ${resError.message}`);
...
...
arkui/ace_ets_web_dev_three/entry/src/main/ets/test/WebJsunit.test.ets
浏览文件 @
6edaadd2
...
...
@@ -581,9 +581,30 @@ export default function webJsunit() {
*tc.desic Save current page
*/
it('WebMessExtGetArrayBuffer',0,async function(done){
emitKey="emitWebMessExt
GetArrayBuffe
r";
emitKey="emitWebMessExt
SetErro
r";
Utils.registerEvent("WebMessExtGetArrayBuffer","result getArrayBuffer byteLength:8",514,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_054
*tc.name WebMessExtSetError
*tc.desic Save current page
*/
it('WebMessExtSetError',0,async function(done){
emitKey="emitWebMessExtGetError";
var result="Error:SyntaxError, msg:"
Utils.registerEvent("WebMessExtSetError",JSON.stringify(result),515,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_055
*tc.name WebMessExtGetError
*tc.desic Save current page
*/
it('WebMessExtGetError',0,async function(done){
emitKey="emitWebMessExtGetError";
Utils.registerEvent("WebMessExtGetError","result type:object",516,done);
sendEventByKey('webcomponent',10,'');
})
})
}
arkui/ace_ets_web_dev_three/entry/src/main/resources/rawfile/index.js
浏览文件 @
6edaadd2
/*
* Copyright (
C) 2021
Huawei Device Co., Ltd.
* Copyright (
c) 2021~2023
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
...
...
@@ -113,13 +113,16 @@ function postArrayBufferToApp() {
}
}
function
postErrorToApp
()
{
try
{
throw
new
URIError
(
"
URI seq 0222
"
)
}
catch
(
e
){
console
.
log
(
"
hwd URIError:
"
+
(
e
instanceof
SyntaxError
));
console
.
log
(
"
hwd URIError:
"
+
e
.
message
);
console
.
log
(
"
hwd URIError:
"
+
e
.
name
);
if
(
h5Port
)
{
console
.
log
(
"
In html send error message
"
);
let
err
=
{
name
:
"
cuowu
"
,
message
:
"
cuowu
"
};
h5Port
.
postMessage
(
err
);
console
.
log
(
"
In html send error message end
"
);
}
else
{
console
.
error
(
"
In html h5port is null, please init first
"
);
h5Port
.
postMessage
(
e
);
}
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录