[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.21-584-g1e41756
eric at webkit.org
eric at webkit.org
Fri Feb 26 22:22:10 UTC 2010
The following commit has been merged in the webkit-1.1 branch:
commit 48b9810bd670c630e45d1749efffba4b637fafa6
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Feb 17 07:32:30 2010 +0000
2010-02-16 Chris Evans <cevans at chromium.org>
Reviewed by Adam Barth.
Add a new setting which gives the option of assigning every file:///
to its own unique domain.
https://bugs.webkit.org/show_bug.cgi?id=34778
Test: Pending in forthcoming separate change due to non-trivial
dependencies.
* dom/Document.cpp:
(WebCore::Document::initSecurityContext): Place file:/// URI documents
into their own unique domains if the new setting requires it.
* page/Settings.h:
* page/Settings.cpp:
(WebCore::Settings::setAllowFileAccessFromFileURLs): Simple setter.
* page/SecurityOrigin.h:
* page/SecurityOrigin.cpp:
(WebCore::SecurityOrigin::makeUnique): Add simple ability to force an
origin to be considered unique.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54873 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 97249bd..4c6be7a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,26 @@
+2010-02-16 Chris Evans <cevans at chromium.org>
+
+ Reviewed by Adam Barth.
+
+ Add a new setting which gives the option of assigning every file:///
+ to its own unique domain.
+
+ https://bugs.webkit.org/show_bug.cgi?id=34778
+
+ Test: Pending in forthcoming separate change due to non-trivial
+ dependencies.
+
+ * dom/Document.cpp:
+ (WebCore::Document::initSecurityContext): Place file:/// URI documents
+ into their own unique domains if the new setting requires it.
+ * page/Settings.h:
+ * page/Settings.cpp:
+ (WebCore::Settings::setAllowFileAccessFromFileURLs): Simple setter.
+ * page/SecurityOrigin.h:
+ * page/SecurityOrigin.cpp:
+ (WebCore::SecurityOrigin::makeUnique): Add simple ability to force an
+ origin to be considered unique.
+
2010-02-16 Pavel Feldman <pfeldman at chromium.org>
Reviewed by Timothy Hatcher.
diff --git a/WebCore/WebCore.base.exp b/WebCore/WebCore.base.exp
index df43780..6215e24 100644
--- a/WebCore/WebCore.base.exp
+++ b/WebCore/WebCore.base.exp
@@ -671,6 +671,7 @@ __ZN7WebCore8Settings28setForceFTPDirectoryListingsEb
__ZN7WebCore8Settings28setFrameSetFlatteningEnabledEb
__ZN7WebCore8Settings29setAuthorAndUserStylesEnabledEb
__ZN7WebCore8Settings29setWebArchiveDebugModeEnabledEb
+__ZN7WebCore8Settings30setAllowFileAccessFromFileURLsEb
__ZN7WebCore8Settings31setShrinksStandaloneImagesToFitEb
__ZN7WebCore8Settings32setAcceleratedCompositingEnabledEb
__ZN7WebCore8Settings32setNeedsAdobeFrameReloadingQuirkEb
diff --git a/WebCore/dom/Document.cpp b/WebCore/dom/Document.cpp
index b103e31..69a39d1 100644
--- a/WebCore/dom/Document.cpp
+++ b/WebCore/dom/Document.cpp
@@ -4417,6 +4417,10 @@ void Document::initSecurityContext()
// Some clients want file:// URLs to have universal access, but that
// setting is dangerous for other clients.
securityOrigin()->grantUniversalAccess();
+ } else if (!settings->allowFileAccessFromFileURLs() && securityOrigin()->isLocal()) {
+ // Some clients want file:// URLs to have even tighter restrictions by
+ // default, and not be able to access other local files.
+ securityOrigin()->makeUnique();
}
}
diff --git a/WebCore/page/SecurityOrigin.cpp b/WebCore/page/SecurityOrigin.cpp
index af63637..fe6efbd 100644
--- a/WebCore/page/SecurityOrigin.cpp
+++ b/WebCore/page/SecurityOrigin.cpp
@@ -286,6 +286,11 @@ void SecurityOrigin::grantUniversalAccess()
m_universalAccess = true;
}
+void SecurityOrigin::makeUnique()
+{
+ m_isUnique = true;
+}
+
bool SecurityOrigin::isLocal() const
{
return shouldTreatURLSchemeAsLocal(m_protocol);
diff --git a/WebCore/page/SecurityOrigin.h b/WebCore/page/SecurityOrigin.h
index b441474..c96bb83 100644
--- a/WebCore/page/SecurityOrigin.h
+++ b/WebCore/page/SecurityOrigin.h
@@ -138,6 +138,9 @@ public:
// addition, the SandboxOrigin flag is inherited by iframes.
bool isUnique() const { return m_isUnique; }
+ // Marks an origin as being unique.
+ void makeUnique();
+
// Convert this SecurityOrigin into a string. The string
// representation of a SecurityOrigin is similar to a URL, except it
// lacks a path component. The string representation does not encode
diff --git a/WebCore/page/Settings.cpp b/WebCore/page/Settings.cpp
index 969969f..c82b234 100644
--- a/WebCore/page/Settings.cpp
+++ b/WebCore/page/Settings.cpp
@@ -75,6 +75,7 @@ Settings::Settings(Page* page)
, m_isJavaScriptEnabled(false)
, m_isWebSecurityEnabled(true)
, m_allowUniversalAccessFromFileURLs(true)
+ , m_allowFileAccessFromFileURLs(true)
, m_javaScriptCanOpenWindowsAutomatically(false)
, m_shouldPrintBackgrounds(false)
, m_textAreasAreResizable(false)
@@ -240,6 +241,11 @@ void Settings::setAllowUniversalAccessFromFileURLs(bool allowUniversalAccessFrom
m_allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
}
+void Settings::setAllowFileAccessFromFileURLs(bool allowFileAccessFromFileURLs)
+{
+ m_allowFileAccessFromFileURLs = allowFileAccessFromFileURLs;
+}
+
void Settings::setJavaEnabled(bool isJavaEnabled)
{
m_isJavaEnabled = isJavaEnabled;
diff --git a/WebCore/page/Settings.h b/WebCore/page/Settings.h
index 577459c..6648a08 100644
--- a/WebCore/page/Settings.h
+++ b/WebCore/page/Settings.h
@@ -112,6 +112,9 @@ namespace WebCore {
void setAllowUniversalAccessFromFileURLs(bool);
bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; }
+ void setAllowFileAccessFromFileURLs(bool);
+ bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; }
+
void setJavaScriptCanOpenWindowsAutomatically(bool);
bool javaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
@@ -320,6 +323,7 @@ namespace WebCore {
bool m_isJavaScriptEnabled : 1;
bool m_isWebSecurityEnabled : 1;
bool m_allowUniversalAccessFromFileURLs: 1;
+ bool m_allowFileAccessFromFileURLs: 1;
bool m_javaScriptCanOpenWindowsAutomatically : 1;
bool m_shouldPrintBackgrounds : 1;
bool m_textAreasAreResizable : 1;
diff --git a/WebKit/chromium/public/WebSettings.h b/WebKit/chromium/public/WebSettings.h
index 03097ac..d3a91d3 100644
--- a/WebKit/chromium/public/WebSettings.h
+++ b/WebKit/chromium/public/WebSettings.h
@@ -78,6 +78,7 @@ public:
virtual void setShouldPaintCustomScrollbars(bool) = 0;
virtual void setDatabasesEnabled(bool) = 0;
virtual void setAllowUniversalAccessFromFileURLs(bool) = 0;
+ virtual void setAllowFileAccessFromFileURLs(bool) = 0;
virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded() = 0;
virtual void setOfflineWebApplicationCacheEnabled(bool) = 0;
virtual void setExperimentalWebGLEnabled(bool) = 0;
diff --git a/WebKit/chromium/src/WebSettingsImpl.cpp b/WebKit/chromium/src/WebSettingsImpl.cpp
index d87951c..a680321 100644
--- a/WebKit/chromium/src/WebSettingsImpl.cpp
+++ b/WebKit/chromium/src/WebSettingsImpl.cpp
@@ -236,6 +236,11 @@ void WebSettingsImpl::setAllowUniversalAccessFromFileURLs(bool allow)
m_settings->setAllowUniversalAccessFromFileURLs(allow);
}
+void WebSettingsImpl::setAllowFileAccessFromFileURLs(bool allow)
+{
+ m_settings->setAllowFileAccessFromFileURLs(allow);
+}
+
void WebSettingsImpl::setTextDirectionSubmenuInclusionBehaviorNeverIncluded()
{
// FIXME: If you ever need more behaviors than this, then we should probably
diff --git a/WebKit/chromium/src/WebSettingsImpl.h b/WebKit/chromium/src/WebSettingsImpl.h
index cd01a95..64ccab5 100644
--- a/WebKit/chromium/src/WebSettingsImpl.h
+++ b/WebKit/chromium/src/WebSettingsImpl.h
@@ -80,6 +80,7 @@ public:
virtual void setShouldPaintCustomScrollbars(bool);
virtual void setDatabasesEnabled(bool);
virtual void setAllowUniversalAccessFromFileURLs(bool);
+ virtual void setAllowFileAccessFromFileURLs(bool);
virtual void setTextDirectionSubmenuInclusionBehaviorNeverIncluded();
virtual void setOfflineWebApplicationCacheEnabled(bool);
virtual void setExperimentalWebGLEnabled(bool);
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 8c5b802..d5167ad 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -2550,7 +2550,8 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
enableScripts, enablePlugins, enableDeveloperExtras, resizableTextAreas,
enablePrivateBrowsing, enableCaretBrowsing, enableHTML5Database, enableHTML5LocalStorage,
enableXSSAuditor, javascriptCanOpenWindows, enableOfflineWebAppCache,
- enableUniversalAccessFromFileURI, enableDOMPaste, tabKeyCyclesThroughElements,
+ enableUniversalAccessFromFileURI, enableFileAccessFromFileURI,
+ enableDOMPaste, tabKeyCyclesThroughElements,
enableSiteSpecificQuirks, usePageCache;
WebKitEditingBehavior editingBehavior;
@@ -2580,6 +2581,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
"enable-offline-web-application-cache", &enableOfflineWebAppCache,
"editing-behavior", &editingBehavior,
"enable-universal-access-from-file-uris", &enableUniversalAccessFromFileURI,
+ "enable-file-access-from-file-uris", &enableFileAccessFromFileURI,
"enable-dom-paste", &enableDOMPaste,
"tab-key-cycles-through-elements", &tabKeyCyclesThroughElements,
"enable-site-specific-quirks", &enableSiteSpecificQuirks,
@@ -2610,6 +2612,7 @@ static void webkit_web_view_update_settings(WebKitWebView* webView)
settings->setOfflineWebApplicationCacheEnabled(enableOfflineWebAppCache);
settings->setEditingBehavior(core(editingBehavior));
settings->setAllowUniversalAccessFromFileURLs(enableUniversalAccessFromFileURI);
+ settings->setAllowFileAccessFromFileURLs(enableFileAccessFromFileURI);
settings->setDOMPasteAllowed(enableDOMPaste);
settings->setNeedsSiteSpecificQuirks(enableSiteSpecificQuirks);
settings->setUsesPageCache(usePageCache);
@@ -2703,6 +2706,8 @@ static void webkit_web_view_settings_notify(WebKitWebSettings* webSettings, GPar
settings->setEditingBehavior(core(static_cast<WebKitEditingBehavior>(g_value_get_enum(&value))));
else if (name == g_intern_string("enable-universal-access-from-file-uris"))
settings->setAllowUniversalAccessFromFileURLs(g_value_get_boolean(&value));
+ else if (name == g_intern_string("enable-file-access-from-file-uris"))
+ settings->setAllowFileAccessFromFileURLs(g_value_get_boolean(&value));
else if (name == g_intern_string("enable-dom-paste"))
settings->setDOMPasteAllowed(g_value_get_boolean(&value));
else if (name == g_intern_string("tab-key-cycles-through-elements")) {
diff --git a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
index b8e912e..150a020 100644
--- a/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
+++ b/WebKit/mac/WebView/WebPreferenceKeysPrivate.h
@@ -51,6 +51,7 @@
#define WebKitJavaScriptEnabledPreferenceKey @"WebKitJavaScriptEnabled"
#define WebKitWebSecurityEnabledPreferenceKey @"WebKitWebSecurityEnabled"
#define WebKitAllowUniversalAccessFromFileURLsPreferenceKey @"WebKitAllowUniversalAccessFromFileURLs"
+#define WebKitAllowFileAccessFromFileURLsPreferenceKey @"WebKitAllowFileAccessFromFileURLs"
#define WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey @"WebKitJavaScriptCanOpenWindowsAutomatically"
#define WebKitPluginsEnabledPreferenceKey @"WebKitPluginsEnabled"
#define WebKitDatabasesEnabledPreferenceKey @"WebKitDatabasesEnabledPreferenceKey"
diff --git a/WebKit/mac/WebView/WebPreferences.mm b/WebKit/mac/WebView/WebPreferences.mm
index a1176a9..bd3c2a7 100644
--- a/WebKit/mac/WebView/WebPreferences.mm
+++ b/WebKit/mac/WebView/WebPreferences.mm
@@ -316,6 +316,7 @@ static WebCacheModel cacheModelForMainBundle(void)
[NSNumber numberWithBool:YES], WebKitJavaScriptEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitWebSecurityEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
+ [NSNumber numberWithBool:YES], WebKitAllowFileAccessFromFileURLsPreferenceKey,
[NSNumber numberWithBool:YES], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
[NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
[NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
@@ -920,6 +921,16 @@ static WebCacheModel cacheModelForMainBundle(void)
[self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
}
+- (BOOL)allowFileAccessFromFileURLs
+{
+ return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
+}
+
+- (void)setAllowFileAccessFromFileURLs:(BOOL)flag
+{
+ [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
+}
+
- (NSTimeInterval)_backForwardCacheExpirationInterval
{
// FIXME: There's probably no good reason to read from the standard user defaults instead of self.
diff --git a/WebKit/mac/WebView/WebPreferencesPrivate.h b/WebKit/mac/WebView/WebPreferencesPrivate.h
index 7c84d8d..b516640 100644
--- a/WebKit/mac/WebView/WebPreferencesPrivate.h
+++ b/WebKit/mac/WebView/WebPreferencesPrivate.h
@@ -101,6 +101,9 @@ extern NSString *WebPreferencesRemovedNotification;
- (BOOL)allowUniversalAccessFromFileURLs;
- (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag;
+- (BOOL)allowFileAccessFromFileURLs;
+- (void)setAllowFileAccessFromFileURLs:(BOOL)flag;
+
- (BOOL)zoomsTextOnly;
- (void)setZoomsTextOnly:(BOOL)zoomsTextOnly;
diff --git a/WebKit/mac/WebView/WebView.mm b/WebKit/mac/WebView/WebView.mm
index de852d6..0509b01 100644
--- a/WebKit/mac/WebView/WebView.mm
+++ b/WebKit/mac/WebView/WebView.mm
@@ -1287,6 +1287,7 @@ static bool fastDocumentTeardownEnabled()
settings->setJavaScriptEnabled([preferences isJavaScriptEnabled]);
settings->setWebSecurityEnabled([preferences isWebSecurityEnabled]);
settings->setAllowUniversalAccessFromFileURLs([preferences allowUniversalAccessFromFileURLs]);
+ settings->setAllowFileAccessFromFileURLs([preferences allowFileAccessFromFileURLs]);
settings->setJavaScriptCanOpenWindowsAutomatically([preferences javaScriptCanOpenWindowsAutomatically]);
settings->setMinimumFontSize([preferences minimumFontSize]);
settings->setMinimumLogicalFontSize([preferences minimumLogicalFontSize]);
diff --git a/WebKit/qt/Api/qwebsettings.cpp b/WebKit/qt/Api/qwebsettings.cpp
index a94a3aa..d60f09c 100644
--- a/WebKit/qt/Api/qwebsettings.cpp
+++ b/WebKit/qt/Api/qwebsettings.cpp
@@ -215,6 +215,10 @@ void QWebSettingsPrivate::apply()
global->attributes.value(QWebSettings::LocalContentCanAccessRemoteUrls));
settings->setAllowUniversalAccessFromFileURLs(value);
+ value = attributes.value(QWebSettings::LocalContentCanAccessFileUrls,
+ global->attributes.value(QWebSettings::LocalContentCanAccessFileUrls));
+ settings->setAllowFileAccessFromFileURLs(value);
+
value = attributes.value(QWebSettings::XSSAuditorEnabled,
global->attributes.value(QWebSettings::XSSAuditorEnabled));
settings->setXSSAuditorEnabled(value);
@@ -363,6 +367,7 @@ QWebSettings* QWebSettings::globalSettings()
\value LocalStorageDatabaseEnabled \e{This enum value is deprecated.} Use
QWebSettings::LocalStorageEnabled instead.
\value LocalContentCanAccessRemoteUrls Specifies whether locally loaded documents are allowed to access remote urls.
+ \value LocalContentCanAccessFileUrls Specifies whether locally loaded documents are allowed to access other local urls.
\value XSSAuditorEnabled Specifies whether load requests should be monitored for cross-site scripting attempts.
*/
@@ -394,6 +399,7 @@ QWebSettings::QWebSettings()
d->attributes.insert(QWebSettings::OfflineWebApplicationCacheEnabled, false);
d->attributes.insert(QWebSettings::LocalStorageEnabled, false);
d->attributes.insert(QWebSettings::LocalContentCanAccessRemoteUrls, false);
+ d->attributes.insert(QWebSettings::LocalContentCanAccessFileUrls, true);
d->attributes.insert(QWebSettings::AcceleratedCompositingEnabled, false);
d->offlineStorageDefaultQuota = 5 * 1024 * 1024;
d->defaultTextEncoding = QLatin1String("iso-8859-1");
diff --git a/WebKit/qt/Api/qwebsettings.h b/WebKit/qt/Api/qwebsettings.h
index 77f2167..b1f5cf2 100644
--- a/WebKit/qt/Api/qwebsettings.h
+++ b/WebKit/qt/Api/qwebsettings.h
@@ -67,6 +67,7 @@ public:
LocalStorageDatabaseEnabled = LocalStorageEnabled,
#endif
LocalContentCanAccessRemoteUrls,
+ LocalContentCanAccessFileUrls,
DnsPrefetchEnabled,
XSSAuditorEnabled,
AcceleratedCompositingEnabled
diff --git a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
index 613a53d..54c1d42 100644
--- a/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
+++ b/WebKit/win/Interfaces/IWebPreferencesPrivate.idl
@@ -100,4 +100,7 @@ interface IWebPreferencesPrivate : IUnknown
HRESULT setCustomDragCursorsEnabled([in] BOOL);
HRESULT customDragCursorsEnabled([out, retval] BOOL*);
+
+ HRESULT allowFileAccessFromFileURLs([out, retval] BOOL *allowAccess);
+ HRESULT setAllowFileAccessFromFileURLs([in] BOOL allowAccess);
}
diff --git a/WebKit/win/WebPreferenceKeysPrivate.h b/WebKit/win/WebPreferenceKeysPrivate.h
index 9f768f2..d1e0f5e 100644
--- a/WebKit/win/WebPreferenceKeysPrivate.h
+++ b/WebKit/win/WebPreferenceKeysPrivate.h
@@ -49,6 +49,7 @@
#define WebKitJavaScriptEnabledPreferenceKey "WebKitJavaScriptEnabled"
#define WebKitWebSecurityEnabledPreferenceKey "WebKitWebSecurityEnabled"
#define WebKitAllowUniversalAccessFromFileURLsPreferenceKey "WebKitAllowUniversalAccessFromFileURLs"
+#define WebKitAllowFileAccessFromFileURLsPreferenceKey "WebKitAllowFileAccessFromFileURLs"
#define WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey "WebKitJavaScriptCanOpenWindowsAutomatically"
#define WebKitPluginsEnabledPreferenceKey "WebKitPluginsEnabled"
#define WebKitDatabasesEnabledPreferenceKey "WebKitDatabasesEnabled"
diff --git a/WebKit/win/WebPreferences.cpp b/WebKit/win/WebPreferences.cpp
index 13c2ac4..0e44d9f 100644
--- a/WebKit/win/WebPreferences.cpp
+++ b/WebKit/win/WebPreferences.cpp
@@ -205,6 +205,7 @@ void WebPreferences::initializeDefaultSettings()
CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitWebSecurityEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitAllowUniversalAccessFromFileURLsPreferenceKey), kCFBooleanFalse);
+ CFDictionaryAddValue(defaults, CFSTR(WebKitAllowFileAccessFromFileURLsPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitXSSAuditorEnabledPreferenceKey), kCFBooleanTrue);
CFDictionaryAddValue(defaults, CFSTR(WebKitFrameSetFlatteningEnabledPreferenceKey), kCFBooleanFalse);
CFDictionaryAddValue(defaults, CFSTR(WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey), kCFBooleanTrue);
@@ -792,6 +793,20 @@ HRESULT STDMETHODCALLTYPE WebPreferences::setAllowUniversalAccessFromFileURLs(
return S_OK;
}
+HRESULT STDMETHODCALLTYPE WebPreferences::allowFileAccessFromFileURLs(
+ /* [retval][out] */ BOOL* allowAccess)
+{
+ *allowAccess = boolValueForKey(CFSTR(WebKitAllowFileAccessFromFileURLsPreferenceKey));
+ return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE WebPreferences::setAllowFileAccessFromFileURLs(
+ /* [in] */ BOOL allowAccess)
+{
+ setBoolValue(CFSTR(WebKitAllowFileAccessFromFileURLsPreferenceKey), allowAccess);
+ return S_OK;
+}
+
HRESULT STDMETHODCALLTYPE WebPreferences::isXSSAuditorEnabled(
/* [retval][out] */ BOOL* enabled)
{
diff --git a/WebKit/win/WebPreferences.h b/WebKit/win/WebPreferences.h
index 9209b7d..e4af17a 100644
--- a/WebKit/win/WebPreferences.h
+++ b/WebKit/win/WebPreferences.h
@@ -362,6 +362,12 @@ public:
virtual HRESULT STDMETHODCALLTYPE setAllowUniversalAccessFromFileURLs(
/* [in] */ BOOL allowAccess);
+ virtual HRESULT STDMETHODCALLTYPE allowFileAccessFromFileURLs(
+ /* [retval][out] */ BOOL* allowAccess);
+
+ virtual HRESULT STDMETHODCALLTYPE setAllowFileAccessFromFileURLs(
+ /* [in] */ BOOL allowAccess);
+
virtual HRESULT STDMETHODCALLTYPE isXSSAuditorEnabled(
/* [retval][out] */ BOOL* enabled);
diff --git a/WebKit/win/WebView.cpp b/WebKit/win/WebView.cpp
index e278e3b..8636d15 100644
--- a/WebKit/win/WebView.cpp
+++ b/WebKit/win/WebView.cpp
@@ -4621,6 +4621,11 @@ HRESULT WebView::notifyPreferencesChanged(IWebNotification* notification)
return hr;
settings->setAllowUniversalAccessFromFileURLs(!!enabled);
+ hr = prefsPrivate->allowFileAccessFromFileURLs(&enabled);
+ if (FAILED(hr))
+ return hr;
+ settings->setAllowFileAccessFromFileURLs(!!enabled);
+
hr = prefsPrivate->isXSSAuditorEnabled(&enabled);
if (FAILED(hr))
return hr;
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.cpp b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
index c2393c3..2185ede 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.cpp
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.cpp
@@ -940,6 +940,18 @@ static JSValueRef setAllowUniversalAccessFromFileURLsCallback(JSContextRef conte
return JSValueMakeUndefined(context);
}
+static JSValueRef setAllowFileAccessFromFileURLsCallback(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 = static_cast<LayoutTestController*>(JSObjectGetPrivate(thisObject));
+ controller->setAllowFileAccessFromFileURLs(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
@@ -1380,6 +1392,7 @@ JSStaticFunction* LayoutTestController::staticFunctions()
{ "repaintSweepHorizontally", repaintSweepHorizontallyCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAcceptsEditing", setAcceptsEditingCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAllowUniversalAccessFromFileURLs", setAllowUniversalAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
+ { "setAllowFileAccessFromFileURLs", setAllowFileAccessFromFileURLsCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAlwaysAcceptCookies", setAlwaysAcceptCookiesCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAppCacheMaximumSize", setAppCacheMaximumSizeCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
{ "setAuthenticationPassword", setAuthenticationPasswordCallback, kJSPropertyAttributeReadOnly | kJSPropertyAttributeDontDelete },
diff --git a/WebKitTools/DumpRenderTree/LayoutTestController.h b/WebKitTools/DumpRenderTree/LayoutTestController.h
index 5f9df50..286d3c9 100644
--- a/WebKitTools/DumpRenderTree/LayoutTestController.h
+++ b/WebKitTools/DumpRenderTree/LayoutTestController.h
@@ -69,6 +69,7 @@ public:
void removeAllVisitedLinks();
void setAcceptsEditing(bool acceptsEditing);
void setAllowUniversalAccessFromFileURLs(bool);
+ void setAllowFileAccessFromFileURLs(bool);
void setAppCacheMaximumSize(unsigned long long quota);
void setAuthorAndUserStylesEnabled(bool);
void setCacheModel(int);
diff --git a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
index 422e2c2..f97c60a 100644
--- a/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/LayoutTestControllerGtk.cpp
@@ -348,6 +348,15 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool flag)
g_object_set(G_OBJECT(settings), "enable-universal-access-from-file-uris", flag, NULL);
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(bool flag)
+{
+ WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+ ASSERT(view);
+
+ WebKitWebSettings* settings = webkit_web_view_get_settings(view);
+ g_object_set(G_OBJECT(settings), "enable-file-access-from-file-uris", flag, NULL);
+}
+
void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
{
// FIXME: implement
diff --git a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
index 7a4429b..863565d 100644
--- a/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
+++ b/WebKitTools/DumpRenderTree/mac/DumpRenderTree.mm
@@ -396,6 +396,7 @@ static void resetDefaultsToConsistentValues()
WebPreferences *preferences = [WebPreferences standardPreferences];
[preferences setAllowUniversalAccessFromFileURLs:YES];
+ [preferences setAllowFileAccessFromFileURLs:YES];
[preferences setStandardFontFamily:@"Times"];
[preferences setFixedFontFamily:@"Courier"];
[preferences setSerifFontFamily:@"Times"];
diff --git a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
index b726e72..5fbd3cc 100644
--- a/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
+++ b/WebKitTools/DumpRenderTree/mac/LayoutTestControllerMac.mm
@@ -334,6 +334,11 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
[[[mainFrame webView] preferences] setAllowUniversalAccessFromFileURLs:enabled];
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
+{
+ [[[mainFrame webView] preferences] setAllowFileAccessFromFileURLs:enabled];
+}
+
void LayoutTestController::setPopupBlockingEnabled(bool popupBlockingEnabled)
{
[[[mainFrame webView] preferences] setJavaScriptCanOpenWindowsAutomatically:!popupBlockingEnabled];
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
index ac13afe..f20bd44 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.cpp
@@ -317,6 +317,11 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessRemoteUrls, enabled);
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
+{
+ m_drt->webPage()->settings()->setAttribute(QWebSettings::LocalContentCanAccessFileUrls, enabled);
+}
+
void LayoutTestController::setJavaScriptProfilingEnabled(bool enable)
{
m_topLoadingFrame->page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
diff --git a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
index 18d0648..922ffa8 100644
--- a/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
+++ b/WebKitTools/DumpRenderTree/qt/LayoutTestControllerQt.h
@@ -120,6 +120,7 @@ public slots:
void setFrameSetFlatteningEnabled(bool enable);
void setAllowUniversalAccessFromFileURLs(bool enable);
+ void setAllowFileAccessFromFileURLs(bool enable);
void setJavaScriptProfilingEnabled(bool enable);
void setTimelineProfilingEnabled(bool enable);
void setFixedContentsSize(int width, int height);
diff --git a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
index 261b9e6..b793494 100644
--- a/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
+++ b/WebKitTools/DumpRenderTree/win/DumpRenderTree.cpp
@@ -787,6 +787,7 @@ static void resetDefaultsToConsistentValues(IWebPreferences* preferences)
COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
if (prefsPrivate) {
prefsPrivate->setAllowUniversalAccessFromFileURLs(TRUE);
+ prefsPrivate->setAllowFileAccessFromFileURLs(TRUE);
prefsPrivate->setAuthorAndUserStylesEnabled(TRUE);
prefsPrivate->setDeveloperExtrasEnabled(FALSE);
prefsPrivate->setExperimentalNotificationsEnabled(TRUE);
diff --git a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
index 34fd2e6..4e91dfb 100644
--- a/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
+++ b/WebKitTools/DumpRenderTree/win/LayoutTestControllerWin.cpp
@@ -406,6 +406,23 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
prefsPrivate->setAllowUniversalAccessFromFileURLs(enabled);
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
+{
+ COMPtr<IWebView> webView;
+ if (FAILED(frame->webView(&webView)))
+ return;
+
+ COMPtr<IWebPreferences> preferences;
+ if (FAILED(webView->preferences(&preferences)))
+ return;
+
+ COMPtr<IWebPreferencesPrivate> prefsPrivate(Query, preferences);
+ if (!prefsPrivate)
+ return;
+
+ prefsPrivate->setAllowFileAccessFromFileURLs(enabled);
+}
+
void LayoutTestController::setPopupBlockingEnabled(bool enabled)
{
COMPtr<IWebView> webView;
diff --git a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
index 3bc84cd..469e3f2 100644
--- a/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
+++ b/WebKitTools/DumpRenderTree/wx/LayoutTestControllerWx.cpp
@@ -180,6 +180,11 @@ void LayoutTestController::setAllowUniversalAccessFromFileURLs(bool enabled)
// FIXME: implement
}
+void LayoutTestController::setAllowFileAccessFromFileURLs(bool enabled)
+{
+ // FIXME: implement
+}
+
void LayoutTestController::setAuthorAndUserStylesEnabled(bool flag)
{
// FIXME: implement
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list