Commit 0be8d5fe authored by weinig@apple.com's avatar weinig@apple.com

WebKitTools:

        Reviewed by Tim Hatcher.

        Follow up to <rdar://problem/5394877> Safari should not log unsafe JavaScript 
        attempts when in private browsing mode (only an issue if Log JavaScript Exceptions 
        is turned on)

        - Add LayoutTestController.setPrivateBrowsingEnabled(bool) (stub out implementation for windows)

        Added test: http/tests/security/cross-frame-access-private-browsing.html

        * DumpRenderTree/LayoutTestController.cpp:
        (setPrivateBrowsingEnabledCallback):
        (LayoutTestController::staticFunctions):
        * DumpRenderTree/LayoutTestController.h:
        * DumpRenderTree/mac/DumpRenderTree.mm:
        (runTest): Default to private browsing disabled.
        * DumpRenderTree/mac/LayoutTestControllerMac.mm:
        (LayoutTestController::setPrivateBrowsingEnabled):
        * DumpRenderTree/win/LayoutTestControllerWin.cpp:
        (LayoutTestController::setPrivateBrowsingEnabled):

LayoutTests:

        Reviewed by Tim Hatcher.

        Follow up to <rdar://problem/5394877> Safari should not log unsafe JavaScript 
        attempts when in private browsing mode (only an issue if Log JavaScript Exceptions 
        is turned on)

        Test using the new LayoutTestController.setPrivateBrowsingEnabled(bool)

        * http/tests/security/cross-frame-access-private-browsing-expected.txt: Added.
        * http/tests/security/cross-frame-access-private-browsing.html: Added.
        * platform/win/Skipped: Add new test to windows skip list until we have an
        implementation of LayoutTestController.setPrivateBrowsingEnabled(bool) for it.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27676 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 194b9ac8
2007-11-10 Sam Weinig <sam@webkit.org>
Reviewed by Tim Hatcher.
Follow up to <rdar://problem/5394877> Safari should not log unsafe JavaScript
attempts when in private browsing mode (only an issue if Log JavaScript Exceptions
is turned on)
Test using the new LayoutTestController.setPrivateBrowsingEnabled(bool)
* http/tests/security/cross-frame-access-private-browsing-expected.txt: Added.
* http/tests/security/cross-frame-access-private-browsing.html: Added.
* platform/win/Skipped: Add new test to windows skip list until we have an
implementation of LayoutTestController.setPrivateBrowsingEnabled(bool) for it.
2007-11-10 Alexey Proskuryakov <ap@webkit.org>
Reviewed by Darin.
......
This test checks cross-frame access security checks don't log when private browsing is enabled (rdar://problem/5394877).
Attempting to violate the same-origin policy with private browsing enabled. If this succeeds the console should not log the violation.
--------
Frame: '<!--framePath //<!--frame0-->-->'
--------
Inner iframe.
--------
Frame: 'flag'
--------
<html>
<head>
<script src="resources/cross-frame-access.js"></script>
<script>
function loaded() {
if (!window.layoutTestController) {
log("This test must be run in the DumpRenderTree to work.");
return;
}
layoutTestController.dumpAsText();
layoutTestController.dumpChildFramesAsText();
layoutTestController.waitUntilDone();
// Poll until the subframe has finished loading.
setTimeout(waitForFlag, 1);
function waitForFlag() {
if (!layoutTestController.globalFlag) {
setTimeout(waitForFlag, 1);
return;
}
runTest();
}
}
function runTest() {
var subFrame = window.frames[0];
layoutTestController.setPrivateBrowsingEnabled(true);
try {
log("Attempting to violate the same-origin policy with private browsing enabled. If this succeeds the console should not log the violation.");
// Access the document to violate the same-origin policy.
var doc = subFrame.document;
} catch(e) {
}
layoutTestController.notifyDone();
}
</script>
</head>
<body onload="loaded();">
<p>This test checks cross-frame access security checks don't log when private browsing is enabled (rdar://problem/5394877).</p>
<iframe src="http://localhost:8000/security/resources/cross-frame-iframe.html"></iframe>
<pre id="console"></pre>
</body>
</html>
......@@ -613,3 +613,6 @@ svg/custom/gradient-stop-style-change.svg
# <video> support
media
# add support for layoutTestController.setPrivateBrowsingEnabled(bool)
http/tests/security/cross-frame-access-private-browsing.html
2007-11-10 Sam Weinig <sam@webkit.org>
Reviewed by Tim Hatcher.
Follow up to <rdar://problem/5394877> Safari should not log unsafe JavaScript
attempts when in private browsing mode (only an issue if Log JavaScript Exceptions
is turned on)
- Add LayoutTestController.setPrivateBrowsingEnabled(bool) (stub out implementation for windows)
Added test: http/tests/security/cross-frame-access-private-browsing.html
* DumpRenderTree/LayoutTestController.cpp:
(setPrivateBrowsingEnabledCallback):
(LayoutTestController::staticFunctions):
* DumpRenderTree/LayoutTestController.h:
* DumpRenderTree/mac/DumpRenderTree.mm:
(runTest): Default to private browsing disabled.
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setPrivateBrowsingEnabled):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setPrivateBrowsingEnabled):
2007-11-08 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
......
......@@ -382,6 +382,18 @@ static JSValueRef setMainFrameIsFirstResponderCallback(JSContextRef context, JSO
return JSValueMakeUndefined(context);
}
static JSValueRef setPrivateBrowsingEnabledCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
if (argumentCount < 1)
return JSValueMakeUndefined(context);
LayoutTestController* controller = reinterpret_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
controller->setPrivateBrowsingEnabled(JSValueToBoolean(context, arguments[0]));
return JSValueMakeUndefined(context);
}
static JSValueRef setTabKeyCyclesThroughElementsCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
// Has mac & windows implementation
......@@ -548,6 +560,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setMainFrameIsFirstResponder", setMainFrameIsFirstResponderCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPrivateBrowsingEnabled", setPrivateBrowsingEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setTabKeyCyclesThroughElements", setTabKeyCyclesThroughElementsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUseDashboardCompatibilityMode", setUseDashboardCompatibilityModeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setUserStyleSheetEnabled", setUserStyleSheetEnabledCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
......
......@@ -54,6 +54,7 @@ public:
void setAcceptsEditing(bool acceptsEditing);
void setCustomPolicyDelegate(bool setDelegate);
void setMainFrameIsFirstResponder(bool flag);
void setPrivateBrowsingEnabled(bool flag);
void setTabKeyCyclesThroughElements(bool cycles);
void setUseDashboardCompatibilityMode(bool flag);
void setUserStyleSheetEnabled(bool flag);
......
......@@ -1017,6 +1017,7 @@ static void runTest(const char *pathOrURL)
[[mainFrame webView] setTabKeyCyclesThroughElements: YES];
[[mainFrame webView] setPolicyDelegate:nil];
[[mainFrame webView] _setDashboardBehavior:WebDashboardBehaviorUseBackwardCompatibilityMode to:NO];
[[[mainFrame webView] preferences] setPrivateBrowsingEnabled:NO];
[WebView _setUsesTestModeFocusRingColor:YES];
topLoadingFrame = nil;
......
......@@ -170,6 +170,11 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
[(WebHTMLView *)documentView _updateActiveState];
}
void LayoutTestController::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
{
[[[mainFrame webView] preferences] setPrivateBrowsingEnabled:privateBrowsingEnabled];
}
void LayoutTestController::setTabKeyCyclesThroughElements(bool cycles)
{
[[mainFrame webView] setTabKeyCyclesThroughElements:cycles];
......
......@@ -226,6 +226,11 @@ void LayoutTestController::setMainFrameIsFirstResponder(bool flag)
// FIXME: Implement!
}
void LayoutTestController::setPrivateBrowsingEnabled(bool /*privateBrowsingEnabled*/)
{
// FIXME: Implement!
}
void LayoutTestController::setTabKeyCyclesThroughElements(bool shouldCycle)
{
COMPtr<IWebView> webView;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment