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

731 Коммитов

Автор SHA1 Сообщение Дата
Nicholas Nethercote 8478f8d66e Bug 1489047 - Change almost all DOMString occurrences in XPIDL files to AString. r=nika
Because they have almost identical semantics.

--HG--
extra : rebase_source : ea9074bcac2a1d190b88a5d1afc15997593659b7
2018-09-06 18:02:43 +10:00
Nicholas Hurley c5f9b83562 Bug 1440462 - Send httponly cookie names to content processes. r=jdm
Previously, if script tried to set a cookie that matched a cookie we had
received via Set-Cookie that was labeled httponly, script would think
that cookie was properly set (even though it wasn't). This ensures that
script knows just enough about httponly cookies to prevent this
inconsistent view while avoiding leakages of the potentially-sensitive
cookie values.

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

--HG--
extra : moz-landing-system : lando
2018-09-26 15:39:33 +00:00
Andrea Marchesini c00db8b8f6 Bug 1493587 - Remove deprecated attributes in nsICookie, r=ehsan 2018-09-25 07:01:25 +02:00
Andrea Marchesini 47e5a8b711 Bug 1260399 - Remove deprecated messages in nsICookieManager methods - part 4 - remove the deprecated message, r=ehsan 2018-09-24 11:37:57 +02:00
Andrea Marchesini b958c6f170 Bug 1260399 - Remove deprecated messages in nsICookieManager methods - part 3 - nsICookieManager.cookieExists, r=ehsan 2018-09-24 11:37:57 +02:00
Andrea Marchesini 42c515aa1c Bug 1260399 - Remove deprecated messages in nsICookieManager methods - part 2 - nsICookieManager.getCookiesFromHost(), r=ehsan 2018-09-24 11:37:57 +02:00
Andrea Marchesini 61a7f9a598 Bug 1260399 - Remove deprecated messages in nsICookieManager methods - part 1 - nsICookieManager.add(), r=ehsan 2018-09-24 11:37:56 +02:00
Andrea Marchesini def259a086 Bug 1260399 - Remove deprecated messages in nsICookieManager methods - part 0 - nsICookieManager.remove() should not have optional parameters, r=ehsan 2018-09-24 11:37:56 +02:00
Diego Pino Garcia 0f11b0a3d3 Bug 1483986 - Remove sync versions of document.cookie getter/setter; r=ehsan,froydnj 2018-09-21 23:01:32 -04:00
Andrea Marchesini 125aa75f3b Bug 1492769 - Fix a cookie policy range check in CookieServiceChild, r=ehsan 2018-09-21 07:31:41 +02:00
Nathan Froyd e7b3b3140d Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr. But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us). Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.

The current setup has two problems:

1) Derived classes should be using move construction, not copy
   construction, since anything that's shuffling hash table keys/entries
   around will be using move construction.

2) Derived classes should take responsibility for transferring bits of
   superclass state around, and not rely on something else to handle that.

The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the
place. Additionally, if moving entries is implemented via memcpy (which
is quite common), PLDHashTable copying around bits *again* is
inefficient.

Let's fix all these problems in one go, by:

1) Explicitly declaring the set of constructors that PLDHashEntryHdr
   implements (and does not implement). In particular, the copy
   constructor is deleted, so any derived classes that attempt to make
   themselves copyable will be detected at compile time: the compiler
   will complain that the superclass type is not copyable.

This change on its own will result in many compiler errors, so...

2) Change any derived classes to implement move constructors instead of
   copy constructors. Note that some of these move constructors are,
   strictly speaking, unnecessary, since the relevant classes are moved
   via memcpy in nsTHashtable and its derivatives.
2018-09-20 11:20:36 -04:00
Eric Rahm 2fb6934934 Bug 1492204 - Part 3: Remove references to char_iterator. r=froydnj
We can just use 'iterator' now that nsWritingIterator is gone.

--HG--
extra : rebase_source : 3f6fbafc9b57ce89afba581b224b3dc2295fa614
2018-09-18 12:05:23 -07:00
Kershaw Chang cca49915e3 Bug 1487085 - Allow to set cookie with a null channel in child process, r=valentin
In the current implmentation of CookieServiceChild::SetCookieString, pass a null channel will crash the child process. This is because we call aChannel->GetURI() without checking if aChannel is null.
However, set cookie with a null channel is possible in non-e10s mode. To make sure the behavior to be consistent in both non-e10s and e10s mode, we have to pass an empty URIParams in child process.

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

--HG--
extra : moz-landing-system : lando
2018-09-12 15:14:32 +00:00
Gerald Squelart b51e0fd0cc Bug 1489944 - Fixed some std::move warnings - r=froydnj
> dom/media/gmp/CDMStorageIdProvider.cpp(63,10):  warning:
> local variable 'storageId' will be copied despite being returned by name [-Wreturn-std-move]
nsAutoCString -> nsCString, will add std::move().

> layout/painting/DisplayItemClip.cpp(581,10):  warning:
> local variable 'str' will be copied despite being returned by name [-Wreturn-std-move]
nsAutoCString -> nsCString, will add std::move().

> layout/painting/DisplayItemClipChain.cpp(88,10):  warning:
> local variable 'str' will be copied despite being returned by name [-Wreturn-std-move]
nsAutoCString -> nsCString, will add std::move().

> layout/painting/nsDisplayList.cpp(179,10):  warning:
> local variable 'str' will be copied despite being returned by name [-Wreturn-std-move]
nsAutoCString -> nsCString, will add std::move().

> gfx/thebes/gfxWindowsPlatform.cpp(454,10):  warning:
> moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
Will remove std::move().

> gfx/thebes/gfxFontEntry.cpp(245,20):  warning:
> local variable 'name' will be copied despite being returned by name [-Wreturn-std-move]
nsAutoCString -> nsCString, will add std::move().

> netwerk/cookie/nsCookieService.cpp(4460,10):  warning:
> local variable 'path' will be copied despite being returned by name [-Wreturn-std-move]
GetPathFromURI() result is stored in an nsAutoCString, so it might as well return that type.

> toolkit/components/extensions/WebExtensionPolicy.cpp(462,12):  warning:
> local variable 'result' will be copied despite being returned by name [-Wreturn-std-move]
> toolkit/components/extensions/WebExtensionPolicy.cpp(475,10):  warning:
> local variable 'result' will be copied despite being returned by name [-Wreturn-std-move]
`result` may be empty or may be arbitrarily long, so I'll use nsCString inside the function.

> toolkit/xre/CmdLineAndEnvUtils.h(349,10):  warning:
> moving a local object in a return statement prevents copy elision [-Wpessimizing-move]
Returning an UniquePtr, will remove std::move().
Also will `return s` instead of `return nullptr` when `(!s)`, to avoid extra construction which could also prevent elision (not entirely sure, but it's at least not worse!); and it's clearer that the two `return`s return the same already-constructed on-stack object.

> tools/profiler/core/shared-libraries-win32.cc(111,10):  warning:
> local variable 'version' will be copied despite being returned by name [-Wreturn-std-move]
nsPrintfCString -> nsCString, will add std::move().

> xpcom/glue/FileUtils.cpp(179,10):  warning:
> local variable 'fullName' will be copied despite being returned by name [-Wreturn-std-move]
> xpcom/glue/FileUtils.cpp(209,10):  warning:
> local variable 'path' will be copied despite being returned by name [-Wreturn-std-move]
nsAuto{,C}String -> ns{,C}String, will add std::move().

This allowed removals of 'AllowCompilerWarnings' from layout/painting,
netwerk/cookie, and toolkit/components/extensions.

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

--HG--
extra : moz-landing-system : lando
2018-09-10 15:51:48 +00:00
Tiberius Oros a325c6ef11 Merge mozilla-central to autoland. a=merge CLOSED TREE 2018-09-06 01:27:49 +03:00
Ehsan Akhgari bff765cf05 Bug 1488784 - Part 2: Remove the XPCOM component registration for nsCookiePermission; r=jdm
Differential Revision: https://phabricator.services.mozilla.com/D5038
2018-09-05 11:56:17 -04:00
Kershaw Chang b3b648ffd1 Bug 1488441 - Extend cookie's expiring time from 1s to 3s r=jdm
The fail log shows that the cookie's expiring time is too short(only 1s). The cookie could be already expired.
A simple solution in this patch is just extending the expiring time to 3s.

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

--HG--
extra : moz-landing-system : lando
2018-09-05 18:24:51 +00:00
Daniel Varga 3c3e9e37c6 Merge mozilla-central to mozilla-inbound
--HG--
extra : rebase_source : 65372156c004c649109b08227f8aa6a91cb22969
2018-09-04 01:05:40 +03:00
Kershaw Chang 766fce11a1 Bug 1357676 - Implement batch eviction r=jdm
1. Add network.cookie.QuotaPerHost, which has the default value 150.
2. When the cookies exceed more than 180, evict cookies to 150.
3. The concept of eviction is to sort all cookies by whether the cookie is expired and the cookie's last access time. Then, evict cookies by the given count.
4. Details of evict algorithm:
   4.1 Create a priority queue and push all cookies in it.
   4.2 Use custom comparator to compare the cookie by expiry and last access.
   4.3 Pop 30(180 - 150) cookies from the queue and append them to an output array.

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

--HG--
extra : moz-landing-system : lando
2018-09-03 14:49:58 +00:00
Andrea Marchesini 40a8c122d3 Bug 1487331 - STATE_BLOCKED_TRACKING_COOKIES must tell why cookies are blocked, r=ehsan
Introduce these new blocking state values:

const unsigned long STATE_COOKIES_BLOCKED_BY_PERMISSION = 0x10000000;
const unsigned long STATE_COOKIES_BLOCKED_TRACKER       = 0x20000000;
const unsigned long STATE_COOKIES_BLOCKED_ALL           = 0x40000000;
const unsigned long STATE_COOKIES_BLOCKED_FOREIGN       = 0x80000000;
2018-08-31 11:02:33 +02:00
Ehsan Akhgari 743149d399 Bug 1488115 - Part 2: Replace the usage of nsUTF8ConverterService in nsCookie.cpp with the mozilla/Encoding.h API; r=hsivonen
Differential Revision: https://phabricator.services.mozilla.com/D4873
2018-09-03 14:58:50 -04:00
Andrea Marchesini 1d190ffa57 Bug 1487093 - Call AntiTrackingCommon::NotifyRejection when cookies are rejected because of cookie policies, r=ehsan 2018-08-30 17:44:38 +02:00
Ehsan Akhgari d4ab894392 Bug 1486926 - Part 1: Make the Disable Protection button in the control centre UI work for the reject foreign cookie behavior; r=baku 2018-08-29 14:26:22 -04:00
Tiberius Oros 0354172fa8 Backed out 5 changesets (bug 1486944, bug 1486926)for multiple failures on a CLOSED TREE
Backed out changeset b536e2deff08 (bug 1486944)
Backed out changeset 5fc45a7e2b35 (bug 1486944)
Backed out changeset fef913dda33d (bug 1486926)
Backed out changeset f6533c40954f (bug 1486926)
Backed out changeset 20f625526901 (bug 1486926)
2018-08-29 16:50:15 +03:00
Ehsan Akhgari 1743f7b993 Bug 1486926 - Part 1: Make the Disable Protection button in the control centre UI work for the reject foreign cookie behavior; r=baku 2018-08-29 08:27:15 -04:00
Ehsan Akhgari 0a3c630be4 Bug 1486184 - Add reject tracker to the list of cases that we consider requiring third-party checks for; r=baku
This was an omission from bug 1480780 which merged the prefs.
2018-08-27 09:17:25 -04:00
Kris Maglione 3a5c05e76f Bug 1484496: Part 5e - Convert remaining nsISimpleEnumerator users to use JS iteration. r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D3733

--HG--
extra : rebase_source : c0fac176d7b3d840c4dbb14f8d95ccfc7f83a5a8
extra : histedit_source : a92c40117d0808a3ad68c972f622a7a42c9ae8ba
2018-08-18 18:13:14 -07:00
Kris Maglione 2dee0aae3c Bug 1484496: Part 4b - Add intrinsic type information to most nsSimpleEnumerators. r=froydnj
This allows JS callers to automatically get the correct types during
interation, without having to explicitly specify them.

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

--HG--
extra : rebase_source : b708f382d8ea571d199c669bfed5b5a7ca9ffac4
extra : histedit_source : 7df6feb82088c8a5ca45dc28fe4d2b852c177fee
2018-08-18 21:06:32 -07:00
Andrea Marchesini d1e5833a37 Bug 1480780 - Merge the privacy.3rdpartystorage.enabled pref with the network.cookie.cookieBehavior pref; r=ehsan
This patch introduces a new cookie behavior policy called
BEHAVIOR_REJECT_TRACKER.  It also makes it possible to override that
behavior with cookie permissions similar to other cookie behaviors.
2018-08-13 16:01:16 -04:00
Junior Hsu 6fcddbf2de Bug 1481609 - Remove MOZ_SQLITE_COOKIES_OLD_SCHEMA telemetry probe r=valentin
Differential Revision: https://phabricator.services.mozilla.com/D2896

--HG--
extra : moz-landing-system : lando
2018-08-08 16:43:09 +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
Andrea Marchesini 5991b3ebdd Bug 1457170 - Get rid of nsICookieService::ACCEPT_FOR_N_DAYS, r=valentin 2018-08-01 14:41:21 +02:00
Cosmin Sabou bfc1e72e01 Backed out changeset 9035ff3757ac (bug 1415980) at request from froydnj on the suspicion that it's going to break MSVC builds when it gets merged to central. 2018-07-31 01:19:49 +03:00
Nathan Froyd 017b016850 Bug 1415980 - make hash keys movable and not copyable; r=erahm
Everything that goes in a PLDHashtable (and its derivatives, like
nsTHashtable) needs to inherit from PLDHashEntryHdr.  But through a lack
of enforcement, copy constructors for these derived classes didn't
explicitly invoke the copy constructor for PLDHashEntryHdr (and the
compiler didn't invoke the copy constructor for us).  Instead,
PLDHashTable explicitly copied around the bits that the copy constructor
would have.

The current setup has two problems:

1) Derived classes should be using move construction, not copy
   construction, since anything that's shuffling hash table keys/entries
   around will be using move construction.

2) Derived classes should take responsibility for transferring bits of
   superclass state around, and not rely on something else to handle
   that.

The second point is not a huge problem for PLDHashTable (PLDHashTable
only has to copy PLDHashEntryHdr's bits in a single place), but future
hash table implementations that might move entries around more
aggressively would have to insert compensation code all over the place.
Additionally, if moving entries is implemented via memcpy (which is
quite common), PLDHashTable copying around bits *again* is inefficient.

Let's fix all these problems in one go, by:

1) Explicitly declaring the set of constructors that PLDHashEntryHdr
   implements (and does not implement).  In particular, the copy
   constructor is deleted, so any derived classes that attempt to make
   themselves copyable will be detected at compile time: the compiler
   will complain that the superclass type is not copyable.

   This change on its own will result in many compiler errors, so...

2) Change any derived classes to implement move constructors instead
   of copy constructors.  Note that some of these move constructors are,
   strictly speaking, unnecessary, since the relevant classes are moved
   via memcpy in nsTHashtable and its derivatives.
2018-07-30 17:15:11 -04:00
Andrea Marchesini 1498612e1b Bug 1474812 - No needs to store granted storage access in nsILoadInfo and in the inner window, r=ehsan 2018-07-13 12:02:19 +02:00
Andrea Marchesini 0a542c2c05 Bug 1469993 - Grant storage access to a 3rd party, tracking resource if a opened document has user-interaction - part 7 - cookies, r=ehsan 2018-07-10 10:09:59 +02:00
Margareta Eliza Balazs c37b51f523 Backed out 9 changesets (bug 1469993) for causing bustage in build/srcdom/base/nsGlobalWindowInner.cpp on a CLOSED TREE
Backed out changeset e89192032fe2 (bug 1469993)
Backed out changeset 4b261595099d (bug 1469993)
Backed out changeset 37182cfe869c (bug 1469993)
Backed out changeset 5b9870995c73 (bug 1469993)
Backed out changeset 55499fcd9738 (bug 1469993)
Backed out changeset 8c1c838d54ba (bug 1469993)
Backed out changeset 12b9c8bfa41f (bug 1469993)
Backed out changeset 04ab7d6c169a (bug 1469993)
Backed out changeset 53885d61244e (bug 1469993)
2018-07-10 11:32:34 +03:00
Andrea Marchesini de64db476d Bug 1469993 - Grant storage access to a 3rd party, tracking resource if a opened document has user-interaction - part 7 - cookies, r=ehsan 2018-07-10 10:09:59 +02:00
Rob Wu d987da8b60 Bug 1351663 - Ensure that OriginAttributes is initialized when nsCookieService::Add receives a SameSite parameter r=valentin
InitializeOriginAttributes takes aArgc and only initializes the
parameter when aArgc is 1. nsCookieService::Add takes another optional
parameter, namely aSameSite. If a caller sets this SameSite flag, then
InitializeOriginAttributes would skip the initialization of the
OriginAttributes.

This was caught by a private browsing test in
toolkit/components/extensions/test/mochitest/test_ext_cookies.html
(after I added support for SameSite flag in the extension API)

MozReview-Commit-ID: HLfte7x1X7T

--HG--
extra : rebase_source : 1feb84ceca157d8c5ec8575c6336cc606c3504fe
2018-06-09 01:21:02 +02:00
Rob Wu a1cd43731e Bug 1351663 - Skip "optimization" if SameSite flag changes r=valentin
After writing a unit test I discovered that updating a cookie's samesite
flag did not work. This is caused by an "optimization" that avoids
modifying a cookie if any of the cookie attributes were not changed.
This check did not account for the SameSite flag, until now.

A unit test for this will be added in a later commit, at
toolkit/components/extensions/test/xpcshell/test_ext_cookies_samesite.js

MozReview-Commit-ID: ChiwwqqOE57

--HG--
extra : rebase_source : f6bd9bd650f6db50a0726451cd781ca7984962a1
2018-06-09 00:23:45 +02: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
Andrea Marchesini 99fa4c908a Bug 1470578 - Rename the anti-tracking pref, r=francois 2018-06-25 22:46:13 +02:00
Andrea Marchesini 5b9437cad2 Bug 1461921 - Block storage access for third-parties on the tracking protection list - part 5 - Cookies, r=ehsan 2018-06-20 13:38:22 -04:00
Andi-Bogdan Postelnicu dcb297f5a0 Bug 1453795 - Netwerk/Coockies - Initialize member fields in classes/ structures. r=josh 2018-06-13 23:52:59 +03:00
Andrea Marchesini 1273dc5391 Bug 1446933 - Remove 'using namespace mozilla::net' from BackgroundUtils.h, r=qdot 2018-05-30 21:21:17 +02:00
Nicholas Hurley e648506f89 Bug 1460251 - Up cookie limit to 180 per host and expose prefs. r=mcmanus
MozReview-Commit-ID: 1zFMQ4pbntp

--HG--
extra : rebase_source : 3a0537b63bedaa50f8c59985f24ff9f718cd2814
2018-05-08 04:45:20 -07:00
Mark Banner 9c03ace970 Bug 1458235 - Fix various cases where Assert.ok or Assert.equal have been called wrongly. r=Gijs
MozReview-Commit-ID: Br3lKpKNVQJ

--HG--
extra : rebase_source : 972c69ecf63bb522b0f368e3c388f4eff558bbe3
2018-05-01 22:15:43 +01:00
Andi-Bogdan Postelnicu 3f2298c2f6 Bug 1457411 - Update netwerk module to make use of newer methods introduced with c++11 and c++14. r=valentin
MozReview-Commit-ID: 666LNaHyiuQ

--HG--
extra : rebase_source : f3a24e0342d8dcdf9020dd473bc6b1045cbc533b
2018-04-30 19:46:04 +03:00
Valentin Gosu f127ad2cdb Bug 1454100 - Add some telemetry for time spent moving cookies r=Ehsan,francois,mayhemer
MozReview-Commit-ID: 1pAiKaSok3J

--HG--
extra : rebase_source : ac0685003b643dc2ed9b55bfad676dfdddd06e81
2018-04-26 16:56:40 +02:00
Valentin Gosu d47341a80e Bug 1454100 - Move cookies around every X seconds r=Ehsan,mayhemer
MozReview-Commit-ID: Y1zUvbDgDX

--HG--
extra : rebase_source : e43b03369250dab027287316f778e75ef81e6879
2018-04-26 16:39:13 +02:00