Bug 807556 - Remove imgIRequest::loadImage's aRequest argument. r=joe

This commit is contained in:
Seth Fowler 2012-11-03 23:04:07 -04:00
Родитель c7c75c9730
Коммит 7864e2fd96
10 изменённых файлов: 23 добавлений и 45 удалений

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

@ -2760,7 +2760,6 @@ nsContentUtils::LoadImage(nsIURI* aURI, nsIDocument* aLoadingDocument,
aLoadingDocument, /* uniquification key */
aLoadFlags, /* load flags */
nullptr, /* cache key */
nullptr, /* existing request*/
channelPolicy, /* CSP info */
aRequest);
}

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

@ -305,7 +305,7 @@ nsContextMenuInfo::GetBackgroundImageRequestInternal(nsIDOMNode *aDOMNode, imgIR
NS_ENSURE_TRUE(il, NS_ERROR_FAILURE);
return il->LoadImage(bgUri, nullptr, nullptr, principal, nullptr,
nullptr, nullptr, nsIRequest::LOAD_NORMAL, nullptr,
nullptr, nullptr, nsIRequest::LOAD_NORMAL,
nullptr, channelPolicy, aRequest);
}
}

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

@ -27,7 +27,7 @@ interface nsIChannelPolicy;
* @version 0.3
* @see imagelib2
*/
[scriptable, uuid(f5a7c016-8caf-460a-b1a1-3fe5534d5c9e)]
[scriptable, uuid(278c4c8e-934f-4364-b49b-081cd8b1d595)]
interface imgILoader : nsISupports
{
// Extra flags to pass to loadImage if you want a load to use CORS
@ -47,8 +47,6 @@ interface imgILoader : nsISupports
* @param aLoadFlags Load flags for the request
* @param aCacheKey cache key to use for a load if the original
* image came from a request that had post data
* @param aRequest A newly created, unused imgIRequest object or NULL for one to
be created for you.
* libpr0n does NOT keep a strong ref to the observer; this prevents
@ -65,7 +63,6 @@ interface imgILoader : nsISupports
in nsISupports aCX,
in nsLoadFlags aLoadFlags,
in nsISupports cacheKey,
in imgIRequest aRequest,
in nsIChannelPolicy channelPolicy);
/**

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

@ -681,8 +681,7 @@ imgCacheQueue::const_iterator imgCacheQueue::end() const
nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup,
imgINotificationObserver *aObserver,
nsLoadFlags aLoadFlags, imgIRequest *aProxyRequest,
imgIRequest **_retval)
nsLoadFlags aLoadFlags, imgIRequest **_retval)
{
LOG_SCOPE_WITH_PARAM(GetImgLog(), "imgLoader::CreateNewProxyForRequest", "imgRequest", aRequest);
@ -691,12 +690,7 @@ nsresult imgLoader::CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup
proxy calls to |aObserver|.
*/
imgRequestProxy *proxyRequest;
if (aProxyRequest) {
proxyRequest = static_cast<imgRequestProxy *>(aProxyRequest);
} else {
proxyRequest = new imgRequestProxy();
}
imgRequestProxy *proxyRequest = new imgRequestProxy();
NS_ADDREF(proxyRequest);
/* It is important to call |SetLoadFlags()| before calling |Init()| because
@ -1165,7 +1159,6 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request,
imgINotificationObserver *aObserver,
nsISupports *aCX,
nsLoadFlags aLoadFlags,
imgIRequest *aExistingRequest,
imgIRequest **aProxyRequest,
nsIChannelPolicy *aPolicy,
nsIPrincipal* aLoadingPrincipal,
@ -1180,8 +1173,7 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request,
// If we're currently in the middle of validating this request, just hand
// back a proxy to it; the required work will be done for us.
if (request->mValidator) {
rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver,
aLoadFlags, aExistingRequest,
rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver, aLoadFlags,
reinterpret_cast<imgIRequest **>(aProxyRequest));
if (NS_FAILED(rv)) {
return false;
@ -1224,7 +1216,7 @@ bool imgLoader::ValidateRequestWithNewChannel(imgRequest *request,
nsCOMPtr<imgIRequest> req;
rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver,
aLoadFlags, aExistingRequest, getter_AddRefs(req));
aLoadFlags, getter_AddRefs(req));
if (NS_FAILED(rv)) {
return false;
}
@ -1288,7 +1280,6 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry,
nsISupports *aCX,
nsLoadFlags aLoadFlags,
bool aCanMakeNewChannel,
imgIRequest *aExistingRequest,
imgIRequest **aProxyRequest,
nsIChannelPolicy *aPolicy,
nsIPrincipal* aLoadingPrincipal,
@ -1389,8 +1380,7 @@ bool imgLoader::ValidateEntry(imgCacheEntry *aEntry,
return ValidateRequestWithNewChannel(request, aURI, aInitialDocumentURI,
aReferrerURI, aLoadGroup, aObserver,
aCX, aLoadFlags, aExistingRequest,
aProxyRequest, aPolicy,
aCX, aLoadFlags, aProxyRequest, aPolicy,
aLoadingPrincipal, aCORSMode);
}
@ -1521,7 +1511,7 @@ nsresult imgLoader::EvictEntries(imgCacheQueue &aQueueToClear)
nsIRequest::VALIDATE_ONCE_PER_SESSION)
/* imgIRequest loadImage (in nsIURI aURI, in nsIURI initialDocumentURI, in nsIPrincipal loadingPrincipal, in nsILoadGroup aLoadGroup, in imgINotificationObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in imgIRequest aRequest); */
/* imgIRequest loadImage(in nsIURI aURI, in nsIURI aInitialDocumentURL, in nsIURI aReferrerURI, in nsIPrincipal aLoadingPrincipal, in nsILoadGroup aLoadGroup, in imgINotificationObserver aObserver, in nsISupports aCX, in nsLoadFlags aLoadFlags, in nsISupports cacheKey, in nsIChannelPolicy channelPolicy); */
NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
nsIURI *aInitialDocumentURI,
@ -1532,7 +1522,6 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
nsISupports *aCX,
nsLoadFlags aLoadFlags,
nsISupports *aCacheKey,
imgIRequest *aRequest,
nsIChannelPolicy *aPolicy,
imgIRequest **_retval)
{
@ -1557,10 +1546,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
#ifdef DEBUG
bool isPrivate = false;
nsCOMPtr<nsIChannel> channel = do_QueryInterface(aRequest);
if (channel) {
isPrivate = NS_UsePrivateBrowsing(channel);
} else if (aLoadGroup) {
if (aLoadGroup) {
nsCOMPtr<nsIInterfaceRequestor> callbacks;
aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks));
if (callbacks) {
@ -1615,7 +1601,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
if (cache.Get(spec, getter_AddRefs(entry)) && entry) {
if (ValidateEntry(entry, aURI, aInitialDocumentURI, aReferrerURI,
aLoadGroup, aObserver, aCX, requestFlags, true,
aRequest, _retval, aPolicy, aLoadingPrincipal, corsmode)) {
_retval, aPolicy, aLoadingPrincipal, corsmode)) {
request = getter_AddRefs(entry->GetRequest());
// If this entry has no proxies, its request has no reference to the entry.
@ -1746,7 +1732,7 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIURI *aURI,
LOG_MSG(GetImgLog(), "imgLoader::LoadImage", "creating proxy request.");
rv = CreateNewProxyForRequest(request, aLoadGroup, aObserver,
requestFlags, aRequest, _retval);
requestFlags, _retval);
if (NS_FAILED(rv)) {
return rv;
}
@ -1823,7 +1809,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat
// code, but seems nonsensical.
if (ValidateEntry(entry, uri, nullptr, nullptr, nullptr, aObserver, aCX,
requestFlags, false, nullptr, nullptr, nullptr,
nullptr, imgIRequest::CORS_NONE)) {
imgIRequest::CORS_NONE)) {
request = getter_AddRefs(entry->GetRequest());
} else {
nsCOMPtr<nsICachingChannel> cacheChan(do_QueryInterface(channel));
@ -1870,7 +1856,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat
*listener = nullptr; // give them back a null nsIStreamListener
rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
requestFlags, nullptr, _retval);
requestFlags, _retval);
static_cast<imgRequestProxy*>(*_retval)->NotifyListener();
} else {
// Default to doing a principal check because we don't know who
@ -1898,7 +1884,7 @@ NS_IMETHODIMP imgLoader::LoadImageWithChannel(nsIChannel *channel, imgINotificat
PutIntoCache(originalURI, entry);
rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
requestFlags, nullptr, _retval);
requestFlags, _retval);
// Explicitly don't notify our proxy, because we're loading off the
// network, and necko (or things called from necko, such as

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

@ -285,24 +285,22 @@ public:
private: // methods
bool ValidateEntry(imgCacheEntry *aEntry, nsIURI *aKey,
nsIURI *aInitialDocumentURI, nsIURI *aReferrerURI,
nsILoadGroup *aLoadGroup,
imgINotificationObserver *aObserver, nsISupports *aCX,
nsLoadFlags aLoadFlags, bool aCanMakeNewChannel,
imgIRequest *aExistingRequest,
imgIRequest **aProxyRequest,
nsIChannelPolicy *aPolicy,
nsIPrincipal* aLoadingPrincipal,
int32_t aCORSMode);
bool ValidateRequestWithNewChannel(imgRequest *request, nsIURI *aURI,
nsIURI *aInitialDocumentURI,
nsIURI *aReferrerURI,
nsILoadGroup *aLoadGroup,
imgINotificationObserver *aObserver,
nsISupports *aCX, nsLoadFlags aLoadFlags,
imgIRequest *aExistingRequest,
imgIRequest **aProxyRequest,
nsIChannelPolicy *aPolicy,
nsIPrincipal* aLoadingPrincipal,
@ -310,8 +308,7 @@ private: // methods
nsresult CreateNewProxyForRequest(imgRequest *aRequest, nsILoadGroup *aLoadGroup,
imgINotificationObserver *aObserver,
nsLoadFlags aLoadFlags, imgIRequest *aRequestProxy,
imgIRequest **_retval);
nsLoadFlags aLoadFlags, imgIRequest **_retval);
void ReadAcceptHeaderPref();

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

@ -96,7 +96,7 @@ function checkSecondLoad()
var listener = new ImageListener(checkClone, secondLoadDone);
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
.createScriptedObserver(listener);
requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null));
requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null));
listener.synchronous = false;
}
@ -198,7 +198,7 @@ function startImageCallback(otherCb)
var listener2 = new ImageListener(null, function(foo, bar) { do_test_finished(); });
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
.createScriptedObserver(listener2);
requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null));
requests.push(gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null));
listener2.synchronous = false;
// Now that we've started another load, chain to the callback.
@ -216,7 +216,7 @@ function run_test()
var listener = new ImageListener(startImageCallback(checkClone), firstLoadDone);
var outer = Cc["@mozilla.org/image/tools;1"].getService(Ci.imgITools)
.createScriptedObserver(listener);
var req = gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null, null);
var req = gCurrentLoader.loadImage(uri, null, null, null, null, outer, null, 0, null, null);
requests.push(req);
// Ensure that we don't cause any mayhem when we lock an image.

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

@ -73,7 +73,7 @@ function loadImage(isPrivate, callback) {
var loadGroup = Cc["@mozilla.org/network/load-group;1"].createInstance(Ci.nsILoadGroup);
loadGroup.notificationCallbacks = new NotificationCallbacks(isPrivate);
var loader = isPrivate ? gPrivateLoader : gPublicLoader;
requests.push(loader.loadImage(uri, null, null, null, loadGroup, outer, null, 0, null, null, null));
requests.push(loader.loadImage(uri, null, null, null, loadGroup, outer, null, 0, null, null));
listener.synchronous = false;
}

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

@ -1837,7 +1837,6 @@ nsImageFrame::LoadIcon(const nsAString& aSpec,
nullptr, /* Not associated with any particular document */
loadFlags,
nullptr,
nullptr,
nullptr, /* channel policy not needed */
aRequest);
}

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

@ -202,7 +202,7 @@ nsAlertsIconListener::StartRequest(const nsAString & aImageUrl)
return il->LoadImage(imageUri, nullptr, nullptr, nullptr, nullptr, this,
nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr,
nullptr, getter_AddRefs(mIconRequest));
getter_AddRefs(mIconRequest));
}
void

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

@ -305,7 +305,7 @@ nsMenuItemIconX::LoadIcon(nsIURI* aIconURI)
// Passing in null for channelPolicy here since nsMenuItemIconX::LoadIcon is
// not exposed to web content
nsresult rv = loader->LoadImage(aIconURI, nullptr, nullptr, nullptr, loadGroup, this,
nullptr, nsIRequest::LOAD_NORMAL, nullptr, nullptr,
nullptr, nsIRequest::LOAD_NORMAL, nullptr,
nullptr, getter_AddRefs(mIconRequest));
if (NS_FAILED(rv)) return rv;