
Loading…
[firefox] open a new website in an existing tab causes website to break #1140
When you say
now goto wilderssecurity.com
How? Entering the address manually, link, bookmark...?
I had the same problem as @harshanvn when I drag&drop installed the latest .xpi (self compiled), it looks like a browser restart got rid of the problem & never experienced it again. (The count badge also showed huge blocking numbers 500+ and more.)
When I had, say, majorgeeks.com open, the popup showed the majorgeeks related items, when i then clicked another bookmark to open in that same tab, the content of the tab got broken, and the popup showed items of both majorgeeks and the newly opened site.
Looks like some code must have mangled using the restartless update method which required a browser restart to fix it permanently.
FF 40(nightly), Win7, one of the latest commits.
@harshanvn Yep, that's how sites looked here too. I just drag&drop installed the latest commit and couldn't reproduce anymore. That's good.
@harshanvn Ok, that's how I tried to reproduce, by typing the address in the address bar.
I suspect some changes sometimes require a browser restart, and for the commit mentioned above there were changes about using a new API for tab change events.
Ok Thanks. That sounds reasonable.
Strange thing (unrelated to this bug i think..), when you try open above give gif link directly...it open fine. However if i try to do ctrl-f5 to reload the page, it will not reload...
https://cloud.githubusercontent.com/assets/779630/6927159/14c1b692-d809-11e4-900e-2893cb1c10f5.gif
Does it work fine for you in firefox..
Strange thing (unrelated to this bug i think..), when you try open above give gif link directly...it open fine. However if i try to do ctrl-f5 to reload the page, it will not reload...
https://cloud.githubusercontent.com/assets/779630/6927159/14c1b692-d809-11e4-900e-2893cb1c10f5.gif
Does it work fine for you in firefox..
Please ignore this. Looks like a firefox thing. Able to reproduce the issue even if ublock has been disabled. Maybe sth to do with v37 release...
https://cloud.githubusercontent.com/assets/779630/6927159/14c1b692-d809-11e4-900e-2893cb1c10f5.gif is unreachable at the moment for me.
you restart your browser and open the link. it will work fine for the first time and then the issue repeats from second reload onwards...
Happens to me too. I see the image is hidden because it is detected as being blocked by the content script, though it is not blocked by the network requests handler. Investigating.
If whitelisting about-scheme, the issue does not arise. So it's yet another Firefox navigation problem. Will see if it existed without the latest changes.
I am unable to reproduce with 0.9.2.3. @harshanvn can you open a new issue for this? Looks like the issue arise because of #1135.
Actually, I believe the issue here could very well be explained by the image problem as well.
Repro steps:
- Advanced user mode
- Globally block 3rd parties
- Un-whitelist
about-schemeif not done yet. - Click the GIF in this comment: gorhill/uBlock#1140 (comment).
- Sometimes, the image won't display because it will be deemed 3rd-party by uBlock, because the tab is still bound to
about:blankby the time the content scripts execute.
The fact that the image is not blocked as a network request but is blocked when queried by the content script is because the image is requested as a root document, which obviously can't ever be filtered as a 3rd-party resource, but the content script query result of filtering as an image.
I could not reproduce the issue in 0.9.2.3, so likely related to #1135.
Argh, some nasty timings going on here. OK, so it looks like if nsIObserver.observe for document-element-inserted is called, it's called before nsIWebProgressListener.onLocationChange is called, which is a little irritating.
What we could do is insert a sync message to ensure that a location changed is registered before running the content scripts, so in frameModule.js to the docReady function add:
let messageManager = doc.docShell.getInterface(Ci.nsIContentFrameMessageManager);
messageManager.sendSyncMessage(locationChangedMessageName, {
url: loc.href,
});
just before loading the contentscript-end.js.
We still need the location change listener too, though, because document-element-inserted is not called at all if the page is loaded from session cache (navigating backwards and forwards, for example). This means we will usually get two location changes for the same page, which isn't ideal either. I'm not sure how much of a problem this would be, if it is worth trying to set some sort of flag that document-element-inserted has already raised locationChanged so onLocationChange should skip it? That's the sort of fragile hack that usually ends up causing more problems, though.
Edit: Packaged the code fragment I described into a pull request for convenience: #1150
Just some thoughts about the latest regressions.
I have always seen stability as more important than "minimize code duplication", and it's why I was more of the opinion to have a dedicated Fennec branch, so that any code change to it would have zero effect on the Firefox branch. I was planning a release next weekend, but it doesn't look like this will happen. Adding more hacks to patch unexpected side effects is likely not a stabilizing move.
So.. I have to say now I wonder if it is time to split Firefox/Fennec in two, put back the Firefox branch into the state where all was working as expected, and from now on work on Fennec with no longer the fear there will be any side effect to the Firefox version -- and vice versa.
I see where you're coming from. There are disadvantages to having separate Fennec and Desktop builds too, of course, and I'm not sure what AMO can offer by way of linking listings, but in the end you've got to weigh it all up in consideration.
I will say that these latest changes, to move to a nsIWebProgressListener, were not simply for Fennec but were an attempt at undoing a previous hack (triggering an onNavigation as a result of TabSelect) for Desktop. The alternative would have been more layers of hacks on top of it, even if separately for Fennec and Desktop. It would just mean different hacks for the two of them, which isn't necessarily an improvement!
@AlexVallat can't reproduce anymore, so that's a good sign.
It should, at a minimum, fix the issue. My only concern is whether it causes other unexpected problems. Together with caea8c5, I'm pretty sure it won't have any ill effect when onLocationChange occurs before observe (as is good and natural), but in rare cases such as the gitHub gif link here, when they arrive reversed, it will have the side effect that two location changes will be raised for the same page. I think the worst that could happen would be a slightly inaccurate badge count, as it would reset the counter with the second call. Unless there's something else horrible I've missed, I'd be happy to call this one closed.


Steps To Reproduce
You will see wilderssecurity.com completely broken..
Here is the uBlock popup snapshot -
