Closed Bug 1488635 Opened 6 years ago Closed 6 years ago

Add a test with the cookie permission for the image cache case

Categories

(Firefox :: Protections UI, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
Firefox 64
Tracking Status
firefox64 --- fixed

People

(Reporter: ehsan.akhgari, Assigned: baku, NeedInfo)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

Our coverage data shows that we currently don't cover the image cache case when cookie permissions are set: https://codecov.io/gh/mozilla/gecko-dev/src/e126996/toolkit/components/antitracking/AntiTrackingCommon.cpp#L609

baku, do you have cycles to take this?
Flags: needinfo?(amarchesini)
Attached patch image_test.patchSplinter Review
Assignee: nobody → amarchesini
Flags: needinfo?(amarchesini)
Attachment #9006511 - Flags: review?(ehsan)
Comment on attachment 9006511 [details] [diff] [review]
image_test.patch

Review of attachment 9006511 [details] [diff] [review]:
-----------------------------------------------------------------

::: toolkit/components/antitracking/test/browser/browser_imageCache7.js
@@ +2,5 @@
> +
> +/* Setting a custom permission for this website */
> +let uriObj = Services.io.newURI(TEST_DOMAIN);
> +let cp = Cc["@mozilla.org/cookie/permission;1"]
> +           .getService(Ci.nsICookiePermission);

I just made this not work in bug 1488784.  :-)

Please use the permission manager directly instead, like the part 1 patch there does.
Attachment #9006511 - Flags: review?(ehsan) → review+
Comment on attachment 9006511 [details] [diff] [review]
image_test.patch

Review of attachment 9006511 [details] [diff] [review]:
-----------------------------------------------------------------

Actually r- because of the below reason.

::: toolkit/components/antitracking/test/browser/imageCacheWorker.js
@@ +39,5 @@
>        await new Promise(resolve => { img.onload = resolve; });
>        ok(true, "Image 4 loaded");
>      },
>    },
>    null, // cleanup function

Actually, you need to add a cleanup function now, I think, to ensure the added permission is indeed cleared at the end of the test.
Attachment #9006511 - Flags: review+ → review-
Status: NEW → ASSIGNED
Priority: -- → P1
> Actually, you need to add a cleanup function now, I think, to ensure the
> added permission is indeed cleared at the end of the test.

This is done by imageCacheWorker.js:
https://searchfox.org/mozilla-central/rev/5a18fb5aeeec99f1ca1c36a697082c221189a3b9/toolkit/components/antitracking/test/browser/imageCacheWorker.js#58
Flags: needinfo?(ehsan)
Ah right
Flags: needinfo?(ehsan)
Attachment #9006511 - Flags: review- → review+
Pushed by amarchesini@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/bf109313acc3
Add a test with the cookie permission for the image cache case, r=ehsan
https://hg.mozilla.org/mozilla-central/rev/bf109313acc3
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → Firefox 64
Hmm, actually we don't cover these cases in the normal AntiTracking test suite in head.js, do we?
Flags: needinfo?(amarchesini)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: