diff --git a/src/browser/extension/devtools/index.js b/src/browser/extension/devtools/index.js index f9206141..b8e17f1c 100644 --- a/src/browser/extension/devtools/index.js +++ b/src/browser/extension/devtools/index.js @@ -1,3 +1,14 @@ -chrome.devtools.panels.create( - 'Redux', 'img/logo/scalable.png', chrome.extension.getBackgroundPage ? 'window.html' : 'devpanel.html', function() {} -); +function createPanel(url) { + chrome.devtools.panels.create( + 'Redux', 'img/logo/scalable.png', url, function() {} + ); +} + +if (chrome.runtime.getBackgroundPage) { + // Check if the background page's object is accessible (not in incognito) + chrome.runtime.getBackgroundPage(background => { + createPanel(background ? 'window.html' : 'devpanel.html'); + }); +} else { + createPanel('devpanel.html'); +}