Commit Graph

1274 Commits

Author SHA1 Message Date
Henri Sivonen
f7d4cef573 Bug 1485325 - Avoid nsTSubstring::GetMutableData() in URL classifier. r=francois
MozReview-Commit-ID: EzyOTuEZ9Ot

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

--HG--
extra : moz-landing-system : lando
2018-08-22 23:07:59 +00:00
Daniel Holbert
f566163698 Bug 1485142: Make url-classifier 'PartialHashHex()' API return a nsAutoCString instead of nsCString, to address build warning & reduce copying. r=gcp
Before this patch -- with the nsCString return type -- we have to do heap
allocation and copying to produce the return value.  But the callers don't
actually care about having a nsCString -- they just call .get() to access the
character buffer, and log it, and then they're done. They can do this just as
easily with the stack-allocated nsAutoCString that PartialHashHex() works with
locally, so let's change the return type so that Return Value Optimization
can give them that variable directly and avoid needless copying/allocation.

This patch addresses the following clang 8.0 build warning:
 LookupCache.h:63:12 [-Wreturn-std-move]
 local variable 'hex' will be copied despite being returned by name

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

--HG--
extra : moz-landing-system : lando
2018-08-22 16:51:56 +00:00
Francois Marier
66ef6df55a Bug 1482306 - Ensure that tables are enabled when shared between features. r=dimi!
The enable/disable logic of the list manager was wrong. If multiple features
shared a given table (e.g. tracking protection and tracking annotations)
and only one of them was enabled, then updates could either be disabled
or enabled depending on which feature was checked first.

By disabling everything at the beginning and selectively re-enabling tables,
we can ensure that no table gets both enabled and disabled by different
feature toggles.

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

--HG--
extra : moz-landing-system : lando
2018-08-15 12:13:16 +00:00
Francois Marier
71239f0c25 Bug 1480450 - Honor browser.contentblocking.enabled in tracking protection. r=dimi!
Depends on D3131

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

--HG--
extra : moz-landing-system : lando
2018-08-13 23:20:40 +00:00
Ciure Andrei
057ea5d560 Backed out 1 changesets (bug 1480450) for mochitest/test_trackingprotection_bug1157081.html failures CLOSED TREE
Backed out changeset 34d3b10c54eb (bug 1480450)
2018-08-13 22:45:37 +03:00
Francois Marier
47ba3463cd Bug 1480450 - Honor browser.contentblocking.enabled in tracking protection. r=dimi!
Depends on D3131

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

--HG--
extra : moz-landing-system : lando
2018-08-13 14:54:10 +00:00
Francois Marier
8ffdb93d06 Bug 1480450 - Move TP tests to using async/await and promises. r=dimi!
There are no actual changes/additions to these tests.

Depends on D3130

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

--HG--
extra : moz-landing-system : lando
2018-08-13 14:41:18 +00:00
Francois Marier
b5aa77a96c Bug 1480450 - Use correct resource url for chrome test. r=dimi!
Differential Revision: https://phabricator.services.mozilla.com/D3130

--HG--
extra : moz-landing-system : lando
2018-08-13 14:34:35 +00:00
Dimi Lee
5118e93be6 Bug 1479438 - Use correct resource url for chrome scope test_privatebrowsing_trackingprotection.html. r=francois
Differential Revision: https://phabricator.services.mozilla.com/D2512

--HG--
extra : moz-landing-system : lando
2018-08-06 10:11:37 +00:00
Masatoshi Kimura
3b21b7868b Bug 1090497 - Re-enable warnings as errors on clang-cl. r=froydnj
--HG--
extra : rebase_source : c09366fb93e5b0f72abe1e99d3094e3d96a934fb
extra : intermediate-source : 5950c9d63c3b4fd63a25464a7b50944aaec7079f
extra : source : ca1b9a2bcc4381795f556fea2fb59066567c30f3
2018-07-31 22:10:07 +09:00
Francois Marier
c370f17bbc Bug 1461515 - Make TP test fail if it uses the wrong list. r=dimi
I added a test case in one of the tracking protection tests which will
fail if the annotation list gets pulled into the TP ones.

I also removed unnecessary prefs that were being set in the test.

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

--HG--
extra : moz-landing-system : lando
2018-08-01 11:53:14 +00:00
Francois Marier
e98e918836 Bug 1461515 - Fix and expand tracking annotation test. r=dimi
Here's a summary of things that were wrong about this test:

1. It was setting urlclassifier.trackingTable only to be overwritten
   later by addTestTrackers().
2. It was using an http event which fires before the classification has
   been done.
3. It didn't disable tailing, which interferes with lowering the priority of
   XHRs.
4. It was not testing that non-annotated or whitelisted resources would not
   have their priority lowered.

I added more test cases both to ensure that the correct list
(urlclassifier.trackingAnnotationTable) is used but also to ensure that
whitelisted or non-blacklisted URLs preserve the normal priority (point #4 above).

I found that XHRs do not get their priority lowered because of this flag:

  https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/netwerk/base/nsChannelClassifier.cpp#221

which gets set here:

  https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/dom/xhr/XMLHttpRequestMainThread.cpp#2548

and so I had to disable tailing in the test (point #3 above).

There was also a problem where the test was resetting the prefs too early
because we were not actually waiting for the classification to finish.

We would wait for the following event: http-on-opening-request

  https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/netwerk/protocol/http/nsIHttpProtocolHandler.idl#85

whereas maybe a more appropriate one would be http-on-before-connect:

  https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/netwerk/protocol/http/nsIHttpProtocolHandler.idl#103

since that is triggerred after annotations (point #2 above):

  https://searchfox.org/mozilla-central/rev/d47c829065767b6f36d29303d650bffb7c4f94a3/netwerk/protocol/http/nsHttpChannel.cpp#6614

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

--HG--
extra : moz-landing-system : lando
2018-08-01 11:52:03 +00:00
Francois Marier
9f161ab08f Bug 1461515 - Split tracking annotations from tracking protection. r=dimi
This makes it possible to use different lists for tracking protection
and for the features that rely on tracking annotations.

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

--HG--
extra : moz-landing-system : lando
2018-08-01 20:45:41 +00:00
Kris Maglione
031076f2f3 Bug 1463291: Move docShell getter from Document to Window. r=bz
DocShells are associated with outer DOM Windows, rather than Documents, so
having the getter on the document is a bit odd to begin with. But it's also
considerably less convenient, since most of the times when we want a docShell
from JS, we're dealing most directly with a window, and have to detour through
the document to get it.

MozReview-Commit-ID: LUj1H9nG3QL

--HG--
extra : source : fcfb99baa0f0fb60a7c420a712c6ae7c72576871
extra : histedit_source : 5be9b7b29a52a4b8376ee0bdfc5c08b12e3c775a
2018-05-21 16:58:23 -07:00
Kris Maglione
02ba563399 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : source : 0d69b4fb1ed43751cfcbc0b4f2fe3b6a49bc0494
extra : histedit_source : d0ce31513ffaae2fd7f01f6567a97b6d2d96b797%2Cfff837de7a00fa90809d2c3e755097180dfd56d8
2018-05-20 18:10:16 -07:00
Narcis Beleuzu
561ccb2ceb Backed out 2 changesets (bug 1463016, bug 1463291) for geckoview failures
Backed out changeset fcfb99baa0f0 (bug 1463291)
Backed out changeset 0d69b4fb1ed4 (bug 1463016)
2018-07-29 03:55:23 +03:00
Kris Maglione
cb1ee1e34d Bug 1463291: Move docShell getter from Document to Window. r=bz
DocShells are associated with outer DOM Windows, rather than Documents, so
having the getter on the document is a bit odd to begin with. But it's also
considerably less convenient, since most of the times when we want a docShell
from JS, we're dealing most directly with a window, and have to detour through
the document to get it.

MozReview-Commit-ID: LUj1H9nG3QL

--HG--
extra : rebase_source : a13c59d1a5ed000187c7fd8e7339408ad6e2dee6
2018-05-21 16:58:23 -07:00
Kris Maglione
636f1839e5 Bug 1463016: Part 5 - Add domWindow property to DocShellTreeItem and update callers to use it. r=nika
MozReview-Commit-ID: FRRAdxLHRtG

--HG--
extra : rebase_source : 36565ef5e74360aad14062005e5bdab2939e888b
2018-05-20 18:10:16 -07:00
Dimi Lee
fdb4d54a9e Bug 1407123 - Wait for the update task to be finished before running next test case. r=francois
The test_partialUpdateV4() test case doesn't wait for the update task
to be finished. It checks the status in the HTTP server side and then calls
run_next_test(). However, when XPCShell test is done, it will trigger
the shutdown process and hence interrupt the ongoing update task.

This cause the xpcshell test receives an error since the update is
interrupted and returns an error like NS_ERROR_UC_UPDATE_SHUTDOWNING.

This patch also fixes a javascript error that we didn't stop the httpd
server when cleanup.

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

--HG--
extra : moz-landing-system : lando
2018-07-26 18:26:19 +00:00
dlee
8ca348be37 Bug 1453038 - Interrupt update when firefox is shutting down. r=francois
URL Classifier has a mUpdateInterrupted flag to abort an ongoing
update in several checkpoints, but we didn't use this while shutting down.

Set this flag in PreShutdown() to avoid url-classifier worker thread or
update thread takes too long to finish an update.

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

--HG--
extra : moz-landing-system : lando
2018-07-16 16:48:53 +00:00
Francois Marier
3aa5d0aeda Bug 1362761 - Make WritePrefixes() more readable. r=dimi
Add assertions to highlight what the various data structures
should look like.

Also assert to ensure that mIndexPrefixes is always the same
length as mIndexDeltas and avoid writing the prefixes to disk
if that's not the case.

Do a single fallible allocation before we create the indexStarts
array instead of checking on each AppendElement() to simplify
the loop and emphasize the number of elements that the array
will receive (indexSize + 1). Remove the last element since we
don't actually end up writing it to disk.

MozReview-Commit-ID: HIg7ZmgaL7x

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

--HG--
extra : moz-landing-system : lando
2018-07-11 09:10:31 +00:00
Francois Marier
b81007a163 Bug 1362761 - Safer Clean() and IsEmpty() handling in PrefixSet. r=dimi
This simplifies the logic around clearing the prefix set and also adds
the clearing of the mIndexDeltasChecksum which should have been done
as part of 3a00711bb0e6.

Additionally, the checks for whether or not the prefix set is empty
include some sanity-checking asserts.

Finally, mTotalPrefixes could be out of sync with mIndexPrefixes
and mIndexDeltas if LoadPrefixes() or MakePrefixSet() fail so we
now only update it once all elements have been added successfully.

There is now a release assert to catch grossly out-of-sync (or
corrupt) values of mTotalPrefixes.

MozReview-Commit-ID: BSbyD2dGsUY

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

--HG--
extra : moz-landing-system : lando
2018-07-11 12:40:34 +00:00
Francois Marier
6d1a4291f4 Bug 1362761 - Add more specific warnings in case of file corruption. r=dimi
MozReview-Commit-ID: KsgcQWLGulH

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

--HG--
extra : moz-landing-system : lando
2018-07-11 08:58:15 +00:00
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
Francois Marier
53ee4cb546 Bug 1362761 - Make prefix and chunk sets as const as possible. r=dimi
MozReview-Commit-ID: JdnNOxnBAgC

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

--HG--
extra : moz-landing-system : lando
2018-07-11 12:52:37 +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
Kris Maglione
17578086c0 Bug 1472523: Part 4 - Avoid unnecessary domain string duplication in preference observers. r=njn
MozReview-Commit-ID: EMCgMRTDqDn

--HG--
extra : rebase_source : 11731e5a7c53c725396a9c8b46f116071d0c6e31
2018-07-04 14:52:48 -07:00
Chris Peterson
2afd829d0f Bug 1469769 - Part 6: Replace non-failing NS_NOTREACHED with MOZ_ASSERT_UNREACHABLE. r=froydnj
This patch is an automatic replacement of s/NS_NOTREACHED/MOZ_ASSERT_UNREACHABLE/. Reindenting long lines and whitespace fixups follow in patch 6b.

MozReview-Commit-ID: 5UQVHElSpCr

--HG--
extra : rebase_source : 4c1b2fc32b269342f07639266b64941e2270e9c4
extra : source : 907543f6eae716f23a6de52b1ffb1c82908d158a
2018-06-17 22:43:11 -07:00
Francois Marier
e33ff43117 Bug 1467581 - Replace all nsAutoPtrs with UniquePtrs in Safe Browsing code. r=gcp
This should not change anything since we were using nsAutoPtrs properly,
but we may as well clean this up given the recent move to smart pointers
for everything.

MozReview-Commit-ID: FWS54SYNiBm

--HG--
extra : rebase_source : ade51b42049782e62f661c84b6d701f9ec33cc77
2018-06-18 13:54:59 -07:00
Francois Marier
00afdd238f Bug 1467581 - Do less work in Reset() if Close() has been called. r=gcp
If Reset() is interleaved with a shutdown, there's no point in
finishing up and we may as well bail early.

MozReview-Commit-ID: Lhm6NfAEgSj

--HG--
extra : rebase_source : e74cc22a36d287a59425079a9f7c4676e7351eba
2018-06-07 17:45:46 -07:00
Francois Marier
79f1e9e5a8 Bug 1467581 - Remove the use of default captures in closures. r=gcp
Explicitly specify the arguments to copy to avoid making a copy of
a dangling `this` pointer.

Convert nsUrlClassifierDBService::mClassifier to a RefPtr since
the update closure might need to continue to access its members
after it's been released by the main thread.

MozReview-Commit-ID: CPio3n9MmsK

--HG--
extra : rebase_source : d7a8b207336209ee37441f3429bc608140e404ae
2018-06-07 17:22:32 -07:00
Mark Banner
b30ac6aacd Bug 1456762 - Remove now unnecessary import-globals-from statements in html files. r=mossop
Depends on D1643

MozReview-Commit-ID: 84M50HDg0wl

Differential Revision: https://phabricator.services.mozilla.com/D1644
2018-06-16 08:21:33 +00:00
Joel Maher
50b91c0a14 Bug 1405428 - skip-if = verify on mochitests which do not pass test-verify. r=gbrown 2018-06-10 05:01:47 -04:00
arthur.iakab
edbf2c0099 Merge inbound to mozilla-central a=merge 2018-06-08 12:55:49 +03:00
Francois Marier
e0fce2a920 Bug 1434206 - Keep LookupResult objects in smart pointers. r=gcp
Replace raw pointers to LookupResult with RefPtrs and eplace the
nsAutoPtr objects + raw pointers params with UniquePtrs.

Also remove unnecessarily paranoid OOM checks when creating single
LookupResult objects since those are pretty small.

MozReview-Commit-ID: G85RNnAat6H

--HG--
extra : rebase_source : a8f6a1ff1e24663d428c8d894cb624e1c67e1bd3
2018-06-05 13:15:03 -07:00
Francois Marier
251bca17ba Bug 1452445 - Fix update error observer in unit test. r=gcp
We should only observe for update errors while we are expecting
a successful update.

MozReview-Commit-ID: 3grGhmxqhIX

--HG--
extra : rebase_source : d099b83560ac5ec15b18fb69177368a645b63952
2018-05-29 18:06:49 -07:00
Francois Marier
c97cf72b4d Bug 1434206 - Make DBSserviceWorkerProxy as const as possible. r=gcp
MozReview-Commit-ID: KPzzmb1Jehi

--HG--
extra : rebase_source : 1e03ee545418b896cc162e6a9c62f70e5c52751e
2018-05-24 16:40:35 -07:00
Francois Marier
8795e4c222 Bug 1434206 - Keep CacheResult objects in smart pointers. r=gcp
Some of the objects were kept in UniquePtr and nsAutoPtr but that
seemed unnecessary complexity given that we can simply use RefPtr
everywhere.

It's also possible to make all of the CacheResult arrays const
since we don't ever modify the elements once they are added.

MozReview-Commit-ID: 5OlcbkQLrGb

--HG--
extra : rebase_source : d58963443d97296236056c69881846f8e67ee3e9
2018-06-01 15:49:14 -07:00
Francois Marier
e8e020d2af Bug 1434206 - Clarify when the lookupcache arrays should be cleared. r=gcp
MozReview-Commit-ID: 7smtnCC0MGT

--HG--
extra : rebase_source : 6288f543abc837cc8084de69f75ab30b7ce642db
2018-05-21 15:58:12 -07: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
8f19e9f805 Bug 1434206 - Keep LookupCache objects in smart pointers. r=gcp
The existing mix of UniquePtr and raw pointers is confusing when
trying to figure out the exact lifetime of these objects.

MozReview-Commit-ID: Br4S7BXEFKs

--HG--
extra : rebase_source : ba35d5c2eeda0741eb4c5491a6caf03f20f3d0ce
2018-05-16 19:13:48 -07:00
Francois Marier
cde64ec41a Bug 1434206 - Add const to functions and members that can take it. r=gcp
MozReview-Commit-ID: D8IQoLZkFaA

--HG--
extra : rebase_source : 107a936dc4bfd000b84cecdabc017723cd920420
2018-05-16 15:39:33 -07:00
Francois Marier
84e344038a Bug 1434206 - Replace a pointer with a reference. r=gcp
This will prevent our holding on to this pointer incorrectly in the
future.

MozReview-Commit-ID: H8ueIOK1qAK

--HG--
extra : rebase_source : 937e9c702c5109b6dfc1684392a1204d8a1edc49
2018-05-15 17:18:18 -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
214074e8d4 Bug 1434206 - Keep TableUpdate objects in smart pointers. r=gcp
Manually keeping tabs on the lifetime of these objects is a pain
and is the likely source of some of our crashes. I suspect we might
also be leaking memory.

This change creates an explicit copy of the main array into the
update thread to avoid using a non-thread-safe shared data
structure. This is a shallow copy. Only the pointers to the
TableUpdates are copied, which means one pointer per list (e.g. 5
in total for google4 in a new profile).

MozReview-Commit-ID: 221d6GkKt0M

--HG--
extra : rebase_source : e1b81f11bb9b41e465571a95845079f455b5868e
2018-06-01 15:48:48 -07:00
Francois Marier
a13da01475 Bug 1434206 - Assert that gethash processing happens on the right thread. r=gcp
MozReview-Commit-ID: FbF8LzCZ3XO

--HG--
extra : rebase_source : 097b1c519ddb162bce877f76b3b37eb7e80d0ac7
2018-05-11 11:47:26 -07:00
Francois Marier
aca17da686 Bug 1434206 - Don't cache gethash response if we failed to apply results. r=gcp
MozReview-Commit-ID: APJ1qhofU3t

--HG--
extra : rebase_source : 56d257b6d3fba565ab005c5f5ee4679e0f8a753b
2018-06-01 15:33:30 -07:00
Francois Marier
d16c2f1d5c Bug 1434206 - Use a TableUpdateV2 param in ApplyUpdate(). r=gcp
HashStore::ApplyUpdate() is a V2-only function and so we can be
explicit about that and remove unnecessary casts.

Add a new update error code for when we fail to cast a TableUpdate
object to the expected protocol version.

MozReview-Commit-ID: 65BBwiZJw6J

--HG--
extra : rebase_source : 3f4bb0f7594d4015e2614ef747526ec5e8168a08
2018-05-10 16:06:49 -07:00
Francois Marier
2a98feb53f Bug 1434206 - Clear the current table when protocol parser is done. r=gcp
Add assertions in the functions that don't already test for
mTableUpdate just to be extra-safe.

MozReview-Commit-ID: 8R67SLSgj23

--HG--
extra : rebase_source : 78283eec163d7bf26598d6a7c979878ed0813d32
2018-05-10 17:58:01 -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