Javascript 使用调试器API时禁用Chrome消息
在我的扩展中,我使用Javascript 使用调试器API时禁用Chrome消息,javascript,google-chrome-extension,Javascript,Google Chrome Extension,在我的扩展中,我使用chrome.debuggerAPI来获取托管在不同域上的样式。Chrome显示弹出窗口,显示消息“Extension”已开始调试此浏览器。是否有为用户禁用此消息的选项? 代码: 信息: 唯一的方法是使用--静默调试器扩展api命令行运行chrome,这将删除所有扩展的警告,因此小心不要安装恶意使用调试器api的扩展。 chrome.debugger.attach(debuggeeId, '1.3', async () => { const send =
chrome.debugger
API来获取托管在不同域上的样式。Chrome显示弹出窗口,显示消息“Extension”已开始调试此浏览器。是否有为用户禁用此消息的选项?代码: 信息:
唯一的方法是使用
--静默调试器扩展api
命令行运行chrome,这将删除所有扩展的警告,因此小心不要安装恶意使用调试器api的扩展。
chrome.debugger.attach(debuggeeId, '1.3', async () => {
const send = (cmd, params = null) => new Promise(resolve =>
chrome.debugger.sendCommand(debuggeeId, cmd, params, resolve));
await send('Page.enable');
const {frameTree} = await send('Page.getResourceTree');
const frameQueue = [frameTree];
const results = [];
for (const {frame, childFrames, resources} of frameQueue) {
if(childFrames){
frameQueue.push(...childFrames);
}
const frameId = frame.id;
for (const {url, type} of resources) {
if (type === 'Stylesheet') {
results.push({
url,
frameUrl: frame.url,
...await send('Page.getResourceContent', {frameId, url}),
});
}
}
}
await send('Page.disable');
});