Handle origin when blocking content

This commit is contained in:
Anthony Ramine 2016-05-25 13:11:11 +02:00
parent 074fc4a5e1
commit a09773e819

View file

@ -862,10 +862,15 @@ pub fn load<A, B>(load_data: &LoadData,
let mut block_cookies = false;
if let Some(ref rules) = *http_state.blocked_content {
let same_origin =
load_data.referrer_url.as_ref()
.map(|url| url.origin() == doc_url.origin())
.unwrap_or(false);
let load_type = if same_origin { LoadType::FirstParty } else { LoadType::ThirdParty };
let actions = process_rules_for_request(rules, &CBRequest {
url: &doc_url,
resource_type: to_resource_type(&load_data.context),
load_type: LoadType::FirstParty, //FIXME need request origin
load_type: load_type,
});
for action in actions {
match action {