Bug 1875466 - Remove nsIObjectLoadingContent::TYPE_IMAGE. r=webidl,emilio

Depends on D199116

Differential Revision: https://phabricator.services.mozilla.com/D199117
This commit is contained in:
Tom Schuster
2024-01-22 14:26:11 +00:00
parent 549a8ff507
commit 8c14e039c0
5 changed files with 9 additions and 47 deletions

View File

@@ -27,7 +27,6 @@ interface nsIObjectLoadingContent : nsISupports
* See notes in nsObjectLoadingContent.h
*/
const unsigned long TYPE_LOADING = 0;
const unsigned long TYPE_IMAGE = 1;
const unsigned long TYPE_FALLBACK = 2;
const unsigned long TYPE_FAKE_PLUGIN = 3;
const unsigned long TYPE_DOCUMENT = 4;

View File

@@ -252,13 +252,11 @@ already_AddRefed<nsIDocShell> nsObjectLoadingContent::SetupDocShell(
void nsObjectLoadingContent::UnbindFromTree(bool aNullParent) {
nsImageLoadingContent::UnbindFromTree(aNullParent);
if (mType != eType_Image) {
// nsImageLoadingContent handles the image case.
// Reset state and clear pending events
/// XXX(johns): The implementation for GenericFrame notes that ideally we
/// would keep the docshell around, but trash the frameloader
UnloadObject();
}
// nsImageLoadingContent handles the image case.
// Reset state and clear pending events
/// XXX(johns): The implementation for GenericFrame notes that ideally we
/// would keep the docshell around, but trash the frameloader
UnloadObject();
}
nsObjectLoadingContent::nsObjectLoadingContent()
@@ -826,9 +824,6 @@ bool nsObjectLoadingContent::CheckProcessPolicy(int16_t* aContentPolicy) {
nsContentPolicyType objectType;
switch (mType) {
case eType_Image:
objectType = nsIContentPolicy::TYPE_INTERNAL_IMAGE;
break;
case eType_Document:
objectType = nsIContentPolicy::TYPE_DOCUMENT;
break;
@@ -1274,16 +1269,9 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
return NS_OK;
}
if (doc->IsLoadedAsData() && !doc->IsStaticDocument()) {
if (doc->IsLoadedAsData() || doc->IsStaticDocument()) {
return NS_OK;
}
if (doc->IsStaticDocument()) {
// We only allow image loads in static documents, but we need to let the
// eType_Loading state go through too while we do so.
if (mType != eType_Image && mType != eType_Loading) {
return NS_OK;
}
}
LOG(("OBJLC [%p]: LoadObject called, notify %u, forceload %u, channel %p",
this, aNotify, aForceLoad, aLoadingChannel));
@@ -1449,17 +1437,6 @@ nsresult nsObjectLoadingContent::LoadObject(bool aNotify, bool aForceLoad,
// prevent re-entry ugliness with CloseChannel()
nsCOMPtr<nsIStreamListener> finalListener;
switch (mType) {
case eType_Image:
if (!mChannel) {
// We have a LoadImage() call, but UpdateObjectParameters requires a
// channel for images, so this is not a valid state.
MOZ_ASSERT_UNREACHABLE("Attempting to load image without a channel?");
rv = NS_ERROR_UNEXPECTED;
break;
}
rv = LoadImageWithChannel(mChannel, getter_AddRefs(finalListener));
// finalListener will receive OnStartRequest below
break;
case eType_Document: {
if (!mChannel) {
// We could mFrameLoader->LoadURI(mURI), but UpdateObjectParameters
@@ -1850,10 +1827,9 @@ void nsObjectLoadingContent::NotifyStateChanged(ObjectType aOldType,
aOldType, mType, aNotify));
dom::Element* thisEl = AsContent()->AsElement();
if (mType != eType_Image) {
// Non-images are always not broken.
thisEl->RemoveStates(ElementState::BROKEN, aNotify);
}
// Non-images are always not broken.
// XXX: I assume we could just remove this completely?
thisEl->RemoveStates(ElementState::BROKEN, aNotify);
if (mType == aOldType) {
return;

View File

@@ -53,8 +53,6 @@ class nsObjectLoadingContent : public nsImageLoadingContent,
enum ObjectType {
// Loading, type not yet known. We may be waiting for a channel to open.
eType_Loading = TYPE_LOADING,
// Content is a *non-svg* image
eType_Image = TYPE_IMAGE,
// Content is a "special" plugin. Plugins are removed but these MIME
// types display an transparent region in their place.
// (Special plugins that have an HTML fallback are eType_Null)

View File

@@ -86,8 +86,6 @@ interface mixin MozObjectLoadingContent {
[ChromeOnly]
const unsigned long TYPE_LOADING = 0;
[ChromeOnly]
const unsigned long TYPE_IMAGE = 1;
[ChromeOnly]
const unsigned long TYPE_FALLBACK = 2;
[ChromeOnly]
const unsigned long TYPE_FAKE_PLUGIN = 3;

View File

@@ -3657,13 +3657,6 @@ nsCSSFrameConstructor::FindObjectData(const Element& aElement,
"embed and object must implement "
"nsIObjectLoadingContent!");
objContent->GetDisplayedType(&type);
if (type == nsIObjectLoadingContent::TYPE_IMAGE &&
aElement.State().HasState(ElementState::BROKEN)) {
// GetDisplayedType isn't necessarily nsIObjectLoadingContent::TYPE_NULL for
// cases when the object is broken/suppressed/etc (e.g. a broken image), but
// we want to treat those cases as TYPE_NULL
type = nsIObjectLoadingContent::TYPE_NULL;
}
if (type == nsIObjectLoadingContent::TYPE_FALLBACK &&
!StaticPrefs::layout_use_plugin_fallback()) {
@@ -3675,8 +3668,6 @@ nsCSSFrameConstructor::FindObjectData(const Element& aElement,
NS_NewEmptyFrame),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_FALLBACK,
ToCreationFunc(NS_NewBlockFrame)),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_IMAGE,
NS_NewSubDocumentFrame),
SIMPLE_INT_CREATE(nsIObjectLoadingContent::TYPE_DOCUMENT,
NS_NewSubDocumentFrame),
// Fake plugin handlers load as documents