Systrace Error. Uncaught SecurityError: Failed to execute 'pushState' on 'History'

12,504

Solution 1

I was able to fix it following the directions here: https://stackoverflow.com/a/13262673/1292598

Long story short: Start Chrome with the --allow-file-access-from-files flag.

Solution 2

The problem is that window.history.pushState throws an error when window.history.state is null or undefined.

To fix this problem, just do:

if (window.history.state) {
   window.history.pushState(state, title, href);
}

Solution 3

I found the solution while building a client-side router was to make sure that I had a base href tag in my html document and then configure the router to have options to set the root of my router to use the base href while in html5 history mode. Both the base Href attribute and the root property in your code while using the HTML 5 History API should match otherwise I have found that you will get errors like this.

Share:
12,504
Shyam Sundar Kulkarni
Author by

Shyam Sundar Kulkarni

Updated on July 31, 2022

Comments

  • Shyam Sundar Kulkarni
    Shyam Sundar Kulkarni over 1 year

    I am trying to open the HTML file generated by systrace. When I click on one the block I used to get the selected slice information like "Duration", "Total Time" etc. But with the latest version of chrome that is not working.

    Tried on latest chrome(ver.45), chrome beta(ver.46) and chrome Dev(ver.47) version and I see the same problem across all the versions.

    I see that when I click on the slice, instead of showing the details, it throws error stating

    Uncaught SecurityError: Failed to execute 'pushState' on 'History': A history state object with URL 'file:///C:/Users/ssundark/Desktop/vsync_off_default_sclk.html' cannot be created in a document with origin 'null'.

    Can someone please let me any work around to this problem ? or if there is some way we can open this file to know the selected slice information.

  • Shyam Sundar Kulkarni
    Shyam Sundar Kulkarni over 8 years
    Thank you for the suggestion. Tried. Its not working for me.
  • Pardeep Jain
    Pardeep Jain over 6 years
    i have reactjs build and facing same issue, where to add this fix may i know ?