chrome-extension-auto-reload icon indicating copy to clipboard operation
chrome-extension-auto-reload copied to clipboard

Optional reload methods and added gulp build process

Open JeromeDane opened this issue 9 years ago • 14 comments

The actual reloading of extensions wasn't happening for me (see issue https://github.com/robin-drexler/chrome-extension-auto-reload/issues/1), so I fixed it using code from this extension. I also added a gulp build process in order to streamline all source code into src/ and automatically generate the .zip file you can publish up to the chrome web store.

I've included more detailed comments regarding my thoughts on each commit below.

Hope this is useful!

JeromeDane avatar Oct 15 '15 20:10 JeromeDane

@robin-drexler are you still maintaining this extension? I've found it SUPER useful, and hope you'll consider pulling in my updates to fix whatever broke in v0.1.0 hosted on the chrome web store. It would be nice to get the web store version updated to v0.2.1 (my updates) or some other build so that others can take advantage of your extremely useful tool.

I didn't see any license information in the project, so I assumed GPL2, MIT, or some other open license. I've made updates and created a contributors section in the README. Please let me know if any of this is not OK.

If you're not maintaining this any more, please let me know, and I'll publish an updated version to the chrome web store with attribution to you if that's alright.

JeromeDane avatar Nov 07 '15 19:11 JeromeDane

Hey thanks for your contribution. I didn't notice the original PR, I'm very sorry that I did not respond to this sooner. Unfortunately I'm currently on vacation and only have access to my phone, so I can't review the PR thoroughly. I will do so during the next week.

Can you tell me what doesn't work anymore? Because I saw you're using the Chrome extension management api to reload extensions now. I avoided that, because using the management api causes open inspection windows (e.g. for console) to close, every time a file changes. I found that to be very annoying. Or has this changed until now?

On Sat, Nov 7, 2015, 7:54 PM Jerome Dane [email protected] wrote:

@robin-drexler https://github.com/robin-drexler are you still maintaining this extension? I've found it SUPER useful, and hope you'll consider pulling in my updates to fix whatever broke in v0.1.0 hosted on the chrome web store https://chrome.google.com/webstore/detail/chrome-unpacked-extension/fddfkmklefkhanofhlohnkemejcbamln. It would be nice to get the web store version updated to v0.2.1 (my updates) or some other build so that others can take advantage of your extremely useful tool.

I didn't see any license information in the project, so I assumed GPL2, MIT, or some other open license. I've made updates and created a contributors section in the README. Please let me know if any of this is not OK.

If you're not maintaining this any more, please let me know, and I'll publish an updated version to the chrome web store with attribution to you if that's alright.

— Reply to this email directly or view it on GitHub https://github.com/robin-drexler/chrome-extension-auto-reload/pull/2#issuecomment-154743237 .

robin-drexler avatar Nov 08 '15 09:11 robin-drexler

Hey @robin-drexler, I see what you mean about any open dev tools windows being closed. Here's what I'm experiencing on both my Windows box and Mac laptop with your v0.1.0:

TLDR: Background scripts do reload when you reload chrome://extensions tab, but content scripts only seem to get refreshed when clicking "Reload" link next to the desired extension, which is why I switched to the api solution @arikw used here.

To verify Chrome behavior:

  1. Create a simple extension that injects a content script into any URL with an alert call that can be modified to show changes.
  2. Reload any tab and verify that alert shows up
  3. Modify alert call in source content script and reload chrome://extensions tab
  4. Reload any tab and see that alert has not changed
  5. Return to chrome://extensions tab and click on "reload" link next to unpacked extension created in step 1.
  6. Reload any tab and see that alert has changed.

To reproduce on v0.1.0 of your reloader:

  1. Create a simple extension that has a background script and a content script that gets injected into any URL
  2. Add a console.log call to both background and content scripts that can be modified to show changes.
  3. Inspect background page, which should show console.log statement.
  4. Reload and inspect any tab, which should show console.log statement from content script.
  5. Modify source console.log in both background and content scripts
  6. Reload background inspector, which will show change
  7. Reload the tab from step 5, which will not show change in console.log statement

If you can reproduce this and we can't figure out how to get your reload method to reload content scripts, then we could have an options page for your extension that lets users choose which reload method they want to use. That way people working on background script extensions wouldn't have their dev tools windows closed, and people working on heavy content script injected extensions would get their content scripts reloaded.

Let me know what you think. I'm happy to put in that options page if you like the idea, although it might be worth taking a few days between the two of us to figure out alternatives. @arikw, if you see this and have any thoughts, please feel free to chime in.

Again, love what you've done here!

JeromeDane avatar Nov 08 '15 14:11 JeromeDane

Hey guys,

I couldn't find a way to keep the inspection windows open after an extension "reload" (disable + enable), because there's no true reload API that does the same as pressing the reload link next to the extension in the extensions page.

I think @JeromeDane's suggestion for letting the user choose the reload method is good.

Cheers.

arikw avatar Nov 10 '15 08:11 arikw

@arikw Arrggg! the inspection windows closing is a real bummer. Can't we make auto-reload to click automatically the inspect link to reopen it after refresh. It's so close...

yograf avatar Nov 25 '15 08:11 yograf

I thought of that @yograf, but for security reasons, chrome doesn't allow you to inject content scripts into 'chrome://extensions'

JeromeDane avatar Nov 25 '15 11:11 JeromeDane

+1 for @JeromeDane's proposal

kfei avatar Dec 04 '15 18:12 kfei

+1, yes. I guess a way to switch between the 2 reload options is the best we can have for now.

yograf avatar Dec 04 '15 21:12 yograf

Will implement options page this weekend if I get time.

Edit: I obviously haven't gotten around to doing this yet, so I created https://github.com/robin-drexler/chrome-extension-auto-reload/issues/3 to remind me to get it done.

JeromeDane avatar Dec 05 '15 01:12 JeromeDane

Apparently the original way of reloading is broken due to a Chrome bug. https://code.google.com/p/chromium/issues/detail?id=526945 If you star it, it might have an impact on the priority, but I'm not sure.

robin-drexler avatar Dec 08 '15 19:12 robin-drexler

@arikw, @yograf, @kfei - Options page added: https://github.com/JeromeDane/chrome-extension-auto-reload/commit/3a5d1ab47e980d62122c0f641379b19bad40e240 - release at https://github.com/JeromeDane/chrome-extension-auto-reload/releases/tag/v0.3.0

@robin-drexler do you have time to merge in this pull request and re-publish to the updated version to the chrome web store, or would you like for me to re-host on the web store with an updated version? I'd rather keep everything in your official release channel, but you don't seem very active these days, so maybe I can help you out with that.

JeromeDane avatar Dec 12 '15 21:12 JeromeDane

@JeromeDane, Thank you! Happily using your fork now.

kfei avatar Dec 17 '15 07:12 kfei

@robin-drexler chrome bug mentioend above https://code.google.com/p/chromium/issues/detail?id=526945 is fixed. you can verify with Chrome canary. feel free to call me if you're still seeing issue.

sunglim avatar Dec 24 '15 01:12 sunglim

@JeromeDane did you end up publishing your version to the store?

kinghat avatar Feb 26 '19 17:02 kinghat