Bugs :  K-Meleon Web Browser Forum
You can talk about issues with k-meleon here.  
Event order inaccurate order or inaccurate reporting
Posted by: JamesD
Date: January 20, 2015 06:24PM

When closing a window containing one or more tabs, the events do not happen in the correct order or the reporting of the events is out of order.

What I think should happen is this:

OnCloseTab should be reported for as many tabs as the window contains.
OnCloseWindow should be reported.

What actually occurs is this:

OnCloseWindow is reported.
OnCloseTab is reported for as many tabs as the window contains.

The problem this causes is that without a window the code associated with the OnCloseTab has nowhere to run or the data is already gone.

This is easily checked using this macro:
https://dl.dropboxusercontent.com/u/1522294/EventOrder.kmm

A major problem is caused for the PriorTab macro in that tabs closed as a result of a window close are not captured.
https://dl.dropboxusercontent.com/u/1522294/PriorTabs.7z

Can anyone confirm or provide more information?

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: siria
Date: January 20, 2015 08:11PM

Will have to try your test macro, but so far I thought the "onclosetab" is really fired before "onclosewindow", that somehow it wouldn't be possible otherwise at all. But you might well be right, considering that background tabs are not stored when opening another session... Then again, perhaps KM starts closing tabs with all background tabs first, and the active tab as last?

Just had another idea, as its name indicates already, the macro only works at all if TABS are enabled. But there are still a few crazy people out there who still use only Windows, perhaps they'd like to store their closed pages too? Sigh, this macro keeps my creativity busy grinning smiley



Edited 2 time(s). Last edit at 01/20/2015 08:18PM by siria.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: siria
Date: January 20, 2015 08:26PM

Cool test macro, like it! smiling smiley Nothing like a real life test!

So yes, OnCloseWindow is really fired first.
BUT - OnCloseTab is *also* fired. Before or after, for PriorTabs it should be the same, not?

Edit:
Strange, now I'm only getting OnCloseWindow. No OnCloseTab anymore. And no AppExit. Was a parallel session with only 1 window. Must test more...
Edit-2:
Yes, that happens for the last window only. If another window remains open, OnCloseTab alerts are showing. For the purpose of this macro that's okay, it shall not store anything between sessions anyway.



Edited 2 time(s). Last edit at 01/21/2015 12:36AM by siria.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: Dorian
Date: January 21, 2015 06:26PM

In fact you have for KM 75 :

CloseWindow (OnCloseWindow macro)
  CloseTab (never send)
  DestroyTab (OnCloseTab macro)
DestroyWindow (not mapped in macro)

Don't know why it's like that, but moving OnCloseTab to CloseTab seems logic and would fix your problem.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: siria
Date: January 21, 2015 07:01PM

Ah interesting...
And would there be any easy way to get the url of background tabs by a macro? I think that prob occured in the past a few times, not just when closing... ah yes, probably OnLoad...

Not sure if that's the reason for the current method, but closing a tab does not destroy its tab history yet, only when it's really gone afterwards.



Edited 1 time(s). Last edit at 01/21/2015 07:04PM by siria.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: JamesD
Date: January 21, 2015 07:15PM

Quote
Dorian
Don't know why it's like that, but moving OnCloseTab to CloseTab seems logic and would fix your problem.

That is fine. Just make sure the change does not cause other problems. Weighting PriorTabs against K-Meleon, I would go with stability for KM.

Related question: Clicking 'Close Tab' when there is only one tab in a window does not actually close the tab. It just makes the URL equal to "about:blank". Is this connected to the same code? Should closing the only tab in a window also close the window?

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: siria
Date: January 21, 2015 07:38PM

The setting to close the window is in F2/Browsing/Tabbed browsing.
Can't remember what the default setting was, but when I kept accidentally closing the whole browser again and again, when overlooking that a tab was the last, I was really glad this pref exists.
Therefore what would be handy, if this pref would affect only multiple windows, those are okay to close, just not the very last one without warning... Then again, that's another existing pref, to warn when exiting! Oh well, it's been a long time, perhaps was not too aware of the second one yet at the time, can't remember ;-)
Never mind, I'm happy as is now smiling smiley

Edit: oh man, now I confused that exit warning, was meaning the warning about "closing a window multiple tabs"!



Edited 3 time(s). Last edit at 01/22/2015 01:39AM by siria.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: JamesD
Date: January 22, 2015 01:07AM

That is good information, Siria. The default value for "kmeleon.tabs.onCloseLast" is integer 1. I don't think that I have ever changed it before.

If set to integer zero the window closes when the last tab is closed. Now the question is how to make the best use of this information.

$WindowNumber contains the number of windows. What about this logic?

while $WindowNumber > 1 set "kmeleon.tabs.onCloseLast" = 0 else 1
and check at every window close. Offer to include with PriorTabs?

I am a little bit afraid of messing with the user's setup.

I think Dorian has offered a solution here. Maybe we should move the rest of the discussion back to Improvements.

http://kmeleonbrowser.org/forum/read.php?4,131640,131745#msg-131745



Edited 1 time(s). Last edit at 01/22/2015 01:36AM by JamesD.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: rodocop
Date: January 22, 2015 02:17PM

I think that the next issue (really old issue) is somehow connected to the topic.

The bug is that session info in prefs.js isn't updated on the tab closing.

So if you close some tabs right before exiting KM, then they reaapear after KM restart.

So to get sure your session is updated you need open empty tab and close it - only then new session config gets written!

This bug works in old branches (1.6 and earlier) and remains alive in 74-75.

Moreover, in new KM sometimes you need not only open/close empty tab but also make some activity in one of needed tabs (for example - reload it).



Edited 1 time(s). Last edit at 01/22/2015 02:17PM by rodocop.

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: Dorian
Date: January 22, 2015 11:13PM

Forget what I've said. It's just a stupid bug grinning smiley
@rodocop, this is fixed in 75

Options: ReplyQuote
Re: Event order inaccurate order or inaccurate reporting
Posted by: rodocop
Date: January 23, 2015 12:56PM

It seems to work right, Dorian!
Thank you once again!

But one more new question appeared:

when I'm setting Sessions Options for a first time, I cannot now choose 'Previous session'. Only the 'Last session' item exists by default there in box.

Bur after first reload 'Previous session' appears.

Is it bug or feature? What is the real difference between 'Last' and 'Previous'?

What is the right way to behave (set up) here in order to get old way of restoring that was used to?

Options: ReplyQuote


K-Meleon forum is powered by Phorum.