}
} else if (node instanceof CssTree.Term
&& (CssPropertyPartType.URI == propertyPartType(node))) {
boolean remove = false;
Message removeMsg = null;
CssTree term = (CssTree.Term) node;
CssTree.CssLiteral content =
(CssTree.CssLiteral) term.children().get(0);
if (content instanceof CssTree.Substitution) {
return true; // Handled by later pass.
}
String uriStr = content.getValue();
try {
URI baseUri = content.getFilePosition().source().getUri();
URI relUri = new URI(uriStr);
URI uri = baseUri.resolve(relUri);
ExternalReference ref = new ExternalReference(
uri, baseUri, relUri, content.getFilePosition());
Name propertyPart = propertyPart(node); // TODO
if (uriPolicy != null) {
String rewritten = UriPolicyNanny.apply(
uriPolicy,
ref, UriEffect.SAME_DOCUMENT, LoaderType.SANDBOXED,
Collections.singletonMap(
UriPolicyHintKey.CSS_PROP.key, propertyPart));
if (rewritten == null) {
removeMsg = new Message(
PluginMessageType.DISALLOWED_URI,
node.getFilePosition(),
MessagePart.Factory.valueOf(uriStr));
remove = true;
}
}
} catch (URISyntaxException ex) {
removeMsg = new Message(
PluginMessageType.DISALLOWED_URI,
node.getFilePosition(), MessagePart.Factory.valueOf(uriStr));
remove = true;
}