| Index: third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
| diff --git a/third_party/WebKit/Source/core/frame/LocalFrame.cpp b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
| index 9f754700b681b8db9480cfba98761e51c2171fef..6f1cd6a70bfa466295117abd93275ada2f6361ed 100644
|
| --- a/third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
| +++ b/third_party/WebKit/Source/core/frame/LocalFrame.cpp
|
| @@ -466,26 +466,35 @@ SecurityContext* LocalFrame::securityContext() const {
|
| return document();
|
| }
|
|
|
| -void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame,
|
| - const char* reason) {
|
| +String LocalFrame::getTargetFrameDescription(const Frame& targetFrame) const {
|
| // URLs aren't available for RemoteFrames, so the error message uses their
|
| // origin instead.
|
| - String targetFrameDescription =
|
| - targetFrame.isLocalFrame()
|
| - ? "with URL '" +
|
| - toLocalFrame(targetFrame).document()->url().getString() + "'"
|
| - : "with origin '" +
|
| - targetFrame.securityContext()->getSecurityOrigin()->toString() +
|
| - "'";
|
| + return targetFrame.isLocalFrame()
|
| + ? "with URL '" +
|
| + toLocalFrame(targetFrame).document()->url().getString() + "'"
|
| + : "with origin '" +
|
| + targetFrame.securityContext()
|
| + ->getSecurityOrigin()
|
| + ->toString() +
|
| + "'";
|
| +}
|
| +
|
| +void LocalFrame::printNavigationErrorMessage(const Frame& targetFrame,
|
| + const char* reason) {
|
| String message =
|
| "Unsafe JavaScript attempt to initiate navigation for frame " +
|
| - targetFrameDescription + " from frame with URL '" +
|
| + getTargetFrameDescription(targetFrame) + " from frame with URL '" +
|
| document()->url().getString() + "'. " + reason + "\n";
|
|
|
| domWindow()->printErrorMessage(message);
|
| }
|
|
|
| -void LocalFrame::printNavigationWarning(const String& message) {
|
| +void LocalFrame::printNavigationWarning(const Frame& targetFrame,
|
| + const char* reason) {
|
| + String message = "Frame with URL '" + document()->url().getString() +
|
| + "' attempted to navigate its top-level window " +
|
| + getTargetFrameDescription(targetFrame) + ". " + reason +
|
| + "\n";
|
| m_console->addMessage(
|
| ConsoleMessage::create(JSMessageSource, WarningMessageLevel, message));
|
| }
|
|
|