зеркало из https://github.com/mozilla/gecko-dev.git
Bug 514033 - Error recovery for imagelib - part 14 - Log data errors to the console.r=joe,a=blocker
This commit is contained in:
Родитель
7e4eafdb4f
Коммит
6602afc21b
|
@ -37,6 +37,8 @@
|
|||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "Decoder.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIConsoleService.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace imagelib {
|
||||
|
@ -114,6 +116,14 @@ Decoder::Finish()
|
|||
// notifications.
|
||||
if (!IsSizeDecode() && !mDecodeDone) {
|
||||
|
||||
// Log data errors to the error console
|
||||
nsCOMPtr<nsIConsoleService> aConsoleService = do_GetService("@mozilla.org/consoleservice;1");
|
||||
if (aConsoleService && !IsDecoderError()) {
|
||||
nsAutoString msg(NS_LITERAL_STRING("Image corrupt or truncated: ") +
|
||||
NS_ConvertASCIItoUTF16(mImage->GetURIString()));
|
||||
aConsoleService->LogStringMessage(msg.get());
|
||||
}
|
||||
|
||||
// If we only have a data error, see if things are worth salvaging
|
||||
bool salvage = !IsDecoderError() && mImage->GetNumFrames();
|
||||
|
||||
|
@ -252,8 +262,6 @@ void
|
|||
Decoder::PostDataError()
|
||||
{
|
||||
mDataError = true;
|
||||
|
||||
//XXXbholley - we should probably log to the web console here
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -305,6 +305,8 @@ public:
|
|||
static void SetMaxMSBeforeYield(PRUint32 aMaxMS);
|
||||
static void SetMaxBytesForSyncDecode(PRUint32 aMaxBytes);
|
||||
|
||||
const char* GetURIString() { return mURIString.get();}
|
||||
|
||||
private:
|
||||
struct Anim
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче