Bug 1307749 - Ensure that we still set filterSourceGraphicTainted and an empty filter when updating our filter in CanvasRenderingContext2D r=mstange

This commit is contained in:
George Wright 2016-10-11 15:18:45 -04:00
Родитель 5fc72c6bc3
Коммит 0d128cb330
2 изменённых файлов: 17 добавлений и 0 удалений

Просмотреть файл

@ -2843,6 +2843,11 @@ CanvasRenderingContext2D::UpdateFilter()
{
nsCOMPtr<nsIPresShell> presShell = GetPresShell();
if (!presShell || presShell->IsDestroying()) {
// Ensure we set an empty filter and update the state to
// reflect the current "taint" status of the canvas
CurrentState().filter = FilterDescription();
CurrentState().filterSourceGraphicTainted =
(mCanvasElement && mCanvasElement->IsWriteOnly());
return;
}

Просмотреть файл

@ -1082,6 +1082,18 @@ protected:
RefPtr<nsSVGFilterChainObserver> filterChainObserver;
mozilla::gfx::FilterDescription filter;
nsTArray<RefPtr<mozilla::gfx::SourceSurface>> filterAdditionalImages;
// This keeps track of whether the canvas was "tainted" or not when
// we last used a filter. This is a security measure, whereby the
// canvas is flipped to write-only if a cross-origin image is drawn to it.
// This is to stop bad actors from reading back data they shouldn't have
// access to.
//
// This also limits what filters we can apply to the context; in particular
// feDisplacementMap is restricted.
//
// We keep track of this to ensure that if this gets out of sync with the
// tainted state of the canvas itself, we update our filters accordingly.
bool filterSourceGraphicTainted;
bool imageSmoothingEnabled;