[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.18-1-697-g2f78b87
aroben at apple.com
aroben at apple.com
Wed Jan 20 22:28:11 UTC 2010
The following commit has been merged in the debian/unstable branch:
commit fd8b8d0c81b33f54e3ea06ed6752425ddf06c92e
Author: aroben at apple.com <aroben at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Jan 18 21:26:39 2010 +0000
Add WebKit SPI to disallow setting document.domain from certain URL schemes
Fixes <http://webkit.org/b/33806> <rdar://problem/7552837> Would like
API to disallow setting of document.domain for pages with certain URL
schemes
Reviewed by Sam Weinig.
WebCore:
Add SecurityOrigin::{set,is}DomainRelaxationForbiddenForURLScheme and
respect it
Test: http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
* WebCore.base.exp: Export
SecurityOrigin::setDomainRelaxationForbiddenForURLScheme.
* dom/Document.cpp:
(WebCore::Document::setDomain): If domain relaxation is forbidden for
our security origin's scheme, throw an exception and don't allow
the domain to be set.
* page/SecurityOrigin.cpp:
(WebCore::schemesForbiddenFromDomainRelaxation): Added. Returns a
global set of schemes.
(WebCore::SecurityOrigin::setDomainRelaxationForbiddenForURLScheme):
Add or remove the scheme to schemesForbiddenFromDomainRelaxation, as
appropriate.
(WebCore::SecurityOrigin::isDomainRelaxationForbiddenForURLScheme):
Returns true if the scheme is in schemesForbiddenFromDomainRelaxation.
* page/SecurityOrigin.h: Added
{set,is}DomainRelaxationForbiddenForURLScheme.
WebKit/mac:
Add +[WebView _setDomainRelaxationForbidden:forURLScheme:]
* WebView/WebView.mm:
(+[WebView _setDomainRelaxationForbidden:forURLScheme:]):
* WebView/WebViewPrivate.h:
Added. Calls through to SecurityOrigin.
WebKit/win:
Add IWebViewPrivate::setDomainRelaxationForbiddenForURLScheme
* Interfaces/IWebViewPrivate.idl: Added
setDomainRelaxationForbiddenForURLScheme.
* Interfaces/WebKit.idl: Touched to force a build.
* WebView.cpp:
(WebView::setDomainRelaxationForbiddenForURLScheme):
* WebView.h:
Added. Calls through to SecurityOrigin.
WebKitTools:
Add LayoutTestController support for calling new WebKit SPI to
disallow setting document.domain
* DumpRenderTree/LayoutTestController.cpp:
(setDomainRelaxationForbiddenForURLSchemeCallback): Added. Calls
through to LayoutTestController.
(LayoutTestController::staticFunctions): Added
setDomainRelaxationForbiddenForURLScheme.
* DumpRenderTree/LayoutTestController.h: Added
setDomainRelaxationForbiddenForURLScheme.
* DumpRenderTree/mac/LayoutTestControllerMac.mm:
(LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
* DumpRenderTree/win/LayoutTestControllerWin.cpp:
(LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
Added. Calls through to WebKit.
* DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
(LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
* DumpRenderTree/wx/LayoutTestControllerWx.cpp:
(LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
Stubbed out.
LayoutTests:
Add tests for new WebKit SPI to disallow setting document.domain
* http/tests/security/setDomainRelaxationForbiddenForURLScheme-expected.txt: Added.
* http/tests/security/setDomainRelaxationForbiddenForURLScheme.html: Added.
* platform/gtk/Skipped: Skip the new test since WebKitGtk doesn't have
this API.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@53423 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 379bf81..149344e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,19 @@
+2010-01-18 Adam Roben <aroben at apple.com>
+
+ Add tests for new WebKit SPI to disallow setting document.domain
+
+ Tests for <http://webkit.org/b/33806> <rdar://problem/7552837> Would
+ like API to disallow setting of document.domain for pages with certain
+ URL schemes
+
+ Reviewed by Sam Weinig.
+
+ * http/tests/security/setDomainRelaxationForbiddenForURLScheme-expected.txt: Added.
+ * http/tests/security/setDomainRelaxationForbiddenForURLScheme.html: Added.
+
+ * platform/gtk/Skipped: Skip the new test since WebKitGtk doesn't have
+ this API.
+
2010-01-18 Dan Bernstein <mitz at apple.com>
Reviewed by Darin Adler.
diff --git a/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme-expected.txt b/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme-expected.txt
new file mode 100644
index 0000000..bc33f1d
--- /dev/null
+++ b/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme-expected.txt
@@ -0,0 +1,13 @@
+Test for Bug 33806: Would like API to disallow setting of document.domain for pages with certain URL schemes. If the test succeeds, you will see a series of "PASS" messages below.
+
+PASS: document.domain should be 127.0.0.1 and is
+PASS: document.domain should be 0.0.1 and is
+Forbidding domain relaxation for the http: scheme
+PASS: Setting document.domain from a forbidden URL scheme threw exception "Error: SECURITY_ERR: DOM Exception 18"
+PASS: document.domain should be 0.0.1 and is
+Allowing domain relaxation for the http: scheme
+PASS: document.domain should be 0.1 and is
+Forbidding domain relaxation for the not-http: scheme
+PASS: document.domain should be 1 and is
+Allowing domain relaxation for the not-http: scheme
+
diff --git a/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme.html b/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
new file mode 100644
index 0000000..b631f97
--- /dev/null
+++ b/LayoutTests/http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
@@ -0,0 +1,78 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>Test for Bug 33806: Would like API to disallow setting of document.domain for pages with certain URL schemes</title>
+</head>
+<body>
+ <p>Test for <a href="http://webkit.org/b/33806">Bug 33806: Would like API to disallow setting of
+ document.domain for pages with certain URL schemes</a>. If the test succeeds, you will see a
+ series of "PASS" messages below.</p>
+
+ <pre id=log></pre>
+ <script>
+ function log(msg)
+ {
+ document.getElementById("log").appendChild(document.createTextNode(msg + "\n"));
+ }
+
+ function domainShouldBe(expected)
+ {
+ var actual = document.domain;
+ var succeeded = actual === expected;
+ if (succeeded)
+ log("PASS: document.domain should be " + expected + " and is");
+ else
+ log("FAIL: document.domain should be " + expected + " but is " + actual);
+ }
+
+ if (window.layoutTestController)
+ layoutTestController.dumpAsText();
+ else
+ log("This test can be run meaningfully only in DumpRenderTree");
+
+ domainShouldBe("127.0.0.1");
+ document.domain = "0.0.1";
+ domainShouldBe("0.0.1");
+
+ log("Forbidding domain relaxation for the http: scheme");
+
+ if (window.layoutTestController)
+ layoutTestController.setDomainRelaxationForbiddenForURLScheme(true, "http");
+
+ var exception;
+ try {
+ document.domain = "0.1";
+ } catch (e) {
+ exception = e;
+ }
+
+ if (exception)
+ log("PASS: Setting document.domain from a forbidden URL scheme threw exception \"" + exception + "\"");
+ else
+ log("FAIL: Setting document.domain from a forbidden URL scheme should have thrown an exception, but didn't");
+
+ domainShouldBe("0.0.1");
+
+ if (window.layoutTestController)
+ layoutTestController.setDomainRelaxationForbiddenForURLScheme(false, "http");
+
+ log("Allowing domain relaxation for the http: scheme");
+
+ document.domain = "0.1";
+ domainShouldBe("0.1");
+
+ log("Forbidding domain relaxation for the not-http: scheme");
+
+ if (window.layoutTestController)
+ layoutTestController.setDomainRelaxationForbiddenForURLScheme(true, "not-http");
+
+ document.domain = "1";
+ domainShouldBe("1");
+
+ log("Allowing domain relaxation for the not-http: scheme");
+
+ if (window.layoutTestController)
+ layoutTestController.setDomainRelaxationForbiddenForURLScheme(false, "not-http");
+ </script>
+</body>
+</html>
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 1d45e0a..5e7f43c 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5756,3 +5756,6 @@ media/video-loop.html
# GTK+ does not have layoutTestController.setWillSendRequestReturnsNull.
fast/loader/onload-willSendRequest-null-for-script.html
+
+# GTK+ does not have layoutTestController.setDomainRelaxationForbiddenForURLScheme
+http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9789ae3..6d65922 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,36 @@
+2010-01-18 Adam Roben <aroben at apple.com>
+
+ Add SecurityOrigin::{set,is}DomainRelaxationForbiddenForURLScheme and
+ respect it
+
+ WebCore part of fixing <http://webkit.org/b/33806>
+ <rdar://problem/7552837> Would like API to disallow setting of
+ document.domain for pages with certain URL schemes
+
+ Test: http/tests/security/setDomainRelaxationForbiddenForURLScheme.html
+
+ Reviewed by Sam Weinig.
+
+ * WebCore.base.exp: Export
+ SecurityOrigin::setDomainRelaxationForbiddenForURLScheme.
+
+ * dom/Document.cpp:
+ (WebCore::Document::setDomain): If domain relaxation is forbidden for
+ our security origin's scheme, throw an exception and don't allow
+ the domain to be set.
+
+ * page/SecurityOrigin.cpp:
+ (WebCore::schemesForbiddenFromDomainRelaxation): Added. Returns a
+ global set of schemes.
+ (WebCore::SecurityOrigin::setDomainRelaxationForbiddenForURLScheme):
+ Add or remove the scheme to schemesForbiddenFromDomainRelaxation, as
+ appropriate.
+ (WebCore::SecurityOrigin::isDomainRelaxationForbiddenForURLScheme):
+ Returns true if the scheme is in schemesForbiddenFromDomainRelaxation.
+
+ * page/SecurityOrigin.h: Added
+ {set,is}DomainRelaxationForbiddenForURLScheme.
+
2010-01-18 Dan Bernstein <mitz at apple.com>
Address review comments on the last change
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index 7aeb6d0..694e175 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -300,6 +300,7 @@ __ZN7WebCore14SecurityOrigin18shouldHideReferrerERKNS_4KURLERKNS_6StringE
__ZN7WebCore14SecurityOrigin24registerURLSchemeAsLocalERKNS_6StringE
__ZN7WebCore14SecurityOrigin25whiteListAccessFromOriginERKS0_RKNS_6StringES5_b
__ZN7WebCore14SecurityOrigin27resetOriginAccessWhiteListsEv
+__ZN7WebCore14SecurityOrigin40setDomainRelaxationForbiddenForURLSchemeEbRKNS_6StringE
__ZN7WebCore14SecurityOrigin6createERKNS_4KURLEi
__ZN7WebCore14SecurityOrigin7canLoadERKNS_4KURLERKNS_6StringEPNS_8DocumentE
__ZN7WebCore15ArchiveResource6createEN3WTF10PassRefPtrINS_12SharedBufferEEERKNS_4KURLERKNS_6StringESA_SA_RKNS_16ResourceResponseE
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index 457bcc3..0cf7611 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -3133,6 +3133,11 @@ String Document::domain() const
void Document::setDomain(const String& newDomain, ExceptionCode& ec)
{
+ if (SecurityOrigin::isDomainRelaxationForbiddenForURLScheme(securityOrigin()->protocol())) {
+ ec = SECURITY_ERR;
+ return;
+ }
+
// Both NS and IE specify that changing the domain is only allowed when
// the new domain is a suffix of the old domain.
diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp
index a2bdfaf..b2a1c89 100644
--- a/WebCore/page/SecurityOrigin.cpp
+++ b/WebCore/page/SecurityOrigin.cpp
@@ -146,6 +146,31 @@ void SecurityOrigin::setDomainFromDOM(const String& newDomain)
m_domain = newDomain.lower();
}
+static HashSet<String>& schemesForbiddenFromDomainRelaxation()
+{
+ DEFINE_STATIC_LOCAL(HashSet<String>, schemes, ());
+ return schemes;
+}
+
+void SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(bool forbidden, const String& scheme)
+{
+ if (scheme.isEmpty())
+ return;
+
+ if (forbidden)
+ schemesForbiddenFromDomainRelaxation().add(scheme);
+ else
+ schemesForbiddenFromDomainRelaxation().remove(scheme);
+}
+
+bool SecurityOrigin::isDomainRelaxationForbiddenForURLScheme(const String& scheme)
+{
+ if (scheme.isEmpty())
+ return false;
+
+ return schemesForbiddenFromDomainRelaxation().contains(scheme);
+}
+
bool SecurityOrigin::canAccess(const SecurityOrigin* other) const
{
if (m_universalAccess)
diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h
index 3514401..71681d7 100644
--- a/WebCore/page/SecurityOrigin.h
+++ b/WebCore/page/SecurityOrigin.h
@@ -62,6 +62,9 @@ public:
void setDomainFromDOM(const String& newDomain);
bool domainWasSetInDOM() const { return m_domainWasSetInDOM; }
+ static void setDomainRelaxationForbiddenForURLScheme(bool forbidden, const String&);
+ static bool isDomainRelaxationForbiddenForURLScheme(const String&);
+
String protocol() const { return m_protocol; }
String host() const { return m_host; }
String domain() const { return m_domain; }
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index 7676d41..7442d82 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,18 @@
+2010-01-18 Adam Roben <aroben at apple.com>
+
+ Add +[WebView _setDomainRelaxationForbidden:forURLScheme:]
+
+ WebKit/mac part of fixing <http://webkit.org/b/33806>
+ <rdar://problem/7552837> Would like API to disallow setting of
+ document.domain for pages with certain URL schemes
+
+ Reviewed by Sam Weinig.
+
+ * WebView/WebView.mm:
+ (+[WebView _setDomainRelaxationForbidden:forURLScheme:]):
+ * WebView/WebViewPrivate.h:
+ Added. Calls through to SecurityOrigin.
+
2010-01-16 Maciej Stachowiak <mjs at apple.com>
Reviewed by Oliver Hunt.
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index f2e816f..e3d2e27 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -2334,6 +2334,11 @@ static PassOwnPtr<Vector<String> > toStringVector(NSArray* patterns)
frame->animation()->resumeAnimations(frame->document());
}
++ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme
+{
+ SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, scheme);
+}
+
@end
@implementation _WebSafeForwarder
diff --git a/WebKit/mac/WebView/WebViewPrivate.h b/WebKit/mac/WebView/WebViewPrivate.h
index ee7ec4b..d3e6f62 100644
--- a/WebKit/mac/WebView/WebViewPrivate.h
+++ b/WebKit/mac/WebView/WebViewPrivate.h
@@ -508,6 +508,8 @@ Could be worth adding to the API.
*/
- (void)setCSSAnimationsSuspended:(BOOL)suspended;
++ (void)_setDomainRelaxationForbidden:(BOOL)forbidden forURLScheme:(NSString *)scheme;
+
@end
@interface WebView (WebViewPrintingPrivate)
diff --git a/WebKit/win/ChangeLog b/WebKit/win/ChangeLog
index 05c9132..e6636ac 100644
--- a/WebKit/win/ChangeLog
+++ b/WebKit/win/ChangeLog
@@ -1,3 +1,23 @@
+2010-01-18 Adam Roben <aroben at apple.com>
+
+ Add IWebViewPrivate::setDomainRelaxationForbiddenForURLScheme
+
+ WebKit/win part of fixing <http://webkit.org/b/33806>
+ <rdar://problem/7552837> Would like API to disallow setting of
+ document.domain for pages with certain URL schemes
+
+ Reviewed by Sam Weinig.
+
+ * Interfaces/IWebViewPrivate.idl: Added
+ setDomainRelaxationForbiddenForURLScheme.
+
+ * Interfaces/WebKit.idl: Touched to force a build.
+
+ * WebView.cpp:
+ (WebView::setDomainRelaxationForbiddenForURLScheme):
+ * WebView.h:
+ Added. Calls through to SecurityOrigin.
+
2010-01-18 Chris Marrin <cmarrin at apple.com>
Reviewed by Darin Adler.
diff --git a/WebKit/win/Interfaces/IWebViewPrivate.idl b/WebKit/win/Interfaces/IWebViewPrivate.idl
index 9b35963..7ab2304 100644
--- a/WebKit/win/Interfaces/IWebViewPrivate.idl
+++ b/WebKit/win/Interfaces/IWebViewPrivate.idl
@@ -224,4 +224,6 @@ interface IWebViewPrivate : IUnknown
HRESULT geolocationProvider([out, retval] IWebGeolocationProvider** locationProvider);
HRESULT geolocationDidChangePosition([in] IWebGeolocationPosition* position);
HRESULT geolocationDidFailWithError([in] IWebError* error);
+
+ HRESULT setDomainRelaxationForbiddenForURLScheme([in] BOOL forbidden, [in] BSTR scheme);
}
diff --git a/WebKit/win/Interfaces/WebKit.idl b/WebKit/win/Interfaces/WebKit.idl
index 1d8ff7d..5ae1ad9 100644
--- a/WebKit/win/Interfaces/WebKit.idl
+++ b/WebKit/win/Interfaces/WebKit.idl
@@ -45,7 +45,7 @@ cpp_quote(" * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
cpp_quote(" * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY")
cpp_quote(" * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT")
cpp_quote(" * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE")
-cpp_quote(" * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ")
+cpp_quote(" * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.")
cpp_quote(" */")
#include "autoversion.h"
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index 4095b88..4d67110 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -6125,6 +6125,12 @@ HRESULT WebView::geolocationDidFailWithError(IWebError* error)
#endif
}
+HRESULT WebView::setDomainRelaxationForbiddenForURLScheme(BOOL forbidden, BSTR scheme)
+{
+ SecurityOrigin::setDomainRelaxationForbiddenForURLScheme(forbidden, String(scheme, SysStringLen(scheme)));
+ return S_OK;
+}
+
class EnumTextMatches : public IEnumTextMatches
{
long m_ref;
diff --git a/WebKit/win/WebView.h b/WebKit/win/WebView.h
index 4327377..cd857a8 100644
--- a/WebKit/win/WebView.h
+++ b/WebKit/win/WebView.h
@@ -778,6 +778,8 @@ public:
virtual HRESULT STDMETHODCALLTYPE geolocationDidChangePosition(IWebGeolocationPosition* position);
virtual HRESULT STDMETHODCALLTYPE geolocationDidFailWithError(IWebError* error);
+ virtual HRESULT STDMETHODCALLTYPE setDomainRelaxationForbiddenForURLScheme(BOOL forbidden, BSTR scheme);
+
// WebView
bool shouldUseEmbeddedView(const WebCore::String& mimeType) const;
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 04bc328..f10e745 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,35 @@
+2010-01-18 Adam Roben <aroben at apple.com>
+
+ Add LayoutTestController support for calling new WebKit SPI to
+ disallow setting document.domain
+
+ DRT part of fixing <http://webkit.org/b/33806>
+ <rdar://problem/7552837> Would like API to disallow setting of
+ document.domain for pages with certain URL schemes
+
+ Reviewed by Sam Weinig.
+
+ * DumpRenderTree/LayoutTestController.cpp:
+ (setDomainRelaxationForbiddenForURLSchemeCallback): Added. Calls
+ through to LayoutTestController.
+ (LayoutTestController::staticFunctions): Added
+ setDomainRelaxationForbiddenForURLScheme.
+
+ * DumpRenderTree/LayoutTestController.h: Added
+ setDomainRelaxationForbiddenForURLScheme.
+
+ * DumpRenderTree/mac/LayoutTestControllerMac.mm:
+ (LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
+ * DumpRenderTree/win/LayoutTestControllerWin.cpp:
+ (LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
+ Added. Calls through to WebKit.
+
+ * DumpRenderTree/gtk/LayoutTestControllerGtk.cpp:
+ (LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
+ * DumpRenderTree/wx/LayoutTestControllerWx.cpp:
+ (LayoutTestController::setDomainRelaxationForbiddenForURLScheme):
+ Stubbed out.
+
2010-01-18 Adam Barth <abarth at webkit.org>
Reviewed by Adam Roben.
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index fe93984..e71cd29 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -700,6 +700,21 @@ static JSValueRef setDatabaseQuotaCallback(JSContextRef context, JSObjectRef fun
return JSValueMakeUndefined(context);
}
+static JSValueRef setDomainRelaxationForbiddenForURLSchemeCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
+{
+ // Has Mac and Windows implementation
+ if (argumentCount < 2)
+ return JSValueMakeUndefined(context);
+
+ LayoutTestController* controller = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+
+ bool forbidden = JSValueToBoolean(context, arguments[0]);
+ JSRetainPtr<JSStringRef> scheme(Adopt, JSValueToStringCopy(context, arguments[1], 0));
+ controller->setDomainRelaxationForbiddenForURLScheme(forbidden, scheme.get());
+
+ return JSValueMakeUndefined(context);
+}
+
static JSValueRef setMockGeolocationPositionCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
{
if (argumentCount < 3)
@@ -1300,6 +1315,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "setCloseRemainingWindowsWhenComplete", setCloseRemainingWindowsWhenCompleteCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setCustomPolicyDelegate", setCustomPolicyDelegateCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setDatabaseQuota", setDatabaseQuotaCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setDomainRelaxationForbiddenForURLScheme", setDomainRelaxationForbiddenForURLSchemeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setGeolocationPermission", setGeolocationPermissionCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setHandlesAuthenticationChallenges", setHandlesAuthenticationChallengesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setPOSIXLocale", setPOSIXLocaleCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 51e929a..c8da6ab 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -72,6 +72,7 @@ public:
void setCacheModel(int);
void setCustomPolicyDelegate(bool setDelegate, bool permissive);
void setDatabaseQuota(unsigned long long quota);
+ void setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme);
void setMockGeolocationPosition(double latitude, double longitude, double accuracy);
void setMockGeolocationError(int code, JSStringRef message);
void setIconDatabaseEnabled(bool iconDatabaseEnabled);
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 6efe715..a74f7ad 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -426,6 +426,11 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota)
webkit_security_origin_set_web_database_quota(origin, quota);
}
+void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
{
webkit_application_cache_set_maximum_size(size);
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index 69fe19f..5f020fa 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -251,6 +251,12 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota)
[origin release];
}
+void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
+{
+ RetainPtr<CFStringRef> schemeCFString(AdoptCF, JSStringCopyCFString(kCFAllocatorDefault, scheme));
+ [WebView _setDomainRelaxationForbidden:forbidden forURLScheme:(NSString *)schemeCFString.get()];
+}
+
void LayoutTestController::setMockGeolocationPosition(double latitude, double longitude, double accuracy)
{
[WebGeolocationMock setPosition:latitude:longitude:accuracy];
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 5debf16..b7a63fc 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -806,6 +806,17 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota)
databaseManager->setQuota(TEXT("file:///"), quota);
}
+void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool forbidden, JSStringRef scheme)
+{
+ COMPtr<IWebViewPrivate> webView;
+ if (FAILED(WebKitCreateInstance(__uuidof(WebView), 0, __uuidof(webView), reinterpret_cast<void**>(&webView))))
+ return;
+
+ BSTR schemeBSTR = JSStringCopyBSTR(scheme);
+ webView->setDomainRelaxationForbiddenForURLScheme(forbidden, schemeBSTR);
+ SysFreeString(schemeBSTR);
+}
+
void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
{
printf("ERROR: LayoutTestController::setAppCacheMaximumSize() not implemented\n");
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 2c46950..282a80f 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -216,6 +216,11 @@ void LayoutTestController::setDatabaseQuota(unsigned long long quota)
// FIXME: implement
}
+void LayoutTestController::setDomainRelaxationForbiddenForURLScheme(bool, JSStringRef)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setAppCacheMaximumSize(unsigned long long size)
{
// FIXME: implement
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list