Support CORS attributes for image elements.

This commit is contained in:
Josh Matthews 2019-10-03 17:36:02 -04:00
parent 583536c940
commit 1df8d57dc6
102 changed files with 277 additions and 363 deletions

View file

@ -442,13 +442,19 @@ pub mod utils {
use crate::dom::window::Window;
use net_traits::image_cache::CanRequestImages;
use net_traits::image_cache::{ImageOrMetadataAvailable, ImageResponse, UsePlaceholder};
use net_traits::request::CorsSettings;
use servo_url::ServoUrl;
pub fn request_image_from_cache(window: &Window, url: ServoUrl) -> ImageResponse {
pub fn request_image_from_cache(
window: &Window,
url: ServoUrl,
cors_setting: Option<CorsSettings>,
) -> ImageResponse {
let image_cache = window.image_cache();
let response = image_cache.find_image_or_metadata(
url.into(),
window.origin().immutable().clone(),
cors_setting,
UsePlaceholder::No,
CanRequestImages::No,
);