Граф коммитов

97 Коммитов

Автор SHA1 Сообщение Дата
Francois Marier 3e4ea00c5f Bug 1362761 - Force file and streams to use smart pointers. r=dimi
MozReview-Commit-ID: GscB9PaaN02

Differential Revision: https://phabricator.services.mozilla.com/D2060

--HG--
extra : moz-landing-system : lando
2018-07-12 22:19:40 +00:00
dlee 6f76698fc0 Bug 1469412 - Convert nsIUrlClassifierCacheInfo* objects to smart pointers. r=francois
Differential Revision: https://phabricator.services.mozilla.com/D2048

--HG--
extra : moz-landing-system : lando
2018-07-10 17:12:42 +00:00
Francois Marier 5a2649faf7 Bug 1434206 - Make LookupCache objects const as much as possible. r=gcp
MozReview-Commit-ID: AqC6NUh6ifm

--HG--
extra : rebase_source : a125989490e7988021215f47d17d3cb3b0303651
2018-05-21 15:11:01 -07:00
Francois Marier 8b98277f9f Bug 1434206 - Make TableUpdate objects const as much as possible. r=gcp
I tried to make TableUpdateArray point to const TableUpdate objects
everywhere but there were two problems:

- HashStore::ApplyUpdate() triggers a few Merge() calls which include
  sorting the underlying TableUpdate object first.

- LookupCacheV4::ApplyUpdate() calls TableUpdateV4::NewChecksum() when the
  checksum is missing and that sets mChecksum.

MozReview-Commit-ID: LIhJcoxo7e7

--HG--
extra : rebase_source : f6ca4bf42d1ddb897a974a0b19c7185b0b6b93af
2018-05-11 16:02:37 -07:00
Francois Marier 30207d91aa Bug 1434206 - Add const to members and functions that can take it. r=gcp
MozReview-Commit-ID: B2aaQTttPAV

--HG--
extra : rebase_source : bbd8d9c734660a4380922ed9b76f1af1de427f3f
2018-05-16 15:26:14 -07:00
Francois Marier 7d4feeefa4 Bug 1442486 - Mark LookupCacheV4 as primed after creating it. r=gcp
RegenActiveTables() relies on mPrimed being set correctly and so
the V4 lookup cache should behave the same way as the V2 one.

The V2 lookup cache on the other hand was unnecessarily setting
mPrimed to true twice.

MozReview-Commit-ID: LwNdI9DTqZ7

--HG--
extra : rebase_source : ff7d7a051f28867be5c35c1079407bb2bfd3a490
2018-03-01 18:09:58 -08:00
Francois Marier 8462db41d1 Bug 1433636 - Put a limit on the length of Safe Browsing metadata values. r=gcp
Disk corruption can lead to the stored length of a value to be
unreasonably large and trigger an OOM.

Since values are all currently <= 32 bytes, we can safely enforce
a 256-byte upper bound.

MozReview-Commit-ID: XygReOpEK3

--HG--
extra : rebase_source : cd2bc880d43612b04d43fb4132bba32bdc3d0f3e
2018-01-30 14:21:33 -08:00
Sylvestre Ledru e68f74a508 Bug 1424867 - Fix some ignored-qualifiers warnings in url-classifier & reputationservice r=francois
MozReview-Commit-ID: 9lLifMbNlnO

--HG--
extra : rebase_source : a69a76f97a9b4912b1de3f556114bf0804f28266
2017-12-12 08:10:59 -06:00
Boris Zbarsky fb684cc726 Bug 1409152. Add an nsTArray::ContainsSorted method. r=froydnj 2017-10-17 15:39:59 -04:00
Chris Peterson 45aa2a8e8e Bug 870698 - Part 2: Replace Append("") with AppendLiteral(""). r=erahm
MozReview-Commit-ID: CrkIP4iHP1U

--HG--
extra : rebase_source : 5dc4e91a3f1860773c199f1abf3f66479218834a
extra : intermediate-source : ba51cc79847f2b43ba616f4a5d2bbc6958ca9f6d
extra : source : 1fda2fa990cc918c748ffa14fcc5dbe13fe3bdc3
2017-09-03 22:14:11 -07: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
Sylvestre Ledru 7c0ae251cd Bug 1381253 - Remove redundant control flow declarations rs=ehsan
MozReview-Commit-ID: FFxP4aMCbOL

--HG--
extra : amend_source : 3aec108430b11048f47ffe19d5da7ac5034770a9
2017-07-15 19:03:04 +02:00
Nicholas Nethercote f1364a75ea Bug 1374580 (part 3) - Remove ns{,C}Substring typedefs. r=froydnj.
All the instances are converted as follows.

- nsSubstring  --> nsAString
- nsCSubstring --> nsACString

--HG--
extra : rebase_source : cfd2238c52e3cb4d13e3bd5ddb80ba6584ab6d91
2017-06-20 19:19:52 +10:00
DimiL e4d42d14a2 Bug 1359299 - V4 caches in LookupCache need to be copied around in copy constructor. r=hchang
MozReview-Commit-ID: AjzUUmQKiPW

--HG--
extra : rebase_source : 1c30ee5aa3548dce9b861a70660b1e60410f3654
2017-06-06 14:16:57 +08:00
Ryan VanderMeulen 35b3731614 Backed out changeset c0b940487708 (bug 1359299) for causing intermittent Windows safebrowsing crashes. 2017-05-24 09:11:04 -04:00
DimiL 81b83a1f76 Bug 1359299 - Copy fullhash cache when update. r=hchang
After adopting the new thread model for safebrowsing, we will create a new
lookup cache for update so we can still check lookup cache at the same time.

Prefix set, completions will be generated when we open the new lookup cache
but it won't include cache, so we will loss cache after that.

This patch will copy cache data from old lookup cache to new lookup
cache while update.

MozReview-Commit-ID: L0WpiHOGIGm

--HG--
extra : rebase_source : ebaf249535561b87a983a3f24dacb8fbab7c096e
2017-05-23 09:19:06 +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
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
dimi 7842472dad Bug 1311935 - P3. Implement safebrowsing v4 caching logic. r=francois
LookupCacheV4::Has implements safebrowsing v4 caching logic.
1. Check if fullhash match any prefix in local database:
  - If not, the URL is safe.
2. Check if prefix is in the cache(prefix is always the first 4-byte of
   the fullhash, Bug 1323953):
  - If not, send fullhash request
3. Check if fullhash is in the positive cache:
  - If fullhash is found and it is not expired, the URL is not safe.
  - If fullhash is found and it is expired, send fullhash request.
4. If fullhash is not found, check negative cache expired time:
  - If negative cache time is not expired, the URL is safe.
  - If negative cache time is expired, send fullhash request.

MozReview-Commit-ID: GRX7CP8ig49

--HG--
extra : rebase_source : 6d3ae8929b11731584810c44d46a1526f7d83e12
2017-04-10 14:21:08 +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 a58847dca1 Bug 1311935 - P3. Implement safebrowsing v4 caching logic. r=francois
LookupCacheV4::Has implements safebrowsing v4 caching logic.
1. Check if fullhash match any prefix in local database:
  - If not, the URL is safe.
2. Check if prefix is in the cache(prefix is always the first 4-byte of
   the fullhash, Bug 1323953):
  - If not, send fullhash request
3. Check if fullhash is in the positive cache:
  - If fullhash is found and it is not expired, the URL is not safe.
  - If fullhash is found and it is expired, send fullhash request.
4. If fullhash is not found, check negative cache expired time:
  - If negative cache time is not expired, the URL is safe.
  - If negative cache time is expired, send fullhash request.

MozReview-Commit-ID: GRX7CP8ig49

--HG--
extra : rebase_source : bcb5fa7aa2b7b116d862e3382447611424603c2d
2017-04-10 14:21:08 +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
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 1f53a466a3 Bug 1336909 - Restrict URLCLASSIFIER_PREFIX_MATCH to profiles that have working V4. r=francois
MozReview-Commit-ID: L3lKgiohalH

--HG--
extra : rebase_source : 1ac11242c4db4b129fdb316deee92dd514b65f49
2017-02-08 15:18:35 +08:00
dimi 4f2ec370e6 Bug 1328821 - hash completion request for v4 should not depend on table freshness. r=francois,henry
MozReview-Commit-ID: EIjDrnj1I4S

--HG--
extra : rebase_source : 83be77637f14753a8baf008af65c44e83b93508c
2017-01-17 08:33:08 +08:00
Henry Chang 5401fe7ad1 Bug 1312339 - LookupResult to support variable length partial hash. r=francois
MozReview-Commit-ID: DKwNCNKJAW

--HG--
extra : rebase_source : 082c8a1d88a00f0d568c56c7ed7214c0b0ed20ef
2016-12-16 14:34:32 +08:00
Thomas Nguyen 493ff90f5c Bug 1315386 - Make Safe Browsing code more shutdown-aware. r=francois,gcp.
MozReview-Commit-ID: ATCVfh5YLZl

--HG--
extra : rebase_source : d87cfae3838f1a26dc67d2546264e47768011a63
2016-11-25 16:02:37 +08:00
Henry Chang 1a53231595 Bug 1315097 - Build the provider dictionary on the main thread to be used everywhere. r=francois,gcp
MozReview-Commit-ID: Ft1deSNKuVB

--HG--
extra : rebase_source : 0cf746b1d2def35606f012c994ddbda0857ccf2d
2016-11-04 17:54:05 +08:00
Dimi Lee 9e95041e88 Bug 1305801 - Part 5: Support SafeBrowsing v4 partial update. r=gcp
MozReview-Commit-ID: 7OEWLaZbotS

--HG--
extra : rebase_source : ab7a5eda234aaff3166e7082f9dc1f8b450d715b
2016-10-04 09:14:39 +08:00
Dimi Lee 3ef7d52f53 Bug 1305801 - Part 4: Store variable-length prefix to disk. r=francois, r=gcp
MozReview-Commit-ID: BMTGtgMuQdg

--HG--
extra : rebase_source : dc4975d9ac8d14ecfabf6fc1229fdb8e863cde46
2016-09-19 11:51:01 +08:00
Phil Ringnalda 35869db574 Backed out 5 changesets (bug 1305801) for ASan gtest bustage
Backed out changeset 0c95d5dec6d9 (bug 1305801)
Backed out changeset bca0e706dbc5 (bug 1305801)
Backed out changeset def8da367beb (bug 1305801)
Backed out changeset 56ceae52d847 (bug 1305801)
Backed out changeset 14457cc4c325 (bug 1305801)
2016-10-03 22:14:49 -07:00
Dimi Lee b4c5400f77 Bug 1305801 - Part 5: Support SafeBrowsing v4 partial update. r=gcp
MozReview-Commit-ID: 7OEWLaZbotS

--HG--
extra : rebase_source : dea720f726306238f7fe3687d7c2579410923752
2016-10-04 09:14:39 +08:00
Dimi Lee f0aab4a2ce Bug 1305801 - Part 4: Store variable-length prefix to disk. r=francois, r=gcp
MozReview-Commit-ID: BMTGtgMuQdg

--HG--
extra : rebase_source : 6f613883071de209f53596060b637e928f458978
2016-09-19 11:51:01 +08:00
Francois Marier 65350bc2ed Bug 1297865 - Remove unused URLCLASSIFIER_PS_FAILURE probe. r=bsmedberg,gcp
MozReview-Commit-ID: Gl4o8gllqcs

--HG--
extra : rebase_source : 6eb303a2a5928b05e5dc8bb78fe36e648a657ddd
2016-08-25 16:34:07 -07:00
Henry Chang 6e64c9ee89 Bug 1254763 - Part 1: Use per-provider directory for V4 databases. r=dimi,gcp
MozReview-Commit-ID: KZGWIcKAQyW

--HG--
extra : rebase_source : f153e87ce132f0066d6c8e21398e7abaaaff6375
2016-09-02 12:00:00 +08:00
Nicholas Nethercote b71747b2ac Bug 1299727 - Rename NS_WARN_IF_FALSE as NS_WARNING_ASSERTION. r=erahm.
The new name makes the sense of the condition much clearer. E.g. compare:

  NS_WARN_IF_FALSE(!rv.Failed());

with:

  NS_WARNING_ASSERTION(!rv.Failed());

The new name also makes it clearer that it only has effect in debug builds,
because that's standard for assertions.

--HG--
extra : rebase_source : 886e57a9e433e0cb6ed635cc075b34b7ebf81853
2016-09-01 15:01:16 +10:00
dimi 365c242c26 Bug 1254766 - Stop caching Safe Browsing completions to disk. r=gcp
MozReview-Commit-ID: 8Qnc8yymgDL
2016-08-11 08:17:39 +08:00
Nicholas Nethercote b89b0e13a4 Bug 1276724 - Make two url-classifier allocations fallible. r=gcp.
This addresses two crashes in the top #75 on 47.0.1.
2016-07-29 19:34:20 +10:00
Ralph Giles 2d78dbf106 Bug 1275744 - Reference MOZ_LOG in toolkit comments. r=erahm
NSPR_LOG_MODULES is deprecated.

MozReview-Commit-ID: 2iZFe60Uxvi

--HG--
extra : rebase_source : 040671ce46a6d8b7d8503f4a05ff5ef04968a8aa
2016-05-26 11:14:47 -07:00
sajitk 2ed26c8df4 Bug 1219482: Replace PRLogModuleInfo with LazyLogModule in toolkit subdirectory.r=erahm 2016-01-28 10:37:00 -08:00
Nicholas Nethercote c0d9bd0923 Bug 1205358 - Fix up nsUrlClassifierPrefixSet memory reporting. r=gcp.
This patch reverts the "measure-in-advance" approach added in part 1 of bug
1050108 -- because that doesn't interact well with DMD -- and adds locking to
avoid races between the url-classifier thread and the main thread.

--HG--
extra : rebase_source : 8c5fdb2627376787a65b192b7c566fdde112a926
2016-02-10 08:30:48 +11:00
Wes Kocher e060c6dced Backed out changeset 24af6caa9bba (bug 1219482) to hopefully fix the intermittent hazard failures CLOSED TREE
--HG--
extra : commitid : ETz5wi5nzdH
2016-01-29 10:15:30 -08:00
sajitk aff6f586b9 Bug 1219482 - Replace PRLogModuleInfo with LazyLogModule in toolkit subdirectory. r=erahm
--HG--
extra : rebase_source : 71c02b7294a95ecba7876b0372a0dee0ea05b4ed
2016-01-28 10:37:00 -05:00
Gian-Carlo Pascutto 760f31a46e Bug 1100338 - Do not consider noise for Completion matches. Remove dead code. r=francois 2015-07-06 04:24:00 +02:00
Birunthan Mohanathas a8939590de Bug 1182996 - Fix and add missing namespace comments. rs=ehsan
The bulk of this commit was generated by running:

  run-clang-tidy.py \
    -checks='-*,llvm-namespace-comment' \
    -header-filter=^/.../mozilla-central/.* \
    -fix
2015-07-13 08:25:42 -07:00
Dragana Damjanovic 7987d2203e Bug 905127 - Part 2 - remove unnecessary nsNetUtil.h includes r=jduell 2015-07-06 07:55:00 +02:00
Emanuel Hoogeveen 7d1e52f2ff Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell 2015-07-07 04:17:00 +02:00
Eric Rahm 75c4bebb79 Bug 1165515 - Part 13-2: Replace usage of PRLogModuleLevel and PR_LOG_*. rs=froydnj
This is straightforward mapping of PR_LOG levels to their LogLevel
counterparts:
  PR_LOG_ERROR   -> LogLevel::Error
  PR_LOG_WARNING -> LogLevel::Warning
  PR_LOG_WARN    -> LogLevel::Warning
  PR_LOG_INFO    -> LogLevel::Info
  PR_LOG_DEBUG   -> LogLevel::Debug
  PR_LOG_NOTICE  -> LogLevel::Debug
  PR_LOG_VERBOSE -> LogLevel::Verbose

Instances of PRLogModuleLevel were mapped to a fully qualified
mozilla::LogLevel, instances of PR_LOG levels in #defines were mapped to a
fully qualified mozilla::LogLevel::* level, and all other instances were
mapped to us a shorter format of LogLevel::*.

Bustage for usage of the non-fully qualified LogLevel were fixed by adding
|using mozilla::LogLevel;| where appropriate.
2015-06-03 15:25:57 -07:00
Eric Rahm f50b813989 Bug 1165515 - Part 3: Convert PR_LOG_TEST to MOZ_LOG_TEST. r=froydnj 2015-06-03 15:22:28 -07:00