未验证 提交 139b0ae6 编写于 作者: O openharmony_ci 提交者: Gitee

!8927 【OpenHarmony 4.0.8.1】【Master】【ARKUI子系统】【TOD】【rk3568】【必现】修改OnErrorReceive的Url,新增接口覆盖属性覆盖

Merge pull request !8927 from 边鑫博/master
...@@ -404,13 +404,13 @@ struct Index { ...@@ -404,13 +404,13 @@ struct Index {
break; break;
} }
case "emitOnErrorReceive":{ case "emitOnErrorReceive":{
this.controller.loadUrl({url:'http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html'}) this.controller.loadUrl({url:'http://bianixnbo.com'})
setTimeout(()=>{ setTimeout(()=>{
this.controller.loadUrl({url:'http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html'}) this.controller.loadUrl({url:'http://bianixnbo.com'})
setTimeout(() => { setTimeout(() => {
Utils.emitEvent(this.errorReceive,65) Utils.emitEvent(this.errorReceive,65)
},3000) },4000)
},3000) },4000)
break; break;
} }
case "emitOnHttpErrorReceive":{ case "emitOnHttpErrorReceive":{
......
...@@ -439,7 +439,7 @@ export default function webJsunit() { ...@@ -439,7 +439,7 @@ export default function webJsunit() {
*/ */
it('onErrorReceive',0,async function(done){ it('onErrorReceive',0,async function(done){
emitKey="emitOnHttpErrorReceive"; emitKey="emitOnHttpErrorReceive";
Utils.registerEvent("onErrorReceive","http://192.168.5.40:9006/sso_web/html/H5/doctor/aboutUs.html",65,done); Utils.registerEvent("onErrorReceive","http://bianixnbo.com/",65,done);
sendEventByKey('webcomponent',10,''); sendEventByKey('webcomponent',10,'');
}) })
/* /*
......
...@@ -22,6 +22,25 @@ import fileio from '@ohos.fileio'; ...@@ -22,6 +22,25 @@ import fileio from '@ohos.fileio';
import prompt from '@system.prompt'; import prompt from '@system.prompt';
let loadedUrl; let loadedUrl;
function Uint8ArrayToString(dataArray) {
var dataString = ''
for (var i = 0; i < dataArray.length; i++) {
dataString += String.fromCharCode(dataArray[i])
}
return dataString
}
function ParseX509CertInfo(x509CertArray) {
let res: string = 'getCertificate success: len = ' + x509CertArray.length;
for (let i = 0; i < x509CertArray.length; i++) {
res += ', index = ' + i + ', issuer name = '
+ Uint8ArrayToString(x509CertArray[i].getIssuerName().data) + ', subject name = '
+ Uint8ArrayToString(x509CertArray[i].getSubjectName().data) + ', valid start = '
+ x509CertArray[i].getNotBeforeTime()
+ ', valid end = ' + x509CertArray[i].getNotAfterTime()
}
return res
}
@Entry @Entry
@Component @Component
...@@ -49,6 +68,10 @@ struct Index { ...@@ -49,6 +68,10 @@ struct Index {
@State getArray:boolean =false @State getArray:boolean =false
@State msg1:string="" @State msg1:string=""
@State type:number=0 @State type:number=0
@State enterPageEndAuto: boolean =false
@State enterPageEndOff: boolean =false
@State outputStr: string = ''
...@@ -572,7 +595,7 @@ struct Index { ...@@ -572,7 +595,7 @@ struct Index {
} }
case "emitSetHttpDnsSuccess":{ case "emitSetHttpDnsSuccess":{
try { try {
web_webview.WebviewController.setHttpDns(web_webview.SecureDnsMode.SecureOnly, "https://httpdns-browser.platform.dbankcloud.cn/dns-query{?dns}") web_webview.WebviewController.setHttpDns(web_webview.SecureDnsMode.SECURE_ONLY, "https://httpdns-browser.platform.dbankcloud.cn/dns-query{?dns}")
this.controller.loadUrl("https://www.example.com/"); this.controller.loadUrl("https://www.example.com/");
this.enterPageEnd=true this.enterPageEnd=true
} catch(error) { } catch(error) {
...@@ -856,6 +879,75 @@ struct Index { ...@@ -856,6 +879,75 @@ struct Index {
} }
break; break;
} }
case "emitGetAccessibleGeolocationPromise":{
try {
web_webview.GeolocationPermissions.getAccessibleGeolocation("file:///")
.then(result => {
console.log('getAccessibleGeolocationPromise result: ' + result);
Utils.emitEvent(result,517)
}).catch(error => {
console.log('getAccessibleGeolocationPromise error: ' + JSON.stringify(error));
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitSetHttpDnsSuccessAuto":{
try {
web_webview.WebviewController.setHttpDns(web_webview.SecureDnsMode.AUTO, "https://httpdns-browser.platform.dbankcloud.cn/dns-query{?dns}")
this.controller.loadUrl("https://www.example.com/");
this.enterPageEndAuto=true
} catch(error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitSetHttpDnsSuccessOff":{
try {
web_webview.WebviewController.setHttpDns(web_webview.SecureDnsMode.OFF, "https://httpdns-browser.platform.dbankcloud.cn/dns-query{?dns}")
this.controller.loadUrl("https://www.example.com/");
this.enterPageEndOff=true
} catch(error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
case "emitGetCertificateCallback":{
try {
this.controller.loadUrl("https://www.example.com/");
console.info("jinru")
this.controller.getCertificate((error, x509CertArray) => {
if (error) {
this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message;
} else {
this.outputStr = ParseX509CertInfo(x509CertArray);
console.info("hahahha"+this.outputStr.length)
console.info("hahahha"+this.outputStr)
Utils.emitEvent(this.outputStr.length,520)
}
})
} catch (error) {
this.outputStr = 'getCertificate failed: ' + error.code + ", errMsg: " + error.message;
}
break;
}
case "emitGetStoredGeolocationPromise":{
try {
web_webview.GeolocationPermissions.allowGeolocation("file:///")
web_webview.GeolocationPermissions.getStoredGeolocation()
.then(origins => {
let origins_str: string = origins.join();
console.log('getStoredGeolocationPromise origins: ' + origins_str);
Utils.emitEvent(origins_str, 521);
}).catch(error => {
console.log('getStoredGeolocationPromise error: ' + JSON.stringify(error));
});
} catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
}
break;
}
...@@ -898,6 +990,14 @@ struct Index { ...@@ -898,6 +990,14 @@ struct Index {
Utils.emitEvent(1,446) Utils.emitEvent(1,446)
this.enterPageEnd=false this.enterPageEnd=false
} }
if(this.enterPageEndAuto){
Utils.emitEvent(this.controller.getTitle(),518)
this.enterPageEndAuto=false
}
if(this.enterPageEndOff){
Utils.emitEvent(this.controller.getTitle(),519)
this.enterPageEndOff=false
}
if(this.getString){ if(this.getString){
try { try {
this.controller.runJavaScriptExt( this.controller.runJavaScriptExt(
...@@ -980,19 +1080,14 @@ struct Index { ...@@ -980,19 +1080,14 @@ struct Index {
} }
if(this.getArray){ if(this.getArray){
try { try {
this.controller.runJavaScriptExt( this.controller.runJavaScriptExt('getArrayForJs()')
'getArrayForJs()', .then((result) => {
(error, result) => { var type = result.getType()
if (error) { if(web_webview.JsMessageType.ARRAY== type){
console.info(`run JavaScript error: ` + JSON.stringify(error)) this.msg1 = "result type:" + typeof (result.getArray());
return; Utils.emitEvent(this.msg1+web_webview.JsMessageType.NOT_SUPPORT,504)
} }
var type = result.getType() })
if(web_webview.JsMessageType.ARRAY== type){
this.msg1 = "result type:" + typeof (result.getArray());
Utils.emitEvent(this.msg1+web_webview.JsMessageType.NOT_SUPPORT,504)
}
});
console.info('urlgetstring: ', event.url); console.info('urlgetstring: ', event.url);
} catch (error) { } catch (error) {
console.error(`ErrorCode: ${error.code}, Message: ${error.message}`); console.error(`ErrorCode: ${error.code}, Message: ${error.message}`);
......
...@@ -602,9 +602,59 @@ export default function webJsunit() { ...@@ -602,9 +602,59 @@ export default function webJsunit() {
*tc.desic Save current page *tc.desic Save current page
*/ */
it('WebMessExtGetError',0,async function(done){ it('WebMessExtGetError',0,async function(done){
emitKey="emitWebMessExtGetError"; emitKey="emitGetAccessibleGeolocationPromise";
Utils.registerEvent("WebMessExtGetError","result type:object",516,done); Utils.registerEvent("WebMessExtGetError","result type:object",516,done);
sendEventByKey('webcomponent',10,''); sendEventByKey('webcomponent',10,'');
}) })
/*
*tc.number SUB_ACE_BASIC_ETS_API_056
*tc.name GetAccessibleGeolocationPromise
*tc.desic Save current page
*/
it('GetAccessibleGeolocationPromise',0,async function(done){
emitKey="emitSetHttpDnsSuccessAuto";
Utils.registerEvent("GetAccessibleGeolocationPromise",true,517,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_057
*tc.name SetHttpDnsSuccessAuto
*tc.desic Save current page
*/
it('SetHttpDnsSuccessAuto',0,async function(done){
emitKey="emitSetHttpDnsSuccessOff";
Utils.registerEvent("SetHttpDnsSuccessAuto","Example Domain",518,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_058
*tc.name SetHttpDnsSuccessOff
*tc.desic Save current page
*/
it('SetHttpDnsSuccessOff',0,async function(done){
emitKey="emitGetCertificateCallback";
Utils.registerEvent("SetHttpDnsSuccessOff","Example Domain",519,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_059
*tc.name GetCertificateCallback
*tc.desic Save current page
*/
it('GetCertificateCallback',0,async function(done){
emitKey="emitGetStoredGeolocationPromise";
Utils.registerEvent("GetCertificateCallback",31,520,done);
sendEventByKey('webcomponent',10,'');
})
/*
*tc.number SUB_ACE_BASIC_ETS_API_060
*tc.name GetStoredGeolocationPromise
*tc.desic Save current page
*/
it('GetStoredGeolocationPromise',0,async function(done){
emitKey="emitGetStoredGeolocationPromise";
Utils.registerEvent("GetStoredGeolocationPromise","file:///",521,done);
sendEventByKey('webcomponent',10,'');
})
}) })
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册