prevent-duplicate-tabs icon indicating copy to clipboard operation
prevent-duplicate-tabs copied to clipboard

"Reopen Closed tab" is throwing the extension in to infinite loop

Open vsrawat opened this issue 2 years ago • 2 comments

When I open a closed tab using browser's "Reopen Closed tab" from right click menu, if I had earlier opened same tab twice, then the browser reopens one tab first, but when the browser reopens the same tab again because that is what is in its sequence, your extension promptly closes that, and then as that closed has become last closed tab now, if I give the reopen command again, the browser opens that same tab again, but your extension closes yet again.

That is falling in an infinite loop.

I guess this qualifies for a bug.

Please give it a thought. May be your extension should work to close only if duplicate tabs are opened by middle click or some what "in one go". Your extension must not close when only one tab it being opened by any command, even if a tab with exact same url is already open in a next tab.

vsrawat avatar Jun 18 '23 03:06 vsrawat

Could you explain step by step, following the steps the way to describe mentioned in bug report? I tried to reproduce the way you explained, but there must be some detail missing so that it is possible to reproduce the problem.

brcontainer avatar Jul 25 '23 02:07 brcontainer

Thanks for writing.

  1. you open any url in a tab
  2. you close it.

(3. you go to some different urls, open and/ or close it, all or some. this step is not the point.) you can skip this step altogether. I am presenting a real life scenario. but then I tried and step 3 can be skipped to shorted the recreation of the problem.

  1. You open the first url again (that was opened in step 1). Keep it open this time.

  2. Now when you click "reopen closed tab" repeatedly, as soon as you reach step 1, tab url is opened but because that url is already open in other tab in step 4. That reopened url from step 1 is closed.

now the url in step 5, that your extension has just automatically closed, has become the "last closed url", so every time you now give "reopen closed tab" command, it will open the same url, but as the same url from step 4 is open, your extension closes the just reopened url of step 1/4/5 which are all same.

So it is stuck in an infinite loop. We cannot go to urls we had been to before we did step 1, except by directly searching and clicking in history.

maybe it should check that the url it is going to open is not already in any previously opened url present in another tab, if so, then it should not try to open that url again.

It depends on whether you have already taken over from browser before opening a url, otherwise if browser keeps on opening it and then you take over and match and close the duplicate, then I couldn't come up with a solution.

Thanks.

On 25-Jul-23 8:23 AM, Guilherme Nascimento wrote:

Could you explain step by step, following the steps the way to describe mentioned in bug report https://github.com/brcontainer/prevent-duplicate-tabs/blob/main/.github/ISSUE_TEMPLATE/bug_report.md? I tried to reproduce the way you explained, but there must be some detail missing so that it is possible to reproduce the problem.

vsrawat avatar Jul 25 '23 03:07 vsrawat