This is very similar to the previous patch in this series, but now for the
version of this function with "Async" in the name.
Differential Revision: https://phabricator.services.mozilla.com/D299044
This reverts commit 1ab110ab2f.
Revert "Bug 2037761: Change RegisterStrongMemoryReporter to take already_AddRefed instead of a raw pointer, and update callsites. r=dom-core,smaug"
This reverts commit 2e187ddbc8.
This is very similar to the previous patch in this series, but now for the
version of this function with "Async" in the name.
Differential Revision: https://phabricator.services.mozilla.com/D299044
These flags were being inherited to subresource loads through the load group's
mLoadFlags member. This member put in special effort to strip nsIChannel flags
thanks to nsIRequest::LOAD_REQUESTMASK, but did not strip the new(-er)
`LOAD_HTML_OBJECT_DATA` and `LOAD_DOCUMENT_NEEDS_COOKIE` flags.
This meant that when I incorrectly assumed that `LOAD_DOCUMENT_NEEDS_COOKIE`
implied `LOAD_DOCUMENT_URI` from how the flag was being set, I started sending
cookies down for HTML subresource requests as well as for main document
requests, likely leading to the performance regression.
This patch fixes the issue in 2 ways:
1. It re-adds the `LOAD_DOCUMENT_URI` check which had previously avoided this
issue (`IsNavigation()`).
2. It updates the mask used for nsLoadGroup flag inheritance to explicitly
exclude LOAD_DOCUMENT_NEEDS_COOKIE and LOAD_HTML_OBJECT_DATA, as those flags
should not be inherited to subresource requests.
In addition to the call-site in `nsLoadGroup`, the other user of
LOAD_REQUESTMASK was also updated, as it appears to be used for image loads
which originate from documents, and should likely also strip the flag.
The new flag is declared with %{C++ as XPIDL doesn't support `&` or `~`.
Differential Revision: https://phabricator.services.mozilla.com/D291878
Bug 1832553 regressed this in 2023 so that we never trimmed unused images from the cache, and we never noticed a problem until I was poking at this code. So increasing the size of the cache can't cause any problems since this patch effectively lowers it from infinity to 20mb.
The desktop and geckoview values were both choosen in 2008 (see the bug for links to bugs/changesets where it was changed). The geckoview value was based on an N8x0 device with 128mb of ram at the time. So it seems time for an update.
Differential Revision: https://phabricator.services.mozilla.com/D264682
Commit automatically generated through clang-tidy's
performance-use-std-move new pass.
- nsCOMPtr benefits from being moved
- Maybe type has a custom move-assign operator
- nsAutoCString benefits from being moved
- nsRegion benefits from being moved
Differential Revision: https://phabricator.services.mozilla.com/D285677
This patch adds WAICT integrity verification for image loads in imgLoader (Nightly-only). When an image load is covered by the document’s IntegrityPolicyWAICT for destination type Image, we compute a hash of the full image response and verify it against the policy before delivering any bytes to the image decoder.
As a result, WAICT-checked images are no longer progressively decoded: we buffer the full response, verify integrity at OnStopRequest, and only then forward the buffered bytes to the downstream stream listener.
Differential Revision: https://phabricator.services.mozilla.com/D283676
Don't reduce request priority of lazy-loaded images for having LOAD_BACKGROUND. Only apply the LOAD_BACKGROUND priority penalty for link rel=preload images, which intentionally set the flag.
Lazy-loaded images also have LOAD_BACKGROUND but only to bypass the loadgroup, and should not be doubly penalized.
Differential Revision: https://phabricator.services.mozilla.com/D253680
The content length of the original request is now also saved and passed
as new content length for cached images when notifying the observers.
Differential Revision: https://phabricator.services.mozilla.com/D280311
The network predictor used the HTTP cache as a database to learn browsing
patterns and make speculative DNS prefetches, TCP preconnects, and resource
prefetches. While this provided performance benefits for repeat visits to
frequently-accessed sites, it came with significant costs: I/O on every page
load, CPU overhead for prediction algorithms, memory for caching learned
patterns, and substantial IPC complexity with six message types coordinating
predictions between processes.
A large part of the functionality the predictor was meant to improve is now
available to webdevelopers. HTTP 103 Early Hints allow servers to explicitly
specify resources to preload while generating the response.
And Speculation Rules API will enable content authors to declaratively specify
prefetch/prerender behavior based on their knowledge of site structure and user
intent, providing immediate accuracy without a learning period.
The network.predictor.enable-hover-on-ssl preference is retained as it controls
simpler hover-triggered speculative connections that don't require the
predictor's learning system. This removal simplifies the codebase while
steering users toward more accurate, standards-based optimization mechanisms.
The one feature of the predictor which was never used was learning websites
that are opened soon after startup. There was no action taken based on this
info, and we could already predict this info based on the history database.
Differential Revision: https://phabricator.services.mozilla.com/D276437
The network predictor used the HTTP cache as a database to learn browsing
patterns and make speculative DNS prefetches, TCP preconnects, and resource
prefetches. While this provided performance benefits for repeat visits to
frequently-accessed sites, it came with significant costs: I/O on every page
load, CPU overhead for prediction algorithms, memory for caching learned
patterns, and substantial IPC complexity with six message types coordinating
predictions between processes.
A large part of the functionality the predictor was meant to improve is now
available to webdevelopers. HTTP 103 Early Hints allow servers to explicitly
specify resources to preload while generating the response.
And Speculation Rules API will enable content authors to declaratively specify
prefetch/prerender behavior based on their knowledge of site structure and user
intent, providing immediate accuracy without a learning period.
The network.predictor.enable-hover-on-ssl preference is retained as it controls
simpler hover-triggered speculative connections that don't require the
predictor's learning system. This removal simplifies the codebase while
steering users toward more accurate, standards-based optimization mechanisms.
The one feature of the predictor which was never used was learning websites
that are opened soon after startup. There was no action taken based on this
info, and we could already predict this info based on the history database.
Differential Revision: https://phabricator.services.mozilla.com/D276437
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
This reverts commit 8c929cc018.
Revert "Bug 1979013 - Part 2: Require nsITimer API callers to provide a nsACString, r=xpcom-reviewers,media-playback-reviewers,webrtc-reviewers,profiler-reviewers,dom-storage-reviewers,toolkit-telemetry-reviewers,firefox-style-system-reviewers,mstange,emz,bwc,janv,emilio,padenot"
This reverts commit e01c0a6a32.
Revert "Bug 1979013 - Part 1: Eagerly fetch name for timer callbacks, r=xpcom-reviewers,mccr8"
This reverts commit 9f8e73c163.
This avoids the small overhead and potential for bugs from the previous
approach of assuming all `const char*` arguments passed to `nsITimer`
initializers are string literals, by instead requiring the argument to be a
`const nsACString&`. This involves changing all callsites to pass a `""_ns`
string literal down instead of a bare string literal.
It appears that while there were currently no buggy callers which
would've provided a dynamic string, there was at least one piece of code
(nsRepeatService::Start) which did pass down a raw char* which may be
dynamically allocated (all callers pass down `nsLiteralCString` so we're
actually OK here right now, but this was a footgun).
Differential Revision: https://phabricator.services.mozilla.com/D261032
LOAD_BACKGROUND is not about priority of the load, but about whether it blocks the load event (by bypassing the loadgroup), so don't lower the request priority.
Differential Revision: https://phabricator.services.mozilla.com/D253680
In order to clear cache from ChromeUtils.clearResourceCache with variuos
filtering, imgLoader needs a method that are adaptive to the current process,
where in the parent process, clear all processes' cache,
and in the content process, clear the cache in the process.
Refactored the cache methods based on single static method and single IPC
method, this is also necessary to extend the ChromeUtils.clearResourceCache in
bug 1947158.
Differential Revision: https://phabricator.services.mozilla.com/D239138
Those query interfaces on image load show up in profiles, eg it's about 0.05% of total time of the NewsSite test on sp3.
Differential Revision: https://phabricator.services.mozilla.com/D192726