Bug 1044181: style loader now annotates classified tracking nodes r=dbaron

This commit is contained in:
Georgios Kontaxis 2014-08-08 15:16:34 -07:00
parent 3380ccba4c
commit 045244b07a

View File

@ -808,6 +808,22 @@ SheetLoadData::OnStreamComplete(nsIUnicharStreamLoader* aLoader,
if (NS_FAILED(aStatus)) {
LOG_WARN((" Load failed: status 0x%x", aStatus));
// Handle sheet not loading error because source was a tracking URL.
// We make a note of this sheet node by including it in a dedicated
// array of blocked tracking nodes under its parent document.
//
// Multiple sheet load instances might be tied to this request,
// we annotate each one linked to a valid owning element (node).
if (aStatus == NS_ERROR_TRACKING_URI) {
nsIDocument* doc = mLoader->GetDocument();
if (doc) {
for (SheetLoadData* data = this; data; data = data->mNext) {
// mOwningElement may be null but AddBlockTrackingNode can cope
nsCOMPtr<nsIContent> content = do_QueryInterface(data->mOwningElement);
doc->AddBlockedTrackingNode(content);
}
}
}
mLoader->SheetComplete(this, aStatus);
return NS_OK;
}