Back out 2 changesets (bug 1163856) for Windows !mSyncLoad assertion failures

CLOSED TREE

Backed out changeset 62c1c616f21c (bug 1163856)
Backed out changeset 04239448fe0b (bug 1163856)
This commit is contained in:
Phil Ringnalda 2015-06-25 19:57:00 -07:00
parent 708189b9ec
commit bf15233770
10 changed files with 46 additions and 83 deletions

View File

@ -52,9 +52,8 @@ skip-if = e10s # scratchpad.xul is not loading in e10s window
[browser_markupview_events.js]
skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
[browser_markupview_events_form.js]
# [browser_markupview_events-overflow.js]
# skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
# disabled - See bug 1177550
[browser_markupview_events-overflow.js]
skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
[browser_markupview_events_jquery_1.0.js]
skip-if = e10s # Bug 1040751 - CodeMirror editor.destroy() isn't e10s compatible
[browser_markupview_events_jquery_1.1.js]

View File

@ -165,9 +165,6 @@ public:
* INIT_FLAG_DOWNSCALE_DURING_DECODE: The container should attempt to
* downscale images during decoding instead of decoding them to their
* intrinsic size.
*
* INIT_FLAG_SYNC_LOAD: The container is being loaded synchronously, so
* it should avoid relying on async workers to get the container ready.
*/
static const uint32_t INIT_FLAG_NONE = 0x0;
static const uint32_t INIT_FLAG_DISCARDABLE = 0x1;
@ -175,7 +172,6 @@ public:
static const uint32_t INIT_FLAG_DECODE_IMMEDIATELY = 0x4;
static const uint32_t INIT_FLAG_TRANSIENT = 0x8;
static const uint32_t INIT_FLAG_DOWNSCALE_DURING_DECODE = 0x10;
static const uint32_t INIT_FLAG_SYNC_LOAD = 0x20;
virtual already_AddRefed<ProgressTracker> GetProgressTracker() = 0;
virtual void SetProgressTracker(ProgressTracker* aProgressTracker) {}

View File

@ -159,7 +159,7 @@ ImageFactory::CreateAnonymousImage(const nsCString& aMimeType)
newTracker->SetImage(newImage);
newImage->SetProgressTracker(newTracker);
rv = newImage->Init(aMimeType.get(), Image::INIT_FLAG_SYNC_LOAD);
rv = newImage->Init(aMimeType.get(), Image::INIT_FLAG_NONE);
NS_ENSURE_SUCCESS(rv, BadImage(newImage));
return newImage.forget();

View File

@ -43,11 +43,11 @@ CheckProgressConsistency(Progress aProgress)
// No preconditions.
}
if (aProgress & FLAG_ONLOAD_BLOCKED) {
// No preconditions.
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);
}
if (aProgress & FLAG_ONLOAD_UNBLOCKED) {
MOZ_ASSERT(aProgress & FLAG_ONLOAD_BLOCKED);
MOZ_ASSERT(aProgress & (FLAG_SIZE_AVAILABLE | FLAG_HAS_ERROR));
MOZ_ASSERT(aProgress & (FLAG_FRAME_COMPLETE | FLAG_HAS_ERROR));
}
if (aProgress & FLAG_IS_ANIMATED) {
MOZ_ASSERT(aProgress & FLAG_DECODE_STARTED);

View File

@ -266,11 +266,9 @@ RasterImage::RasterImage(ImageURL* aURI /* = nullptr */) :
mHasSize(false),
mDecodeOnlyOnDraw(false),
mTransient(false),
mSyncLoad(false),
mDiscardable(false),
mHasSourceData(false),
mHasBeenDecoded(false),
mDownscaleDuringDecode(false),
mPendingAnimation(false),
mAnimationFinished(false),
mWantFullDecode(false)
@ -322,7 +320,6 @@ RasterImage::Init(const char* aMimeType,
mWantFullDecode = !!(aFlags & INIT_FLAG_DECODE_IMMEDIATELY);
mTransient = !!(aFlags & INIT_FLAG_TRANSIENT);
mDownscaleDuringDecode = !!(aFlags & INIT_FLAG_DOWNSCALE_DURING_DECODE);
mSyncLoad = !!(aFlags & INIT_FLAG_SYNC_LOAD);
#ifndef MOZ_ENABLE_SKIA
// Downscale-during-decode requires Skia.
@ -335,13 +332,10 @@ RasterImage::Init(const char* aMimeType,
SurfaceCache::LockImage(ImageKey(this));
}
// Create an async size decoder if we're not being loaded synchronously.
// (If we are, we'll take care of the size decode in OnImageDataComplete.)
if (!mSyncLoad) {
nsresult rv = Decode(Nothing(), DECODE_FLAGS_DEFAULT);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
// Create the initial size decoder.
nsresult rv = Decode(Nothing(), DECODE_FLAGS_DEFAULT);
if (NS_FAILED(rv)) {
return NS_ERROR_FAILURE;
}
// Mark us as initialized
@ -1185,10 +1179,10 @@ RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*, nsresult aStatus,
// Let decoders know that there won't be any more data coming.
mSourceBuffer->Complete(aStatus);
if (mSyncLoad && !mHasSize) {
// We're loading this image synchronously, so it needs to be usable after
// this call returns. Since we haven't gotten our size yet, we need to do a
// synchronous size decode here.
if (!mHasSize) {
// We need to guarantee that we've gotten the image's size, or at least
// determined that we won't be able to get it, before we deliver the load
// event. That means we have to do a synchronous size decode here.
Decode(Nothing(), FLAG_SYNC_DECODE);
}
@ -1204,47 +1198,28 @@ RasterImage::OnImageDataComplete(nsIRequest*, nsISupports*, nsresult aStatus,
DoError();
}
Progress loadProgress = LoadCompleteProgress(aLastPart, mError, finalStatus);
if (!mHasSize && !mError) {
// We don't have our size yet, so we'll fire the load event in SetSize().
MOZ_ASSERT(!mSyncLoad, "Firing load asynchronously but mSyncLoad is set?");
NotifyProgress(FLAG_ONLOAD_BLOCKED);
mLoadProgress = Some(loadProgress);
return finalStatus;
}
NotifyForLoadEvent(loadProgress);
return finalStatus;
}
void
RasterImage::NotifyForLoadEvent(Progress aProgress)
{
MOZ_ASSERT(mHasSize || mError, "Need to know size before firing load event");
MOZ_ASSERT(!mHasSize ||
(mProgressTracker->GetProgress() & FLAG_SIZE_AVAILABLE),
"Should have notified that the size is available if we have it");
Progress loadProgress = LoadCompleteProgress(aLastPart, mError, finalStatus);
if (mDecodeOnlyOnDraw) {
// For decode-only-on-draw images, we want to send notifications as if we've
// already finished decoding. Otherwise some observers will never even try
// to draw. (We may have already sent some of these notifications from
// NotifyForDecodeOnlyOnDraw(), but ProgressTracker will ensure no duplicate
// notifications get sent.)
aProgress |= FLAG_DECODE_STARTED |
FLAG_FRAME_COMPLETE |
FLAG_DECODE_COMPLETE;
}
// If we encountered an error, make sure we notify for that as well.
if (mError) {
aProgress |= FLAG_HAS_ERROR;
loadProgress |= FLAG_DECODE_STARTED |
FLAG_FRAME_COMPLETE |
FLAG_DECODE_COMPLETE;
}
// Notify our listeners, which will fire this image's load event.
NotifyProgress(aProgress);
NotifyProgress(loadProgress);
return finalStatus;
}
void
@ -2195,13 +2170,6 @@ RasterImage::FinalizeDecoder(Decoder* aDecoder)
} else if (wasSize && !mHasSize) {
DoError();
}
// If we were waiting to fire the load event, go ahead and fire it now.
if (mLoadProgress && wasSize) {
NotifyForLoadEvent(*mLoadProgress);
mLoadProgress = Nothing();
NotifyProgress(FLAG_ONLOAD_UNBLOCKED);
}
}
if (aDecoder->ImageIsLocked()) {

View File

@ -244,7 +244,6 @@ public:
nsresult aStatus,
bool aLastPart) override;
void NotifyForLoadEvent(Progress aProgress);
void NotifyForDecodeOnlyOnDraw();
/**
@ -361,9 +360,6 @@ private: // data
nsIntSize mSize;
Orientation mOrientation;
/// If this has a value, we're waiting for SetSize() to send the load event.
Maybe<Progress> mLoadProgress;
nsCOMPtr<nsIProperties> mProperties;
/// If this image is animated, a FrameAnimator which manages its animation.
@ -411,7 +407,6 @@ private: // data
bool mHasSize:1; // Has SetSize() been called?
bool mDecodeOnlyOnDraw:1; // Decoding only on draw?
bool mTransient:1; // Is the image short-lived?
bool mSyncLoad:1; // Are we loading synchronously?
bool mDiscardable:1; // Is container discardable?
bool mHasSourceData:1; // Do we have source data?
bool mHasBeenDecoded:1; // Decoded at least once?

View File

@ -13,7 +13,6 @@ observer event with the nsIURI of the failed image as the subject
<body>
<p id="display"></p>
<pre id="test">
</pre>
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
@ -44,9 +43,9 @@ var observer = {
obs.addObserver(observer, "net:failed-to-process-uri-content", false);
document.write('<img src="damon.jpg">');
document.write('<img src="invalid.jpg">');
</script>
</pre>
<img src="damon.jpg">
<img src="invalid.jpg">
</body>
</html>

View File

@ -23,14 +23,10 @@
canvas.toBlob(function(blob) {
var uri = window.URL.createObjectURL(blob);
uri += '#-moz-samplesize=8';
var testImage = document.getElementById('test');
document.getElementById('test').src = uri;
testImage.onload = testImage.onerror = function() {
// Take the snapshot.
document.documentElement.removeAttribute('class');
};
testImage.src = uri;
// Take the snapshot.
document.documentElement.removeAttribute('class');
}, 'image/jpeg', 0.99);
}

View File

@ -22,14 +22,10 @@
// Convert the image into a blob URI and use it as #test's src.
canvas.toBlob(function(blob) {
var uri = window.URL.createObjectURL(blob);
var testImage = document.getElementById('test');
testImage.onload = testImage.onerror = function() {
// Take the snapshot.
document.documentElement.removeAttribute('class');
};
document.getElementById('test').src = uri;
testImage.src = uri;
// Take the snapshot.
document.documentElement.removeAttribute('class');
}, 'image/jpeg', 0.99);
}

View File

@ -108,6 +108,20 @@ function firstLoadDone(oldlistener, aRequest)
do_test_finished();
}
// Return a closure that allows us to check the stream listener's status when the
// image starts loading.
function getChannelLoadImageStartCallback(streamlistener)
{
return function channelLoadStart(imglistener, aRequest) {
// We must not have received all status before we get this start callback.
// If we have, we've broken people's expectations by delaying events from a
// channel we were given.
do_check_eq(streamlistener.requestStatus & STOP_REQUEST, 0);
checkClone(imglistener, aRequest);
}
}
// Return a closure that allows us to check the stream listener's status when the
// image finishes loading.
function getChannelLoadImageStopCallback(streamlistener, next)
@ -136,7 +150,7 @@ function checkSecondChannelLoad()
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);
var listener = new ImageListener(null,
var listener = new ImageListener(getChannelLoadImageStartCallback(channellistener),
getChannelLoadImageStopCallback(channellistener,
all_done_callback));
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
@ -165,7 +179,7 @@ function run_loadImageWithChannel_tests()
var channellistener = new ChannelListener();
channel.asyncOpen(channellistener, null);
var listener = new ImageListener(null,
var listener = new ImageListener(getChannelLoadImageStartCallback(channellistener),
getChannelLoadImageStopCallback(channellistener,
checkSecondChannelLoad));
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)