Commit Graph

50 Commits

Author SHA1 Message Date
Andrew McCreight
f9c73e6cf3 Bug 1272707, part 2 - Limit the size of preference values sent to child processes. r=bsmedberg
Don't send any preferences that have a string value that is longer
than MAX_ADVISABLE_PREF_LENGTH. This is intended to mitigate OOM
issues, as I've seen a parent process crash trying to create a 100mb
message to send to the child. Such users likely cannot use e10s at
all.

This has a test for all combinations of setting the default and user
values of a preference to large or small string values, or not setting
them at all.

I manually verified that filtering out preferences reduces the size of
the IPC::Message that is sent to the child by printing out the size of
the reply message in PContentParent::OnMessageReceived().
2016-05-17 07:55:49 -07:00
Matt Woodrow
6451cce121 Bug 1267868 - Make AddXXXVarCache only match exact prefs, not prefixes. r=froydnj 2016-05-04 12:26:04 +12:00
Kyle Huey
c73656947b Bug 1265927: Move nsRunnable to mozilla::Runnable, CancelableRunnable to mozilla::CancelableRunnable. r=froydnj 2016-04-25 17:23:21 -07:00
Milan Sreckovic
779e30cf76 Bug 278878: Send preference parsing errors to browser console. r=bsmedberg
MozReview-Commit-ID: 61mi71dZbO8

--HG--
extra : rebase_source : 87e32940aa557acd809ba0753fda08caf70ed0f9
2016-04-22 15:35:01 -04:00
Julian Seward
96a413ffed Bug 1248915 - TSan: data race on global 'mozilla::net::CacheObserver::sDiskCacheCapacity'. r=honzab.moz, n.nethercote. 2016-03-20 10:08:57 +01:00
Milan Sreckovic
eefe011285 Bug 1249157 - prefapi enums into class enums, explicit conversion, cleanup. r=bsmedberg 2016-02-22 09:15:00 +01:00
Wes Kocher
952924118d Backed out changeset dd911452e3f7 (bug 1249157) for build bustage CLOSED TREE
--HG--
extra : commitid : 9S2zNfX2mUX
2016-02-22 09:05:21 -08:00
Milan Sreckovic
3336950f44 Bug 1249157: prefapi enums into class enums, explicit conversion, cleanup. r=bsmedberg
MozReview-Commit-ID: nvvOD8ajV4

--HG--
extra : rebase_source : cbdaea69100559893e8386c3618a5594ff38433d
2016-02-18 13:27:06 -05:00
Nicholas Nethercote
9fed28582d Bug 1245393 - Measure s{,Default}RootBranch in the Preferences memory reporter. r=froydnj. 2016-02-03 17:30:54 +11:00
Nicholas Nethercote
b80cb9f1e0 Bug 1244982 - Fix minor double-reporting of memory in prefs code. r=erahm.
--HG--
extra : rebase_source : 3d93515169f0355aeb6ac074d13564bfedec2b57
2016-02-02 14:31:49 +11:00
Nathan Froyd
ddf1ea7512 Bug 1233234 - part 3 - clean up UniquePtr usage in WritePrefFile; r=njn
We shouldn't use .get() on UniquePtr<T[]> unless we have to, and it
makes the code clearer to not use pointer incrementing in any event.
2015-12-06 09:11:55 -05:00
Nathan Froyd
b88ea2e0d7 Bug 1233234 - part 2 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in pref_savePrefs; r=njn
Returning outparams with UniquePtr is not convenient or idiomatic, so in
addition to removing nsAutoArrayPtr usage, let's return a UniquePtr from
the function directly.
2015-12-06 09:06:02 -05:00
Nathan Froyd
bd9c024bdb Bug 1233234 - part 1 - use UniquePtr<T[]> instead of nsAutoArrayPtr<T> in openPrefFile; r=njn 2015-12-06 08:13:36 -05:00
Birunthan Mohanathas
1cc56207d5 Bug 1227569 - Remove unsupported OpenVMS code. r=mccr8 2015-12-18 15:02:50 +02:00
Nicholas Nethercote
7e4bd1e0e1 Bug 1187152 (part 3) - Replace nsBaseHashtable::Enumerate() calls in modules/ with iterators. r=froydnj. 2015-11-22 18:52:40 -08:00
Nathan Froyd
65fd1f7783 Bug 1219310 - part 2 - keep track of how much pref file we have read; r=njn
Looking at a preference file read with strace typically looks like:

open("...", O_RDONLY) = X
...
read(X, "...", SIZE) = SIZE
read(X, "...", SIZE) = 0
...

There's no reason to call Read() and make another syscall to determine
there's no data left for reading.  We can keep track of how much we've
read at minimal cost and thus determine for ourselves when we are done.
2015-10-28 12:19:03 -04:00
Nathan Froyd
17b7d5be31 Bug 1219310 - part 1 - ask the prefs file for its size directly; r=njn
Calling nsIInputStream::Available on nsIFileInputStreams is relatively
expensive, as it requires three system calls: one to determine the
current file position, one to seek to the end file position, and one to
rewind to the previous file position.

We can do better by asking the file for its size directly, prior to
opening the stream.  This only requires one system call, stat, and is
thus superior--at least in considering the number of system calls.
2015-10-28 12:16:33 -04:00
Nathan Froyd
01583602a9 Bug 1207245 - part 6 - rename nsRefPtr<T> to RefPtr<T>; r=ehsan; a=Tomcat
The bulk of this commit was generated with a script, executed at the top
level of a typical source code checkout.  The only non-machine-generated
part was modifying MFBT's moz.build to reflect the new naming.

CLOSED TREE makes big refactorings like this a piece of cake.

 # The main substitution.
find . -name '*.cpp' -o -name '*.cc' -o -name '*.h' -o -name '*.mm' -o -name '*.idl'| \
    xargs perl -p -i -e '
 s/nsRefPtr\.h/RefPtr\.h/g; # handle includes
 s/nsRefPtr ?</RefPtr</g;   # handle declarations and variables
'

 # Handle a special friend declaration in gfx/layers/AtomicRefCountedWithFinalize.h.
perl -p -i -e 's/::nsRefPtr;/::RefPtr;/' gfx/layers/AtomicRefCountedWithFinalize.h

 # Handle nsRefPtr.h itself, a couple places that define constructors
 # from nsRefPtr, and code generators specially.  We do this here, rather
 # than indiscriminantly s/nsRefPtr/RefPtr/, because that would rename
 # things like nsRefPtrHashtable.
perl -p -i -e 's/nsRefPtr/RefPtr/g' \
     mfbt/nsRefPtr.h \
     xpcom/glue/nsCOMPtr.h \
     xpcom/base/OwningNonNull.h \
     ipc/ipdl/ipdl/lower.py \
     ipc/ipdl/ipdl/builtin.py \
     dom/bindings/Codegen.py \
     python/lldbutils/lldbutils/utils.py

 # In our indiscriminate substitution above, we renamed
 # nsRefPtrGetterAddRefs, the class behind getter_AddRefs.  Fix that up.
find . -name '*.cpp' -o -name '*.h' -o -name '*.idl' | \
    xargs perl -p -i -e 's/nsRefPtrGetterAddRefs/RefPtrGetterAddRefs/g'

if [ -d .git ]; then
    git mv mfbt/nsRefPtr.h mfbt/RefPtr.h
else
    hg mv mfbt/nsRefPtr.h mfbt/RefPtr.h
fi

--HG--
rename : mfbt/nsRefPtr.h => mfbt/RefPtr.h
2015-10-18 01:24:48 -04:00
Xidorn Quan
f062c6a861 Bug 1213123 - Make Preferences::SetString accept char16ptr_t instead of char16_t*. r=froydnj
--HG--
extra : source : 201ba51e2d2c674f3b6088ac255e2e6331d1a162
2015-10-10 12:19:23 +11:00
Nicholas Nethercote
647b520991 Bug 1201135 - Rename pldhash.{h,cpp} to PLDHashTable.{h,cpp}. r=mccr8.
--HG--
rename : xpcom/glue/pldhash.cpp => xpcom/glue/PLDHashTable.cpp
rename : xpcom/glue/pldhash.h => xpcom/glue/PLDHashTable.h
extra : rebase_source : 06b9d30db96ed78500fd44d9c0b51609103508a3
2015-09-15 20:49:53 -07:00
Nicholas Nethercote
d98d14fa1e Bug 1189156 (part 4) - Don't use enumeration style for nsBaseHashtable::SizeOf{In,Ex}cludingThis(). r=erahm,jfkthame.
After this change, we have ShallowSizeOf{In,Ex}cludingThis(), which don't do
anything to measure children. (They can be combined with iteration to measure
children.)

--HG--
extra : rebase_source : f98420176f50990bbc5a25e35788328154cfeb00
2015-07-30 21:19:57 -07:00
Nicholas Nethercote
2d56c1f52e Bug 1189156 (part 1) - Don't use enumeration style for PLDHashTable::SizeOf{In,Ex}cludingThis(). r=froydnj.
After this change, we have PLDHashTable::ShallowSizeOf{In,Ex}cludingThis(),
which don't do anything to measure children. (They can be combined with
iteration to measure children.)

This patch also removes the PL_DHashTableSizeOf{In,Ex}cludingThis() functions.
They're not necessary because the methods can be used instead.

Finally, the patch deliberately converts some SizeOfExcludingThis() calls to
SizeOfIncludingThis(). These are all done on heap pointers so this change is
valid.

--HG--
extra : rebase_source : b1d51096a8e7dcac29d7efd92e28938836ff5481
2015-07-29 22:28:20 -07:00
Nicholas Nethercote
87b80f8c66 Bug 1188745 - Rename nsTArray::SizeOfExcludingThis() as ShallowSizeOfExcludingThis(). r=froydnj.
This makes it clearer that, unlike how SizeOf*() functions usually work, this
doesn't measure any children hanging off the array.

And do likewise for nsTObserverArray.

--HG--
extra : rebase_source : 6a8c8d8ffb53ad51b5773afea77126cdd767f149
2015-07-28 23:24:24 -07: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
Emanuel Hoogeveen
7d1e52f2ff Bug 905127 - Part 1 - Make some functions from nsNetUtil not inline. r=jduell 2015-07-07 04:17:00 +02:00
Juan Gomez
258ad59e3f Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj 2015-07-03 18:29:00 -07:00
Nicholas Nethercote
a38880a83a Bug 1176159 (part 2) - Remove uses of PL_DHashTableEnumerate() from libpref. r=bsmedberg.
--HG--
extra : rebase_source : 15488918c1d6b4f7cc994016485d0619061d51a9
2015-06-18 17:58:24 -07:00
Nicholas Nethercote
7320c1e183 Bug 1176159 (part 1) - Remove pref_SaveTypes. r=bsmedberg.
Because SAVE_ALL is the only value ever used.

--HG--
extra : rebase_source : fbbb49dc8cc5051913d62102581db86a1fa8db49
2015-06-18 16:44:35 -07:00
Ryan VanderMeulen
5f5c327690 Backed out changeset 8b4e4083639e (bug 1171931) for B2G debug emulator bustage. 2015-06-25 19:48:42 -04:00
Juan Gomez
702a59d135 Bug 1171931 - Refactor duplicated code using XRE_IsParent/ContentProcess. r=froydnj
--HG--
extra : rebase_source : 2ecbe6c1dd8a7ad8dc529b53349ad431cf1116c9
2015-06-24 14:11:00 -04:00
Nicholas Nethercote
638d83d097 Bug 1171309 - Remove PREF_Init()'s return value. r=bsmedberg.
This is now possible because PLDHashTable initialization is infallible.

--HG--
extra : rebase_source : 395605d27234d97f52125aa78b9446614649ffec
2015-06-04 16:14:48 -07:00
Nicholas Nethercote
86da9069cd Bug 1165768 (part 7) - Convert |gHashTable| to |PLDHashTable2*|. r=froydnj.
--HG--
extra : rebase_source : 26bab7a5ffdc8759d3391288d80552e44ccd6138
2015-05-18 00:52:08 -07:00
Nicholas Nethercote
eab9ff6d25 Back out all four patches from bug 1161377. r=me.
Due to Android startup regressions (bug 1163066) and plugin crashes (bug
1165155).

--HG--
extra : rebase_source : 380f79e67dff4c4eaa2614f286a4d0669666b652
2015-05-14 21:48:43 -07:00
Nicholas Nethercote
9a60518e5b Bug 1161377 (part 2.5) - Move all static PLDHashTable instances onto the heap to avoid static constructors. r=froydnj.
--HG--
extra : rebase_source : 73029d4a1ed5a41263db882d66b1f380f5e7254b
2015-05-12 17:33:22 -07:00
Mike Hommey
924c9eb636 Bug 1134923 - Remove NS_Alloc/NS_Realloc/NS_Free. r=nfroyd
They are kept around for the sake of the standalone glue, which is used
for e.g. webapprt, which doesn't have direct access to jemalloc, and thus
still needs a wrapper to go through the xpcom function list and get to
jemalloc from there.
2015-05-01 09:40:30 +09:00
Kartikaya Gupta
cd5b55f8d6 Bug 1039866 - Rip out a bunch of metro-only code. r=jimm,gavin,rstrong 2015-04-23 15:10:30 -04:00
Nathan Froyd
4c7234747e Bug 1143651 - don't use CallQueryInterface when the compiler can do the cast for us; r=ehsan 2015-03-12 13:20:29 -04:00
Andrea Marchesini
e6f385fb3d Bug 1148527 - Indentation fix after bug 1145631, r=ehsan 2015-03-27 18:52:19 +00:00
Ehsan Akhgari
883849ee32 Bug 1145631 - Part 1: Replace MOZ_OVERRIDE and MOZ_FINAL with override and final in the tree; r=froydnj
This patch was automatically generated using the following script:

function convert() {
echo "Converting $1 to $2..."
find . \
       ! -wholename "*/.git*" \
       ! -wholename "obj-ff-dbg*" \
         -type f \
      \( -iname "*.cpp" \
         -o -iname "*.h" \
         -o -iname "*.c" \
         -o -iname "*.cc" \
         -o -iname "*.idl" \
         -o -iname "*.ipdl" \
         -o -iname "*.ipdlh" \
         -o -iname "*.mm" \) | \
    xargs -n 1 sed -i -e "s/\b$1\b/$2/g"
}

convert MOZ_OVERRIDE override
convert MOZ_FINAL final
2015-03-21 12:28:04 -04:00
Nicholas Nethercote
63e3218e4c Back out changesets 2fcef6b54be7, 2be07829fefc, 66dfe37b8532, df3fcd2be8fd, 0a436bce77a6 (bug 1050035) for causing intermittent crashes and assertion failures.
--HG--
extra : rebase_source : eb30be83c3143c6c203585a80a18f180025efaba
2015-02-10 14:39:49 -08:00
Nicholas Nethercote
9a36fdbde4 Bug 1050035 (part 2) - Remove the fallible version of PL_DHashTableInit(). r=froydnj,mrbkap.
Because it's no longer needed now that entry storage isn't allocated there.
(The other possible causes of failures are much less interesting and simply
crashing is a reasonable thing to do for them.)

This also makes PL_DNewHashTable() infallible.

--HG--
extra : rebase_source : 848cc9bbdfe434525857183b8370d309f3acbf49
2015-02-01 20:19:08 -08:00
Nicholas Nethercote
8bd1f6f072 Bug 1123151 (part 2) - Add PLDHashTable::IsInitialized(). r=froydnj.
This encapsulates most of the uses of PLDHashTable::ops.

--HG--
extra : rebase_source : 7760ce8e46a37e87dcfe590e809a21df01fe510f
2015-01-19 16:11:34 -08:00
Ehsan Akhgari
f15344731a Bug 1116551 - Remove the code to handle shutdown-cleanse from the prefs service; r=bsmedberg
shutdown-cleanse has not been a thing for quite a while.
2015-01-02 17:55:32 -05:00
Irving Reid
bc89cfa2a7 Bug 1056170 - Expose pref service 'dirty' flag and test it. r=bsmedberg 2014-09-04 09:52:28 -04:00
Carsten "Tomcat" Book
4a6706885f Backed out changeset 4a4e0c618649 (bug 1056170) for XPC Test Failures 2014-09-04 09:40:01 +02:00
Irving Reid
8b8bcbdcc3 Bug 1056170 - Expose pref service 'dirty' flag and test it. r=bsemdberg 2014-08-27 22:21:07 -04:00
Ehsan Akhgari
5bffafdd26 Bug 1061061 - Fix more bad implicit constructors in misc. code; r=bsmedberg 2014-09-02 18:24:24 -04:00
Nicholas Nethercote
df1c26a45e Bug 1057912 - Privatize most of PLDHashTable's fields. r=roc.
--HG--
extra : rebase_source : 0f55e70b63d9c191fbd9418cb1177ff534deeed9
2014-08-25 16:56:33 -07:00
Nicholas Nethercote
a7cf4142b4 Bug 1050009 - Initialize pldhash tables with a length, not a capacity. r=roc.
* * *
imported patch rm-dummy-params

--HG--
extra : rebase_source : c25987eb11bae197218d5fc53b77def19afa36ac
2014-08-06 06:31:21 -07:00
Birunthan Mohanathas
0f53566ffe Bug 1047877 - Flatten modules/libpref/{public,src}/ directories. r=bsmedberg
--HG--
rename : modules/libpref/src/Makefile.in => modules/libpref/Makefile.in
rename : modules/libpref/src/Preferences.cpp => modules/libpref/Preferences.cpp
rename : modules/libpref/public/Preferences.h => modules/libpref/Preferences.h
rename : modules/libpref/src/init/all.js => modules/libpref/init/all.js
rename : modules/libpref/public/nsIPrefBranch.idl => modules/libpref/nsIPrefBranch.idl
rename : modules/libpref/public/nsIPrefBranch2.idl => modules/libpref/nsIPrefBranch2.idl
rename : modules/libpref/public/nsIPrefBranchInternal.idl => modules/libpref/nsIPrefBranchInternal.idl
rename : modules/libpref/public/nsIPrefLocalizedString.idl => modules/libpref/nsIPrefLocalizedString.idl
rename : modules/libpref/public/nsIPrefService.idl => modules/libpref/nsIPrefService.idl
rename : modules/libpref/public/nsIRelativeFilePref.idl => modules/libpref/nsIRelativeFilePref.idl
rename : modules/libpref/src/nsPrefBranch.cpp => modules/libpref/nsPrefBranch.cpp
rename : modules/libpref/src/nsPrefBranch.h => modules/libpref/nsPrefBranch.h
rename : modules/libpref/src/nsPrefsFactory.cpp => modules/libpref/nsPrefsFactory.cpp
rename : modules/libpref/src/prefapi.cpp => modules/libpref/prefapi.cpp
rename : modules/libpref/src/prefapi.h => modules/libpref/prefapi.h
rename : modules/libpref/src/prefapi_private_data.h => modules/libpref/prefapi_private_data.h
rename : modules/libpref/src/prefread.cpp => modules/libpref/prefread.cpp
rename : modules/libpref/src/prefread.h => modules/libpref/prefread.h
2014-08-07 21:52:04 -07:00