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

167 Коммитов

Автор SHA1 Сообщение Дата
Nicholas Nethercote ee320f219e Bug 1413811 (part 3) - Rename RegisterPriorityCallback(). r=glandium.
MozReview-Commit-ID: 5Ov1cHgfB5Y

--HG--
extra : rebase_source : 767ae8c0390f68555e334945cb5479479a52e1ef
2017-11-02 17:20:36 +11:00
Nicholas Nethercote d8ca9e91d7 Bug 1413811 (part 2) - Factor out similarities between RegisterPriorityCallback() and Preferences::RegisterCallback(). r=glandium.
MozReview-Commit-ID: 8K3RNjZTSc3

--HG--
extra : rebase_source : 1bd0aacc120248f024e2e428af40087bba3f6848
2017-11-02 17:13:47 +11:00
Nicholas Nethercote 90032b0798 Bug 1413811 (part 1) - Avoid PrefCallback for pref callbacks registered with Preferences::RegisterCallback(). r=glandium.
Pref callbacks registered via Preferences::Add*VarCache() are wrapped in a
ValueObserver -- which groups all callback requests that have the same prefname
and callback function -- and the ValueObserver is put into gObserverTable. This
is reasonable.

Observers registered via nsPrefBranch::Add{Weak,Strong}Observer() are wrapped
in a PrefCallback, and the PrefCallback is put into sRootBranch->mObservers.
This is also reasonable.

Pref callbacks registered via Preferences::RegisterCallback() are conceptually
similar to those registered via Preferences::Add*VarCache(). However, they are
implemented by using *both* of the above mechanisms: they are wrapped in a
ValueObserver which is put into gObserverTable, *and* that ValueObserver is then
wrapped in a PrefCallback which is put into sRootBranch->mObservers.

Using both mechanisms isn't necessary, so this patch removes the
PrefCallback/mObservers part. This makes Preferences::RegisterCallback() work
in much the same way as Preferences::Add*VarCache().

Specifically:

- Preferences::RegisterCallback() now calls PREF_RegisterCallback() instead of
  Preferences::AddStrongObserver(). This makes it more similar to
  RegisterPriorityCallback().

- Preferences::UnregisterCallback() now explicitly calls
  PREF_UnregisterCallback() instead of Preferences::RemoveObserver (which
  previously happened via ~ValueObserver() when the ValueObserver was removed
  from gObserverTable and its refcount dropped to zerod).

MozReview-Commit-ID: 1tEQNeYrBUU

--HG--
extra : rebase_source : 431a42402397a172d562b81b8d46418503bb8dfe
2017-11-02 17:11:51 +11:00
Nicholas Nethercote b9c6a1d730 Bug 1413413 (part 2) - Remove support for extensions having their own prefs file. r=glandium,kmag.
It's no longer needed, now that legacy extensions aren't supported.

Pieces removed include the following.

- The "load-extension-default" observer notification.

- The code for reading defaults/preferences/*.js from extensions.

- The unit test for this stuff.

- A crash reporter annotation relating to very long prefs set by add-ons.

- All references to "ExtPrefDL".

MozReview-Commit-ID: KMBoYn3uZ3x

--HG--
extra : rebase_source : 4dc8ffd425c6cdf06806409090c4f9d04a64930b
2017-10-31 16:34:57 +11:00
Nicholas Nethercote 08cb1f38b2 Bug 1413413 (part 1) - Remove unused "@mozilla.org/preferences;1" ID. r=glandium.
MozReview-Commit-ID: 9d1ca2R6fNb

--HG--
extra : rebase_source : a7377b8b242cf07eb7a48cd0cb431b4768792326
2017-10-31 16:34:38 +11:00
Nicholas Nethercote 9245fb0232 Bug 1413400 (part 2) - Make Preferences::sPreferences a StaticRefPtr. r=froydnj.
The notable part of this change is Shutdown(). I've made it just null out
sPreferences, contrary to the old comment, which was strange for a couple of
reasons:

- ~Preferences() used to null out sPreference, which is backwards compared to
  how this sort of thing normally works.

- In both the before and after cases, as far as I can tell,
  Preferences::Shutdown() is called but ~Preferences() is never called;
  something keeps the singleton Preferences instance alive until process
  termination.

MozReview-Commit-ID: Ab0ui31rVcI
2017-11-01 13:55:28 +11:00
Nicholas Nethercote 3baceb4b37 Bug 1413400 (part 1) - Move s{,Default}RootBranch into Preferences. r=froydnj.
sRootBranch and sDefaultRootBranch have the same lifetime as sPreferences, so
this patch makes them non-static nsCOMPtr<> members of Preferences.

MozReview-Commit-ID: 1TLhh13ZpBI

--HG--
extra : rebase_source : 9419cd205b9a06f7ae82722a6732e3fc2722473b
2017-11-01 13:41:14 +11:00
Nicholas Nethercote ede7a0db1d Bug 1413085 - Inline and remove pref_SetPref(). r=glandium.
It has a single call site.

MozReview-Commit-ID: Hdt1KkG2jTV

--HG--
extra : rebase_source : 0b851491f08646fbd4d8a4862601f8cadad02522
2017-11-01 08:59:30 +11:00
Nicholas Nethercote 559a3f06ee Bug 1413085 - Make PREF_Get{CString,Int,Bool}Pref() more uniform. r=glandium.
This patch does the following.

- Reduces nesting and simplifies control flow by handling failure cases
  earlier, and makes all three functions have identical structure.

- Avoids unnecessary temporary local variables, including |rv|.

- Removes low-value comments, including some misleading ones (e.g. "This
  function will perform conversion...").

- PREF_GetCStringValue() previously did not check HasDefaultValue(), unlike the
  other two. It now does.

- PREF_GetCStringValue() now calls SetIsVoid(true) at the start, so that
  aValueOut will be Voided on all failure paths.

MozReview-Commit-ID: 2uCSv76Y8eu

--HG--
extra : rebase_source : 9ca9148ad0a5069bdd3e08aec0038216d27ea092
2017-11-01 08:55:07 +11:00
Sebastian Hengst 2181970726 merge mozilla-central to mozilla-inbound. r=merge a=merge 2017-11-01 00:39:58 +01:00
Nicholas Nethercote af33aed804 Bug 1412718 (part 2) - Improve nsPrefBranch::DeleteBranch(). r=glandium.
This patch converts it to use Gecko strings instead of C strings, which makes
it much nicer.

MozReview-Commit-ID: KtRp3vaXwN5

--HG--
extra : rebase_source : c6788cbed5c4b932eb5b4119c407aea538cb1799
2017-11-01 08:28:10 +11:00
Nicholas Nethercote 89134cc30a Bug 1412718 (part 1) - Inline and remove PREF_DeleteBranch(). r=glandium.
It has a single call site.

MozReview-Commit-ID: BH7GuipEgl

--HG--
extra : rebase_source : fa13eb8be2a088b717d834686d60b4eea6b1df4d
2017-11-01 07:59:40 +11:00
Alessio Placitelli 5230ddc6b6 Bug 1412845 - Whitelist the "default" channel in Prferences.cpp. r=chutten
This is needed for local developer builds to enable extended
telemetry recording by default. As a consequence, other subsystems
relying on this prefs will turn on (e.g. experiments, BHR, ...).

MozReview-Commit-ID: W3RarufCdY

--HG--
extra : rebase_source : 8690e969baad1b9191ea3fef9fb7dd6e41e00de7
2017-10-31 08:53:32 +01:00
Chris H-C 84de24dd05 bug 1406391 - Lock toolkit.telemetry.enabled based on channel r=froydnj
In Unified Telemetry toolkit.telemetry.enabled controls whether we send base
collection data or extended collection. The difference is mostly in volume, not
in kind (though extended collection has a little stricter testing and monitoring
requirements).

Since the Preferences UI change in Firefox 56, users no longer have the ability
to change toolkit.telemetry.enabled. This is a good thing as for pre-release
users very few disabled extended collection, and even fewer release users
enabled it. This provides uniform collection based on channel which should
eventually net us some efficiencies.

Until then we need to align our use of the toolkit.telemetry.enabled pref with
the UI change that has already shipped. This is accomplished by locking t.t.e
to 'true' on pre-release channels and locking it to 'false' on everything else.

This doesn't apply to Android as it doesn't (yet) use Unified Telemetry. t.t.e
means something rather different there.

MozReview-Commit-ID: EOpWm8b0jWA
2017-10-30 10:47:39 -04:00
Nicholas Nethercote 9252435548 Bug 1410794 (attempt 2) - Change some |string| occurrences in nsIPrefBranch.idl to |ACString|. r=erahm.
This makes the code nicer. In particular, it removes many getter_Copies()
calls. The patch also converts a lot of nsCStrings to nsAutoCString, which will
avoid heap allocation in the common case.

The patch also renames PREF_CopyCharPref() as PREF_GetCStringPref(), because
it's actually getting a string, not a char, and that matches the existing
GetCString() and GetDefaultCString() methods. Correspondingly, it also renames
PREF_SetCharPref() as PREF_SetCStringPref().

The |aPrefName| arguments in nsIPrefBranch.idl remain as |string| because they
almost always involve passing in C string literals, and passing "foo" is much
nicer than passing NS_LITERAL_CSTRING("foo").

It's worth noting that early versions of this patch used |AUTF8String| instead
of |ACString|. But it turns out that libpref stores prefs internally as Latin1.
And |ACString| is compatible with Latin1 but |AUTF8String| isn't, because
non-ASCII Latin1 strings are not valid UTF-8!

MozReview-Commit-ID: D3f7a1Vl1oE

--HG--
extra : rebase_source : e6e4b15d6d210cfd93686f96400281f02bd1d06b
2017-10-27 10:30:33 +11:00
Phil Ringnalda 4bc2b1615d Backed out 4 changesets (bug 1408433, bug 1406391, bug 1408512) for crashing tests by touching the network contacting incoming.telemetry.mozilla.org on nightly builds
Backed out changeset 9bfd4b0927dc (bug 1408433)
Backed out changeset 555850d5107e (bug 1408512)
Backed out changeset 15d959b9123e (bug 1406391)
Backed out changeset e1f34ba9cecc (bug 1406391)

MozReview-Commit-ID: BVoGRsD73Hf
2017-10-27 21:08:27 -07:00
Chris H-C be62507aa8 bug 1406391 - Lock toolkit.telemetry.enabled based on channel r=froydnj
In Unified Telemetry toolkit.telemetry.enabled controls whether we send base
collection data or extended collection. The difference is mostly in volume, not
in kind (though extended collection has a little stricter testing and monitoring
requirements).

Since the Preferences UI change in Firefox 56, users no longer have the ability
to change toolkit.telemetry.enabled. This is a good thing as for pre-release
users very few disabled extended collection, and even fewer release users
enabled it. This provides uniform collection based on channel which should
eventually net us some efficiencies.

Until then we need to align our use of the toolkit.telemetry.enabled pref with
the UI change that has already shipped. This is accomplished by locking t.t.e
to 'true' on pre-release channels and locking it to 'false' on everything else.

This doesn't apply to Android as it doesn't (yet) use Unified Telemetry. t.t.e
means something rather different there.

MozReview-Commit-ID: EOpWm8b0jWA
2017-10-27 10:59:36 -04:00
Nicholas Nethercote 63f0f0af1c Bug 1411480 (attempt 2) - Change PrefSaveData's element type. r=glandium.
Because nsCString is nicer than UniqueFreePtr<char>.

The patch also streamlines pref_savePrefs(). And also changes StrEscape() to
always put quotations around the result, because that's needed in both call
sites.

MozReview-Commit-ID: HT7HZz4QiSN

--HG--
extra : rebase_source : 442bb6002e004803a9ecb637239a000f11ec5774
2017-10-26 16:48:11 +11:00
Nicholas Nethercote bfdd7e8e70 Bug 1411480 (attempt 2) - Simplify pref_HashPref()'s workings. r=glandium.
First, the patch removes the return values from PrefTypeFlags::Set*(). They
allow chained calls, but they're barely used and they just make the code harder
to read.

Second, the patch changes pref_SetValue() to not modify and return the pref
flags. It's clearer if the flags changing is done separately. This requires
passing pref_SetValue() the old type instead of the flags.

MozReview-Commit-ID: HZVS2TIlBIY

--HG--
extra : rebase_source : 6638244214cda15ceae5a1930659aed434d8261b
2017-10-26 16:36:17 +11:00
Nicholas Nethercote 7a6dc9eed0 Bug 1411480 (attempt 2) - Make CallbackNode::mDomain const. r=glandium.
MozReview-Commit-ID: EvLC5FrMyKy

--HG--
extra : rebase_source : f31ddbc01716a539ad3a92154de1a6a49ad9a42a
2017-10-26 16:27:12 +11:00
Nicholas Nethercote 6e67b39c9c Bug 1411480 (attempt 2) - Make PrefValue::mStringVal const. r=glandium.
This makes it clear that the stored string values are never modified.

It requires some const_casts to free the strings, but that feels like an ok
trade-off.

MozReview-Commit-ID: JikBT3uwpfq

--HG--
extra : rebase_source : 1720969ba2c1ae245dff91a6d3a85d48fb669ced
2017-10-26 16:27:09 +11:00
Nicholas Nethercote ad06d5cebc Bug 1411480 (attempt 2) - Use |private| instead of |protected| in nsPrefBranch. r=glandium.
There's not much use using |protected| in a |final| class.

MozReview-Commit-ID: IECyfNGZsL5

--HG--
extra : rebase_source : e734b360c18e5e040bea186d5aedf91137711861
2017-10-26 16:26:24 +11:00
Nicholas Nethercote 2c49c63d40 Bug 1411480 (attempt 2) - Remove pref_savePrefs()'s argument. r=glandium.
It's always gHashTable, and all the other functions in this file work directly
on gHashTable rather than taking a parameter.

MozReview-Commit-ID: BDCEvcMlo8P

--HG--
extra : rebase_source : 8f136c100f2a4f7b2b34cfa884b8cc91c2d80e3a
2017-10-26 16:26:24 +11:00
Nicholas Nethercote 5f344fea70 Bug 1411480 (attempt 2) - Remove the machinery for choosing the dirty callback. r=glandium.
It's unnecessarily general, because we only ever use
Preferences::DirtyCallback() as the callback.

And because it's no longer a callback, the patch renames DirtyCallback() as
HandleDirty().

MozReview-Commit-ID: Hl50dcxfVQq

--HG--
extra : rebase_source : 5807d2ed650466f85cd7325f2adccdc177ccb4d2
2017-10-26 16:14:01 +11:00
Nicholas Nethercote 0416bcac82 Bug 1411480 (attempt 2) - Inline and remove PREF_GetPrefType(). r=glandium.
It has a single call site.

MozReview-Commit-ID: o5CwR8Od7o

--HG--
extra : rebase_source : 85663f6414ae7214d2ba32a0bb3b3166da2c89c5
2017-10-26 16:14:00 +11:00
Nicholas Nethercote 9e821ded90 Bug 1411480 (attempt 2) - Inline and remove pref_[SG]etInitPhase(). r=glandium.
They both have a single use.

MozReview-Commit-ID: 4Jj64B6NV0o

--HG--
extra : rebase_source : 19c1d93393688daee5b7670be241785639df81d2
2017-10-26 16:14:00 +11:00
Nicholas Nethercote 3418db65be Bug 1411480 (attempt 2) - Inline and remove pref_SetWatchingPref(). r=glandium.
It's simple enough that having a separate function isn't helpful.

MozReview-Commit-ID: Ke9BIfp9yHU

--HG--
extra : rebase_source : 57aee451b8fd3450da4a604cefbf9fafda894b1c
2017-10-26 16:14:00 +11:00
Nicholas Nethercote dc68184056 Bug 1411480 (attempt 2) - Inline and remove the parser's pref_DoCallback() function. r=glandium.
Preferences.cpp has two functions named pref_DoCallback(). One of them has a
single use in the parser. This patch inlines that single use to remove the name
duplication.

MozReview-Commit-ID: HnyteQ0N5M1

--HG--
extra : rebase_source : 37a34f3fbe866eee71a7bf0bba07d9d67cc8c81d
2017-10-26 15:32:15 +11:00
Kris Maglione 257d9118dc Bug 1409249: Require singleton constructors to return explicit already_AddRefed. r=froydnj
Right now, NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR expects singleton
constructors to return already-addrefed raw pointers, and while it accepts
constructors that return already_AddRefed, most existing don't do so.

Meanwhile, the convention elsewhere is that a raw pointer return value is
owned by the callee, and that the caller needs to addref it if it wants to
keep its own reference to it.

The difference in convention makes it easy to leak (I've definitely caused
more than one shutdown leak this way), so it would be better if we required
the singleton getters to return an explicit already_AddRefed, which would
behave the same for all callers.


This also cleans up several singleton constructors that left a dangling
pointer to their singletons when their initialization methods failed, when
they released their references without clearing their global raw pointers.

MozReview-Commit-ID: 9peyG4pRYcr

--HG--
extra : rebase_source : 2f5bd89c17cb554541be38444672a827c1392f3f
2017-10-16 21:08:42 -07:00
Phil Ringnalda 535f8401d0 Backed out 11 changesets (bug 1411480) for libpref xpcshell test failures
Backed out changeset 0f266ffacf0d (bug 1411480)
Backed out changeset 75212b4a8c0a (bug 1411480)
Backed out changeset 0c807a8e8b29 (bug 1411480)
Backed out changeset 21324f73db0c (bug 1411480)
Backed out changeset f7de6fa0ef2c (bug 1411480)
Backed out changeset b7cdbe5153fa (bug 1411480)
Backed out changeset 8a66ec3e8338 (bug 1411480)
Backed out changeset 3fdf2ac7762d (bug 1411480)
Backed out changeset eaa177ef5f60 (bug 1411480)
Backed out changeset e87ba9542cf8 (bug 1411480)
Backed out changeset f1cf84a50ebc (bug 1411480)

MozReview-Commit-ID: GEVRPZp5eSH
2017-10-25 20:03:25 -07:00
Nicholas Nethercote 14790e76d7 Bug 1411480 - Make CallbackNode::mDomain const. r=glandium.
MozReview-Commit-ID: EvLC5FrMyKy

--HG--
extra : rebase_source : d5998326dd40365903554094b9038248095020dc
2017-10-26 12:29:41 +11:00
Nicholas Nethercote 9222ab2401 Bug 1411480 - Make PrefValue::mStringVal const. r=glandium.
This makes it clear that the stored string values are never modified.

It requires some const_casts to free the strings, but that feels like an ok
trade-off.

MozReview-Commit-ID: JikBT3uwpfq

--HG--
extra : rebase_source : e611e57de4f059275ae2908f7300065cf953461d
2017-10-26 12:29:34 +11:00
Nicholas Nethercote 9702633811 Bug 1411480 - Change PrefSaveData's element type. r=glandium.
Because nsCString is nicer than UniqueFreePtr<char>.

The patch also streamlines pref_savePrefs(). And also changes StrEscape() to
always put quotations around the result, because that's needed in both call
sites.

MozReview-Commit-ID: HT7HZz4QiSN

--HG--
extra : rebase_source : f8d26a8c9f7ea911272113efc56744df639c5ccf
2017-10-25 10:22:39 +11:00
Nicholas Nethercote d7b5b4b246 Bug 1411480 - Use |private| instead of |protected| in nsPrefBranch. r=glandium.
There's not much use using |protected| in a |final| class.

MozReview-Commit-ID: IECyfNGZsL5

--HG--
extra : rebase_source : bc9597ee45583e809f89f7e558cc325460390f98
2017-10-25 10:22:39 +11:00
Nicholas Nethercote e52452101f Bug 1411480 - Remove pref_savePrefs()'s argument. r=glandium.
It's always gHashTable, and all the other functions in this file work directly
on gHashTable rather than taking a parameter.

MozReview-Commit-ID: BDCEvcMlo8P

--HG--
extra : rebase_source : e5d10e42401136a9a82d665d9717cf71ecf7e4ae
2017-10-25 10:22:39 +11:00
Nicholas Nethercote f357e38587 Bug 1411480 - Simplify pref_HashPref()'s workings. r=glandium.
First, the patch removes the return values from PrefTypeFlags::Set*(). They
allow chained calls, but they're barely used and they just make the code harder
to read.

Second, the patch changes pref_SetValue() to not modify and return the pref
flags. It's clearer if the flags changing is done separately. This requires
passing pref_SetValue() the old type instead of the flags.

MozReview-Commit-ID: HZVS2TIlBIY

--HG--
extra : rebase_source : 32950f00975f7d9df63fa0af1c36e82b58516245
2017-10-25 10:22:39 +11:00
Nicholas Nethercote 74915ed170 Bug 1411480 - Remove the machinery for choosing the dirty callback. r=glandium.
It's unnecessarily general, because we only ever use
Preferences::DirtyCallback() as the callback.

And because it's no longer a callback, the patch renames DirtyCallback() as
HandleDirty().

MozReview-Commit-ID: Hl50dcxfVQq

--HG--
extra : rebase_source : f453d31215de3fdb0c5b6176becf2669e7ad55f1
2017-10-25 10:22:38 +11:00
Nicholas Nethercote 21290f6159 Bug 1411480 - Inline and remove PREF_GetPrefType(). r=glandium.
It has a single call site.

MozReview-Commit-ID: o5CwR8Od7o

--HG--
extra : rebase_source : 2f24a0bc7fa65af8cb60b820982c8d6cb8ee5298
2017-10-25 10:22:38 +11:00
Nicholas Nethercote 5eeb08fa63 Bug 1411480 - Inline and remove pref_[SG]etInitPhase(). r=glandium.
They both have a single use.

MozReview-Commit-ID: 4Jj64B6NV0o

--HG--
extra : rebase_source : 51297caa052281544383bc76f120b4b62b686015
2017-10-25 10:22:38 +11:00
Nicholas Nethercote 49e302c18e Bug 1411480 - Inline and remove pref_SetWatchingPref(). r=glandium.
It's simple enough that having a separate function isn't helpful.

MozReview-Commit-ID: Ke9BIfp9yHU

--HG--
extra : rebase_source : de1518544ddb28185635628c33d356ab07480c1c
2017-10-25 10:22:38 +11:00
Nicholas Nethercote 529db19e62 Bug 1411480 - Inline and remove the parser's pref_DoCallback() function. r=glandium.
Preferences.cpp has two functions named pref_DoCallback(). One of them has a
single use in the parser. This patch inlines that single use to remove the name
duplication.

MozReview-Commit-ID: HnyteQ0N5M1

--HG--
extra : rebase_source : 93f963d3ba445c1c3a482fa95dbab33e57dae188
2017-10-25 10:22:38 +11:00
Phil Ringnalda 93456fb0f4 Backed out changeset 3d0093f961ee (bug 1410794) for Mac plugin crashes and Android test_worker_interfaces.html failures
MozReview-Commit-ID: 20UosHyIr0t
2017-10-24 22:46:36 -07:00
Nicholas Nethercote a861772b10 Bug 1410794 - Change some |string| occurrences in nsIPrefBranch.idl to |ACString|. r=erahm.
This makes the code nicer. In particular, it removes many getter_Copies()
calls. The patch also converts a lot of nsCStrings to nsAutoCString, which will
avoid heap allocation in the common case.

The patch also renames PREF_CopyCharPref() as PREF_GetCStringPref(), because
it's actually getting a string, not a char, and that matches the existing
GetCString() and GetDefaultCString() methods. Correspondingly, it also renames
PREF_SetCharPref() as PREF_SetCStringPref().

The |aPrefName| arguments in nsIPrefBranch.idl remain as |string| because they
almost always involve passing in C string literals, and passing "foo" is much
nicer than passing NS_LITERAL_CSTRING("foo").

It's worth noting that early versions of this patch used |AUTF8String| instead
of |ACString|. But it turns out that libpref stores prefs internally as Latin1.
And |ACString| is compatible with Latin1 but |AUTF8String| isn't, because
non-ASCII Latin1 strings are not valid UTF-8!

--HG--
extra : rebase_source : 725ccf57943283a60ef8c9d654afe4515b4089f8
2017-10-25 10:22:38 +11:00
Nicholas Nethercote ce583d5ebe Bug 1410765 (part 3) - Remove nsPrefBranch::RemoveObserverFromMap declaration. r=glandium.
--HG--
extra : rebase_source : ab40d0f3430c9259a4fa4cc7fed3f114a946c158
2017-10-25 10:22:37 +11:00
Nicholas Nethercote c67dabae5c Bug 1410765 (part 2) - Redo clang-format on libpref/. r=glandium.
--HG--
extra : rebase_source : 7bf014830baec7abfab51f71ac89a5bc3bec1860
2017-10-25 10:22:37 +11:00
Nicholas Nethercote 91f9b1d8e1 Bug 1410765 (part 1) - Remove unused PrefTypeFlags values. r=glandium.
--HG--
extra : rebase_source : f5d4ac642ddbfc720891c7a72cf735e0f77a460a
2017-10-25 10:22:37 +11:00
Andrea Marchesini ec610d5b7e Bug 1409329 - NS_NewBufferedOutputStream should take the ownership of the outputStream, r=smaug 2017-10-24 14:38:23 +02:00
Nicholas Nethercote b94945fed2 Bug 1407494 (follow-up) - Revert operator new use to malloc(), to pair with free(). r=glandium.
--HG--
extra : rebase_source : 5fd9221d7a0509e0c094767e66661be0d9ff1688
2017-10-18 16:31:23 +11:00
Nicholas Nethercote ddf867ccad Bug 1409635 (part 2) - Fix up nsIPrefLocalizedString. r=froydnj.
nsIPrefLocalizedString is meant to be a wrapper for nsISupportsString,
basically identical but with a different identifier. But it's not a
sub-interface of nsISupportsString. Instead it (almost) duplicates
nsISupportsString's internals.

Specifically, nsISupportsString has `attribute AString data`, resulting in
these C++ methods:

> NS_IMETHOD GetData(nsAString& aData)
> NS_IMETHOD SetData(const nsAString& aData)

nsIPrefLocalizedString has `attribute wstring data`, resulting in these C++
methods:

> NS_IMETHOD GetData(char16_t** aData)
> NS_IMETHOD SetData(const char16_t* aData)

Then we have nsPrefLocalizedString, the concrete subclass of
nsIPrefLocalizedString. It implements the AString methods via
NS_FORWARD_NSISUPPORTSSTRING, which forwards to mUnicodeString. It also
implements the wstring methods explicitly, and they just call the AString
methods. It's all a bit of a mess.

(Both interfaces also have `wstring toString()`. The forwarding works more
smoothly for that method.)

This patch changes nsIPrefLocalizedString so it is a trivial sub-interface of
nsISupportsString. This change eliminates the need for the wstring methods, so
the patch removes them as well. The net result is we have less code, and fewer
conversions between C strings and Gecko strings. The patch also merges the
nsISupportsString and nsIPrefLocalizedString cases in
nsPrefBranch::SetComplexValue(), because they are now identical. (The
nsISupportsString and nsIPrefLocalizedString cases in
nsPrefBranch::GetComplexValue() remain distinct; indeed, that's the whole
reason for having them as separate interfaces.)
2017-10-18 16:51:56 +11:00
Nicholas Nethercote 380feab757 Bug 1409635 (part 1) - Remove nsIPrefLocalizedString::setDataWithLength. r=froydnj.
It's unused.
2017-10-18 16:39:52 +11:00