MozillaZine

[Ext] BackTrack Tab History

Announce and Discuss the Latest Theme and Extension Releases.
Str0ngwun

User avatar
 
Posts: 222
Joined: January 29th, 2011, 9:50 am

Post Posted October 19th, 2015, 11:50 am

Is it still exhibiting the problem with the new tab?

Unfortunately it does.
Just for clarity, steps to reproduce: 1. open new tab (file:/// path) 2. click any link on that page. 3. try to hit 'back' button. 'Back' button is inactive and can't be clicked.

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted October 19th, 2015, 12:07 pm

Hmm. I'm not seeing it. OK, just to be clear, they are just ordinary <a href= links, not anything special with javascript or anything? They just open in the same tab, not a new tab or window? I assume you've sanity-checked that if you disable BackTrack, you get the new tab page showing up in the history correctly?

To open the new tab, I'm just hitting the + button on the tab bar - I can't imagine that would make a difference, though.

If you then continue to follow further links in that tab, the history behaves normally, just not including that first new tab page?

Str0ngwun

User avatar
 
Posts: 222
Joined: January 29th, 2011, 9:50 am

Post Posted October 20th, 2015, 3:21 am

Hmm. I'm not seeing it. OK, just to be clear, they are just ordinary <a href= links, not anything special with javascript or anything? They just open in the same tab, not a new tab or window?

That's correct.
I assume you've sanity-checked that if you disable BackTrack, you get the new tab page showing up in the history correctly?

Sorry, I hadn't. Now I did and turns out the problem is elsewhere: even if I disable both (backtrack and new tab override) - the problem is still there.
Thanks for your help, and sorry for disturbance.

onemen

User avatar
 
Posts: 1130
Joined: October 15th, 2004, 7:48 am

Post Posted October 23rd, 2015, 10:27 pm

Hello Alex,

I'm the developer of Tab mix plus

Both Tab mix and your extension change Firefox code.
When your extension installed Tab mix can't access the original Firefox functions (hookFunctionInChain) since your extension hide it in a closure.

Is it possible for you to save the original function in an object that other extensions have access to?

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted October 24th, 2015, 12:21 am

onemen wrote:Hello Alex,

I'm the developer of Tab mix plus

Both Tab mix and your extension change Firefox code.
When your extension installed Tab mix can't access the original Firefox functions (hookFunctionInChain) since your extension hide it in a closure.

Is it possible for you to save the original function in an object that other extensions have access to?


Hello oneman,

Thank you for getting in touch. I'm a big admirer of your Tab Mix Plus extension. With regards to modifying the code, what BackTrack does by default is to replace the current firefox function with a new one, and call the current one from the new one. This is the recommended practice, as described by Mozilla: http://developer.mozilla.org/en-US/Add-ons/Overlay_Extensions/XUL_School/Appendix_C:_Avoid_using_eval_in_Add-ons#Overriding.2FExtending.2FAmending_existing_functions

The idea being, if both our add-ons want to override, for example, openLinkIn, then the first one to execute replaces the native openLinkIn with their own version (openLinkInA), then calls the original. The second one to execute replaces the now current openLinkInA with their override, openLinkInB, which calls the one they are replacing. So openLinkInB calls openLinkInA which finally calls the native openLinkIn. This works well if add-ons want to execute code before, or after the native function, or to modify parameter values. It doesn't work so well if they want to replace the function entirely and not call the original at all, but then logically it is not possible for more than one add-on to completely replace the behaviour with something different!

As I know that using string-patching and eval to modify functions has been used by several other add-ons, yours included, I provided a config setting, extensions.backtrack.stringPatchCompatibility, which will make BackTrack modify the existing function rather than replacing it. I've done my best to try an ensure it won't interfere with other modifications by only adding minimal code at the start and marking it clearly, but it's still possible that clashes could occur.

onemen

User avatar
 
Posts: 1130
Joined: October 15th, 2004, 7:48 am

Post Posted October 24th, 2015, 6:25 am

Alex,

I prefer not to use extensions.backtrack.stringPatchCompatibility, since i don't know how it effect other extensions.
but since Tabmix need to modify to original function (not just wrap it with before and after function), i need access to the original functions.
as a workaround Tabmix can modify the functions that are also modified by BackTrack earlier.

In hookFunctionInChain you save the original function to a private variable that i can not use
Code: Select all
var originalFunction = functionContext[functionName];

if you can change it to something like this
Code: Select all
functionContext["BackTrack_" + functionName] = functionContext[functionName];

then i can use it

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted October 25th, 2015, 2:43 am

onemin,

I agree, using stringPatchCompatibility might affect other extensions and that's why I don't use it by default, and would discourage its use.

The problem with the approach you suggest is that there is no way of knowing if originalFunction is actually the Firefox native function, or simply the next extension down the chain. As far as I know, there's no standard mechanism defined for walking down the chain to find the original, so using the chain mechanism you simply can't modify functions, only wrap and replace them.

However, I suppose there's nothing stopping us from defining such a standard here and now. Then hoping it catches on!

I propose that any replacement function have a property called .originalFunction which contains the function that it wraps. Therefore, to walk the chain you just call .originalFunction in a loop until that is undefined. At which point you either have the native function, or a replacement function which doesn't support this standard, and you can go no further. Replacing the value of .originalFunction must change the behaviour of the replacement function to call that replaced value, to allow for modification of the chain.

I still don't like it, I think that functions should *never* be live-patched, but if that's not going to happen then this would be a work-around.

I've uploaded an implementation of this as: v0.8pre4

eugenesan
 
Posts: 4
Joined: January 21st, 2016, 7:15 am

Post Posted January 21st, 2016, 7:30 am

Hi Alex,

First, thank you for a great addon.

There seems to be a conflict between "BackTrack Tab History" and "UnloadTab" (https://addons.mozilla.org/en-US/firefo ... b/?src=api).
When both addons are installed, browser fails to restore sessions and open new tabs.

Below is the error as it observed in browser console (when new tab creation is attempted):
---
09:05:36.113 ReferenceError: onBeforeFunction is not defined
gBrowser.loadOneTab() unloadtab.js line 1869 > eval:5
openLinkIn() utilityOverlay.js:345
hookFunctionInChain/replacementFunction() hookFunction.jsm:43
openUILinkIn() utilityOverlay.js:188
BrowserOpenTab() browser.js:12856
BrowserOpenNewTabOrWindow() browser.js:18405
oncommand() browser.xul:1
1 unloadtab.js line 1869 > eval:5:1
---

Since both addons are crucial for me, it would be nice if you could take a look.

Thanks.

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted January 21st, 2016, 11:32 am

It looks like UnloadTab is using string patching, which is an older, deprecated method of modifying browser functions. Ideally, UnloadTab could fix this by switching to using the function replacement method. If that's not an option, then BackTrack can be made to work in a compatibility mode by setting the "extensions.backtrack.stringPatchCompatibility" preference to true, then restarting Firefox. This may cause other incompatibilities with other add-ons, but can be used as a last resort.

I've added UnloadTab to the list of known incompatible addons on the first-run page, thanks for reporting it.

eugenesan
 
Posts: 4
Joined: January 21st, 2016, 7:15 am

Post Posted January 21st, 2016, 6:20 pm

Alex,

Thanks you for prompt and detailed response.
Now when know exactly what is the problem, the search for solution should easier :-)

eugenesan
 
Posts: 4
Joined: January 21st, 2016, 7:15 am

Post Posted February 26th, 2016, 9:45 pm

Hi,

I would like to report two issues with the extension:
1) In some situations new tabs opened without history. For example if you open link on addon's preferences page.
2) In some situations dropdown menus of Back/Forward buttons are only partially functional. All the items in the dropdown menu contain links (you can see the links by hovering with the mouse above them), but when clicked the tab stays the same (usually only two last items in the history are working).

* There are no related massages in browser-console.
* Browser version is 44.0.2@Ubuntu14.04
* Extension version is 0.8
* I am not sure but I think the issues were introduced with 44.0.2 update.

P.S.
I suspect the second issue is related to tab unloading using other extensions or browser restart.

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted February 27th, 2016, 1:28 am

Hi, thanks for reporting these. It won't work with links from browser internal UI pages because the code for determining which the source page is won't be run for them. I'm not sure if it is even possible to do so, but I'll run some experiments and see if it's possible.

Your number 2 is more worrying. I will investigate further around unloading tabs through restarting, but if you find any simple steps that can reliably reproduce the issue, that would be very helpful.

eugenesan
 
Posts: 4
Joined: January 21st, 2016, 7:15 am

Post Posted February 27th, 2016, 7:23 am

Hi,

I've just experienced both of the described issues in one tab.
Few new observations:
* The tab was a new tab that started as google and then a link was opened from search results
* The back button didn't work nor all the "unbranched" entires in the dropdown menu.
* For some reason, the history had a single itemed branch with google search I've performed earlier (in an unrelated tab) and this was the only history item working in dropdown history.
* I tried playing with tabs "unloading" but it didn't affect history behavior.

Hope above helps with identification of the problem.

AlexVallat wrote:Hi, thanks for reporting these. It won't work with links from browser internal UI pages because the code for determining which the source page is won't be run for them. I'm not sure if it is even possible to do so, but I'll run some experiments and see if it's possible.

Your number 2 is more worrying. I will investigate further around unloading tabs through restarting, but if you find any simple steps that can reliably reproduce the issue, that would be very helpful.

AlexVallat
 
Posts: 66
Joined: September 30th, 2006, 8:53 am

Post Posted February 28th, 2016, 5:02 am

That doesn't sound like either of the problems you described before. One problem is that it is not possible to identify browser chrome as a 'source tab', even if it behaves like a normal page (like about:addons). I don't think I'll be fixing that.

A second problem is related to unloaded tabs - I haven't reproduced that yet, is there a specific add-on you are using for unloading them.

Then this third problem appears unrelated to either, as it doesn't seem to have anything to do with unloaded tabs. If I understand right, you opened a new tab, navigated to Google search results, and opened a result link in a new tab. The resulting new tab had broken history behaviour. Needless to say, that doesn't happen when I try it! Perhaps there's another add-on you have installed that is conflicting in some way?

Str0ngwun

User avatar
 
Posts: 222
Joined: January 29th, 2011, 9:50 am

Post Posted March 15th, 2016, 1:17 am

For me the add-on stopped working correctly almost in all cases (especially in the simplest ones):
1. Open github.
2. Middle click the 'Gist' link there.
Actual result: new tab gets opened without back history at all.
Backtrack settings:
Image

Return to Extension/Theme Releases


Who is online

Users browsing this forum: No registered users and 1 guest