更新打印日志不完全的问题

This commit is contained in:
ylw00 2023-09-01 09:18:21 +08:00
parent 242f07dcba
commit 19ce50552f
5 changed files with 375 additions and 371 deletions

View File

@ -27,51 +27,51 @@ location = {};
location = { location = {
ancestorOrigins() { ancestorOrigins() {
let result = new class DOMStringList { }; let result = new class DOMStringList { };
if (lwVm.config.log_print === true) lwVm.logAdd('Func', 'Location', 'ancestorOrigins', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Func', 'Location', 'ancestorOrigins', arguments, result);
return result; return result;
}, },
assign() { assign() {
let result = undefined; let result = undefined;
if (lwVm.config.log_print === true) lwVm.logAdd('Func', 'Location', 'assign', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Func', 'Location', 'assign', arguments, result);
return result; return result;
}, },
get hash() { get hash() {
let result = $attribute_map.hash; let result = $attribute_map.hash;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'hash', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'hash', arguments, result);
return result return result
}, },
set hash(value) { set hash(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'hash', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'hash', arguments);
$attribute_map.hash = value $attribute_map.hash = value
}, },
get host() { get host() {
let result = $attribute_map.host let result = $attribute_map.host
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'host', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'host', arguments, result);
return result return result
}, },
set host(value) { set host(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'host', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'host', arguments);
$attribute_map.host = value $attribute_map.host = value
}, },
get hostname() { get hostname() {
let result = $attribute_map.hostname; let result = $attribute_map.hostname;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'hostname', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'hostname', arguments, result);
return result return result
}, },
set hostname(value) { set hostname(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'hostname', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'hostname', arguments);
$attribute_map.hostname = value $attribute_map.hostname = value
}, },
get href() { get href() {
let result = $attribute_map.href let result = $attribute_map.href
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'href', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'href', arguments, result);
return result return result
}, },
set href(value) { set href(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'href', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'href', arguments);
let a = value.match(/([^:]+:)\/\/([^/:?#]+):?(\d+)?([^?#]*)?(\?[^#]*)?(#.*)?/); let a = value.match(/([^:]+:)\/\/([^/:?#]+):?(\d+)?([^?#]*)?(\?[^#]*)?(#.*)?/);
location.protocol = a[1] ? a[1] : ""; location.protocol = a[1] ? a[1] : "";
location.host = a[2] ? a[2] : ""; location.host = a[2] ? a[2] : "";
@ -86,64 +86,64 @@ location = {};
get origin() { get origin() {
let result = $attribute_map.origin; let result = $attribute_map.origin;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'origin', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'origin', arguments, result);
return result return result
}, },
set origin(value) { set origin(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'origin', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'origin', arguments);
$attribute_map.origin = value $attribute_map.origin = value
}, },
get pathname() { get pathname() {
let result = $attribute_map.pathname let result = $attribute_map.pathname
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'pathname', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'pathname', arguments, result);
return result return result
}, },
set pathname(value) { set pathname(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'pathname', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'pathname', arguments);
$attribute_map.pathname = value $attribute_map.pathname = value
}, },
get port() { get port() {
let result = $attribute_map.port; let result = $attribute_map.port;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'port', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'port', arguments, result);
return result return result
}, },
set port(value) { set port(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'port', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'port', arguments);
$attribute_map.port = value $attribute_map.port = value
}, },
get protocol() { get protocol() {
let result = $attribute_map.protocol; let result = $attribute_map.protocol;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'protocol', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'protocol', arguments, result);
return result; return result;
}, },
set protocol(value) { set protocol(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'protocol', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'protocol', arguments);
$attribute_map.protocol = value $attribute_map.protocol = value
}, },
reload() { reload() {
let result = undefined; let result = undefined;
if (lwVm.config.log_print === true) lwVm.logAdd('Func', 'Location', 'reload', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Func', 'Location', 'reload', arguments, result);
return result; return result;
}, },
replace() { replace() {
let result = undefined; let result = undefined;
if (lwVm.config.log_print === true) lwVm.logAdd('Func', 'Location', 'replace', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Func', 'Location', 'replace', arguments, result);
return result; return result;
}, },
get search() { get search() {
let result = $attribute_map.search; let result = $attribute_map.search;
if (lwVm.config.log_print === true) lwVm.logAdd('Get', 'Location', 'search', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Get', 'Location', 'search', arguments, result);
return result return result
}, },
set search(value) { set search(value) {
if (lwVm.config.log_print === true) lwVm.logAdd('Set', 'Location', 'search', arguments); if (lwVm.config.logOpen === true) lwVm.logAdd('Set', 'Location', 'search', arguments);
$attribute_map.search = value $attribute_map.search = value
}, },
toString() { toString() {
let result = location.href; let result = location.href;
if (lwVm.config.log_print === true) lwVm.logAdd('Func', 'Location', 'toString', arguments, result); if (lwVm.config.logOpen === true) lwVm.logAdd('Func', 'Location', 'toString', arguments, result);
return result return result
} }
}; };

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ function QXVm_help(){
logOpen: true // 是否日志打印(调试模式) logOpen: true // 是否日志打印(调试模式)
} }
canvas: String, // 自定义canvas指纹 canvas: String, // 自定义canvas指纹
window_attribute: Object, // 自定义window属性(暴露window出来) window_attribute: Object, // 自定义window属性(暴露window出来, 设置非浏览器环境对象/参数)
plugin: Array, // 自定义浏览器插件 plugin: Array, // 自定义浏览器插件
env: Object { // 自定义浏览器环境 env: Object { // 自定义浏览器环境
navigator: Object, // 针对 加密UA和请求UA必须一致的情况 navigator: Object, // 针对 加密UA和请求UA必须一致的情况
@ -22,6 +22,10 @@ function QXVm_help(){
document: Object // 自定义属性 document: Object // 自定义属性
} }
} }
:exports: {
printLog: function,
{{func_name}}: {{func_name}},
}
`) `)
} }

View File

@ -46,19 +46,19 @@ def gen_new_js(js_all: str):
upjs = str(new_js[-1].strip()) upjs = str(new_js[-1].strip())
if strip_js == '},' or strip_js == '}': if strip_js == '},' or strip_js == '}':
if upjs.endswith('new TypeError("Illegal constructor"); };'): if upjs.endswith('new TypeError("Illegal constructor"); };'):
js = f" let result = undefined;\n if (qxVm.config.log_print === true) qxVm.logAdd('Func', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js js = f" let result = undefined;\n if (qxVm.config.logOpen === true) qxVm.logAdd('Func', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js
elif upjs.startswith('return '): elif upjs.startswith('return '):
del new_js[-1] del new_js[-1]
_1, _2 = upjs.split(' ', 1) _1, _2 = upjs.split(' ', 1)
js = f" let result = {_2};\n if (qxVm.config.log_print === true) qxVm.logAdd('Func', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js js = f" let result = {_2};\n if (qxVm.config.logOpen === true) qxVm.logAdd('Func', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js
# new_js.append(js) # new_js.append(js)
elif get: elif get:
upjs = str(new_js[-1].strip()) upjs = str(new_js[-1].strip())
if strip_js == '},': if strip_js == '},':
if upjs.endswith('new TypeError("Illegal constructor"); };'): if upjs.endswith('new TypeError("Illegal constructor"); };'):
js = f" let result = undefined;\n if (qxVm.config.log_print === true) qxVm.logAdd('Get', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js js = f" let result = undefined;\n if (qxVm.config.logOpen === true) qxVm.logAdd('Get', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js
elif upjs.startswith('return '): elif upjs.startswith('return '):
# if 'onmanagedconfigurationchange' in upjs: # if 'onmanagedconfigurationchange' in upjs:
@ -66,18 +66,18 @@ def gen_new_js(js_all: str):
# pass # pass
del new_js[-1] del new_js[-1]
_1, _2 = upjs.split(' ', 1) _1, _2 = upjs.split(' ', 1)
js = f" let result = {_2};\n if (qxVm.config.log_print === true) qxVm.logAdd('Get', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js js = f" let result = {_2};\n if (qxVm.config.logOpen === true) qxVm.logAdd('Get', '{prototype}', '{funcName}', arguments, result);\n return result;\n" + js
elif _set: elif _set:
if strip_js == '},': if strip_js == '},':
_1 = new_js[-1] _1 = new_js[-1]
del new_js[-1] del new_js[-1]
upjs = str(_1.strip()) upjs = str(_1.strip())
if upjs.endswith('new TypeError("Illegal constructor"); };'): if upjs.endswith('new TypeError("Illegal constructor"); };'):
js = f" if (qxVm.config.log_print === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n qxVm.memory.private_data.get(this).{funcName} = value;\n" + js js = f" if (qxVm.config.logOpen === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n qxVm.memory.private_data.get(this).{funcName} = value;\n" + js
elif upjs.startswith('qxVm.memory.private_data.get(this)'): elif upjs.startswith('qxVm.memory.private_data.get(this)'):
js = f" if (qxVm.config.log_print === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n" + _1 + '\n' + js js = f" if (qxVm.config.logOpen === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n" + _1 + '\n' + js
elif upjs.startswith('$attribute_map'): elif upjs.startswith('$attribute_map'):
js = f" if (qxVm.config.log_print === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n" + _1 + "\n" + js js = f" if (qxVm.config.logOpen === true) qxVm.logAdd('Set', '{prototype}', '{funcName}', arguments);\n" + _1 + "\n" + js
new_js.append(js) new_js.append(js)
# print(js) # print(js)

File diff suppressed because one or more lines are too long