The event that fires for document-start script insertion [ tabLocationChange ] event itself probably holds some clues about what type of tab location change has occurred (this is my hope) and would make it easy to isolate when to run scripts and when not to.
Perhaps some scripts need updates as a result of this being fixed, although I agree they should never run again until a new document is created. For people who will need to update their scripts; this may be relevant to users who wish to detect such events: http://stackoverflow.com/questions/4570093/how-to-get-notified-about-changes-of-the-history-via-history-pushstate I am curious if you experience this or any similar problem in the behavior of document-end scripts on facebook, if not then existing document-end scripts probably pose a few solutions to the problem of detecting pushstate events. On Tue, May 29, 2012 at 4:46 PM, Anthony Lieuallen <[email protected]>wrote: > Thanks everyone for your work figuring this out so far. It really should > be reported as an issue which is tracked until it's fixed: > > https://github.com/greasemonkey/greasemonkey/issues > > Ideally, with a reproducible testcase which is standalone (not Facebook). > I'm a bit busy at the moment to do this myself, but if an issue is > reported, I'll get to it when I have time. > > > On Tue, May 29, 2012 at 3:11 PM, Matt Kruse <[email protected]>wrote: > >> On May 29, 2:03 pm, Sam Larison <[email protected]> wrote: >> > see window.history.pushState >> >> Ah, I didn't realize that using pushState/replaceState would actually >> trigger Greasemonkey to fire again. IMO, it really shouldn't, because >> the DOM is not being re-loaded. Just because the url changes doesn't >> necessarily mean that the page is changing, and you could run the risk >> of a GM script being run twice or more on the same DOM. >> >> I'm also finding that the script does not fire consistently. Even >> though the url changes (I assume via pushState), the script is >> sometimes not fired again. So it's not really dependable. >> >> For now, I will stick with setting a flag on unsafeWindow, and exiting >> my script if the flag is already set. That will guarantee that I run >> only once. If there is a preferred work-around, let me know. >> >> Thanks for the clarification! >> >> Matt Kruse >> >> -- >> You received this message because you are subscribed to the Google Groups >> "greasemonkey-users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/greasemonkey-users?hl=en. >> >> > -- > You received this message because you are subscribed to the Google Groups > "greasemonkey-users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/greasemonkey-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "greasemonkey-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/greasemonkey-users?hl=en.
