Closed Bug 15217 Opened 25 years ago Closed 25 years ago

need hook for default plugin

Categories

(Core Graveyard :: Plug-ins, enhancement, P3)

enhancement

Tracking

(Not tracked)

VERIFIED FIXED

People

(Reporter: akhil.arora, Assigned: blackconnect)

Details

Attachments

(1 file)

Currently there is no way for a plugin to indicate that it wants to be the
default handler. We have a requirement to write a plugin that wants to be called
if there is no other plugin for that mime type installed on the system.

So when the PluginHostImpl is looking for a plugin for a certain mime type, it
first searches for all the installed plugins if they can handled the requested
mime type. If none is found, we would like our default plugin to be called
before a Plugin Not Found error is returned. Essentially, this hook allows us to
implement Java Pluglets without any other modifications required to the mozilla
codebase.

One easy way of indicating interest in becoming the default MIME type handler is
to register with the special MIME type of "*", the asterisk. The following patch
by Igor Kushnirskiy <idk@eng.sun.com> achieves this objective. Please review and
approve.

This particular RFE has been discussed with Erik Krock at the Plugin Codestock.

Index: nsPluginHostImpl.cpp
===================================================================
RCS file: /cvsroot/mozilla/modules/plugin/nglsrc/nsPluginHostImpl.cpp,v
retrieving revision 1.76
diff -C3 -r1.76 nsPluginHostImpl.cpp
***************
*** 1911,1917 ****

        for (cnt = 0; cnt < variants; cnt++)
        {
!         if (0 == strcmp(plugins->mMimeTypeArray[cnt], aMimeType))
            return NS_OK;
        }

--- 1915,1922 ----

        for (cnt = 0; cnt < variants; cnt++)
        {
!         if (0 == strcmp(plugins->mMimeTypeArray[cnt], aMimeType)
!             || 0 == strcmp(plugins->mMimeTypeArray[cnt],"*"))
            return NS_OK;
        }

***************
*** 2138,2144 ****
  {
    nsPluginTag *plugins = nsnull;
    PRInt32     variants, cnt;
!
    aPlugin = nsnull;

    if (PR_FALSE == mPluginsLoaded)
--- 2143,2149 ----
  {
    nsPluginTag *plugins = nsnull;
    PRInt32     variants, cnt;
!   nsPluginTag *starPlugin = nsnull;
    aPlugin = nsnull;

    if (PR_FALSE == mPluginsLoaded)
***************
*** 2160,2166 ****
            aPlugin = plugins;
                            return NS_OK;
                    }
!           }

        if (cnt < variants)
          break;
--- 2165,2175 ----
            aPlugin = plugins;
                            return NS_OK;
                    }
!         if (0 == strcmp(plugins->mMimeTypeArray[cnt],"*"))
!         {
!           starPlugin = plugins;
!         }
!       }

        if (cnt < variants)
          break;
***************
*** 2168,2174 ****
        plugins = plugins->mNext;
      }
    }
!
    return NS_ERROR_FAILURE;
  }

--- 2177,2187 ----
        plugins = plugins->mNext;
      }
    }
!   if (starPlugin != nsnull)
!   {
!     aPlugin = starPlugin;
!     return NS_OK;
!   }
    return NS_ERROR_FAILURE;
  }
Assignee: av → idk
Attached patch dix for this bugSplinter Review
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Attachment (id=2882) is a fix for this bug
a = idk@eng.sun.com
r = akhil.arora@sun.com

The idea of this fix is:
if there are no handlers for some MIME type we are trying to get
"component://netscape/blackwood/pluglet-engine"  service and to use it for
creating  PluginInstance

This proposal was sent to  netscape.public.mozilla.java and
netscape.public.mozilla.plugins at 11/01/99.
Nobody was concerned about it.

Eric Krock (ekrock@netscape.com) gives me permissions to integrate this fix.

I am integrating this fix and closing this bug as fixed
Akhil, would you like to verify this, or shall I rubber-stamp Igor's changes as
Verified-Fixed? Thank you!
Status: RESOLVED → VERIFIED
I think it is OK to rubberstamp. Igor has done pretty thorough testing to make
sure that this does not break anything.
Thank you, Igor & Akhil!
Product: Core → Core Graveyard
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: