p->BumpPriority(priority);
p->AdjustPriority(priority);
static nsresult NewImageChannel(nsIChannel **aResult,                                nsIURI *aURI,                                nsIURI *aInitialDocumentURI,                                nsIURI *aReferringURI,                                nsILoadGroup *aLoadGroup,                                nsLoadFlags aLoadFlags){  nsresult rv;  nsCOMPtr<nsIChannel> newChannel;  nsCOMPtr<nsIHttpChannel> newHttpChannel;   nsCOMPtr<nsIInterfaceRequestor> callbacks;  if (aLoadGroup) {    // Get the notification callbacks from the load group for the new channel.    //    // XXX: This is not exactly correct, because the network request could be    //      referenced by multiple windows...  However, the new channel needs    //      something.  So, using the 'first' notification callbacks is better    //      than nothing...    //    aLoadGroup->GetNotificationCallbacks(getter_AddRefs(callbacks));  }  // Pass in a NULL loadgroup because this is the underlying network request.  // This request may be referenced by several proxy image requests (psossibly  // in different documents).  // If all of the proxy requests are canceled then this request should be  // canceled too.  //  rv = NS_NewChannel(aResult,                     aURI,        // URI                      nsnull,      // Cached IOService                     nsnull,      // LoadGroup                     callbacks,   // Notification Callbacks                     aLoadFlags);  if (NS_FAILED(rv))    return rv;  // Initialize HTTP-specific attributes  newHttpChannel = do_QueryInterface(*aResult);  if (newHttpChannel) {    newHttpChannel->SetRequestHeader(NS_LITERAL_CSTRING("Accept"),                                     NS_LITERAL_CSTRING("image/png,*/*;q=0.5"),                                     PR_FALSE);    nsCOMPtr<nsIHttpChannelInternal> httpChannelInternal = do_QueryInterface(newHttpChannel);    NS_ENSURE_TRUE(httpChannelInternal, NS_ERROR_UNEXPECTED);    httpChannelInternal->SetDocumentURI(aInitialDocumentURI);    newHttpChannel->SetReferrer(aReferringURI);  }  // Image channels are loaded by default with reduced priority.  nsCOMPtr<nsISupportsPriority> p = do_QueryInterface(*aResult);  if (p) {    PRUint32 priority = nsISupportsPriority::PRIORITY_LOW;    if (aLoadFlags & nsIRequest::LOAD_BACKGROUND)      ++priority; // further reduce priority for background loads    p->BumpPriority(priority);  }  return NS_OK;}