From 4b5a82dc6f4345ebc1c63f10e951432da4856653 Mon Sep 17 00:00:00 2001 From: "sullivan@apple.com" Date: Sat, 10 Nov 2007 21:08:17 +0000 Subject: [PATCH] Reviewed by Tim Hatcher - fixed Safari should not log unsafe JavaScript attempts when in private browsing mode (only an issue if Log JavaScript Exceptions is turned on) * bindings/js/kjs_window.cpp: (KJS::Window::isSafeScript): Don't log unsafe JavaScript attempts to console or chromeClient if in private browsing mode git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27667 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- WebCore/ChangeLog | 11 +++++++++++ WebCore/bindings/js/kjs_window.cpp | 17 +++++++++-------- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 5deea2b8312..4e0b8eb9d67 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,14 @@ +2007-11-10 John Sullivan + + Reviewed by Tim Hatcher + + - fixed Safari should not log unsafe JavaScript attempts when + in private browsing mode (only an issue if Log JavaScript Exceptions is turned on) + + * bindings/js/kjs_window.cpp: + (KJS::Window::isSafeScript): + Don't log unsafe JavaScript attempts to console or chromeClient if in private browsing mode + 2007-11-10 Alexey Proskuryakov Reviewed by Darin. diff --git a/WebCore/bindings/js/kjs_window.cpp b/WebCore/bindings/js/kjs_window.cpp index e26331e6a0c..dd63d2ae55c 100644 --- a/WebCore/bindings/js/kjs_window.cpp +++ b/WebCore/bindings/js/kjs_window.cpp @@ -893,17 +893,18 @@ bool Window::isSafeScript(const ScriptInterpreter *origin, const ScriptInterpret originDomain = ancestorFrame->document()->domain(); } - if ( targetDomain == originDomain ) + if (targetDomain == originDomain) return true; - if (Interpreter::shouldPrintExceptions()) { - printf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n", - targetDocument->URL().latin1(), originDocument->URL().latin1()); + if (!originFrame->settings()->privateBrowsingEnabled()) { + if (Interpreter::shouldPrintExceptions()) + printf("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n", + targetDocument->URL().latin1(), originDocument->URL().latin1()); + String message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n", + targetDocument->URL().latin1(), originDocument->URL().latin1()); + if (Page* page = targetFrame->page()) + page->chrome()->addMessageToConsole(JSMessageSource, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL. } - String message = String::format("Unsafe JavaScript attempt to access frame with URL %s from frame with URL %s. Domains must match.\n", - targetDocument->URL().latin1(), originDocument->URL().latin1()); - if (Page* page = targetFrame->page()) - page->chrome()->addMessageToConsole(JSMessageSource, ErrorMessageLevel, message, 1, String()); // FIXME: provide a real line number and source URL. return false; } -- GitLab