Note that this is only triggered if the application is able to draw to the
canvas while the refresh driver is throttled.
Differential Revision: https://phabricator.services.mozilla.com/D136004
OffscreenCanvasDisplayHelper needs its Destroy method called when
HTMLCanvasElement is destroyed. This was missed during the initial
implementation. It holds a weak/raw pointer to the HTMLCanvasElement it
is bound to, so if the element is destroyed, we need to clear our
reference to prevent any UAFs.
This would be a security bug if not for the fact that this feature is
still currently disabled behind a pref and has not shipped out to any
release yet.
Differential Revision: https://phabricator.services.mozilla.com/D136371
When we attempt to resize an OffscreenCanvas, or an HTMLCanvasElement
with transferControlToOffscreen caled on it, we need to ensure we throw
the right error, and a message that is clear to the user. We also need
to propogate size changes to the placeholder
HTMLCanvasElement/OffscreenCanvas, when the OffscreenCanvas object on
the worker thread has its size changed.
Differential Revision: https://phabricator.services.mozilla.com/D134637
This patch ensures that our invalidation is more consistent and less
frequent. It no longer queues an invalidation for each draw call. It now
combines the parameter update (e.g. width, height, opacity) with an
invalidation to ensure the contents of the canvas are consistent with
the advertised properties. It also ensures that if an explicit commit
occurs, any pending commits are cancelled.
Differential Revision: https://phabricator.services.mozilla.com/D134655
When CanvasRenderingContext2d.drawImage, or createImageBitmap are
called with an HTMLCanvasElement with an OffscreenCanvas gotten through
transferControlToOffscreen, we do not snapshot the underlying
OffscreenCanvas. This patch makes it so we do.
There are WPT tests for this, but they only run for canvas 2d.
Differential Revision: https://phabricator.services.mozilla.com/D134078
We will implement this properly in bug 1746260, but for now, let's spare
users with OffscreenCanvas turned on, who have low memory, a content
process crash. Handling it is somewhat complicated because we need to
shuttle over the message to the worker.
Differential Revision: https://phabricator.services.mozilla.com/D133939
This patch integrates OffscreenCanvasDisplayHelper with
HTMLCanvasElement, OffscreenCanvas and nsDisplayCanvas to allow
asynchronous display of an OffscreenCanvas.
Differential Revision: https://phabricator.services.mozilla.com/D130787
This patch contains no functional changes but sets us up for refactoring
in a later part in this series. It also helps silence a bunch of
compiler warnings.
Differential Revision: https://phabricator.services.mozilla.com/D130777
This patch integrates OffscreenCanvasDisplayHelper with
HTMLCanvasElement, OffscreenCanvas and nsDisplayCanvas to allow
asynchronous display of an OffscreenCanvas.
Differential Revision: https://phabricator.services.mozilla.com/D130787
This patch contains no functional changes but sets us up for refactoring
in a later part in this series. It also helps silence a bunch of
compiler warnings.
Differential Revision: https://phabricator.services.mozilla.com/D130777
There are no code changes, only #include changes.
It was a fairly mechanical process: Search for all "AUTO_PROFILER_LABEL", and in each file, if only labels are used, convert "GeckoProfiler.h" into "ProfilerLabels.h" (or just add that last one where needed).
In some files, there were also some marker calls but no other profiler-related calls, in these cases "GeckoProfiler.h" was replaced with both "ProfilerLabels.h" and "ProfilerMarkers.h", which still helps in reducing the use of the all-encompassing "GeckoProfiler.h".
Differential Revision: https://phabricator.services.mozilla.com/D104588
Not really a fan of this, but I can't think of a better alternative
really... Ideas welcome :)
The main issue is that in bug 1662975 we made window.print() not return
until the user has closed the print / print preview dialog (as it is
needed for some use cases). This matches other browsers, too.
We use an nsAutoSyncOperation here, in order not to violate the
run-to-completion invariants, which turns off micro-tasks, timers,
etc... However we'd still want promises inside mozPrintCallback to
resolve and such, which is a bit contradictory. It is really awkward to
have this behavior change based on whether we have a print callback...
Differential Revision: https://phabricator.services.mozilla.com/D89298
Not really a fan of this, but I can't think of a better alternative
really... Ideas welcome :)
The main issue is that in bug 1662975 we made window.print() not return
until the user has closed the print / print preview dialog (as it is
needed for some use cases). This matches other browsers, too.
We use an nsAutoSyncOperation here, in order not to violate the
run-to-completion invariants, which turns off micro-tasks, timers,
etc... However we'd still want promises inside mozPrintCallback to
resolve and such, which is a bit contradictory. It is really awkward to
have this behavior change based on whether we have a print callback...
Differential Revision: https://phabricator.services.mozilla.com/D89298
Canvas only has one context, and that assumption is pretty baked into
the code, so having an API that pretends otherwise is silly.
Differential Revision: https://phabricator.services.mozilla.com/D88990
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
to propagate
* Mortgage/strip out more OffscreenCanvas code for now
Differential Revision: https://phabricator.services.mozilla.com/D75055
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
to propagate
* Mortgage/strip out more OffscreenCanvas code for now
Differential Revision: https://phabricator.services.mozilla.com/D75055
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
to propagate
* Mortgage/strip out more OffscreenCanvas code for now
Differential Revision: https://phabricator.services.mozilla.com/D75055
* Majorly simplity CanvasRenderer
* Replace GLScreenBuffer with trivial GLSwapChain
* Use descriptor structs so that future SharedSurface changes aren't so painful
to propagate
* Mortgage/strip out more OffscreenCanvas code for now
Differential Revision: https://phabricator.services.mozilla.com/D75055
In RFP mode, canvas image extraction leads to an all-white image, replace that
with a random (sample 32 bytes of randomness and fill the buffer with that)
'poison pill'. This helps defeat naive fingerprinters by producing a random
image on every try. This feature is toggled using a new, default on, pref
`privacy.resistFingerprinting.randomDataOnCanvasExtract`.
Updated `browser_canvas_fingerprinting_resistance.js` to test this new feature
as well.
Updates and replaces D66308.
Differential Revision: https://phabricator.services.mozilla.com/D72716