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

4

7

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.

Coretta answered 10/9, 2015 at 17:28 Comment(1)
The file is generated once we run android systrace utility. It is expected to run out of the box. But with latest version of chrome it is not working. With older systrace dump I see that, "window.history.pushState({view_guid:this.guid_,selection_guid:b.guid});" but with latest systrace dump "window.history.pushState({view_guid:this.guid_,selection_guid:b.guid}, "");"Coretta
C
2

I was able to fix it following the directions here: https://mcmap.net/q/126180/-origin-null-is-not-allowed-by-access-control-allow-origin

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

Cetinje answered 10/9, 2015 at 22:24 Comment(1)
Thank you for the suggestion. Tried. Its not working for me.Coretta
R
1

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);
}
Responsory answered 16/9, 2015 at 4:32 Comment(1)
i have reactjs build and facing same issue, where to add this fix may i know ?Wychelm
I
1

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.

Isolda answered 7/5, 2016 at 13:57 Comment(0)
Z
0

this security error from browser, you must run on web server. i'm test run in webstorm and it's worked!

Zonation answered 30/12, 2016 at 9:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.