Backout bug 733553 due to mochitest orange.

This commit is contained in:
Ryan VanderMeulen 2012-05-19 12:10:26 -04:00
Родитель 83ada37673
Коммит 5e78d60411
17 изменённых файлов: 33 добавлений и 227 удалений

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

@ -278,7 +278,8 @@ nsBMPDecoder::WriteInternal(const char* aBuffer, PRUint32 aCount)
// Post our size to the superclass
PostSize(mBIH.width, real_height);
if (HasError()) {
// Setting the size led to an error.
// Setting the size lead to an error; this can happen when for example
// a multipart channel sends an image of a different size.
return;
}

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

@ -920,7 +920,8 @@ nsGIFDecoder2::WriteInternal(const char *aBuffer, PRUint32 aCount)
// Create the image container with the right size.
BeginGIF();
if (HasError()) {
// Setting the size led to an error.
// Setting the size lead to an error; this can happen when for example
// a multipart channel sends an image of a different size.
mGIFStruct.state = gif_error;
return;
}

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

@ -101,7 +101,8 @@ nsIconDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
// Post our size to the superclass
PostSize(mWidth, mHeight);
if (HasError()) {
// Setting the size led to an error.
// Setting the size lead to an error; this can happen when for example
// a multipart channel sends an image of a different size.
mState = iconStateFinished;
return;
}

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

@ -263,7 +263,8 @@ nsJPEGDecoder::WriteInternal(const char *aBuffer, PRUint32 aCount)
// Post our size to the superclass
PostSize(mInfo.image_width, mInfo.image_height);
if (HasError()) {
// Setting the size led to an error.
// Setting the size lead to an error; this can happen when for example
// a multipart channel sends an image of a different size.
mState = JPEG_ERROR;
return;
}

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

@ -519,7 +519,8 @@ nsPNGDecoder::info_callback(png_structp png_ptr, png_infop info_ptr)
// Post our size to the superclass
decoder->PostSize(width, height);
if (decoder->HasError()) {
// Setting the size led to an error.
// Setting the size lead to an error; this can happen when for example
// a multipart channel sends an image of a different size.
longjmp(png_jmpbuf(decoder->mPNG), 1);
}

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

@ -52,7 +52,7 @@ interface nsIPrincipal;
* @version 0.1
* @see imagelib2
*/
[scriptable, uuid(a5a785a8-9881-11e1-aaff-001fbc092072)]
[scriptable, uuid(d35a9adb-8328-4b64-b06f-72a165acd080)]
interface imgIRequest : nsIRequest
{
/**
@ -132,11 +132,6 @@ interface imgIRequest : nsIRequest
*/
readonly attribute nsIPrincipal imagePrincipal;
/**
* Whether the request is multipart (ie, multipart/x-mixed-replace)
*/
readonly attribute bool multipart;
/**
* CORS modes images can be loaded with.
*

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

@ -343,7 +343,7 @@ RasterImage::AdvanceFrame(TimeStamp aTime, nsIntRect* aDirtyRect)
// If we don't have a decoder, we know we've got everything we're going to
// get. If we do, we only display fully-downloaded frames; everything else
// gets delayed.
bool haveFullNextFrame = (mMultipart && mBytesDecoded == 0) || !mDecoder ||
bool haveFullNextFrame = !mDecoder ||
nextFrameIndex < mDecoder->GetCompleteFrameCount();
// If we're done decoding the next frame, go ahead and display it now and
@ -1136,9 +1136,14 @@ RasterImage::SetSize(PRInt32 aWidth, PRInt32 aHeight)
return NS_ERROR_INVALID_ARG;
// if we already have a size, check the new size against the old one
if (!mMultipart && mHasSize &&
if (mHasSize &&
((aWidth != mSize.width) || (aHeight != mSize.height))) {
NS_WARNING("Image changed size on redecode! This should not happen!");
// Alter the warning depending on whether the channel is multipart
if (!mMultipart)
NS_WARNING("Image changed size on redecode! This should not happen!");
else
NS_WARNING("Multipart channel sent an image of a different size");
// Make the decoder aware of the error so that it doesn't try to call
// FinishInternal during ShutdownDecoder.
@ -1210,14 +1215,10 @@ RasterImage::EnsureFrame(PRUint32 aFrameNum, PRInt32 aX, PRInt32 aY,
}
}
// Not reusable, so replace the frame directly.
DeleteImgFrame(aFrameNum);
mFrames.RemoveElementAt(aFrameNum);
nsAutoPtr<imgFrame> newFrame(new imgFrame());
nsresult rv = newFrame->Init(aX, aY, aWidth, aHeight, aFormat, aPaletteDepth);
NS_ENSURE_SUCCESS(rv, rv);
return InternalAddFrameHelper(aFrameNum, newFrame.forget(), imageData,
imageLength, paletteData, paletteLength);
return InternalAddFrame(aFrameNum, aX, aY, aWidth, aHeight, aFormat,
aPaletteDepth, imageData, imageLength,
paletteData, paletteLength);
}
nsresult
@ -1490,31 +1491,6 @@ RasterImage::AddSourceData(const char *aBuffer, PRUint32 aCount)
// This call should come straight from necko - no reentrancy allowed
NS_ABORT_IF_FALSE(!mInDecoder, "Re-entrant call to AddSourceData!");
// Starting a new part's frames, let's clean up before we add any
// This needs to happen just before we start getting EnsureFrame() call(s),
// so that there's no gap for anything to miss us.
if (mBytesDecoded == 0) {
// Our previous state may have been animated, so let's clean up
bool wasAnimating = mAnimating;
if (mAnimating) {
StopAnimation();
mAnimating = false;
}
mAnimationFinished = false;
if (mAnim) {
delete mAnim;
mAnim = nsnull;
}
// If there's only one frame, this could cause flickering
int old_frame_count = mFrames.Length();
if (old_frame_count > 1) {
for (int i = 0; i < old_frame_count; ++i) {
DeleteImgFrame(i);
}
mFrames.Clear();
}
}
// If we're not storing source data, write it directly to the decoder
if (!StoringSourceData()) {
rv = WriteToDecoder(aBuffer, aCount);
@ -1644,7 +1620,7 @@ RasterImage::SourceDataComplete()
}
nsresult
RasterImage::NewSourceData(const char* aMimeType)
RasterImage::NewSourceData()
{
nsresult rv;
@ -1679,8 +1655,6 @@ RasterImage::NewSourceData(const char* aMimeType)
mDecoded = false;
mHasSourceData = false;
mSourceDataMimeType.Assign(aMimeType);
// We're decode-on-load here. Open up a new decoder just like what happens when
// we call Init() for decode-on-load images.
rv = InitDecoder(/* aDoSizeDecode = */ false);

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

@ -304,7 +304,7 @@ public:
nsresult SourceDataComplete();
/* Called for multipart images when there's a new source image to add. */
nsresult NewSourceData(const char *aMimeType);
nsresult NewSourceData();
/**
* A hint of the number of bytes of source data that the image contains. If

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

@ -768,19 +768,14 @@ NS_IMETHODIMP imgRequest::OnStartRequest(nsIRequest *aRequest, nsISupports *ctxt
// If we're multipart, and our image is initialized, fix things up for another round
if (mIsMultiPartChannel && mImage) {
// Update the content type for this new part
nsCOMPtr<nsIChannel> partChan(do_QueryInterface(aRequest));
partChan->GetContentType(mContentType);
if (mContentType.EqualsLiteral(SVG_MIMETYPE) ||
mImage->GetType() == imgIContainer::TYPE_VECTOR) {
// mImage won't be reusable due to format change or a new SVG part
// Reset the tracker and forget that we have data for OnDataAvailable to
// treat its next call as a fresh image.
mStatusTracker = new imgStatusTracker(nsnull);
mGotData = false;
} else if (mImage->GetType() == imgIContainer::TYPE_RASTER) {
if (mImage->GetType() == imgIContainer::TYPE_RASTER) {
// Inform the RasterImage that we have new source data
static_cast<RasterImage*>(mImage.get())->NewSourceData(mContentType.get());
static_cast<RasterImage*>(mImage.get())->NewSourceData();
} else { // imageType == imgIContainer::TYPE_VECTOR
nsCOMPtr<nsIStreamListener> imageAsStream = do_QueryInterface(mImage);
NS_ABORT_IF_FALSE(imageAsStream,
"SVG-typed Image failed QI to nsIStreamListener");
imageAsStream->OnStartRequest(aRequest, ctxt);
}
}

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

@ -131,8 +131,6 @@ public:
// wins.
static void SetCacheValidation(imgCacheEntry* aEntry, nsIRequest* aRequest);
bool GetMultipart() const { return mIsMultiPartChannel; }
// The CORS mode for which we loaded this image.
PRInt32 GetCORSMode() const { return mCORSMode; }

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

@ -558,17 +558,6 @@ NS_IMETHODIMP imgRequestProxy::GetImagePrincipal(nsIPrincipal **aPrincipal)
return NS_OK;
}
/* readonly attribute bool multipart; */
NS_IMETHODIMP imgRequestProxy::GetMultipart(bool *aMultipart)
{
if (!mOwner)
return NS_ERROR_FAILURE;
*aMultipart = mOwner->GetMultipart();
return NS_OK;
}
/* readonly attribute PRInt32 CORSMode; */
NS_IMETHODIMP imgRequestProxy::GetCORSMode(PRInt32* aCorsMode)
{
@ -706,10 +695,6 @@ void imgRequestProxy::OnStopContainer(imgIContainer *image)
nsCOMPtr<imgIDecoderObserver> kungFuDeathGrip(mListener);
mListener->OnStopContainer(this, image);
}
// Multipart needs reset for next OnStartContainer
if (mOwner && mOwner->GetMultipart())
mSentStartContainer = false;
}
void imgRequestProxy::OnStopDecode(nsresult status, const PRUnichar *statusArg)

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

@ -253,7 +253,7 @@ private:
bool mDeferNotifications;
// We only want to send OnStartContainer once for each proxy, but we might
// get multiple OnStartContainer calls.
// get multiple OnStartContainer calls (e.g. from multipart/x-mixed-replace).
bool mSentStartContainer;
};

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

@ -86,10 +86,6 @@ _TEST_FILES = imgutils.js \
bug671906-iframe.html \
bug671906.sjs \
test_bug671906.html \
test_bug733553.html \
bug733553-iframe.html \
bug733553.sjs \
animated-gif2.gif \
test_error_events.html \
error-early.png \
test_drawDiscardedImage.html \

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

@ -1,7 +0,0 @@
<html>
<head>
<title>Bug 733553 iframe</title>
<body>
<img src="bug733553.sjs" id="image1" />
</body>
</html>

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

@ -1,77 +0,0 @@
/* Any copyright is dedicated to the Public Domain.
* http://creativecommons.org/publicdomain/zero/1.0/
*/
var bodyPartIndex = 0;
var bodyParts = [
["red.png", "image/png"],
["red.png", "image/png"], // Tests actually begin here
["animated-gif2.gif", "image/gif"],
["red.png", "image/png"],
["lime100x100.svg", "image/svg+xml"],
["big.png", "image/png"],
["animated-gif2.gif", "image/gif"],
["red.png", "image/png"],
["lime100x100.svg", "image/svg+xml"]
];
var timer = Components.classes["@mozilla.org/timer;1"];
var partTimer = timer.createInstance(Components.interfaces.nsITimer);
function getFileAsInputStream(aFilename) {
var file = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties)
.get("CurWorkD", Components.interfaces.nsIFile);
file.append("tests");
file.append("image");
file.append("test");
file.append("mochitest");
file.append(aFilename);
var fileStream = Components.classes['@mozilla.org/network/file-input-stream;1']
.createInstance(Components.interfaces.nsIFileInputStream);
fileStream.init(file, 1, 0, false);
return fileStream;
}
function handleRequest(request, response)
{
response.setHeader("Content-Type",
"multipart/x-mixed-replace;boundary=BOUNDARYOMG", false);
response.setHeader("Cache-Control", "no-cache", false);
response.setStatusLine(request.httpVersion, 200, "OK");
// We're sending parts off in a delayed fashion, to let the tests occur.
response.processAsync();
response.write("--BOUNDARYOMG\r\n");
sendParts(response);
}
function sendParts(response) {
if (bodyParts.length > bodyPartIndex) {
partTimer.initWithCallback(getSendNextPart(response), 200,
Components.interfaces.nsITimer.TYPE_ONE_SHOT);
}
else {
sendClose(response);
}
}
function sendClose(response) {
response.write("--BOUNDARYOMG--\r\n");
response.finish();
}
function getSendNextPart(response) {
var part = bodyParts[bodyPartIndex++];
var nextPartHead = "Content-Type: " + part[1] + "\r\n\r\n";
var inputStream = getFileAsInputStream(part[0]);
return function () {
response.bodyOutputStream.write(nextPartHead, nextPartHead.length);
response.bodyOutputStream.writeFrom(inputStream, inputStream.available());
inputStream.close();
// Toss in the boundary, so the browser can know this part is complete
response.write("--BOUNDARYOMG\r\n");
sendParts(response);
}
}

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

@ -1,55 +0,0 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=733553
-->
<head>
<title>Test for Bug 733553</title>
<script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=733553">Mozilla Bug 733553</a>
<p id="display"></p>
<pre id="test">
<script type="application/javascript">
SimpleTest.waitForExplicitFinish();
var testIndex = 0;
var testParts = [
[1, "red.png"],
[40, "animated-gif2.gif"],
[1, "red.png"],
[100, "lime100x100.svg"],
[3000, "big.png"],
[40, "animated-gif2.gif"],
[1, "red.png"]
];
function initializeOnload() {
var iframeelem = document.getElementById('test-iframe');
var firstimg = iframeelem.contentDocument.getElementById('image1');
firstimg.addEventListener("load", imageLoad, false);
}
function imageLoad(aEvent) {
if (testParts.length > testIndex) {
var [width, fileName] = testParts[testIndex++];
is(aEvent.target.width, width,
"Test " + (testIndex - 1) + " " + fileName + " width not correct");
}
else {
aEvent.target.removeEventListener("load", arguments.callee, false);
SimpleTest.finish();
}
}
</script>
</pre>
<div id="content"> <!-- style="display: none" -->
<iframe id="test-iframe" src="http://mochi.test:8888/tests/image/test/mochitest/bug733553-iframe.html" onload="initializeOnload()"></iframe>
</div>
</body>
</html>

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

@ -652,10 +652,7 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest,
return NS_ERROR_FAILURE;
}
bool multipart = false;
aRequest->GetMultipart(&multipart);
if (loadType == nsIImageLoadingContent::PENDING_REQUEST || multipart) {
if (loadType == nsIImageLoadingContent::PENDING_REQUEST) {
NotifyNewCurrentRequest(aRequest, aStatus);
}