Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(842)

Unified Diff: Source/core/frame/LocalFrame.cpp

Issue 799923006: Make canNavigate() OOPI-friendly (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/frame/LocalFrame.cpp
diff --git a/Source/core/frame/LocalFrame.cpp b/Source/core/frame/LocalFrame.cpp
index 278cb3a09b112ac93be6757a3439a234c02f5131..22cbf3bb69ae11ac5d244e2f9a3da780f6dbbb44 100644
--- a/Source/core/frame/LocalFrame.cpp
+++ b/Source/core/frame/LocalFrame.cpp
@@ -298,6 +298,18 @@ bool LocalFrame::checkLoadComplete()
return loader().checkLoadCompleteForThisFrame();
}
+void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame, const char* reason)
+{
+ if (!targetFrame.isLocalFrame())
+ return;
+
+ const LocalFrame& targetLocalFrame = toLocalFrameTemporary(targetFrame);
+ String message = "Unsafe JavaScript attempt to initiate navigation for frame with URL '" + targetLocalFrame.document()->url().string() + "' from frame with URL '" + document()->url().string() + "'. " + reason + "\n";
+
+ // FIXME: should we print to the console of the document performing the navigation instead?
+ targetLocalFrame.localDOMWindow()->printErrorMessage(message);
+}
+
void LocalFrame::disconnectOwnerElement()
{
if (owner()) {

Powered by Google App Engine
This is Rietveld 408576698