mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 717759 - negative pipeline feedback on img decode problem r=bz r=jdrew r=honzab
--HG-- extra : rebase_source : cb9795b5442102a777602f59c225ab9572e06cea
This commit is contained in:
parent
ace7949788
commit
e9dedc0c35
@ -685,6 +685,15 @@ NS_IMETHODIMP imgRequest::OnStopDecode(imgIRequest *aRequest,
|
|||||||
aStatusArg);
|
aStatusArg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (NS_FAILED(aStatus)) {
|
||||||
|
// Some kind of problem has happened with image decoding.
|
||||||
|
// Report the URI to net:failed-to-decode-uri observers.
|
||||||
|
|
||||||
|
nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
|
||||||
|
if (os)
|
||||||
|
os->NotifyObservers(mURI, "net:failed-to-process-uri", nsnull);
|
||||||
|
}
|
||||||
|
|
||||||
// RasterImage and everything below it is completely correct and
|
// RasterImage and everything below it is completely correct and
|
||||||
// bulletproof about its handling of decoder notifications.
|
// bulletproof about its handling of decoder notifications.
|
||||||
// Unfortunately, here and above we have to make some gross and
|
// Unfortunately, here and above we have to make some gross and
|
||||||
|
@ -118,6 +118,9 @@ _CHROME_FILES = imgutils.js \
|
|||||||
test_undisplayed_iframe.html \
|
test_undisplayed_iframe.html \
|
||||||
iframe.html \
|
iframe.html \
|
||||||
ref-iframe.html \
|
ref-iframe.html \
|
||||||
|
test_net_failedtoprocess.html \
|
||||||
|
invalid.jpg \
|
||||||
|
damon.jpg \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libs:: $(_TEST_FILES)
|
libs:: $(_TEST_FILES)
|
||||||
|
1
image/test/mochitest/invalid.jpg
Normal file
1
image/test/mochitest/invalid.jpg
Normal file
@ -0,0 +1 @@
|
|||||||
|
notajpg
|
48
image/test/mochitest/test_net_failedtoprocess.html
Normal file
48
image/test/mochitest/test_net_failedtoprocess.html
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
<!DOCTYPE HTML>
|
||||||
|
<html>
|
||||||
|
<!--
|
||||||
|
Test that a image decoding error producs a net:failed-to-process-uri
|
||||||
|
observer event with the nsIURI of the failed image as the subject
|
||||||
|
-->
|
||||||
|
<head>
|
||||||
|
<title>Test for image net:failed-to-process-uri</title>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/MochiKit/packed.js"></script>
|
||||||
|
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||||
|
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<p id="display"></p>
|
||||||
|
<pre id="test">
|
||||||
|
<script type="application/javascript">
|
||||||
|
|
||||||
|
SimpleTest.waitForExplicitFinish();
|
||||||
|
|
||||||
|
const Ci = Components.interfaces;
|
||||||
|
const Cc = Components.classes;
|
||||||
|
|
||||||
|
var observer = {
|
||||||
|
QueryInterface: function (aIID) {
|
||||||
|
if (aIID.equals(Ci.nsISupports) ||
|
||||||
|
aIID.equals(Ci.nsIObserver))
|
||||||
|
return this;
|
||||||
|
throw Cr.NS_ERROR_NO_INTERFACE;
|
||||||
|
},
|
||||||
|
|
||||||
|
observe: function(subject, topic, data) {
|
||||||
|
ok(topic == "net:failed-to-process-uri", "wrong topic");
|
||||||
|
subject = subject.QueryInterface(Ci.nsIURI);
|
||||||
|
ok(subject.asciiSpec == "chrome://mochitests/content/chrome/image/test/mochitest/invalid.jpg", "wrong subject");
|
||||||
|
SimpleTest.finish();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
var obs = Cc["@mozilla.org/observer-service;1"].getService();
|
||||||
|
obs = obs.QueryInterface(Ci.nsIObserverService);
|
||||||
|
obs.addObserver(observer, "net:failed-to-process-uri", false);
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</pre>
|
||||||
|
<img src="damon.jpg">
|
||||||
|
<img src="invalid.jpg">
|
||||||
|
</body>
|
||||||
|
</html>
|
@ -990,6 +990,29 @@ nsHttpConnectionMgr::PipelineFeedbackInfo(nsHttpConnectionInfo *ci,
|
|||||||
ent->OnPipelineFeedbackInfo(info, conn, data);
|
ent->OnPipelineFeedbackInfo(info, conn, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
nsHttpConnectionMgr::ReportFailedToProcess(nsIURI *uri)
|
||||||
|
{
|
||||||
|
NS_ABORT_IF_FALSE(uri, "precondition");
|
||||||
|
|
||||||
|
nsCAutoString host;
|
||||||
|
PRInt32 port = -1;
|
||||||
|
bool usingSSL = false;
|
||||||
|
|
||||||
|
nsresult rv = uri->SchemeIs("https", &usingSSL);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
rv = uri->GetAsciiHost(host);
|
||||||
|
if (NS_SUCCEEDED(rv))
|
||||||
|
rv = uri->GetPort(&port);
|
||||||
|
if (NS_FAILED(rv) || host.IsEmpty())
|
||||||
|
return;
|
||||||
|
|
||||||
|
nsRefPtr<nsHttpConnectionInfo> ci =
|
||||||
|
new nsHttpConnectionInfo(host, port, nsnull, usingSSL);
|
||||||
|
|
||||||
|
PipelineFeedbackInfo(ci, RedCorruptedContent, nsnull, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// we're at the active connection limit if any one of the following conditions is true:
|
// we're at the active connection limit if any one of the following conditions is true:
|
||||||
// (1) at max-connections
|
// (1) at max-connections
|
||||||
// (2) keep-alive enabled and at max-persistent-connections-per-server/proxy
|
// (2) keep-alive enabled and at max-persistent-connections-per-server/proxy
|
||||||
|
@ -205,6 +205,8 @@ public:
|
|||||||
nsHttpConnection *,
|
nsHttpConnection *,
|
||||||
PRUint32);
|
PRUint32);
|
||||||
|
|
||||||
|
void ReportFailedToProcess(nsIURI *uri);
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
// NOTE: functions below may be called only on the socket thread.
|
// NOTE: functions below may be called only on the socket thread.
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
@ -343,6 +343,7 @@ nsHttpHandler::Init()
|
|||||||
mObserverService->AddObserver(this, "net:clear-active-logins", true);
|
mObserverService->AddObserver(this, "net:clear-active-logins", true);
|
||||||
mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, true);
|
mObserverService->AddObserver(this, NS_PRIVATE_BROWSING_SWITCH_TOPIC, true);
|
||||||
mObserverService->AddObserver(this, "net:prune-dead-connections", true);
|
mObserverService->AddObserver(this, "net:prune-dead-connections", true);
|
||||||
|
mObserverService->AddObserver(this, "net:failed-to-process-uri", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
@ -1634,6 +1635,11 @@ nsHttpHandler::Observe(nsISupports *subject,
|
|||||||
mConnMgr->PruneDeadConnections();
|
mConnMgr->PruneDeadConnections();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (strcmp(topic, "net:failed-to-process-uri") == 0) {
|
||||||
|
nsCOMPtr<nsIURI> uri = do_QueryInterface(subject);
|
||||||
|
if (uri && mConnMgr)
|
||||||
|
mConnMgr->ReportFailedToProcess(uri);
|
||||||
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user