[hackers] [surf] Add config option for cross requests from file URLs || Constantine Bytensky

From: <git_AT_suckless.org>
Date: Sat, 3 Jun 2017 10:39:13 +0200 (CEST)

commit 25652669ef1fc4c0024542c5d7a90a58ba99bcbd
Author: Constantine Bytensky <kostya3_AT_gmail.com>
AuthorDate: Thu May 18 14:46:49 2017 +0300
Commit: Quentin Rameau <quinq_AT_fifth.space>
CommitDate: Mon May 22 12:38:49 2017 +0200

    Add config option for cross requests from file URLs
    
    I use it to open local .xml files with .xsl style-sheets.

diff --git a/config.def.h b/config.def.h
index 3a159ec..0b45cd6 100644
--- a/config.def.h
+++ b/config.def.h
_AT_@ -18,6 +18,7 @@ static Parameter defconfig[ParameterLast] = {
         SETV(DefaultCharset, "UTF-8"),
         SETB(DiskCache, 1),
         SETB(DNSPrefetch, 0),
+ SETB(FileURLsCrossAccess,0),
         SETI(FontSize, 12),
         SETB(FrameFlattening, 0),
         SETB(Geolocation, 0),
diff --git a/surf.c b/surf.c
index c11a095..694eff8 100644
--- a/surf.c
+++ b/surf.c
_AT_@ -69,6 +69,7 @@ typedef enum {
         DiskCache,
         DefaultCharset,
         DNSPrefetch,
+ FileURLsCrossAccess,
         FontSize,
         FrameFlattening,
         Geolocation,
_AT_@ -711,6 +712,10 @@ setparameter(Client *c, int refresh, ParamName p, const Arg *a)
         case DNSPrefetch:
                 webkit_settings_set_enable_dns_prefetching(s, a->b);
                 return; /* do not update */
+ case FileURLsCrossAccess:
+ webkit_settings_set_allow_file_access_from_file_urls(s, a->b);
+ webkit_settings_set_allow_universal_access_from_file_urls(s, a->b);
+ return; /* do not update */
         case FontSize:
                 webkit_settings_set_default_font_size(s, a->i);
                 return; /* do not update */
_AT_@ -1026,6 +1031,8 @@ newview(Client *c, WebKitWebView *rv)
                     webkit_web_view_new_with_related_view(rv));
         } else {
                 settings = webkit_settings_new_with_settings(
+ "allow-file-access-from-file-urls", curconfig[FileURLsCrossAccess].val.b,
+ "allow-universal-access-from-file-urls", curconfig[FileURLsCrossAccess].val.b,
                    "auto-load-images", curconfig[LoadImages].val.b,
                    "default-charset", curconfig[DefaultCharset].val.v,
                    "default-font-size", curconfig[FontSize].val.i,
Received on Sat Jun 03 2017 - 10:39:13 CEST

This archive was generated by hypermail 2.3.0 : Sat Jun 03 2017 - 10:48:23 CEST