-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathdevtools.js
More file actions
34 lines (32 loc) · 840 Bytes
/
devtools.js
File metadata and controls
34 lines (32 loc) · 840 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
chrome.devtools.panels.create(
"LiveDebugger",
"images/icon-16.png",
"panel.html",
function (panel) {
let panelWindow;
let isShown = false;
panel.onShown.addListener(async (window) => {
if (!isShown) {
panelWindow = window;
isShown = true;
try {
window.setIframeUrl(await getLiveDebuggerSessionURL(chrome));
} catch (error) {
window.setIframeUrl(null);
}
}
});
chrome.webNavigation.onCompleted.addListener(async (details) => {
if (
details.tabId === chrome.devtools.inspectedWindow.tabId &&
allowRedirects(chrome)
) {
try {
panelWindow.setIframeUrl(await getLiveDebuggerSessionURL(chrome));
} catch (error) {
panelWindow.setIframeUrl(null);
}
}
});
}
);