(params)
| 497 | |
| 498 | /* ================== 日志收集 ================== */ |
| 499 | const log = (params) => { |
| 500 | if (!params) return; |
| 501 | chrome.storage.local.get(PAGE_MONKEY_LOG_KEY, resps => { |
| 502 | let arr = []; |
| 503 | try { arr = JSON.parse((resps && resps[PAGE_MONKEY_LOG_KEY]) || '[]'); } catch (e) {} |
| 504 | arr.push(Object.assign({ time: Date.now() }, params)); |
| 505 | if (arr.length > 300) arr = arr.slice(-300); |
| 506 | let data = {}; data[PAGE_MONKEY_LOG_KEY] = JSON.stringify(arr); |
| 507 | chrome.storage.local.set(data); |
| 508 | }); |
| 509 | }; |
| 510 | |
| 511 | /* ================== @require 白名单校验 ================== */ |
| 512 | // 桥接器代理 fetch 容易被恶意页面滥用做任意 URL 代理(绕过 CORS), |
no test coverage detected