Skip to content

History cleaner: consider replacing the state with null instead of { state: "cleaned_history" } for better compatibility #196

Description

@julienw

Hey,

I noticed that the clear urls addons was doing replaceState to replace the history. The problem is that by using some hardcoded state this is breaking websites.
Most recently this applied to the Firefox Profiler. Here is a typical example:

  1. Open some profile link, such as https://profiler.firefox.com/public/def4zbt1tyg8w0x7nkdtq8g7s6h3ad0ndz7jbzg/calltree/
  2. Change the panel at the bottom (for example click on "Flame Graph")
  3. Then press the back button;

=> The application crashes.

Indeed when changing the panel (and other actions too), the application does a pushState with the new state, and also changes the URL by serializing part of the state. If you're curious, here is the code responsible for this.

The problem is the application thinks that a proper state is present, and use it, and crashes. By using null instead, the application would use the information contained and serialized in the URL. If you're curious, here is the code responsible for this.

I believe this wasn't happening before, but happens now, because the new "recursive cleaning" will make the URL look different while before they were possibly looking the same.

Now I can find 2 solutions (not exhaustive, both could be used):

  1. as I suggest in the title, I'm not sure why we use this hardcoded state information, and I think that using null would provide the same functionality and less breakage.
  2. do not clean history if the hostname stays the same -- we could probably accept that inside one hostname it's acceptable that websites use the history information.

Thanks

Activity

  1. evertheylen commented on Jul 23, 2022

    @evertheylen
    Contributor

    I am building an app and was getting this issue too. I agree that both solution 1 and 2 are better than the current behaviour. Of course, for my app to work as intended, I'd prefer solution 2.

  2. added a commit that references this issue on Feb 12, 2023
    81c5e9e
  3. KevinRoebert commented on May 10, 2023

    @KevinRoebert
    Member

    Fixed by 14a0832

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions