-
Notifications
You must be signed in to change notification settings - Fork 327
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate menu commands #1321
Comments
It's not quite clear yet what's going on, but the adding/clearing of menu commands I've recently refactored is still not right. I'd like to say simply and clearly that I'm not happy with changing to run scripts at pageshow rather than domcontentloaded. It's later, potentially much later for some pages. The right solution almost definitely uses a more reliable page-changed detection than pagehide. (I only started with that because that's what the original implementation seemed to use.) |
I'm not happy with changing to run scripts at pageshow rather than domcontentloaded. It's later, potentially much later for some pages.Could we just use the pageshow to add the menu commands, and go back to using DOMContentLoaded for running scripts? |
I've updated my patch to run scripts on DOMContentLoaded but add menu commands on pageshow. I don't know if this is the solution you want but I think it solves this issue correctly. |
Test script: https://gist.github.com/898642 (you can ignore accelerator related stuff) When I use this in FF 3.6 + GM 0.8, I see:
or
or
Or: bfcache completely confuses existing GM_rmc. The bfcache docs say that an unload handler will disable it, so I tried add a user script which registers an unload handler on every page. The first test above sees the command disappear at step 2, but not come back at step 3. (Closer, but still broken.) Likewise the third behaves the same, disappearing on back but not reappearing on forward. Or, ultimately: failing to take bfcache into accounte does not represent a regression. But it would be real nice to be able to. I have a patch in the works, started last week and accidentally destroyed by a sloppy git command, mostly back. I think it fully works w/ bfcache taken into account, in FF4. But I think it's broken-ish on FF3. Now that I'm more sure what the state before changes was in FF3+GM0.8, I'll compare to this, and then give it more thought. |
Here's what I've worked up for this issue: I still want to test a bit more in FF3, especially if it leaves the potential to leak memory in the menu commands list; FF3 does not give us the nice "window id" data to compare nor events to know about inner windows being destroyed, as far as I can tell. |
Updated my branch. Now, with this test script: https://gist.github.com/902547 I load tabs, I navigate to new pages, I close tabs, I hit forward and back; no matter how I repeat these actions, nor in what order, I'm seeing what I expect. And the pages that come from the bfcache are all working properly too. Tested in Firefox 3.6 and 4.0. I see the "registered menus" array grow at very approximately about the size I expect the bfcache to. It never seems to grow to about 13 across the first 3 tabs, then each new tab (where all tabs have at least 5 pages in the history) only adds one more. Closing tabs makes this number drop. |
I tested your branch with the test script in Firefox 3.6 and 4.0, and can confirm that everything worked as expected. |
Merge branch 'menu-commander' Closed by 2b9ba9a |
See the thread for details and test case.
The text was updated successfully, but these errors were encountered: