sleepingkirby / butWhyMod

For those that don't know, modals are those pop-up windows that are within a webpage as opposed to popups in a separate window or in a dialogue box. Tries to remove thoem. Like all of them. Without prejudice.
GNU General Public License v3.0
1 stars 0 forks source link

Toolbars error out when extension calls or checks gBrowser too early (palemoon browser only) #1

Closed Eleventythreeve closed 5 years ago

Eleventythreeve commented 5 years ago

Hi. We tried it out and it kills custom toolbars. It jams itself to the right of a remaining bar and refuses customization.

When we disabled and restarted PM the toolbars were almost entirely fixed- but a few icons had to be put back up.

We found the original idea interesting- but we had to disable it- at least for now. If you could fix this we might take a second look.

Thanks.

sleepingkirby commented 5 years ago

Hello Eleventythreeve,

Thanks for reporting this. Can I know which browser and what custom toolbar it gets in the way of? The icon that appears in the toolbar is usually placed and decided by the browser and not something I have control over. (For web extensions, in different browsers, you just say set things like "Yes, I want an icon on the tool bar and yes, it should have this as a dropdown menut." But there's nothing about that you can set as to what order it appears in or what it gets in the way of.) If you can give me that info, or if you can link an screenshot of what it's doing, I can look into it further. I haven't personally had that problem so I'd be interested to know how to replicate it.

sleepingkirby commented 5 years ago

In firefox, I just modified my toolbar and couldn't reproduce the problem. In chromium (using linux here), To turned on and off varies toolbars and wasn't able to reproduce the problem. If you can give me more information, I would be most grateful.

Eleventythreeve commented 5 years ago

We just got back from a food break and it was good to see you respond. The browser is Pale Moon and we had originally placed it on a custom toolbar. After the initial installation we didn't restart for a couple of days as we are buried in some projects.

When it restarted with it activated our 2 of our 3 custom toolbars all failed and the icon was placed second from the right on what would be custom bar 1 of 3. We tried customization and the icon wouldn't budge. All others could be moved but it.

We aren't coders- but in the past we have run across icon anchoring. Usually this isn't necessary and it usually is the root of this issue. Maybe that is it.

Hopefully this helps.

sleepingkirby commented 5 years ago

I'm a palemoon user myself (hence how you found the plugin). I think I know what the issue is. Might be my side, might be palemoon's side. I'll some checking and get back to you.

Eleventythreeve commented 5 years ago

If you can nail down the final fix(es) please let us know. If the solution(s) aren't too technical please let us know. We like knowing a thing or two about how things actually work.

sleepingkirby commented 5 years ago

I'm pretty sure I got a solution. It is pretty technical. I even got help from a developer of palemoon (unfortunately frustrated him in the process >.<) to find a good solution. But I found the solution at 4am my time so I had to get some sleep. When I get it fixed, tested and resubmitted, I'll post here.

sleepingkirby commented 5 years ago

It's fixed. I've updated the source and will update to palemoon's add-on site in a bit. It's very technical but here's what happened. There's an object called gBrowser that you would use in javascript to find things like how many tabs are open, which tab is active, what's it's domain name, etc. Although its generally populated pretty quickly, it's not always populated. When not populated, it's a null and/or undefined object. I was checking that via if(typeof gBrowser !=='undefined' && gBrowser !==null){ }. Which, you would think would work fine. But it doesn't. Even if gBrowser is null, just by calling it will a) generate no errors. b) stop user toolbars from being populated. (Don't know why. There's even old archived mozilla.org posting that says that to call gBrowser, you have to add an even listener to make sure the page is loaded before even looking at gBrowser. And, through my testing, I found that even that's not a guarantee. I still had to do the null/undefined check after the window was loaded.) So the fix was, add an even listener to the window and wait for it to load. So when that's loaded, you can add and even listener to gBrowser so then you can check if the page is loaded. But even before then, make sure gBrowser is a valid object. And if all that is correct, then do the pruning of modals.

As I started with, I'll update to palemoon's add-on page in a bit. If you want it early, I always include a release .xpi with the source: https://github.com/sleepingkirby/butWhyMod/blob/xul/releases/butWhyMod_xul.xpi

Feel free to reply if you have any questions or if I missed something. ^^/

sleepingkirby commented 5 years ago

Actually, check that. >.< If you can try the updated version first to make sure it does resolve your problem, I'd appreciate it. Once that's confirmed, I'll update to the palemoon add-on page.

Thank you

Eleventythreeve commented 5 years ago

Where is the actual XPI link or file? We clicked on the link above and didn't find it.

sleepingkirby commented 5 years ago

Huh... weird, works for me. https://github.com/sleepingkirby/butWhyMod/ Switch to the xul branch Then: "releases" folder -> butWhyMod_xul.xpi

Eleventythreeve commented 5 years ago

It appears that the news is bad. We went and found the download, did a manual install and it showed that we had version 1.6.

Then we restarted PM and immediately the toolbars failed. Earlier we did make one mistake: We said that one of the 3 custom bars worked. It was none and the BWM icon forced itself to the right of the navigation bar.

Also, we tried playing with the BWM controls and we had to click on it repeatedly to get it to do anything. Then the menu opened. After that we tried disabling it and restarting. Again, PM came up with the failed bars and BMW still there. Strange!

So we restarted again and the same results. We did it again, the same. Then we manually restarted and again, the same. Nothing could disable BWM at this point. No matter how many times it told us that it would be disabled upon restart there it was.

We did an uninstall and instantly the toolbars were back. Again, neither of us are coders so this is totally a guess- but there probably is something else going on here.

sleepingkirby commented 5 years ago

Hello,

If it still shows you're version 1.6, that's the wrong version without the fix. Please note that if you found the download link from the palemoon add-ons page that's the wrong version. I have not yet updated the extension to the palemoon's add-on page as I want to make sure the fix works before I upload it to palemoon's add-on pages.
Please make sure to do the following: (I just had my wife, who's on a windows machine and never seen a github page before follow these steps. So you should be fine) 1) Go to: https://github.com/sleepingkirby/butWhyMod/blob/xul/releases/butWhyMod_xul.xpi 2) On that page, click the "Download" button 3) Download to a location on your computer you can remember as we will need to use that file later. 4) On palemoon, go to Tools -> Add-ons 5) Remove butWhyMod 1.6 (Don't restart palemoon yet if it offers) 6) On the same Add-ons page, towards the top and to the left of the search field, click on the button that has a panel of sliders. 7) Clicking that button will show you a drop down menu. 8) In that drop down menu, click on "Install Add-on From File..." 9) That will bring up a window to select a file on your computer. 10) Navigate to and select the file downloaded on step 3. 11) Restart palemoon. 12) Tell me if your custom user toolbars are there or if they're missing. 13) If they're still missing, please take a screen capture of palemoon a) Without my extension and with the custom user toolbars b) With my extension and without the custom user toolbars. c) Include what other add-ons are installed on the browser.

Thank you.

Eleventythreeve commented 5 years ago

That is almost exactly what we did. Now we did it again and this time it has a redirect to Rawgithubusercontent that won't complete. last night there was no redirect.

We are going to go eat and try it again when we get back online.

Eleventythreeve commented 5 years ago

We finally got it to download. Upon restart the toolbars were intact, BWM is controllable and so far all appears well!

Do you have some known sites with modals to test it out on?

sleepingkirby commented 5 years ago

Good to hear! I'm working on a side project at the moment so I'll update on palemoon's side when I'm done.

I made the plugin when someone sent a facebook page and that annoying "You're not logged in? We're gonna block EVERYTHING until you do!" So try facebook while not logged in. If you need an example page: https://www.facebook.com/SeattleUTSA/about/?ref=page_internal

sleepingkirby commented 5 years ago

Updated new version palemoon's add-on page. Closing bug.