gecko-dev/image
Timothy Nikkel 64306c8162 Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond
This was observed in an intermittent failure of image/test/mochitest/test_discardAnimatedImage.html. What happened was:

1) Document::MaybePreLoadImage was called for the images in the test.
2) imgRequest::OnDataAvailable is called on at least one of the images. This creates the RasterImage, so any proxy for this imgRequest will now return the image via GetImage(). imgRequest::OnDataAvailable also queues the FinishPreparingForNewPartRunnable back to the main thread to call OnImageAvailable on the progress tracker on the main thread.
3) We get the actual LoadImage calls for the images of the document. We create new proxies for the existing imgRequests. imgRequestProxy::Init calls mBehaviour->SetOwner(aOwner), which sets mOwnerHasImage to true because the progress tracker has an mImage (the one we created above).
4) We get a call to LockImage, this gets forwarded to the RasterImage because mOwnerHasImage is true and we can access the image.
5) The FinishPreparingForNewPartRunnable finally runs on the main thread. The OnImageAvailable notification from the progress tracker ends up in imgRequestProxy::SetHasImage. imgRequestProxy::SetHasImage applies our local count mLockCount to the RasterImage, even though we've already forwarded one of those LockImage calls to the image. LockImage calls are now unbalanced and the image will always remain locked.

The fix is simple. Only apply the Lock/Unlock calls if the FinishPreparingForNewPartRunnable has hit the main thread (ie ignore an image we can access until this happens).

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

--HG--
extra : moz-landing-system : lando
2019-05-01 23:05:47 +00:00
..
build Bug 1524687: Part 3 - Convert nsImageModule to static registration. r=jwatt 2019-01-24 15:40:58 -08:00
decoders Bug 1547143 - Format the tree: Be prescriptive with the pointer style (left) r=Ehsan 2019-05-01 08:47:10 +00:00
encoders Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
test Bug 1544961 - comment on gtests that are disabled, disable ThreadUtils.IdleRunnableMethod and Timers.FindExpirationTime for windows10-aarch64 r=jmaher,gbrown,dmajor 2019-04-23 00:21:37 +00:00
AnimationFrameBuffer.cpp Bug 1516011 - Part 2. Deny recycling for frames used in blob recordings. r=tnikkel 2019-01-14 13:21:57 -05:00
AnimationFrameBuffer.h Bug 1510601 - Part 1. Move size increments into AnimationFrameBuffer::InsertInternal. r=tnikkel 2018-12-05 12:04:20 -05:00
AnimationParams.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
AnimationSurfaceProvider.cpp Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
AnimationSurfaceProvider.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
BMPHeaders.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ClippedImage.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ClippedImage.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
CopyOnWrite.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
DecodedSurfaceProvider.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
DecodedSurfaceProvider.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
DecodePool.cpp Bug 1546500: Avoid dispatching synchronous thread shutdown runnables. r=froydnj 2019-04-23 13:16:15 -07:00
DecodePool.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Decoder.cpp Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
Decoder.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
DecoderFactory.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
DecoderFactory.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
DecoderFlags.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
Downscaler.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Downscaler.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
DownscalingFilter.h Bug 1530774 - Part 2. Remove support for paletted surface pipes. r=tnikkel 2019-03-18 07:30:34 -04:00
DynamicImage.cpp Bug 1501794 - Implement img decode API. r=bzbarsky,tnikkel 2019-04-02 08:56:54 -04:00
DynamicImage.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
FrameAnimator.cpp Bug 1530774 - Part 1. Remove support in FrameAnimator for blending partial/paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
FrameAnimator.h Bug 1530774 - Part 1. Remove support in FrameAnimator for blending partial/paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
FrameTimeout.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
FrozenImage.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
FrozenImage.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ICOFileHeaders.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
IDecodingTask.cpp Bug 1519567, use medium high priority queue for imglib notifications, r=tnikkel 2019-03-01 15:11:56 +02:00
IDecodingTask.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
Image.cpp Bug 1530774 - Part 1. Remove support in FrameAnimator for blending partial/paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
Image.h Bug 1527085 - Ensure we invalidate when the image request changes. r=jrmuizel 2019-02-15 09:24:21 -05:00
ImageCacheKey.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
ImageCacheKey.h Bug 1529780 - Compute ImageCacheKey's hash number lazily; r=tnikkel 2019-02-22 14:25:04 +00:00
ImageFactory.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
ImageFactory.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageLogging.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageMemoryReporter.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
ImageMemoryReporter.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageMetadata.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageOps.cpp Bug 1545567 - Ensure ImageOps decode methods can handle unbuffered input streams properly. r=baku 2019-04-26 11:58:24 -04:00
ImageOps.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageRegion.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImageWrapper.cpp Bug 1501794 - Implement img decode API. r=bzbarsky,tnikkel 2019-04-02 08:56:54 -04:00
ImageWrapper.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ImgDrawResult.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
imgFrame.cpp Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
imgFrame.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
imgICache.idl Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
imgIContainer.idl Bug 1501794 - Implement img decode API. r=bzbarsky,tnikkel 2019-04-02 08:56:54 -04:00
imgIContainerDebug.idl
imgIEncoder.idl
imgILoader.idl
imgINotificationObserver.idl
imgIRequest.idl Bug 1501794 - Implement img decode API. r=bzbarsky,tnikkel 2019-04-02 08:56:54 -04:00
imgIScriptedNotificationObserver.idl
imgITools.idl Bug 1460940 - Remove nsIDOMDocument uses in image/. r=bz 2018-05-11 19:46:15 +02:00
imgLoader.cpp Bug 1548253 - Port pref cache variables of nsContentUtils to StaticPrefs - network.http.tailing.enabled, r=Ehsan 2019-05-01 21:10:31 +00:00
imgLoader.h Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
imgRequest.cpp Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond 2019-05-01 23:05:47 +00:00
imgRequest.h Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond 2019-05-01 23:05:47 +00:00
imgRequestProxy.cpp Bug 1377457. Only apply locks to the image if SetHasImage has been called. r=aosmond 2019-05-01 23:05:47 +00:00
imgRequestProxy.h Bug 1517241 - Rename nsIDocument to mozilla::dom::Document. r=smaug 2019-01-03 17:48:33 +01:00
imgTools.cpp Bug 1532005 - Implement a new js/public/ArrayBuffer.h header to centralize functionality for creating and interacting with ArrayBuffers. r=sfink 2019-03-04 15:19:16 -08:00
imgTools.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
IProgressObserver.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ISurfaceProvider.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
LookupResult.h Bug 1543584 - Always rasterize SVGs but clamp the maximum size. r=tnikkel 2019-04-18 14:35:58 -04:00
moz.build Bug 1514803 - Export nsICOEncoder r=aosmond 2019-01-08 21:30:46 +00:00
MultipartImage.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
MultipartImage.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
nsIIconURI.idl Bug 1432620 - Make nsIMozIconURI attributes readonly r=mayhemer 2018-01-23 22:25:18 +01:00
Orientation.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
OrientedImage.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
OrientedImage.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
PlaybackType.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ProgressTracker.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ProgressTracker.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
RasterImage.cpp Bug 1501794 - Implement img decode API. r=bzbarsky,tnikkel 2019-04-02 08:56:54 -04:00
RasterImage.h Bug 1521000 - Part 2: Adjust our clang-format rules to include spaces after the hash for nested preprocessor directives r=sylvestre 2019-01-18 10:16:18 +01:00
RecyclingSourceSurface.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ScriptedNotificationObserver.cpp Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ScriptedNotificationObserver.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
ShutdownTracker.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
ShutdownTracker.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SourceBuffer.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
SourceBuffer.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
StreamingLexer.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SurfaceCache.cpp Bug 1543584 - Always rasterize SVGs but clamp the maximum size. r=tnikkel 2019-04-18 14:35:58 -04:00
SurfaceCache.h Bug 1543584 - Always rasterize SVGs but clamp the maximum size. r=tnikkel 2019-04-18 14:35:58 -04:00
SurfaceCacheUtils.cpp Bug 1523969 part 10 - Move method definition inline comments to new line in 'image/'. r=aosmond 2019-02-25 16:07:58 -06:00
SurfaceCacheUtils.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SurfaceFilters.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
SurfaceFlags.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
SurfacePipe.cpp Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
SurfacePipe.h Bug 1530774 - Part 2. Remove support for paletted surface pipes. r=tnikkel 2019-03-18 07:30:34 -04:00
SurfacePipeFactory.h Bug 1530774 - Part 3. Remove decoder support for producing paletted frames. r=tnikkel 2019-03-18 07:30:34 -04:00
SVGDocumentWrapper.cpp Bug 1544215 - Make nsIContentVewer::GetPresShell() return mozilla::PresShell instead of nsIPresShell r=bzbarsky 2019-04-16 02:47:26 +00:00
SVGDocumentWrapper.h Bug 1544215 - Make nsIContentVewer::GetPresShell() return mozilla::PresShell instead of nsIPresShell r=bzbarsky 2019-04-16 02:47:26 +00:00
SVGDrawingParameters.h Bug 1511181 - Reformat everything to the Google coding style r=ehsan a=clang-format 2018-11-30 11:46:48 +01:00
VectorImage.cpp Bug 1547138 - IntrinsicSize shouldn't use nsStyleCoord. r=dholbert 2019-04-25 23:48:14 +00:00
VectorImage.h Bug 1543584 - Always rasterize SVGs but clamp the maximum size. r=tnikkel 2019-04-18 14:35:58 -04:00