style: Expand the Parser trait to allow anonymous CORS to be applied.

Depends on D5106

Differential Revision: https://phabricator.services.mozilla.com/D5341
This commit is contained in:
Brad Werth 2018-09-11 18:11:05 +00:00 committed by Emilio Cobos Álvarez
parent b96d44e329
commit 6d57cbd881
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
3 changed files with 38 additions and 7 deletions

View file

@ -201,6 +201,20 @@ impl SpecifiedImageUrl {
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_NONE;
Self::from_css_url_with_cors(url, CORSMode_CORS_NONE)
}
fn from_css_url_with_cors_anonymous(url: CssUrl) -> Self {
use gecko_bindings::structs::root::mozilla::CORSMode_CORS_ANONYMOUS;
Self::from_css_url_with_cors(url, CORSMode_CORS_ANONYMOUS)
}
/// Provides an alternate method for parsing that associates the URL
/// with anonymous CORS headers.
pub fn parse_with_cors_anonymous<'i, 't>(
context: &ParserContext,
input: &mut Parser<'i, 't>,
) -> Result<Self, ParseError<'i>> {
CssUrl::parse(context, input).map(Self::from_css_url_with_cors_anonymous)
}
}
impl Parse for SpecifiedImageUrl {