@@ -215,14 +215,18 @@ class H5vccSchemeURLLoader : public network::mojom::URLLoader {
215215 mime_type_ = kMimeTypeVideoWebM ;
216216 }
217217
218+ // Splash caching only serves the png and webm resources defined in
219+ // the resource map.
218220 const bool supports_splash_caching =
219221 (mime_type_ == kMimeTypeImagePng || mime_type_ == kMimeTypeVideoWebM ) &&
220- browser_context_ ;
222+ base::Contains (resource_map, key) ;
221223
222- // Specify the built-in video/png if the cache is unavailable.
224+ // For png/webm, override resource_key with "fallback" query param.
225+ // If requested key is not found in cache, loader returns the fallback
226+ // resource.
223227 std::string fallback;
224- if (net::GetValueForKeyInQuery (url_, " fallback " , &fallback) &&
225- supports_splash_caching ) {
228+ if (supports_splash_caching &&
229+ net::GetValueForKeyInQuery (url_, " fallback " , &fallback) ) {
226230 LOG (INFO) << " Fallback splash: " << fallback;
227231 resource_key = std::move (fallback);
228232 }
@@ -235,8 +239,7 @@ class H5vccSchemeURLLoader : public network::mojom::URLLoader {
235239 LOG (WARNING) << " Resource not found: " << resource_key;
236240 }
237241
238- // Only attempt to read files defined in the resource map from cache.
239- if (supports_splash_caching && base::Contains (resource_map, key)) {
242+ if (supports_splash_caching && browser_context_) {
240243 ReadSplashCache (key);
241244 return ;
242245 }
0 commit comments