Skip to content

Commit

Permalink
Bug 1691861 - Remove unused mContentType fields. r=mconley
Browse files Browse the repository at this point in the history
This code seems to have been broken quite some time ago, but without adverse effect.
I have filed bug 1691868 so that a proper fix can be found.

In the meantime, this preserves the current behavior and is less confusing.

Differential Revision: https://phabricator.services.mozilla.com/D104634
  • Loading branch information
mstange committed Feb 12, 2021
1 parent c4aefae commit 073241f
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
13 changes: 8 additions & 5 deletions widget/IconLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,15 @@
#include "mozilla/dom/Document.h"
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "nsIContentPolicy.h"

using namespace mozilla;

namespace mozilla::widget {

NS_IMPL_ISUPPORTS(IconLoader, imgINotificationObserver)

IconLoader::IconLoader(Listener* aListener)
: mContentType(nsIContentPolicy::TYPE_INTERNAL_IMAGE),
mListener(aListener) {}
IconLoader::IconLoader(Listener* aListener) : mListener(aListener) {}

IconLoader::~IconLoader() { Destroy(); }

Expand Down Expand Up @@ -60,13 +59,17 @@ nsresult IconLoader::LoadIcon(nsIURI* aIconURI, nsINode* aNode,
if (aIsInternalIcon) {
rv = loader->LoadImage(
aIconURI, nullptr, nullptr, nullptr, 0, loadGroup, this, nullptr,
nullptr, nsIRequest::LOAD_NORMAL, nullptr, mContentType, u""_ns,
nullptr, nsIRequest::LOAD_NORMAL, nullptr,
nsIContentPolicy::TYPE_INTERNAL_IMAGE, u""_ns,
/* aUseUrgentStartForChannel */ false, /* aLinkPreload */ false,
getter_AddRefs(mIconRequest));
} else {
// TODO: nsIContentPolicy::TYPE_INTERNAL_IMAGE may not be the correct
// policy. See bug 1691868 for more details.
rv = loader->LoadImage(
aIconURI, nullptr, nullptr, aNode->NodePrincipal(), 0, loadGroup, this,
aNode, document, nsIRequest::LOAD_NORMAL, nullptr, mContentType, u""_ns,
aNode, document, nsIRequest::LOAD_NORMAL, nullptr,
nsIContentPolicy::TYPE_INTERNAL_IMAGE, u""_ns,
/* aUseUrgentStartForChannel */ false,
/* aLinkPreload */ false, getter_AddRefs(mIconRequest));
}
Expand Down
2 changes: 0 additions & 2 deletions widget/IconLoader.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
#include "imgINotificationObserver.h"
#include "mozilla/RefPtr.h"
#include "nsCOMPtr.h"
#include "nsIContentPolicy.h"
#include "nsISupports.h"

class nsIURI;
Expand Down Expand Up @@ -57,7 +56,6 @@ class IconLoader : public imgINotificationObserver {
virtual ~IconLoader();

private:
nsContentPolicyType mContentType;
RefPtr<imgRequestProxy> mIconRequest;

// The listener, which is notified when loading completes.
Expand Down
1 change: 0 additions & 1 deletion widget/cocoa/nsMenuItemIconX.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ class nsMenuItemIconX : public mozilla::widget::IconLoader::Listener {

protected:
nsCOMPtr<nsIContent> mContent;
nsContentPolicyType mContentType;
nsMenuObjectX* mMenuObject; // [weak]
nsIntRect mImageRegionRect;
bool mSetIcon;
Expand Down
6 changes: 0 additions & 6 deletions widget/cocoa/nsMenuItemIconX.mm
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
nsMenuItemIconX::nsMenuItemIconX(nsMenuObjectX* aMenuItem, nsIContent* aContent,
NSMenuItem* aNativeMenuItem)
: mContent(aContent),
mContentType(nsIContentPolicy::TYPE_INTERNAL_IMAGE),
mMenuObject(aMenuItem),
mSetIcon(false),
mNativeMenuItem(aNativeMenuItem) {
Expand Down Expand Up @@ -160,11 +159,6 @@
return NS_ERROR_FAILURE;
}
} else {
uint64_t dummy = 0;
nsCOMPtr<nsIPrincipal> triggeringPrincipal = mContent->NodePrincipal();
nsContentUtils::GetContentPolicyTypeForUIImageLoading(
mContent, getter_AddRefs(triggeringPrincipal), mContentType, &dummy);

// If this menu item shouldn't have an icon, the string will be empty,
// and NS_NewURI will fail.
rv = NS_NewURI(getter_AddRefs(iconURI), imageURIString);
Expand Down

0 comments on commit 073241f

Please sign in to comment.