<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[183992] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/183992">183992</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2015-05-08 04:53:56 -0700 (Fri, 08 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>[GTK] Expose allowFileAccessFromFileURLs setting to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=144748

Reviewed by Sergio Villar Senin.

Source/WebKit2:

This is needed by local applications loaded as a file URI that do XMLHttpRequests.

* UIProcess/API/gtk/WebKitSettings.cpp:
(webKitSettingsSetProperty):
(webKitSettingsGetProperty):
(webkit_settings_class_init):
(webkit_settings_get_allow_file_access_from_file_urls):
(webkit_settings_set_allow_file_access_from_file_urls):
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
* UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:

Tools:

* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp:
(testWebKitSettings): Check the new setting is correctly
initialized and updated.
* TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
(testWebContextSecurityFileXHR): Check XHR to local files is
allowed from file URLs after changing the setting.
(beforeAll): Add new test.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitSettingscpp">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkWebKitSettingsh">trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt</a></li>
<li><a href="#trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml">trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitSettingscpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp</a></li>
<li><a href="#trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebContextcpp">trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2015-05-08  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Expose allowFileAccessFromFileURLs setting to WebKit2 GTK+ API
+        https://bugs.webkit.org/show_bug.cgi?id=144748
+
+        Reviewed by Sergio Villar Senin.
+
+        This is needed by local applications loaded as a file URI that do XMLHttpRequests.
+
+        * UIProcess/API/gtk/WebKitSettings.cpp:
+        (webKitSettingsSetProperty):
+        (webKitSettingsGetProperty):
+        (webkit_settings_class_init):
+        (webkit_settings_get_allow_file_access_from_file_urls):
+        (webkit_settings_set_allow_file_access_from_file_urls):
+        * UIProcess/API/gtk/WebKitSettings.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt:
+        * UIProcess/API/gtk/docs/webkit2gtk-docs.sgml:
+
</ins><span class="cx"> 2015-05-08  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Optimize serialization of quoted JSON strings.
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -143,7 +143,8 @@
</span><span class="cx">     PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
</span><span class="cx">     PROP_ENABLE_MEDIA_STREAM,
</span><span class="cx">     PROP_ENABLE_SPATIAL_NAVIGATION,
</span><del>-    PROP_ENABLE_MEDIASOURCE
</del><ins>+    PROP_ENABLE_MEDIASOURCE,
+    PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> static void webKitSettingsConstructed(GObject* object)
</span><span class="lines">@@ -309,6 +310,9 @@
</span><span class="cx">     case PROP_ENABLE_MEDIASOURCE:
</span><span class="cx">         webkit_settings_set_enable_mediasource(settings, g_value_get_boolean(value));
</span><span class="cx">         break;
</span><ins>+    case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
+        webkit_settings_set_allow_file_access_from_file_urls(settings, g_value_get_boolean(value));
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
</span><span class="cx">         break;
</span><span class="lines">@@ -464,7 +468,9 @@
</span><span class="cx">     case PROP_ENABLE_MEDIASOURCE:
</span><span class="cx">         g_value_set_boolean(value, webkit_settings_get_enable_mediasource(settings));
</span><span class="cx">         break;
</span><del>-
</del><ins>+    case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
+        g_value_set_boolean(value, webkit_settings_get_allow_file_access_from_file_urls(settings));
+        break;
</ins><span class="cx">     default:
</span><span class="cx">         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
</span><span class="cx">         break;
</span><span class="lines">@@ -1217,6 +1223,25 @@
</span><span class="cx">             _(&quot;Whether MediaSource should be enabled.&quot;),
</span><span class="cx">             FALSE,
</span><span class="cx">             readWriteConstructParamFlags));
</span><ins>+
+    /**
+     * WebKitSettings:allow-file-access-from-file-urls:
+     *
+     * Whether file access is allowed from file URLs. By default, when
+     * something is loaded in a #WebKitWebView using a file URI, cross
+     * origin requests to other file resources are not allowed. This
+     * setting allows you to change that behaviour, so that it would be
+     * possible to do a XMLHttpRequest of a local file, for example.
+     *
+     * Since: 2.10
+     */
+    g_object_class_install_property(gObjectClass,
+        PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
+        g_param_spec_boolean(&quot;allow-file-access-from-file-urls&quot;,
+            _(&quot;Allow file access from file URLs&quot;),
+            _(&quot;Whether file access is allowed from file URLs.&quot;),
+            FALSE,
+            readWriteConstructParamFlags));
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
</span><span class="lines">@@ -2999,3 +3024,41 @@
</span><span class="cx">     priv-&gt;preferences-&gt;setMediaSourceEnabled(enabled);
</span><span class="cx">     g_object_notify(G_OBJECT(settings), &quot;enable-mediasource&quot;);
</span><span class="cx"> }
</span><ins>+
+/**
+ * webkit_settings_get_allow_file_access_from_file_urls:
+ * @settings: a #WebKitSettings
+ *
+ * Get the #WebKitSettings:allow-file-access-from-file-urls property.
+ *
+ * Returns: %TRUE If file access from file URLs is allowed or %FALSE otherwise.
+ *
+ * Since: 2.10
+ */
+gboolean webkit_settings_get_allow_file_access_from_file_urls(WebKitSettings* settings)
+{
+    g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
+
+    return settings-&gt;priv-&gt;preferences-&gt;allowFileAccessFromFileURLs();
+}
+
+/**
+ * webkit_settings_set_allow_file_access_from_file_urls:
+ * @settings: a #WebKitSettings
+ * @allowed: Value to be set
+ *
+ * Set the #WebKitSettings:allow-file-access-from-file-urls property.
+ *
+ * Since: 2.10
+ */
+void webkit_settings_set_allow_file_access_from_file_urls(WebKitSettings* settings, gboolean allowed)
+{
+    g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+    WebKitSettingsPrivate* priv = settings-&gt;priv;
+    if (priv-&gt;preferences-&gt;allowFileAccessFromFileURLs() == allowed)
+        return;
+
+    priv-&gt;preferences-&gt;setAllowFileAccessFromFileURLs(allowed);
+    g_object_notify(G_OBJECT(settings), &quot;allow-file-access-from-file-urls&quot;);
+}
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkWebKitSettingsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -414,6 +414,13 @@
</span><span class="cx"> webkit_settings_set_enable_mediasource                         (WebKitSettings *settings,
</span><span class="cx">                                                                 gboolean        enabled);
</span><span class="cx"> 
</span><ins>+WEBKIT_API gboolean
+webkit_settings_get_allow_file_access_from_file_urls           (WebKitSettings *settings);
+
+WEBKIT_API void
+webkit_settings_set_allow_file_access_from_file_urls           (WebKitSettings *settings,
+                                                                gboolean        allowed);
+
</ins><span class="cx"> G_END_DECLS
</span><span class="cx"> 
</span><span class="cx"> #endif /* WebKitSettings_h */
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtk40sectionstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-4.0-sections.txt        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -431,6 +431,8 @@
</span><span class="cx"> webkit_settings_set_enable_spatial_navigation
</span><span class="cx"> webkit_settings_get_enable_mediasource
</span><span class="cx"> webkit_settings_set_enable_mediasource
</span><ins>+webkit_settings_get_allow_file_access_from_file_urls
+webkit_settings_set_allow_file_access_from_file_urls
</ins><span class="cx"> 
</span><span class="cx"> &lt;SUBSECTION Standard&gt;
</span><span class="cx"> WebKitSettingsClass
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessAPIgtkdocswebkit2gtkdocssgml"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-docs.sgml        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -89,5 +89,10 @@
</span><span class="cx">     &lt;xi:include href=&quot;xml/api-index-2.8.xml&quot;&gt;&lt;xi:fallback /&gt;&lt;/xi:include&gt;
</span><span class="cx">   &lt;/index&gt;
</span><span class="cx"> 
</span><ins>+  &lt;index id=&quot;api-index-2-10&quot; role=&quot;2.10&quot;&gt;
+    &lt;title&gt;Index of new symbols in 2.10&lt;/title&gt;
+    &lt;xi:include href=&quot;xml/api-index-2.10.xml&quot;&gt;&lt;xi:fallback /&gt;&lt;/xi:include&gt;
+  &lt;/index&gt;
+
</ins><span class="cx">   &lt;xi:include href=&quot;xml/annotation-glossary.xml&quot;&gt;&lt;xi:fallback /&gt;&lt;/xi:include&gt;
</span><span class="cx"> &lt;/book&gt;
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Tools/ChangeLog        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2015-05-08  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        [GTK] Expose allowFileAccessFromFileURLs setting to WebKit2 GTK+ API
+        https://bugs.webkit.org/show_bug.cgi?id=144748
+
+        Reviewed by Sergio Villar Senin.
+
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp:
+        (testWebKitSettings): Check the new setting is correctly
+        initialized and updated.
+        * TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp:
+        (testWebContextSecurityFileXHR): Check XHR to local files is
+        allowed from file URLs after changing the setting.
+        (beforeAll): Add new test.
+
</ins><span class="cx"> 2015-05-08  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r183945.
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitSettingscpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitSettings.cpp        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -273,6 +273,11 @@
</span><span class="cx">     webkit_settings_set_enable_mediasource(settings, TRUE);
</span><span class="cx">     g_assert(webkit_settings_get_enable_mediasource(settings));
</span><span class="cx"> 
</span><ins>+    // File access from file URLs is not allowed by default.
+    g_assert(!webkit_settings_get_allow_file_access_from_file_urls(settings));
+    webkit_settings_set_allow_file_access_from_file_urls(settings, TRUE);
+    g_assert(webkit_settings_get_allow_file_access_from_file_urls(settings));
+
</ins><span class="cx">     g_object_unref(G_OBJECT(settings));
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkToolsTestWebKitAPITestsWebKit2GtkTestWebKitWebContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp (183991 => 183992)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp        2015-05-08 10:44:06 UTC (rev 183991)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKit2Gtk/TestWebKitWebContext.cpp        2015-05-08 11:53:56 UTC (rev 183992)
</span><span class="lines">@@ -411,6 +411,39 @@
</span><span class="cx">         | SecurityPolicyTest::CORSEnabled | SecurityPolicyTest::EmptyDocument);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+static void testWebContextSecurityFileXHR(WebViewTest* test, gconstpointer)
+{
+    GUniquePtr&lt;char&gt; fileURL(g_strdup_printf(&quot;file://%s/simple.html&quot;, Test::getResourcesDir(Test::WebKit2Resources).data()));
+    test-&gt;loadURI(fileURL.get());
+    test-&gt;waitUntilLoadFinished();
+
+    GUniquePtr&lt;char&gt; jsonURL(g_strdup_printf(&quot;file://%s/simple.json&quot;, Test::getResourcesDir().data()));
+    GUniquePtr&lt;char&gt; xhr(g_strdup_printf(&quot;var xhr = new XMLHttpRequest; xhr.open(\&quot;GET\&quot;, \&quot;%s\&quot;); xhr.send();&quot;, jsonURL.get()));
+
+    // By default file access is not allowed, this will fail with a cross-origin error.
+    GUniqueOutPtr&lt;GError&gt; error;
+    WebKitJavascriptResult* javascriptResult = test-&gt;runJavaScriptAndWaitUntilFinished(xhr.get(), &amp;error.outPtr());
+    g_assert(!javascriptResult);
+    g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED);
+
+    // Allow file access from file URLs.
+    webkit_settings_set_allow_file_access_from_file_urls(webkit_web_view_get_settings(test-&gt;m_webView), TRUE);
+    test-&gt;loadURI(fileURL.get());
+    test-&gt;waitUntilLoadFinished();
+    javascriptResult = test-&gt;runJavaScriptAndWaitUntilFinished(xhr.get(), &amp;error.outPtr());
+    g_assert(javascriptResult);
+    g_assert(!error);
+
+    // It isn't still possible to load file from an HTTP URL.
+    test-&gt;loadURI(kServer-&gt;getURIForPath(&quot;/&quot;).data());
+    test-&gt;waitUntilLoadFinished();
+    javascriptResult = test-&gt;runJavaScriptAndWaitUntilFinished(xhr.get(), &amp;error.outPtr());
+    g_assert(!javascriptResult);
+    g_assert_error(error.get(), WEBKIT_JAVASCRIPT_ERROR, WEBKIT_JAVASCRIPT_ERROR_SCRIPT_FAILED);
+
+    webkit_settings_set_allow_file_access_from_file_urls(webkit_web_view_get_settings(test-&gt;m_webView), FALSE);
+}
+
</ins><span class="cx"> void beforeAll()
</span><span class="cx"> {
</span><span class="cx">     kServer = new WebKitTestServer();
</span><span class="lines">@@ -423,6 +456,7 @@
</span><span class="cx">     Test::add(&quot;WebKitWebContext&quot;, &quot;spell-checker&quot;, testWebContextSpellChecker);
</span><span class="cx">     WebViewTest::add(&quot;WebKitWebContext&quot;, &quot;languages&quot;, testWebContextLanguages);
</span><span class="cx">     SecurityPolicyTest::add(&quot;WebKitSecurityManager&quot;, &quot;security-policy&quot;, testWebContextSecurityPolicy);
</span><ins>+    WebViewTest::add(&quot;WebKitSecurityManager&quot;, &quot;file-xhr&quot;, testWebContextSecurityFileXHR);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void afterAll()
</span></span></pre>
</div>
</div>

</body>
</html>