Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

The cause of this error showing up in the console in Webkit browsers is well-known and described clearly in the error text:

Unsafe JavaScript attempt to access frame with URL iframed-content-example.com from frame with URL www.example.com. Domains, protocols and ports must match.

But for large sites with many possible pieces of code triggering the error (ads, third-party libraries, site-specific scripts), the error message is not too helpful for tracking down and debugging the line of code that generated the issue. Is there any way to trigger a stack trace when the cross-domain error occurs?

like image 784
Ben Regenspan Avatar asked Jul 10 '11 18:07

Ben Regenspan


2 Answers

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

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

like image 191
vsevik Avatar answered Oct 19 '22 13:10

vsevik


I'm going to go ahead and answer my own question and say this is not currently possible. After checking the source and Chromium's issue tracker, it looks like the lack of stack trace stems from an upstream decision in Webkit to not throw an exception after an unsafe cross-frame access attempt. The decision to keep the error handling deliberately opaque was made based on a security rationale.

like image 2
Ben Regenspan Avatar answered Oct 19 '22 13:10

Ben Regenspan