Closed Bug 1539641 Opened 9 months ago Closed 8 months ago

Surface storage access API exceptions in the content blocking log


(Core :: Privacy: Anti-Tracking, enhancement, P2)




Tracking Status
firefox68 --- fixed


(Reporter: englehardt, Assigned: xeonchen)


(Blocks 1 open bug)



(2 files)

Document::mContentBlockingLog does not currently include any information about why a blocking exception is granted. There are currently three causes

Surfacing this information might be helpful when debugging, and could also be collected in Origin Telemetry.

See Also: → 1539536

Hi Baku, do you think the patch is on the right direction?

Attachment #9055998 - Flags: feedback?(amarchesini)
Comment on attachment 9055998 [details] [diff] [review]

Review of attachment 9055998 [details] [diff] [review]:

::: dom/base/ContentBlockingLog.h
@@ +95,5 @@
>        }
>        if (!entry.mData->mLogs.IsEmpty()) {
>          auto& last = entry.mData->mLogs.LastElement();
> +        if (last.mType == aType && last.mBlocked == aBlocked &&
> +            last.mReason == aReason) {

I don't think we care about comparing the reason. Keep the if() as it was.
We need to decide if we want to 'overwrite' the reason to keep the last or the first one.
I would keep the first one.
Attachment #9055998 - Flags: feedback?(amarchesini) → feedback+
Assignee: nobody → xeonchen
Priority: -- → P2

Gary, I think this could be done in a much cleaner way.

Here I assume aReason is StorageAccessGrantedReason, right? You actually don't need to pass it down to all of the ContentBlockingLog recording methods like you are doing now. StorageAccessGrantedReason is only meaningful when storage access is being granted (note the name of the type!). That means you only need to pass it down from here and for STATE_COOKIES_BLOCKED_TRACKER. That means you only need to modify Document::SetHasTrackingCookiesBlocked() and none of the other similar methods on Document. Inside that method you should probably assert that Nothing() is always passed when aBlocked != false.

I'd like to review your final patch here, if possible. Thanks!

Blocks: 1543114
Pushed by
Log and report storage access granted reason; r=Ehsan,chutten
Closed: 8 months ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla68
You need to log in before you can comment on or make changes to this bug.