Commit Graph

91 Commits

Author SHA1 Message Date
Nicholas Nethercote
ac5efebb4b Bug 1486690 - Remove unnecessary checks after moz_xmalloc() calls. r=glandium
There are surprisingly many of them.

(Plus a couple of unnecessary checks after `new` calls that were nearby.)

--HG--
extra : rebase_source : 47b6d5d7c5c99b1b50b396daf7a3b67abfd74fc1
2018-08-28 15:56:01 +10:00
Marco Bonardo
3323710aec Bug 1468968 - Restrict the concept of root icons and remove orphans, to avoid possible privacy leaks. r=Standard8,mikedeboer
Differential Revision: https://phabricator.services.mozilla.com/D2122

--HG--
extra : moz-landing-system : lando
2018-07-25 14:07:06 +00:00
Andrea Marchesini
a053cf1c15 Bug 1476306 - Moving NullPrincipal/ContentPrincipal/SystemPrincipal under mozilla namespace - part 1 - NullPrincipal, r=ckerschb 2018-07-17 21:37:48 +02:00
Dave Townsend
a518f2709e Bug 1469374: Remove code that tracks failed favicon loads. r=mak
Reviewers: mak

Tags: #secure-revision

Bug #: 1469374

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

--HG--
extra : rebase_source : 44e3a25e3c925307281f7a5bda12060aa2ad811a
2018-06-18 15:09:01 -07:00
Valentin Gosu
a8e3a8c349 Bug 1448330 - Make nsIURI.clone a private method r=mayhemer
MozReview-Commit-ID: 1efpeaEPaXP

--HG--
extra : rebase_source : e660f1e5bcae9b7119bc5b37713691069272b375
2018-06-14 13:05:43 +02:00
Andrea Marchesini
1273dc5391 Bug 1446933 - Remove 'using namespace mozilla::net' from BackgroundUtils.h, r=qdot 2018-05-30 21:21:17 +02:00
Marco Bonardo
c8e987256f Bug 1460570 - Merge mozIAsyncFavicons into nsIFaviconService. r=standard8
MozReview-Commit-ID: JAxNj9MfcUI

--HG--
extra : rebase_source : b096792719a74fcf15909ce93f0d9341754009f6
2018-05-10 13:49:00 +02:00
Tom Ritter
449237fc51 Bug 1378552 - Reduce the liklihood of inadvertently misusing NullPrincipal::Create(). r=ckerschb
NullPrincipal::Create() (will null OA) may cause an OriginAttributes bypass.
We change Create() so OriginAttributes is no longer optional, and rename
Create() with no arguments to make it more explicit about what the caller is doing.

MozReview-Commit-ID: 7DQGlgh1tgJ
2018-03-22 13:36:20 -05:00
Chris Peterson
37efe4d0e6 Bug 1428535 - Add missing override specifiers to overridden virtual functions. r=froydnj
MozReview-Commit-ID: DCPTnyBooIe

--HG--
extra : rebase_source : cfec2d96faeb11656d86d760a34e0a04cacddb13
extra : intermediate-source : 6176724d63788b0fe8caa3f91607c2d93dbaa7ec
extra : source : eebbb0600447f9b64aae3bcd47b4be66c02a51ea
2017-11-05 19:37:28 -08:00
Andrea Marchesini
b4057b86a1 Bug 1421655 - Renaming imgITools::decodeImageBuffer to imgITools::decodeImageFromBuffer, r=aosmond 2017-11-30 14:48:47 +01:00
Andrea Marchesini
2ef23c7ade Bug 1420223 - createImageBitmap must work with nsIAsyncInputStream - part 4 - ImageBitmap must use imgITools::decodeImageBuffer, r=aosmond 2017-11-27 17:05:57 +01:00
Marco Bonardo
1daa7b40ab Bug 1347532 - Allow to set a default icon size for the page-icon protocol. r=standard8
MozReview-Commit-ID: KBQYf14iiQw

--HG--
extra : rebase_source : 568f35d153801a43b1f62ba2e73cb0324ea9bbf7
2017-10-17 16:24:55 +02:00
Kris Maglione
6eccf17f33 Bug 1404198: Part 2f - Switch to NS_NewTimer* in toolkit. r=njn
MozReview-Commit-ID: 185rZ99R6zV

--HG--
extra : rebase_source : 5af93b6f4b115be6b970563aedc94ec8a65f527d
2017-10-15 23:14:00 -07:00
Chris Peterson
a0c8081df4 Bug 870698 - Part 4: Replace Equals("") with EqualsLiteral(""). r=erahm
MozReview-Commit-ID: G1GhyvD29WK

--HG--
extra : rebase_source : 115842c37a40041bdca7b4e1ff0a5680b02ced15
extra : source : 90bfff9c01d80086cdc17637f310e898fea295ea
2017-09-06 01:13:45 -07:00
Kershaw Chang
3ccf2143f7 Bug 1247843 - Part 2: Set request context ID for the channel used to load favicon. r=mak
This patch covers two cases when loading a favicon:
1. Get the request context ID of the document load group, when <link rel="icon"> is found in the page.
2. Use the top level document's request context ID when using the default favicon.
2017-09-20 20:09:00 -04:00
Masatoshi Kimura
6815cee2bd Bug 1387790 - Remove [deprecated] decodeImageData from imgITools. r=tnikkel
MozReview-Commit-ID: GZBYTPanHH6

--HG--
extra : rebase_source : f6ccc1a661533f7bdba8bb33bc9a85855b51ffae
2017-08-06 10:54:14 +09:00
Masatoshi Kimura
f143125cc2 Bug 1326520 - Rename nsIURI.path to pathQueryRef. r=valentin.gosu
MozReview-Commit-ID: DqJdTGopR9G

--HG--
extra : rebase_source : e8c9eb03468c075b79013b6e0bd8b367229c24cd
2017-07-29 20:50:21 +09:00
Bevis Tseng
95b18d794e Bug 1382172 - Name nsITimerCallback instances in native implementation. r=billm
--HG--
extra : rebase_source : 84de1abfcc30a6964144c2e6718a508c71027b65
2017-07-27 02:18:20 +08:00
Marco Bonardo
bfc44708bc Bug 1371677 - Delay the database connection in the history service as far as possible. r=adw
Makes initing Places services cheaper, by delaying the connection creation to the first time
it's actually needed.
Same way, delays reading the bookmark roots at the first time they are requested.
Deprecates the concept of lazy observers, since they are no more needed, we can just use addObserver.
Simplifies the startup path: always sends "places-init-complete" (both as a category and a topic) when
the connection starts and adds a "locked" database state when we can't get a working connection.
Makes PlacesCategoriesStarter register for the new category, since it's cheaper than being a bookmarks
observer.
Fixes a couple race conditions in keywords and expiration due to new startup timings.
Removes a test in test_keywords.js that is no more easily feasible, since it'd requires a pre-build
places.sqlite that should be kept up-to-date at every version.

MozReview-Commit-ID: 6ccPUZ651m0

--HG--
extra : rebase_source : 07376076eb42c84caaedeffd75f133d83a6c3d70
2017-06-09 18:51:09 +02:00
Marco Bonardo
dd81367ed0 Bug 1337858 - Replace CopyFavicon in the Docshell with a proper favicons API. r=standard8
MozReview-Commit-ID: 8wjSbj0FTwE

--HG--
extra : rebase_source : 9957affac43f7e04dcd94d2fa9cf2d973cd327de
2017-05-18 16:48:23 +02:00
Marco Bonardo
86127d4723 Bug 1360891 - Places default favicon should supports hi-dpi. r=dao,standard8
MozReview-Commit-ID: 1b0gnDIQJIQ

--HG--
extra : rebase_source : 9429dc510ac469384c364bad44dbba731abe3a3a
2017-05-03 09:31:05 +02:00
Marco Bonardo
6e9ae758b5 Bug 1360477 - Enlarge favicons size limit and rescale bigger icons instead of discarding them. r=adw
The initially guessed limit for favicons is too small, some common favicons are bigger, so this increases it.
Additionally, if an icon is larger than the limit, instead of discarding it we can rescale it down until it fits.

MozReview-Commit-ID: BaijUP9oDMQ

--HG--
extra : rebase_source : 82d4a94ecc68d5185bfd6665184290d5226b85f6
2017-04-27 18:23:31 +02:00
Marco Bonardo
12dcd10d01 Bug 1356567 - root icons should still create a page association if the domain differs. r=adw,kitcambridge
Root domain icons are no more associated with their pages, BUT if the page uses
a root domain icon from another domain, it should still get an association with it
or we couldn't relate the two.

This also fixes an overlooked problem in PlacesTestUtils where Date objects
cross a boundary and fail instanceof checks. This causes failures in the same
test that this patch is modifying.
To protect from future similar issues some protection has been added to updatedPlaces
so that it will crash in debug builds.

MozReview-Commit-ID: 3MTKhGj3ehj

--HG--
extra : rebase_source : 55120252e7ea8abb91f21ca2486deddc43795142
2017-04-14 20:34:27 +02:00
Carsten "Tomcat" Book
16969b40e2 Backed out changeset eb94759f0fcf (bug 1356567) for test failures in own test 2017-04-18 12:58:09 +02:00
Marco Bonardo
5238755b71 Bug 1356567 - root icons should still create a page association if the domain differs. r=adw,kitcambridge
Root domain icons are no more associated with their pages, BUT if the page uses
a root domain icon from another domain, it should still get an association with it
or we couldn't relate the two.

This also fixes an overlooked problem in PlacesTestUtils where Date objects
cross a boundary and fail instanceof checks. This causes failures in the same
test that this patch is modifying.
To protect from future similar issues some protection has been added to updatedPlaces
so that it will crash in debug builds.

MozReview-Commit-ID: 3MTKhGj3ehj

--HG--
extra : rebase_source : e36ba1ab41649927f92fee053c10bf43474a0bcf
2017-04-14 20:34:27 +02:00
Marco Bonardo
abe092f4db Bug 977177 - Invalidate the page-icon image cache when necessary. r=adw
Remove page-icon entries when the icon changes, so that we start showing the
new content.
Also adds an SVG page-icon test.

MozReview-Commit-ID: 10MIOvwbQ20

--HG--
extra : rebase_source : 27775ada780c0c949555d5bed979e57227549bc1
2017-03-31 17:03:25 +02:00
Marco Bonardo
4a1b0e63d5 Bug 977177 - Don't expire root domain icons with history, and don't associate pages to them. r=adw
Root domain icons should be retained as far as possible, and only expired when
a domain is removed from the database. We do that through the moz_hosts trigger.
Additionally, since we return root domain icons without the need for a direct
association, we can save a lot of database space and performance by not storing
associations at all for root domain icons.
This has some downsides, since we don't exactly know if the page was really
associated with that root icon or not, but the perf gains are far superior.
Note that we still create associations during migration, since it would be too
expensive to examine every single url to figure out if it's a root domain icon.

MozReview-Commit-ID: 3mlfcOV8ixC

--HG--
extra : rebase_source : 789300afb5d700095bd83aabf1a37200218ff210
2017-03-30 15:16:41 +02:00
Marco Bonardo
853d935524 Bug 977177 - Split ico files into native frames. r=adw
When optimizing an ico file, split it into its single resources and pick only
the sizes we care about. This also de-dupes same size resources.
The migration path doesn't split ico files, since it's a performance hot path
and we should try to reduce the I/O load at that time. The worst case is that
some icons may not look that much crisp until the next page reload.
Note that while the "resource" naming would be more appropriate for ico files,
compared to "frame" that is more appropriate for animations, the patch still
uses the frame name, cause it's far less generic and can be more easily
associated with the concept of a graphical asset. Regardless, it's not exposed
in any public API.

MozReview-Commit-ID: 3vrGXzJDfjX

--HG--
extra : rebase_source : d3015836abd5f7737cab42a3b102b5d718c692d6
2017-03-28 17:30:28 +02:00
Marco Bonardo
d60220fa1d bug 977177 - Fallback to the root domain icon. r=adw
When an icon for a specific page is not available, try to fallback for the root
domain icon.
This is valid for both getFaviconUrlForPage and getFaviconDataforPage, as well
as the page-icon: protocol.

MozReview-Commit-ID: JC4cx1PAY38

--HG--
extra : rebase_source : f50e0d4d0ab71a0b218c3d7caaa0da149838d148
2017-03-28 11:50:53 +02:00
Marco Bonardo
9683655025 Bug 977177 - Add size ref fragment to icon protocols. r=adw
Both page-icon: and moz-anno:favicon: should support a simple #size=NNN ref
fragment to allow consumers to request a specific sized icon (if available).
The service will do its best to satisfy the request, but it's not guaranteed.
If no size hint is found, it will default to the biggest icon payload available.

It's currently not possible to test the fragment on moz-anno:favicon: since that
requires imagelib support to extract payloads from ico files. Thus a test will
be added at a later time.

MozReview-Commit-ID: G221MKY7rfs

--HG--
extra : rebase_source : 029a6fcaa9dadda24f8d3ebc9b36c1a0ec6314c6
2017-03-15 16:08:28 +01:00
Marco Bonardo
19cfdf37f2 Bug 977177 - Update favicons API consumers. r=adw
Updates consumers to the new behavior.
Some consumers are changed to use  the "page-icon:" protocol, since it's not
trivial to join the icons table and get a single result out of it. In most cases
the join would return multiple results since a page can have multiple icon payloads.
These consumers for now will return the biggest payload, bug 1347532 will fix
some of them to properly pass a #size=NN fragment.
Note that, even before, these were just "moz-anno:favicon:" uris, and the
payload had to be fetched from the database.
Some other consumers for now just fallback to the largest payload, by passing 0
to GetFaviconURLForPage.

The favicon optimization still happens on the main-thread, bug 1346139 will
handle that problem.

Most of the changes involve handling the modified IconData objects, that now
retain an array of payloads, rather than just one. But note that .ico files are
not yet split into single frames, due to imagelib missing APIs that will be handled
in bug 1337402.
The other changes involve fixing queries to properly join with the new tables.

Finally, note that thanks to the FOREIGN KEYS support, removing from moz_icons or
moz_pages_w_icons will also remove relations from moz_icons_to_pages.

The system only supports square icons, so icons are resized based on their larger side.

This doesn't include new tests, those will be in a following changeset.

MozReview-Commit-ID: JUkpquhpS8y

--HG--
rename : toolkit/components/places/tests/unit/test_svg_favicon.js => toolkit/components/places/tests/favicons/test_svg_favicon.js
extra : rebase_source : fa49c4a81d6ab6b34a2f19ee4175e889a6e9d734
2016-09-28 16:14:30 +02:00
Marco Bonardo
eb7475a826 Bug 977177 - Move favicons to a separate store. r=adw
This patch moves favicons blobs to a separate database names favicons.sqlite.
The dabatase is then ATTACHED to the main Places connection, so that its tables
can be used as if they were all part of the same database.
The favicons.database contains 3 tables:
  1. moz_pages_w_icons
     This is the way to join with moz_places, through page_url_hash and page_url.
     We are not using the place id to avoid possible mismatches between places.sqlite
     and favicons.sqlite. This way the database is "portable" and reusable even
     if places.sqlite changes.
  2. moz_icons
     Contains icons payloads, each payload can either be an SVG or a PNG. These
     are the only stored formats, any other format is rescaled and converted to
     PNG. ICO files are split into single frames and stored as multiple PNGs.
     SVG are distinguishable through width == UINT16_MAX
     In future the table will also contain mask-icon color for SVG and average
     color for PNGs.
     The fixed_icon_url_hash is "fixed" to allow quickly fetch root icons, that
     means icons like "domain/favicon.ico" that can also be reused for any page
     under that domain.
  3. moz_icons_to_pages
     This is the relation table between icons and pages.
     Each page can have multiple icons, each icon can be used by multiple pages.
     There is a FOREIGN_KEY constraint between this (child) table and icons
     or pages (parents), so that it's not possible to insert non-existing ids
     in this table, and if an entry is removed from a parent table, the relation
     will be automatically removed from here.
     Note though that removing from the relation table won't remove from the
     parent tables.
Since the relations are now many-many, it's no more possible to simply join
places with the icons table and obtain a single icon, thus it's suggested that
consumers go through the "page-icon" protocol.
The migration process from the old favicons table is async and interruptible,
it will be restarted along with the favicons service until the temp preference
places.favicons.convertPayloads is set to true.


MozReview-Commit-ID: CUCoL9smRyt

--HG--
extra : rebase_source : 4d25966596dcdf63c9c872425c5bf147406d25ac
2016-11-14 16:22:46 +01:00
Andrea Marchesini
1fd1bc3935 Bug 1343933 - Renaming Principal classes - part 2 - NullPrincipal, r=qdot
--HG--
rename : caps/nsNullPrincipal.cpp => caps/NullPrincipal.cpp
rename : caps/nsNullPrincipal.h => caps/NullPrincipal.h
rename : caps/nsNullPrincipalURI.cpp => caps/NullPrincipalURI.cpp
rename : caps/nsNullPrincipalURI.h => caps/NullPrincipalURI.h
2017-03-22 11:38:40 +01:00
Tim Huang
372ec56ff4 Bug 1277803 - Part 1 : Add a new ContentPolicy TYPE_INTERNAL_IMAGE_FAVICON for indicating a favicon loading. r=ckerschb 2016-10-13 15:43:54 +08:00
Wes Kocher
2142de26c1 Backed out 8 changesets (bug 1277803) for browser-chrome test failures a=backout
Backed out changeset 477890efdb88 (bug 1277803)
Backed out changeset 49da326bfe68 (bug 1277803)
Backed out changeset 2d17a40a9077 (bug 1277803)
Backed out changeset b1cb0a195ca1 (bug 1277803)
Backed out changeset c7d82459d152 (bug 1277803)
Backed out changeset 3be9a06248af (bug 1277803)
Backed out changeset 8d119ca96999 (bug 1277803)
Backed out changeset be767a6f7ecd (bug 1277803)
2016-10-12 14:26:00 -07:00
Tim Huang
0ceca5575d Bug 1277803 - Part 1 : Add a new ContentPolicy TYPE_INTERNAL_IMAGE_FAVICON for indicating a favicon loading. r=ckerschb 2016-10-12 17:32:03 +08:00
Christoph Kerschbaumer
c106303453 Bug 1227289 - Default to the NullPrincipal rather than SystemPrincipal for Favicons. r=billm 2016-08-23 10:30:28 +02:00
Drew Willcoxon
b5ff483219 Bug 798223 - Increase optimized favicon dimension in Places database from 16 to 32. r=mak
MozReview-Commit-ID: HTLPQR66HOn
2016-08-02 18:00:07 -07:00
Chris Peterson
b175c9fdd5 Bug 1277106 - Part 2: Expand MOZ_UTF16() strings to u"" string literals. r=Waldo 2016-07-20 22:03:25 -07:00
Marco Bonardo
0bd3c0c381 Bug 1283825 - Add a page-icon protocol to fetch the best icon for a url. r=adw
MozReview-Commit-ID: 3exDniH8Hkm

--HG--
extra : rebase_source : 299b288933f1a826aadffef4e9fab9559a7950ff
2016-06-30 18:17:44 +02:00
Christoph Kerschbaumer
031a59734b Bug 1196013 - Use channel->ascynOpen2 in toolkit/components/places. r=billm r=sicking r=mak 2016-05-23 23:57:31 +02:00
Christoph Kerschbaumer
46fe165877 Bug 1270808 - Add deprecation warning within nsFaviconService.cpp. r=gijs 2016-05-06 13:56:24 +02:00
Marco Bonardo
817566c802 Bug 1269737 - Make AsyncFaviconHelpers more maintainable. r=adw
MozReview-Commit-ID: l0GnzPZK8w

--HG--
rename : toolkit/components/places/AsyncFaviconHelpers.cpp => toolkit/components/places/FaviconHelpers.cpp
rename : toolkit/components/places/AsyncFaviconHelpers.h => toolkit/components/places/FaviconHelpers.h
extra : rebase_source : d164e8d246ee66b555bbd7d4db0d552da5ff2b28
2016-05-06 11:37:26 +02:00
Marco Bonardo
a4b30a4005 Bug 1265420 - SetAndFetchFaviconForPage should return a cancelable object to allow aborting the fetch. r=Gijs
MozReview-Commit-ID: Leu4iZBkP7z

--HG--
extra : rebase_source : 03ac724d128d8d80ecc099af6fa5f84a85a7d02d
2016-05-03 15:42:12 +02:00
Nicholas Nethercote
beb6cb5381 Bug 1187138 (part 3) - Replace nsBaseHashtable::Enumerate() calls in toolkit/ with iterators. r=froydnj.
--HG--
extra : rebase_source : 716759dac80357e3cdf11c2a555ed32c116a84cc
2015-11-24 16:53:46 -08:00
Christoph Kerschbaumer
7dac07e6e4 Bug 1119386 - Part 4: Use document's principal for favicons in toolkit (r=gijs,mak) 2015-11-24 13:32:22 -08: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
Seth Fowler
ee578a0619 Bug 1118926 (Part 1) - Remove remnants of -moz-resolution in C++ code. r=tn 2015-09-30 17:00:52 -07:00
Christoph Kerschbaumer
9f1e9e2eaa Bug 1048048 - add preload content policy types for images (r=seth)
--HG--
extra : source : 88c2333ff7455b6988eb8d6ccc5e92b414a7ccf8
2015-09-20 14:55:59 -07:00
Wes Kocher
cd079d2bf9 Backed out 7 changesets (bug 1048048) for android crashes in various chunks CLOSED TREE
Backed out changeset b5abe23a4ea5 (bug 1048048)
Backed out changeset 4f91b10e8be0 (bug 1048048)
Backed out changeset 450d4a13c90e (bug 1048048)
Backed out changeset 6a727c40eb68 (bug 1048048)
Backed out changeset 88c2333ff745 (bug 1048048)
Backed out changeset 740ab1ecd079 (bug 1048048)
Backed out changeset 02c6d6aef163 (bug 1048048)
2015-09-21 09:08:34 -07:00