This project is read-only.

Addon doesn't work, freezes firefox


I don't know what's happening but I can't seem to get this addon to work..
I configured my imgur account with the pin, but when I right click and select "Rehost image" the progress bar pop up but stays empty (it doesn't progress) I can no longer scroll, or select things, the page is "frozen".
I have to restart firefox in order to return to normal behaviour.

Any suggestions?
I'd love to use this addon.


Innosin wrote Mar 25, 2016 at 10:46 PM

Same thing happens to me. I've tried logging out and back in, using different imgur accounts, but I still get the same freezing behavior.

winterstormer wrote Mar 30, 2016 at 6:27 AM

Same thing here, using Firefox 45.0.1 on Windows 10 with both my regular Firefox profile and a totally clean testing profile.

RandomEngy wrote Mar 30, 2016 at 4:24 PM

Odd, I can't reproduce on Windows 10 in Firefox 45.0.1, even after signing out and signing in. Do you see anything in Tools -> Web Developer -> Web Console when you do this?

winterstormer wrote Mar 30, 2016 at 9:13 PM

No, nothing.


Steps taken to produce above:
  1. Created a new profile
  2. Installed Rehost Image 1.5.17 from AMO
  3. Found a cat picture on Yahoo
  4. Opened the web console
  5. Right-clicked on picture and hit 'Rehost Image and Copy to Clipboard'
It sat like the above for about two minutes, with Firefox using 25% of CPU (i.e. 100% of its core), before I closed Firefox, reopened it on my main profile, and posted here. I could actually switch tabs on the web console while waiting, though very sluggishly, but no tab appeared to have useful information.

wrote Mar 30, 2016 at 9:13 PM

winterstormer wrote Mar 30, 2016 at 9:29 PM

(I meant that I could switch tabs on the developer tools, not the web console.)

RandomEngy wrote Mar 30, 2016 at 9:38 PM

Hmm, looks like the code got into an infinite loop, though I'm going to have a tough time finding it without being able to reproduce it. If anyone here is willing, I could help them debug to find where it's getting stuck.

winterstormer wrote Mar 31, 2016 at 5:30 AM

I could give it a whirl. I don't know anything about Javascript, though.

patfurg wrote Mar 31, 2016 at 3:19 PM

Me too. Same config.

patfurg wrote Mar 31, 2016 at 3:19 PM

Me too. Same configuration. Fresh installs. No other extensions.

RandomEngy wrote Apr 1, 2016 at 12:39 AM

If you'd like to try to debug:

Download the source code from

Go to %appdata%\Mozilla\Firefox\Profiles\<your_profile>\extensions

Create a new text file. Its contents should be the path to the rehostimage folder of the source. Name it Launch firefox and go to about:config . Change to true. Change devtools.debugger.remote-enabled to true.

Go to Tools -> Web Developer -> Browser Toolbox. Click on the Debugger tab. In the "Search scripts" box type "rehostimage" and select chrome/content/rehostimage.js . Click to the left of the line number to set a breakpoint just inside the rehostImage function. Now try to rehost an image. It should stop at the breakpoint. You can use the Step Over or Step Into buttons in the upper left to move the code execution. Find out how far it gets and where it gets stuck. You can also set other breakpoints to find if it makes it to a certain place.

winterstormer wrote Apr 1, 2016 at 1:39 AM

I followed the steps above and discovered that running line 184
panel.openPopupAtScreen(window.screen.width - 250, window.screen.height - 30, false);
causes the browser to hang.

Additionally, when I commented out that line alone, ran build.cmd, and installed the resulting plug-in, everything worked fine instantly (the test image was uploaded and my clipboard was populated with the URL), with the obvious exception of not seeing any progress bar.

RandomEngy wrote Apr 1, 2016 at 6:38 AM

Thanks for the detective work. Though I don't know why a system call like this would hang. Normally I would try different things here like remove all content from the popup or change the location of the popup to see if that fixed it, but that's rather difficult to iterate this way. Maybe just change the call to panel.openPopupAtScreen(0, 0, false); ?

I just tried with a fresh profile as well and it works for me, so I'm wondering if it has something to do with a browser plugin, which I think are active for all profiles. Could you try disabling all plugins and see if that changes anything?

winterstormer wrote Apr 1, 2016 at 4:31 PM

Following first suggestion of changing the call to panel.openPopupAtScreen(0, 0, false); :
This works perfectly, for reasons I cannot guess at. The progress bar opens at the top left of the screen, completes quickly, and closes, with no notable CPU load.

Following second suggestion of disabling plugins, after reinstalling Rehost Image 1.5.17 from AMO over the custom version:
I disabled all plugins and observed no changes.

However, when I then tried disabling hardware acceleration via about:preferences#advanced -> uncheck 'Use hardware acceleration when available', the progress bar did actually complete and eventually report that the image was uploaded successfully. It was still very sluggish and wound up using all of its core for most of the process (about a minute).

I reenabled plugins without turning hardware acceleration back on and observed the same behavior.

winterstormer wrote Apr 1, 2016 at 4:47 PM

Follow-up to first change:

I changed the call to
panel.openPopupAtScreen(1700, 1000, false);
and it still runs perfectly; it displays directly above the Windows taskbar at the bottom right (I think the math is such that it'd overlap the Windows taskbar if it were using those values directly, as I am on a 1920x1080 screen).

winterstormer wrote Apr 1, 2016 at 5:50 PM

Last follow-up for the moment:
Subtracting a little more from the height in line 184, e.g.
panel.openPopupAtScreen(window.screen.width - 250, window.screen.height - 35, false);
causes it to run perfectly. Oddly enough, that displays in the same place that height-30 does.

winterstormer wrote Apr 1, 2016 at 7:42 PM

I think there might be some problem in Firefox's range-checking code that prevents offscreen pop-ups.

This is the result of passing (20000, 20000, false) as the parameters to openPopupAtScreen:

If you compare it to the first picture I posted (viewing them fullscreen, of course) you'll notice that the original upload bar looks cut-off on bottom, whereas this one is the right size.

RandomEngy wrote Apr 1, 2016 at 9:40 PM

Aces! I think I'll just change to 20000, 20000 like you suggested and rely on the bounds-correcting code to bring it back in.

RandomEngy wrote Apr 1, 2016 at 10:29 PM

Okay, should be fixed in 1.5.18. Still awaiting validation.

winterstormer wrote Apr 3, 2016 at 7:47 AM

It's great to have this add-on working again - thanks!