llcache: Allow file and resource schemes to be cached.

This means things like the default css file and adblock css file
are only loaded and parsed once.
This commit is contained in:
Michael Drake 2019-11-09 17:08:43 +00:00
parent b15cbb72ac
commit 52805a7860
1 changed files with 11 additions and 7 deletions

View File

@ -1792,21 +1792,25 @@ llcache_object_retrieve(nsurl *url,
/* POST requests are never cached */
uncachable = true;
} else {
/* only http and https schemes are cached */
/* only http(s), resource, and file schemes are cached */
lwc_string *scheme;
bool match;
scheme = nsurl_get_component(defragmented_url, NSURL_SCHEME);
if (lwc_string_caseless_isequal(scheme, corestring_lwc_http,
&match) == lwc_error_ok &&
(match == false) &&
lwc_string_caseless_isequal(scheme, corestring_lwc_https,
&match) == lwc_error_ok &&
(match == false) &&
lwc_string_caseless_isequal(scheme, corestring_lwc_resource,
&match) == lwc_error_ok &&
(match == false) &&
lwc_string_caseless_isequal(scheme, corestring_lwc_file,
&match) == lwc_error_ok &&
(match == false)) {
if (lwc_string_caseless_isequal(scheme,
corestring_lwc_https, &match) ==
lwc_error_ok &&
(match == false)) {
uncachable = true;
}
uncachable = true;
}
lwc_string_unref(scheme);
}