arikw / chrome-extensions-reloader

A chrome extension for reloading unpacked extensions
https://chrome.google.com/webstore/detail/extensions-reloader/fimgfedafeadlieiabdeeaodndnlbhid
Apache License 2.0
276 stars 38 forks source link

Close background inspectors of reloaded extensions #1

Closed bmenant closed 9 years ago

bmenant commented 9 years ago

The background page inspector is the most important tool for extension development. Unfortunately, when the chrome-extensions-reloader reloads an extension, it shuts everything down, including its inspector. As a result, we have to reopen the background inspector each time we save changes... which is painful and makes this extension useless

I am pretty sure there is a way to reload extensions without closing those background inspectors. For instance, the “Reload” button provided on the Chrome’s extension page keeps them opened. Any idea?

arikw commented 9 years ago

As far as I know, the only way for extension to reload another extension, is by using chrome.management.setEnabled() and that what makes the background page inspection window to close itself.

Do you know of any other way to do so?

bmenant commented 9 years ago

Unfortunately, I have no idea. There is a method called chrome.runtime.reload()... It’s a bit surprising and frustrating that they didn’t add a reload method to the management object, isn’t it?

arikw commented 9 years ago

Indeed :)

JetFault commented 9 years ago

One way to do it is to reload the chrome://extensions page.

chrome.tabs.query({url: 'chrome://extensions'}, function(tabs) {
  if (tabs.length === 0) {
    //Create a new tab of chrome://extensions
  } else {
    chrome.tabs.reload(tabs[0].id)
  }
});