Commit Graph

231 Commits

Author SHA1 Message Date
Thomas Nguyen
526e01f06e Bug 1363882 - Remove casting address of inactive member union result.hash r=francois
MozReview-Commit-ID: 3pVaVJ1EJZu
2017-07-05 17:21:01 +08:00
Bill McCloskey
ce42826bdf Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-26 14:19:58 -07:00
Nicholas Nethercote
a58025002f Bug 1375392 - Tweak the PROFILER_LABEL* macros. r=mstange.
This patch makes the following changes to the macros.

- Removes PROFILER_LABEL_FUNC. It's only suitable for use in functions outside
  classes, due to PROFILER_FUNCTION_NAME not getting class names, and it was
  mostly misused.

- Removes PROFILER_FUNCTION_NAME. It's no longer used, and __func__ is
  universally available now anyway.

- Combines the first two string literal arguments of PROFILER_LABEL and
  PROFILER_LABEL_DYNAMIC into a single argument. There was no good reason for
  them to be separate, and it forced a '::' in the label, which isn't always
  appropriate. Also, the meaning of the "name_space" argument was interpreted
  in an interesting variety of ways.

- Adds an "AUTO_" prefix to PROFILER_LABEL and PROFILER_LABEL_DYNAMIC, to make
  it clearer they construct RAII objects rather than just being function calls.
  (I myself have screwed up the scoping because of this in the past.)

- Fills in the 'js::ProfileEntry::Category::' qualifier within the macro, so
  the caller doesn't need to. This makes a *lot* more of the uses fit onto a
  single line.

The patch also makes the following changes to the macro uses (beyond those
required by the changes described above).

- Fixes a bunch of labels that had gotten out of sync with the name of the
  class and/or function that encloses them.

- Removes a useless PROFILER_LABEL use within a trivial scope in
  EventStateManager::DispatchMouseOrPointerEvent(). It clearly wasn't serving
  any useful purpose. It also serves as extra evidence that the AUTO_ prefix is
  a good idea.

- Tweaks DecodePool::SyncRunIf{Preferred,Possible} so that the labelling is
  done within them, instead of at their callsites, because that's a more
  standard way of doing things.
2017-06-22 17:08:53 +10:00
Carsten "Tomcat" Book
238bf154d5 Backed out changeset 4f6302a98ae4 (bug 1372405) 2017-06-21 13:59:26 +02:00
Bill McCloskey
67e8af4720 Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-20 21:44:11 -07:00
Carsten "Tomcat" Book
bbe9441993 Backed out changeset 9846de3bd954 (bug 1372405) 2017-06-20 08:27:02 +02:00
Bill McCloskey
f69608368b Bug 1372405 - Provide names for all runnables in the tree (r=froydnj)
MozReview-Commit-ID: DKR6ROiHRS7
2017-06-19 22:25:47 -07:00
Bevis Tseng
e6dc9e02bc Bug 1372453 - Part 2: Name the caller of ProxyReleaseEvent. r=billm
MozReview-Commit-ID: LYhSWnZkq0i
2017-06-14 09:27:17 +08:00
DimiL
20ed1b5b65 Bug 1366920 - SafeBrowinsg V4 only in 56. r=francois
MozReview-Commit-ID: KWhPC7YWzAh
2017-06-14 09:56:27 +08:00
DimiL
611d1430b5 Bug 1366965 - Remove telemetry that compare SafeBrowsing V2 & V4. r=francois
MozReview-Commit-ID: 7vudFBK3rdp
2017-06-12 11:27:19 +08:00
Henry Chang
33354e4470 Bug 1362182 - Early return if mUpdateObserver has been nulled out by CancelUpdate(). r=francois
MozReview-Commit-ID: 2fQCtjMJkx
2017-06-06 17:51:51 +08:00
DimiL
c8f160ac4e Bug 1360480 - about:url-classifier: Cache information. r=francois
MozReview-Commit-ID: 4YXtb2KPgwL
2017-05-17 10:32:33 +08:00
Sebastian Hengst
09a5305d26 Backed out changeset 44635c073692 (bug 1345058) on suspicion of causing intermittent xpcshell failures in toolkit/components/url-classifier/tests/unit/test_bug1274685_unowned_list.js on OS X. r=backout 2017-05-19 13:13:18 +02:00
Henry Chang
53df2ddfd9 Bug 1345058 - Asynchronously decide if a flash document should be blocked. r=baku,bytesized
Technically speaking, we use the new async API 'nsIURIClassifier.asyncClassifyLocalWithTables'
to replace the old sync API. However, since we cannot guarantee the async call will be done when
we neet its result, we need a sync call as a fallback in this case. This is a sub-optimal
solution and we will be investigating if there's a better solution if the sync call
is used too frequently.

MozReview-Commit-ID: L1uQ2eaYr1e
2017-05-10 15:32:34 +08:00
DimiL
769f299a32 Bug 1333328 - Remove mTableFreshness and gFreshnessGuarantee. r=francois
Functions and Preference related to mTableFreshness and gFreshnessGuarantee
could be removed since we will no longer require them.

MozReview-Commit-ID: IAa0UHLSQ56
2017-05-04 11:13:21 +08:00
DimiL
a0b8501692 Bug 1333328 - Refactor cache miss handling mechanism for V2. r=francois
In this patch, we will make Safebrowsing V2 caching use the same algorithm as V4.
So we remove "mMissCache" for negative caching and TableFresness check for
positive caching.

But Safebrowsing V2 doesn't contain negative/positive cache duration information in
gethash response. So we hard-code a fixed value, 15 minutes, as cache duration.
In this way, we can sync the mechanism we handle caching for V2 and V4.

An extra effort for V2 here is that we need to manually record prefixes misses
because we won't get any response for those prefixes(implemented in
nsUrlClassifierLookupCallback::CacheMisses).
2017-05-04 09:38:14 +08:00
Thomas Nguyen
9ca7549a71 Bug 1351472 - Skip AddNoise if the table is unknown or disallowed to getHash r=francois
MozReview-Commit-ID: GMWs2UpiyiP
2017-04-28 15:26:54 +08:00
DimiL
141d7020a5 Bug 1358324 - The URLCLASSIFIER_MATCH_THREAT_TYPE_RESULT probe doesn't seem to be working correctly. r=francois
mResults is lookupResultArray which is created when we find matched prefix in the database.
mCacheResults stores response of gethash request.

We record threat type match telemetry only when completion is found in both V2 and V4,
that is we got one confirmed result for V2 and one for V4. And then we could record threat
types by iterating through mCacheResultsArray.

But if one of lookupResult is from cache, for example, completion is found in 'goog-malware-proto',
then we won't trigger a gethash request for it because it is in the cache.
In this scenario, mCacheResults will not have results from V4 so when we try to record
threat types we won't find V4 ones.

In this patch we only record telemetry when gethash is sent for both V2 and V4. This may limit
the usefulness of that probe a little bit, but we shouldn't make the code less efficient just
to be able to measure telemetry better.

MozReview-Commit-ID: Ib8SGUaxb4c
2017-04-21 15:09:44 +08:00
Thomas Nguyen
87c03bcdea Bug 1353853 - Cache preferences when doing channel classify r=francois
We will cache all preferences which will be read during classifing channel
- Store them into static variables nsUrlClassifierDBService
- Use a singleton class to manage/update preferrences in nsChannelClassifier

MozReview-Commit-ID: GvyBI3rVpYh
2017-04-18 17:00:27 +08:00
dimi
af40c9d725 Bug 1356067 - Fix memory leak in nsUrlClassifierLookupCallback::CompletionV4. r=francois
MozReview-Commit-ID: 67ANYHWIRX0
2017-04-13 15:39:30 +08:00
dimi
80b83c117c Bug 1311933 - P2. Add telemetry to measure if completion match type is the same for v2 and v4. r=francois
When full match is found in both v2 and v4, the threat types returned should also be the same.
If threat types are different, the telemetry record this by setting a bit flags which indicates
what threat types are being returned.

If threat types are the same, this telemetry will record 0.

MozReview-Commit-ID: Laz77yoCg00
2017-04-12 09:11:18 +08:00
dimi
b19db734bc Bug 1311933 - P1. Use integer as the key of safebrowsing cache. r=francois
In Bug 1323953, we always send 4-bytes prefix for completion and the prefix is also
used as the key to store cache result from gethash request.
Since it is always 4-bytes, we could convert it to integer for simplicity.

MozReview-Commit-ID: Lkvrg0wvX5Z
2017-04-11 16:07:26 +08:00
dimi
5b1a0ff5b5 Bug 1311935 - P2. Process fullHashes.find response. r=francois
This patch includes following changes:

1. nsUrlClassifierHashCompleter.js
   nsUrlClassifierHashCompleter.idl
   - Add completionV4 interface for hashCompleter to pass response data to
     DB service.
   - Process response data includes negative cache duration, matched full
     hashes and cache duration for each match. Full matches are passed through
     nsIFullHashMatch interface.
   - Change _requests.responses from array contains matched fullhashes to
     dictionary so that it can store additional information likes negative cache
     duration.
2. nsUrlClassifierDBService.cpp
   - Implement CompletionV4 interface, store response data to CacheResultV4
     object. Expired duration to expired time is handled here.
   - Add CacheResultToTableUpdate function to convert V2 & V4 cache result
     to TableUpdate object.
3. LookupCache.h
   - Extend CacheResult to CacheResultV2 and CacheResultV4 so we can store
     response data in CompletionV2 and CompletionV4.
4. HashStore.h
   - Add API and member variable in TableUpdateV4 to store response data.
     TableUpdate object is used by DB service to pass update data or gethash
     response to Classifier, so we need to extend TableUpdateV4 to be able
     to store fullHashes.find response.
6. Entry.h
   - Define the structure about how we cache fullHashes.find response.

MozReview-Commit-ID: FV4yAl2SAc6
2017-04-11 11:50:48 +08:00
Iris Hsiao
cd018fd494 Backed out 4 changesets (bug 1311935) for causing assertion crash by developer's request
Backed out changeset 27e624cd9479 (bug 1311935)
Backed out changeset 4c0381ab0990 (bug 1311935)
Backed out changeset 73587838ef16 (bug 1311935)
Backed out changeset a5a6c0f79733 (bug 1311935)
2017-04-11 11:04:54 +08:00
dimi
5856f89d1f Bug 1311935 - P2. Process fullHashes.find response. r=francois
This patch includes following changes:

1. nsUrlClassifierHashCompleter.js
   nsUrlClassifierHashCompleter.idl
   - Add completionV4 interface for hashCompleter to pass response data to
     DB service.
   - Process response data includes negative cache duration, matched full
     hashes and cache duration for each match. Full matches are passed through
     nsIFullHashMatch interface.
   - Change _requests.responses from array contains matched fullhashes to
     dictionary so that it can store additional information likes negative cache
     duration.
2. nsUrlClassifierDBService.cpp
   - Implement CompletionV4 interface, store response data to CacheResultV4
     object. Expired duration to expired time is handled here.
   - Add CacheResultToTableUpdate function to convert V2 & V4 cache result
     to TableUpdate object.
3. LookupCache.h
   - Extend CacheResult to CacheResultV2 and CacheResultV4 so we can store
     response data in CompletionV2 and CompletionV4.
4. HashStore.h
   - Add API and member variable in TableUpdateV4 to store response data.
     TableUpdate object is used by DB service to pass update data or gethash
     response to Classifier, so we need to extend TableUpdateV4 to be able
     to store fullHashes.find response.
6. Entry.h
   - Define the structure about how we cache fullHashes.find response.

MozReview-Commit-ID: KgR1NASl7GC
2017-04-10 16:20:09 +08:00
Sebastian Hengst
ac6f4701fe Backed out changeset fc8099c8f98a (bug 1311935) 2017-04-07 19:05:42 +02:00
dimi
b3df2a0280 Bug 1311935 - P2. Process fullHashes.find response. r=francois
This patch includes following changes:

1. nsUrlClassifierHashCompleter.js
   nsUrlClassifierHashCompleter.idl
   - Add completionV4 interface for hashCompleter to pass response data to
     DB service.
   - Process response data includes negative cache duration, matched full
     hashes and cache duration for each match. Full matches are passed through
     nsIFullHashMatch interface.
   - Change _requests.responses from array contains matched fullhashes to
     dictionary so that it can store additional information likes negative cache
     duration.
2. nsUrlClassifierDBService.cpp
   - Implement CompletionV4 interface, store response data to CacheResultV4
     object. Expired duration to expired time is handled here.
   - Add CacheResultToTableUpdate function to convert V2 & V4 cache result
     to TableUpdate object.
3. LookupCache.h
   - Extend CacheResult to CacheResultV2 and CacheResultV4 so we can store
     response data in CompletionV2 and CompletionV4.
4. HashStore.h
   - Add API and member variable in TableUpdateV4 to store response data.
     TableUpdate object is used by DB service to pass update data or gethash
     response to Classifier, so we need to extend TableUpdateV4 to be able
     to store fullHashes.find response.
6. Entry.h
   - Define the structure about how we cache fullHashes.find response.

MozReview-Commit-ID: 8pUJITn8c1n
2017-04-07 16:56:08 +08:00
Henry Chang
7141f6bb42 Bug 1343425 - Supports nsIURIClassifier.asyncClassifyLocalWithTables. r=baku
We add a new "on-off" protocol PURLClassifierLocal which calls
nsIURIClassifier.asyncClassifyLocalWithTables on construction and
calls back on destruction. Pretty much the same design as PURLClassifier.

In order to avoid code duplication, the actor implementation is templatized
and |MaybeInfo| in PURLClassifier.ipdl is moved around.

Test case is included and the custom event target is not in place for labelling.
The custom event target will be done in Bug 1353701.

MozReview-Commit-ID: IdHYgdnBV7S
2017-04-07 14:15:16 +08:00
Henry Chang
4543c61a48 Bug 1339050 - Asynchronously apply safebrowsing DB update. r=francois,gcp
A new function Classifier::AsyncApplyUpdates() is implemented for async update.
Besides, all public Classifier interfaces become "worker thread only" and
we remove DBServiceWorker::ApplyUpdatesBackground/Foreground.

In DBServiceWorker::FinishUpdate, instead of calling Classifier::ApplyUpdates,
we call Classifier::AsyncApplyUpdates and install a callback for notifying
the update observer when update is finished. The callback will occur on the
caller thread (i.e. worker thread.)

As for the shutdown issue, when the main thread is notified to shut down,
we at first *synchronously* dispatch an event to the worker thread to
shut down the update thread. After getting synchronized with all other
threads, we send last two events "CancelUpdate" and "CloseDb" to notify
dangling update (i.e. BeginUpdate is called but FinishUpdate isn't)
and do cleanup work.

MozReview-Commit-ID: DXZvA2eFKlc
2017-04-06 07:07:56 +08:00
dimi
fa1cdd079d Bug 1350798 - Ignore v4 completion too early will cause telemetry::URLCLASSIFIER_MATCH_RESULT gets wrong results. r=francois
Enable safebrowsing v4 completion but ignore the result by checking preference in
nsUrlClassifierLookupCallback::Completion may cause telemetry measure incorrect match
result since v4 completions will always be ignored.

So in this patch we move the preference check after telemetry is measured and then we
ignore the result.

MozReview-Commit-ID: J29JitvW3Lc
2017-03-28 09:09:57 +08:00
Thomas Nguyen
72ec8b5761 Bug 1339006 - Specify event target if we run nsIURIClassifier.clasify() from content process.r=ehsan, r=gcp
MozReview-Commit-ID: BztjVMlQngi
2017-03-08 11:06:36 +08:00
Henry Chang
75d7890222 Bug 1339760 - Split update process to background/foreground and run background on update thread **synchronously**. r=francois,gcp
MozReview-Commit-ID: J0phPC1nWsf
2017-02-22 17:25:26 +08:00
David Major
b1e362f6f7 Bug 1344615: Remove nsXPCOMStrings.{h,cpp} r=bsmedberg
These are now dead code.

MozReview-Commit-ID: AClU0Qx3kmN
2017-03-06 17:52:54 +13:00
Henry Chang
7330f247a6 Bug 1341506 - Part 2: Add telemetry for AsyncClassifyLocalWithTables. r=francois
MozReview-Commit-ID: 14QG0AdxbE5
2017-02-24 00:14:11 +08:00
Henry Chang
40c00b3543 Bug 1341506 - Part 1: Implement and use nsIURIClassifier.asyncClassifyLocalWithTables. r=Ehsan,francois
MozReview-Commit-ID: 8dvYM4o2Xxw
2017-03-01 11:27:51 +08:00
Dimi Lee
7545e85763 Bug 1335974 - Add more error codes to URLCLASSIFIER_UPDATE_ERROR. r=francois
MozReview-Commit-ID: AAd6Yu0AuUO
2017-02-22 16:25:04 +08:00
Dimi Lee
5375a9f0e5 Bug 1311931 - Add telemetry to measure full match rate for v2 and v4. r=francois
MozReview-Commit-ID: H9jAR82rgDh
2017-02-23 23:07:13 +08:00
Thomas Nguyen
6ca9c778d6 Bug 1288633 - Add more information when an URL matches Safe Browsing list. r=dragana,francois
MozReview-Commit-ID: 6u0dUOB838F
2017-02-21 09:46:36 +08:00
Tom Tromey
a4b717ab39 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs
2016-12-15 20:16:31 -07:00
Tom Tromey
48da5b7de4 Bug 1060419 - remove unneeded includes of prprf.h, r=froydnj
MozReview-Commit-ID: JifhpA3oOeH
2016-12-09 10:00:01 -10:00
Francois Marier
93a6db0a84 Bug 1334616 - Add telemetry probe to monitor ClassifyLocalWithTables() perf. r=gcp
MozReview-Commit-ID: LfKovwAX9Ov
2017-02-03 20:56:05 +08:00
Phil Ringnalda
99db7d0422 Backed out changeset 2e9eab35d1ea (bug 1334616) for bustage
CLOSED TREE
2017-02-06 22:04:16 -08:00
Francois Marier
173cf1fe01 Bug 1334616 - Add telemetry probe to monitor ClassifyLocalWithTables() perf. r=gcp
MozReview-Commit-ID: LfKovwAX9Ov
2017-02-03 20:56:05 +08:00
Francois Marier
8ab3e4bd30 Bug 1336376 - Expand the range of values for URLCLASSIFIER_LOOKUP_TIME. r=bsmedberg
MozReview-Commit-ID: 9zh8mldBS7k
2017-02-03 20:30:08 +08:00
Henry Chang
7bb28e53f9 Bug 1323953 - Send 4-byte prefix for both v2/v4 tables. r=francois
MozReview-Commit-ID: 1jlBdSQARNg
2017-02-07 10:56:12 +08:00
Wes Kocher
785ad4f15f Backed out changeset 3a6b42b3d233 (bug 1336376) for build failures a=backout CLOSED TREE
MozReview-Commit-ID: L3oVRVqNDKj
2017-02-06 18:36:24 -08:00
Thomas Nguyen
8306f6ac3b Bug 1336005 - Add null check when releasing and shutting down background thread r=francois
MozReview-Commit-ID: HKlQLqQH2c9
2017-02-07 10:06:21 +08:00
Francois Marier
3714472b99 Bug 1336376 - Expand the range of values for URLCLASSIFIER_LOOKUP_TIME. r=bsmedberg
MozReview-Commit-ID: 9zh8mldBS7k
2017-02-03 20:30:08 +08:00
Dimi Lee
1859178ca5 Bug 1332770 - Fix the google4 provider is showing up as other in some telemetry pings. r=francois
MozReview-Commit-ID: KbpYAnf6qxd
2017-01-27 18:02:36 +08:00
Dimi Lee
45dd73df16 Bug 1333257 - Only cache V2 misses when doing Safe Browsing lookups. r=francois
MozReview-Commit-ID: 6kvM6z5OnPw
2017-01-26 11:36:52 +08:00