Closed Bug 1262406 Opened 8 years ago Closed 8 years ago

Track element doesn't use the URL classifier

Categories

(Toolkit :: Safe Browsing, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla49
Tracking Status
firefox49 --- fixed

People

(Reporter: dlee, Assigned: dlee)

References

(Blocks 1 open bug)

Details

Attachments

(2 files, 1 obsolete file)

HTML Track element open a channel when load resource, but it doesn't specify the nsIChannel::LOAD_CLASSIFY_URI loadflag when open channel
Blocks: 1207775
Assignee: nobody → dlee
Attached patch WIP patch (obsolete) — Splinter Review
Attachment #8738544 - Attachment is obsolete: true
Comment on attachment 8738932 [details]
MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois

https://reviewboard.mozilla.org/r/44859/#review41565

::: dom/html/HTMLTrackElement.cpp:218
(Diff revision 1)
>                       uri,
>                       static_cast<Element*>(this),
>                       nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
>                       nsIContentPolicy::TYPE_INTERNAL_TRACK,
> -                     loadGroup);
> +                     loadGroup,
> +                     nullptr,

Nit: personally, I like to leave a comment next to the `nullptr` here just to label it and help show it was intentional:
https://hg.mozilla.org/mozilla-central/rev/cc28ecb2b687#l1.21
Attachment #8738932 - Flags: review?(francois) → review+
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

https://reviewboard.mozilla.org/r/44861/#review41567

::: toolkit/components/url-classifier/tests/mochitest/test_classify_track.html:21
(Diff revision 1)
> +  const PREF = "browser.safebrowsing.malware.enabled";
> +  const track_path = "tests/toolkit/components/url-classifier/tests/mochitest/basic.vtt";
> +
> +  // Use different url to avoid url classifier bypass classify because of cache.
> +  const malware_url1 = "test1.example.org/";
> +  const malware_url2 = "test2.example.org/";

I wonder here if you could simply add a bogus query string parameter to turn the second one into a different URL for cache purposes:

example.org/tests/toolkit/components/url-classifier/tests/mochitest/basic.vtt

and

example.org/tests/toolkit/components/url-classifier/tests/mochitest/basic.vtt?againplease

I'm being a bit paranoid here, but the advantage of doing it this way is that you can add a single entry to the malware list and then you're actually checking the same blacklisted domain in the last two tests (testBlacklistTrackSafebrowsingOff and testBlacklistTrackSafebrowsingOn).

The issue with tests is that there's nothing to "test the tests", so I like to keep them as simple as possible to make sure they don't start to silently pass when they shouldn't :)
Attachment #8738933 - Flags: review?(francois)
Status: NEW → ASSIGNED
(In reply to François Marier [:francois] from comment #5)
> Comment on attachment 8738933 [details]
> MozReview Request: Bug 1262406 - P2. Classify track element testcase.
> I wonder here if you could simply add a bogus query string parameter to turn
> the second one into a different URL for cache purposes:
> 
> example.org/tests/toolkit/components/url-classifier/tests/mochitest/basic.vtt
> 
> and
> 
> example.org/tests/toolkit/components/url-classifier/tests/mochitest/basic.
> vtt?againplease

Yes, this can avoid cache! Thanks for the suggestion :)
Comment on attachment 8738932 [details]
MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44859/diff/1-2/
Attachment #8738932 - Attachment description: MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r?francois → MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois
Attachment #8738933 - Flags: review?(francois)
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44861/diff/1-2/
Attachment #8738933 - Flags: review?(francois) → review+
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

https://reviewboard.mozilla.org/r/44861/#review41843
https://reviewboard.mozilla.org/r/44859/#review41845

::: dom/html/HTMLTrackElement.cpp:217
(Diff revision 2)
>    rv = NS_NewChannel(getter_AddRefs(channel),
>                       uri,
>                       static_cast<Element*>(this),
>                       nsILoadInfo::SEC_ALLOW_CROSS_ORIGIN_DATA_INHERITS,
>                       nsIContentPolicy::TYPE_INTERNAL_TRACK,
> -                     loadGroup);
> +                     loadGroup, // aLoadGroup

nit: that one is pretty obvious from the name of the variable already :)
Comment on attachment 8738932 [details]
MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44859/diff/2-3/
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44861/diff/2-3/
(In reply to Dimi Lee[:dimi][:dlee] from comment #11)
> Comment on attachment 8738932 [details]
> MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL
> classifier. r=francois
> 
> Review request updated; see interdiff:
> https://reviewboard.mozilla.org/r/44859/diff/2-3/

Address nit.
Comment on attachment 8738932 [details]
MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44859/diff/3-4/
Attachment #8738933 - Attachment description: MozReview Request: Bug 1262406 - P2. Classify track element testcase. r?francois → MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44861/diff/3-4/
Keywords: checkin-needed
Keywords: checkin-needed
remove checkin-needed because this patch has similar problem as bug 1264169, also we should land any urlclassifier testcase after bug 1264169 is fixed
Blocks: 1264169
No longer blocks: 1264169
Depends on: 1264169
try result after rebasing to latest code and apply changes in bug 1264168
https://treeherder.mozilla.org/#/jobs?repo=try&revision=8fcd8bd4b413
Comment on attachment 8738932 [details]
MozReview Request: Bug 1262406 - P1. Track element doesn't use the URL classifier. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44859/diff/4-5/
Comment on attachment 8738933 [details]
MozReview Request: Bug 1262406 - P2. Classify track element testcase. r=francois

Review request updated; see interdiff: https://reviewboard.mozilla.org/r/44861/diff/4-5/
try link is in Comment 19
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/aea79c4f38f4
https://hg.mozilla.org/mozilla-central/rev/77c1d14c1e1f
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla49
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: