How to get stack trace for "Insecure JavaScript to access frame with URL" errors in Chrome / Webkit?

The reason for this error displayed in the console in Webkit browsers is well known and clearly described in the error text:

An unsafe JavaScript attempt to access with the iframed-content-example.com URL from a frame with the URL www.example.com. Domains, protocols, and ports must be consistent.

But for large sites with a lot of possible code fragments causing the error (ads, third-party libraries, site scripts), the error message is not very useful for tracking and debugging the line of code that caused the problem. Is there a way to initiate a stack trace when a cross-domain error occurs ?

+6
source share
2 answers

This issue is tracked here: https://code.google.com/p/chromium/issues/detail?id=88885 .

This particular error message shows the stack trace in the most recent versions of Chromium.

+2
source

I am going to answer and answer my question and say that this is currently not possible. After checking the source and the Chromium issue tracker , it seems that the lack of stack trace stems from the solution in the upper stream in Webkit so as not to throw an exception after an unsafe attempt to access inter-frame access. The decision that error handling be deliberately opaque was made based on a security rationale.

+2
source

Source: https://habr.com/ru/post/892446/


All Articles