Commit graph

234 commits

Author SHA1 Message Date
Kartikaya Gupta
ba4b3b9101 Bug 1384233 - Remove SizePrintfMacros.h. r=froydnj
We have a minimum requirement of VS 2015 for Windows builds, which supports
the z length modifier for format specifiers. So we don't need SizePrintfMacros.h
any more, and can just use %zu and friends directly everywhere.

MozReview-Commit-ID: 6s78RvPFMzv

--HG--
extra : rebase_source : 009ea39eb4dac1c927aa03e4f97d8ab673de8a0e
2017-07-26 16:03:57 -04:00
Thomas Nguyen
7e59091f92 Bug 1378680 - Refactor usage fallible alloc in url-classifier r=francois
MozReview-Commit-ID: HHG1ByeIwZv

--HG--
extra : rebase_source : 1b025edaac49ee202b9a10cd2f2589acb587649b
2017-07-20 16:20:27 +08:00
Andrea Marchesini
50f9ea47a3 Bug 1350958 - Finish labeling ProxyReleaseEvent, r=billm 2017-07-14 08:49:22 +02:00
Thomas Nguyen
4909ab1a70 Bug 1363882 - Remove casting address of inactive member union result.hash r=francois
MozReview-Commit-ID: 3pVaVJ1EJZu

--HG--
extra : rebase_source : 6549a5f1d303363cfb472753c3fe256c3d1dd740
2017-07-05 17:21:01 +08:00
Bill McCloskey
f115503a0b 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
58786e1ea7 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.

--HG--
extra : rebase_source : 318d1bc6fc1425a94aacbf489dd46e4f83211de4
2017-06-22 17:08:53 +10:00
Carsten "Tomcat" Book
8a1350b5a6 Backed out changeset 4f6302a98ae4 (bug 1372405)
--HG--
extra : rebase_source : 41632f3158e88e692809731394a683d065a73dfb
2017-06-21 13:59:26 +02:00
Bill McCloskey
6b3e84ed5f 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
ea1b86680c Backed out changeset 9846de3bd954 (bug 1372405)
--HG--
extra : rebase_source : 5d4a48e8ec394c329994689d938d2a6e9b2752b0
2017-06-20 08:27:02 +02:00
Bill McCloskey
4592152411 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
d1637b9c5a Bug 1372453 - Part 2: Name the caller of ProxyReleaseEvent. r=billm
MozReview-Commit-ID: LYhSWnZkq0i
2017-06-14 09:27:17 +08:00
DimiL
c301aff125 Bug 1366920 - SafeBrowinsg V4 only in 56. r=francois
MozReview-Commit-ID: KWhPC7YWzAh

--HG--
extra : rebase_source : 7fd8bea46709d2eade501b1ce781857ccdc3f189
2017-06-14 09:56:27 +08:00
DimiL
f8c93f3b70 Bug 1366965 - Remove telemetry that compare SafeBrowsing V2 & V4. r=francois
MozReview-Commit-ID: 7vudFBK3rdp

--HG--
extra : rebase_source : ef027d6ec3d44b16dd4115f599e839aab1eadb88
2017-06-12 11:27:19 +08:00
Henry Chang
150a885dfa Bug 1362182 - Early return if mUpdateObserver has been nulled out by CancelUpdate(). r=francois
MozReview-Commit-ID: 2fQCtjMJkx

--HG--
extra : rebase_source : 33b16d2c1958d8a4dcd4cfa9eb3b602f2c84aa55
2017-06-06 17:51:51 +08:00
DimiL
c632a44157 Bug 1360480 - about:url-classifier: Cache information. r=francois
MozReview-Commit-ID: 4YXtb2KPgwL

--HG--
extra : rebase_source : ad9f897aa5772d6001a757e189730d427713f915
2017-05-17 10:32:33 +08:00
Sebastian Hengst
e07a98a1b3 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
a8cf105ce8 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

--HG--
extra : rebase_source : 148e0e85796c932ea85d123092f479e1373ecec9
extra : intermediate-source : 53007a31b576fcd4f16ad6523cccd0a9b90c66f0
extra : source : 1175b9c64b31da2ca2ab88f78488aed6fdc405bc
2017-05-10 15:32:34 +08:00
DimiL
0170f8b6dc 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

--HG--
extra : rebase_source : daa959340c92cfcb751fe8d0548d30762db3783e
2017-05-04 11:13:21 +08:00
DimiL
5aef415cc6 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).

--HG--
extra : rebase_source : 0fb7938464ad24a01a51493ecb1b5c0197c16123
2017-05-04 09:38:14 +08:00
Thomas Nguyen
52ed9fd77e Bug 1351472 - Skip AddNoise if the table is unknown or disallowed to getHash r=francois
MozReview-Commit-ID: GMWs2UpiyiP

--HG--
extra : rebase_source : 9b24bf9fa6ad5aa12077f6e4ffa2ac65b0862b40
2017-04-28 15:26:54 +08:00
DimiL
b5d0ae1f48 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

--HG--
extra : rebase_source : 03265ddd5253d3ae9ae4a7a20bca6ca19d2e7595
2017-04-21 15:09:44 +08:00
Thomas Nguyen
ae9e3b7638 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

--HG--
extra : rebase_source : 0cec0724bd47f55c7b1666e700d172698a708efb
2017-04-18 17:00:27 +08:00
dimi
0cdd204e0e Bug 1356067 - Fix memory leak in nsUrlClassifierLookupCallback::CompletionV4. r=francois
MozReview-Commit-ID: 67ANYHWIRX0

--HG--
extra : rebase_source : ea79c75e4dcb56fa05277b13ca5a46c7cec0650d
2017-04-13 15:39:30 +08:00
dimi
619704ce7d 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

--HG--
extra : rebase_source : 1bcace8464c9d6472a745f66fd547b186e5b3297
2017-04-12 09:11:18 +08:00
dimi
ec8a9a8f96 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

--HG--
extra : rebase_source : 7002b1f55bc0f88ed90340082574cc931f8db87a
2017-04-11 16:07:26 +08:00
dimi
127351f6ef 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

--HG--
extra : rebase_source : 02676ded9bc0580c24b4c906199a4abaf004e296
2017-04-11 11:50:48 +08:00
Iris Hsiao
3d85c0330d 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
5112db082c 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

--HG--
extra : rebase_source : 424db14e4af2ffd691c384414d50f64083d5d20b
2017-04-10 16:20:09 +08:00
Sebastian Hengst
49d5b0cb36 Backed out changeset fc8099c8f98a (bug 1311935) 2017-04-07 19:05:42 +02:00
dimi
9ef006afe3 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

--HG--
extra : rebase_source : efc1ef8e47cd5d0774a931f235e7e0bbdc56fedf
2017-04-07 16:56:08 +08:00
Henry Chang
eec96acbf0 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

--HG--
extra : rebase_source : ab1c896305b9f76cab13a92c9bd88c2d356aacb7
2017-04-07 14:15:16 +08:00
Henry Chang
f3be63826d 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

--HG--
extra : rebase_source : cd2e27a6b679d2c96e769854d1582ed2dcda12bb
2017-04-06 07:07:56 +08:00
dimi
229fe1f890 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

--HG--
extra : rebase_source : 0cf8797de476980ce25d83099e6526321308327c
2017-03-28 09:09:57 +08:00
Thomas Nguyen
2b86f73c62 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
0b68cc7689 Bug 1339760 - Split update process to background/foreground and run background on update thread **synchronously**. r=francois,gcp
MozReview-Commit-ID: J0phPC1nWsf

--HG--
extra : rebase_source : c212bd9fba1ef5951d238967a9b32e4fde0d718b
extra : source : 3daedf653e989c2d91deea785ed9598f2254e609
2017-02-22 17:25:26 +08:00
David Major
ed0b8f8653 Bug 1344615: Remove nsXPCOMStrings.{h,cpp} r=bsmedberg
These are now dead code.

MozReview-Commit-ID: AClU0Qx3kmN

--HG--
extra : rebase_source : df83cf89292da1519bb26027c11e14923d5c54a0
2017-03-06 17:52:54 +13:00
Henry Chang
44b63dd967 Bug 1341506 - Part 2: Add telemetry for AsyncClassifyLocalWithTables. r=francois
MozReview-Commit-ID: 14QG0AdxbE5

--HG--
extra : rebase_source : 03711983d054bd32fcbb2c7e92f9dcf3f6a2f962
extra : source : 1c83c11ea0da03da16fd65d25258018d36072874
2017-02-24 00:14:11 +08:00
Henry Chang
9595454ca7 Bug 1341506 - Part 1: Implement and use nsIURIClassifier.asyncClassifyLocalWithTables. r=Ehsan,francois
MozReview-Commit-ID: 8dvYM4o2Xxw

--HG--
extra : rebase_source : 7e7fabd8ec0a60115eca0c66c55ea0d0369911f1
2017-03-01 11:27:51 +08:00
Dimi Lee
244358a9ac Bug 1335974 - Add more error codes to URLCLASSIFIER_UPDATE_ERROR. r=francois
MozReview-Commit-ID: AAd6Yu0AuUO

--HG--
extra : rebase_source : 63fdc2309348355d74b9bb738d75953d0b435b0f
2017-02-22 16:25:04 +08:00
Dimi Lee
b740658c54 Bug 1311931 - Add telemetry to measure full match rate for v2 and v4. r=francois
MozReview-Commit-ID: H9jAR82rgDh

--HG--
extra : rebase_source : 45b40d6d097882134eff38fe9a434e78cd4a56b1
2017-02-23 23:07:13 +08:00
Thomas Nguyen
65d9ef988a Bug 1288633 - Add more information when an URL matches Safe Browsing list. r=dragana,francois
MozReview-Commit-ID: 6u0dUOB838F

--HG--
extra : rebase_source : 8800e60e6a3b787f1ebaeafb48057e3a3d509468
2017-02-21 09:46:36 +08:00
Tom Tromey
5f8f360823 Bug 1060419 - make log_print use Printf.h, r=froydnj
MozReview-Commit-ID: BIZ1GQEZ1vs

--HG--
extra : rebase_source : 2f1f0aa12493c44f352d9a7e8683e7bb72d2d75b
2016-12-15 20:16:31 -07:00
Tom Tromey
f8ab4ddf02 Bug 1060419 - remove unneeded includes of prprf.h, r=froydnj
MozReview-Commit-ID: JifhpA3oOeH

--HG--
extra : rebase_source : 08460997dc3fd91f3065c718e17b41bb4acf8bae
2016-12-09 10:00:01 -10:00
Francois Marier
6aef23a1fd Bug 1334616 - Add telemetry probe to monitor ClassifyLocalWithTables() perf. r=gcp
MozReview-Commit-ID: LfKovwAX9Ov

--HG--
extra : rebase_source : 744d1a1414fe4c2beb8a1bb604c1cd793e52c90d
2017-02-03 20:56:05 +08:00
Phil Ringnalda
049e9128c4 Backed out changeset 2e9eab35d1ea (bug 1334616) for bustage
CLOSED TREE
2017-02-06 22:04:16 -08:00
Francois Marier
c8725aeef5 Bug 1334616 - Add telemetry probe to monitor ClassifyLocalWithTables() perf. r=gcp
MozReview-Commit-ID: LfKovwAX9Ov

--HG--
extra : rebase_source : a7b921cba7916b72fd67188662875cfd8c5ce7e2
2017-02-03 20:56:05 +08:00
Francois Marier
71cb8fa044 Bug 1336376 - Expand the range of values for URLCLASSIFIER_LOOKUP_TIME. r=bsmedberg
MozReview-Commit-ID: 9zh8mldBS7k

--HG--
extra : rebase_source : 35b77f5852847b82f46ac58ebfd66701d977940d
2017-02-03 20:30:08 +08:00
Henry Chang
a835d0face Bug 1323953 - Send 4-byte prefix for both v2/v4 tables. r=francois
MozReview-Commit-ID: 1jlBdSQARNg

--HG--
extra : rebase_source : 94ca2da38a7aeae061a37cb9013b45dfefbcc843
2017-02-07 10:56:12 +08:00
Wes Kocher
79e705d4bd 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
144d51b0c6 Bug 1336005 - Add null check when releasing and shutting down background thread r=francois
MozReview-Commit-ID: HKlQLqQH2c9

--HG--
extra : rebase_source : 083c6ce7b44b1a01ce19e55af5e6355a39b8a017
2017-02-07 10:06:21 +08:00