Bug 942706 - Remove nsIPluginTagInfo and unused associated methods. r=johns.
authorHenri Sivonen <hsivonen@hsivonen.fi>
Tue, 03 Dec 2013 10:36:13 +0200
changeset 174193 4446b19237a21ae8162c7fd24c111534dc82a442
parent 174192 9b4c3cd287381643a7db081e662804f221bf38cf
child 174194 19bfb5a02699fa3bdc8f1df82ea1f5c10909d7db
push id445
push userffxbld
push dateMon, 10 Mar 2014 22:05:19 +0000
treeherdermozilla-release@dc38b741b04e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjohns
bugs942706
milestone28.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 942706 - Remove nsIPluginTagInfo and unused associated methods. r=johns.
dom/plugins/base/moz.build
dom/plugins/base/nsIPluginInstanceOwner.idl
dom/plugins/base/nsIPluginTagInfo.idl
dom/plugins/base/nsNPAPIPluginInstance.h
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginInstanceOwner.h
--- a/dom/plugins/base/moz.build
+++ b/dom/plugins/base/moz.build
@@ -9,17 +9,16 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'andr
 
 XPIDL_SOURCES += [
     'nsIHTTPHeaderListener.idl',
     'nsIPluginDocument.idl',
     'nsIPluginHost.idl',
     'nsIPluginInputStream.idl',
     'nsIPluginInstanceOwner.idl',
     'nsIPluginTag.idl',
-    'nsIPluginTagInfo.idl',
     'nspluginroot.idl',
 ]
 
 XPIDL_MODULE = 'plugin'
 
 EXPORTS += [
     'npapi.h',
     'npfunctions.h',
--- a/dom/plugins/base/nsIPluginInstanceOwner.idl
+++ b/dom/plugins/base/nsIPluginInstanceOwner.idl
@@ -8,16 +8,23 @@
 #include "nsIInputStream.idl"
 
 interface nsIDocument;
 
 %{C++
 #include "npapi.h"
 #include "mozilla/EventForwards.h"
 class nsNPAPIPluginInstance;
+
+enum nsPluginTagType {
+  nsPluginTagType_Unknown,
+  nsPluginTagType_Embed,
+  nsPluginTagType_Object,
+  nsPluginTagType_Applet
+};
 %}
 
 [ptr] native nsNPAPIPluginInstancePtr(nsNPAPIPluginInstance);
 
 // Do not make this interface scriptable, because the virtual functions in C++
 // blocks will make script call the wrong functions.
 [uuid(59BE4CA5-3CB0-40E6-A111-9A88C8477610)]
 interface nsIPluginInstanceOwner : nsISupports
deleted file mode 100644
--- a/dom/plugins/base/nsIPluginTagInfo.idl
+++ /dev/null
@@ -1,125 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "nsISupports.idl"
-#include "nspluginroot.idl"
-
-%{C++
-enum nsPluginTagType {
-  nsPluginTagType_Unknown,
-  nsPluginTagType_Embed,
-  nsPluginTagType_Object,
-  nsPluginTagType_Applet
-};
-%}
-
-native nsPluginTagType(nsPluginTagType);
-
-interface nsIDOMElement;
-
-/**
- * Plugin Tag Info Interface
- * This interface provides information about the HTML tag on the page.
- * Some day this might get superseded by a DOM API.
- */
-
-[uuid(759a955e-c590-419a-b5f3-e54bb67e24b8)]
-interface nsIPluginTagInfo : nsISupports
-{
-  /**
-   * QueryInterface on nsIPluginInstancePeer to get this.
-   *
-   * (Corresponds to NPP_New's argc, argn, and argv arguments.)
-   * Get a ptr to the paired list of attribute names and values,
-   * returns the length of the array.
-   *
-   * Each name or value is a null-terminated string.
-   */
-  void getAttributes(in PRUint16Ref aCount,
-                     in constCharStarConstStar aNames,
-                     in constCharStarConstStar aValues);
-
-  /**
-   * Gets the value for the named attribute.
-   *
-   * @param aName   - the name of the attribute to find
-   * @param aResult - the resulting attribute
-   * @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
-   * this operation failed. result is set to NULL if the attribute is not found
-   * else to the found value.
-   */
-  void getAttribute(in string aName, out constCharPtr aResult);
-
-  /**
-   * Get the type of the HTML tag that was used ot instantiate this
-   * plugin.  Currently supported tags are EMBED, OBJECT and APPLET.
-   */
-  readonly attribute nsPluginTagType tagType;
-
-  /**
-   * Get a ptr to the paired list of parameter names and values,
-   * returns the length of the array.
-   *
-   * Each name or value is a null-terminated string.
-   */
-  void getParameters(in PRUint16Ref aCount,
-                     in constCharStarConstStar aNames,
-                     in constCharStarConstStar aValues);
-
-  /**
-   * Get the value for the named parameter.  Returns null
-   * if the parameter was not set.
-   *
-   * @param aName   - name of the parameter
-   * @param aResult - parameter value
-   * @result        - NS_OK if this operation was successful
-   */
-  void getParameter(in string aName, out constCharPtr aResult);
-
-  /**
-   * Get the document base
-   */
-  void getDocumentBase(out constCharPtr aDocumentBase);
-    
-  /**
-   * Return an encoding whose name is specified in:
-   * http://java.sun.com/products/jdk/1.1/docs/guide/intl/intl.doc.html#25303
-   */
-  void getDocumentEncoding(out constCharPtr aDocumentEncoding);
-
-  /**
-   * Get object alignment
-   */
-  void getAlignment(out constCharPtr aElignment);
-
-  /**
-   * Get object width
-   */
-  readonly attribute unsigned long width;
-
-  /**
-   * Get object height
-   */
-  readonly attribute unsigned long height;
-
-  /**
-   * Get border vertical space
-   */
-  readonly attribute unsigned long borderVertSpace;
-
-  /**
-   * Get border horizontal space
-   */
-  readonly attribute unsigned long borderHorizSpace;
-
-  /**
-   * Returns the DOM element corresponding to the tag which references
-   * this plugin in the document.
-   *
-   * @param aDOMElement - resulting DOM element
-   * @result - NS_OK if this operation was successful
-   */
-  readonly attribute nsIDOMElement DOMElement;
-};
--- a/dom/plugins/base/nsNPAPIPluginInstance.h
+++ b/dom/plugins/base/nsNPAPIPluginInstance.h
@@ -5,17 +5,17 @@
 
 #ifndef nsNPAPIPluginInstance_h_
 #define nsNPAPIPluginInstance_h_
 
 #include "nsCOMPtr.h"
 #include "nsTArray.h"
 #include "nsPIDOMWindow.h"
 #include "nsITimer.h"
-#include "nsIPluginTagInfo.h"
+#include "nsIPluginInstanceOwner.h"
 #include "nsIURI.h"
 #include "nsIChannel.h"
 #include "nsInterfaceHashtable.h"
 #include "nsHashKeys.h"
 #include <prinrval.h>
 #include "js/TypeDecls.h"
 #ifdef MOZ_WIDGET_ANDROID
 #include "nsAutoPtr.h"
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -142,17 +142,16 @@ static const char *kPrefDisableFullPage 
 // 0.14 force refresh due to locale comparison fix, bug 611296
 // 0.15 force refresh due to bug in reading Java plist MIME data, bug 638171
 // 0.16 version bump to avoid importing the plugin flags in newer versions
 // The current plugin registry version (and the maximum version we know how to read)
 static const char *kPluginRegistryVersion = "0.16";
 // The minimum registry version we know how to read
 static const char *kMinimumRegistryVersion = "0.9";
 
-static NS_DEFINE_IID(kIPluginTagInfoIID, NS_IPLUGINTAGINFO_IID);
 static const char kDirectoryServiceContractID[] = "@mozilla.org/file/directory_service;1";
 
 #define kPluginRegistryFilename NS_LITERAL_CSTRING("pluginreg.dat")
 
 #ifdef PLUGIN_LOGGING
 PRLogModuleInfo* nsPluginLogging::gNPNLog = nullptr;
 PRLogModuleInfo* nsPluginLogging::gNPPLog = nullptr;
 PRLogModuleInfo* nsPluginLogging::gPluginLog = nullptr;
@@ -783,24 +782,18 @@ nsPluginHost::InstantiatePluginInstance(
   }
 
   nsCOMPtr<nsIContent> ourContent = do_QueryInterface(static_cast<nsIImageLoadingContent*>(aContent));
   nsresult rv = instanceOwner->Init(ourContent);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
-  nsCOMPtr<nsIPluginTagInfo> pti;
-  rv = instanceOwner->QueryInterface(kIPluginTagInfoIID, getter_AddRefs(pti));
-  if (NS_FAILED(rv)) {
-    return rv;
-  }
-
   nsPluginTagType tagType;
-  rv = pti->GetTagType(&tagType);
+  rv = instanceOwner->GetTagType(&tagType);
   if (NS_FAILED(rv)) {
     return rv;
   }
 
   if (tagType != nsPluginTagType_Embed &&
       tagType != nsPluginTagType_Applet &&
       tagType != nsPluginTagType_Object) {
     return NS_ERROR_FAILURE;
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -356,19 +356,18 @@ nsPluginInstanceOwner::~nsPluginInstance
   RemovePluginView();
 #endif
 
   if (mInstance) {
     mInstance->SetOwner(nullptr);
   }
 }
 
-NS_IMPL_ISUPPORTS5(nsPluginInstanceOwner,
+NS_IMPL_ISUPPORTS4(nsPluginInstanceOwner,
                    nsIPluginInstanceOwner,
-                   nsIPluginTagInfo,
                    nsIDOMEventListener,
                    nsIPrivacyTransitionObserver,
                    nsISupportsWeakReference)
 
 nsresult
 nsPluginInstanceOwner::SetInstance(nsNPAPIPluginInstance *aInstance)
 {
   NS_ASSERTION(!mInstance || !aInstance, "mInstance should only be set or unset!");
@@ -819,221 +818,32 @@ NS_IMETHODIMP nsPluginInstanceOwner::Get
 
   return rv;
 }
 
 NS_IMETHODIMP nsPluginInstanceOwner::GetParameter(const char* name, const char* *result)
 {
   NS_ENSURE_ARG_POINTER(name);
   NS_ENSURE_ARG_POINTER(result);
-  
+
   nsresult rv = EnsureCachedAttrParamArrays();
   NS_ENSURE_SUCCESS(rv, rv);
 
   *result = nullptr;
 
   for (int i = mNumCachedAttrs + 1; i < (mNumCachedParams + 1 + mNumCachedAttrs); i++) {
     if (0 == PL_strcasecmp(mCachedAttrParamNames[i], name)) {
       *result = mCachedAttrParamValues[i];
       return NS_OK;
     }
   }
 
   return NS_ERROR_FAILURE;
 }
 
-NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentBase(const char* *result)
-{
-  NS_ENSURE_ARG_POINTER(result);
-  nsresult rv = NS_OK;
-  if (mDocumentBase.IsEmpty()) {
-    if (!mObjectFrame) {
-      *result = nullptr;
-      return NS_ERROR_FAILURE;
-    }
-
-    nsIDocument* doc = mContent->OwnerDoc();
-    NS_ASSERTION(doc, "Must have an owner doc");
-    rv = doc->GetDocBaseURI()->GetSpec(mDocumentBase);
-  }
-  if (NS_SUCCEEDED(rv))
-    *result = ToNewCString(mDocumentBase);
-  return rv;
-}
-
-static nsDataHashtable<nsDepCharHashKey, const char *> * gCharsetMap;
-typedef struct {
-    char mozName[16];
-    char javaName[12];
-} moz2javaCharset;
-
-/* XXX If you add any strings longer than
- *  {"x-mac-cyrillic",  "MacCyrillic"},
- *  {"x-mac-ukrainian", "MacUkraine"},
- * to the following array then you MUST update the
- * sizes of the arrays in the moz2javaCharset struct
- */
-
-static const moz2javaCharset charsets[] = 
-{
-    {"windows-1252",    "Cp1252"},
-    {"IBM850",          "Cp850"},
-    {"IBM852",          "Cp852"},
-    {"IBM855",          "Cp855"},
-    {"IBM857",          "Cp857"},
-    {"IBM828",          "Cp862"},
-    {"IBM866",          "Cp866"},
-    {"windows-1250",    "Cp1250"},
-    {"windows-1251",    "Cp1251"},
-    {"windows-1253",    "Cp1253"},
-    {"windows-1254",    "Cp1254"},
-    {"windows-1255",    "Cp1255"},
-    {"windows-1256",    "Cp1256"},
-    {"windows-1257",    "Cp1257"},
-    {"windows-1258",    "Cp1258"},
-    {"EUC-JP",          "EUC_JP"},
-    {"EUC-KR",          "MS949"},
-    {"x-euc-tw",        "EUC_TW"},
-    {"gb18030",         "GB18030"},
-    {"gbk",             "GBK"},
-    {"ISO-2022-JP",     "ISO2022JP"},
-    {"ISO-2022-KR",     "ISO2022KR"},
-    {"ISO-8859-2",      "ISO8859_2"},
-    {"ISO-8859-3",      "ISO8859_3"},
-    {"ISO-8859-4",      "ISO8859_4"},
-    {"ISO-8859-5",      "ISO8859_5"},
-    {"ISO-8859-6",      "ISO8859_6"},
-    {"ISO-8859-7",      "ISO8859_7"},
-    {"ISO-8859-8",      "ISO8859_8"},
-    {"ISO-8859-9",      "ISO8859_9"},
-    {"ISO-8859-13",     "ISO8859_13"},
-    {"x-johab",         "Johab"},
-    {"KOI8-R",          "KOI8_R"},
-    {"TIS-620",         "MS874"},
-    {"x-mac-arabic",    "MacArabic"},
-    {"x-mac-croatian",  "MacCroatia"},
-    {"x-mac-cyrillic",  "MacCyrillic"},
-    {"x-mac-greek",     "MacGreek"},
-    {"x-mac-hebrew",    "MacHebrew"},
-    {"x-mac-icelandic", "MacIceland"},
-    {"macintosh",       "MacRoman"},
-    {"x-mac-romanian",  "MacRomania"},
-    {"x-mac-ukrainian", "MacUkraine"},
-    {"Shift_JIS",       "SJIS"},
-    {"TIS-620",         "TIS620"}
-};
-
-NS_IMETHODIMP nsPluginInstanceOwner::GetDocumentEncoding(const char* *result)
-{
-  NS_ENSURE_ARG_POINTER(result);
-  *result = nullptr;
-
-  nsresult rv;
-  // XXX sXBL/XBL2 issue: current doc or owner doc?
-  nsCOMPtr<nsIDocument> doc;
-  rv = GetDocument(getter_AddRefs(doc));
-  NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get document");
-  if (NS_FAILED(rv))
-    return rv;
-
-  const nsCString &charset = doc->GetDocumentCharacterSet();
-
-  if (charset.IsEmpty())
-    return NS_OK;
-
-  // common charsets and those not requiring conversion first
-  if (charset.EqualsLiteral("us-ascii")) {
-    *result = PL_strdup("US_ASCII");
-  } else if (charset.EqualsLiteral("ISO-8859-1") ||
-      !nsCRT::strncmp(charset.get(), "UTF", 3)) {
-    *result = ToNewCString(charset);
-  } else {
-    if (!gCharsetMap) {
-      const int NUM_CHARSETS = sizeof(charsets) / sizeof(moz2javaCharset);
-      gCharsetMap = new nsDataHashtable<nsDepCharHashKey, const char*>(NUM_CHARSETS);
-      if (!gCharsetMap)
-        return NS_ERROR_OUT_OF_MEMORY;
-      for (uint16_t i = 0; i < NUM_CHARSETS; i++) {
-        gCharsetMap->Put(charsets[i].mozName, charsets[i].javaName);
-      }
-    }
-    // if found mapping, return it; otherwise return original charset
-    const char *mapping;
-    *result = gCharsetMap->Get(charset.get(), &mapping) ? PL_strdup(mapping) :
-                                                          ToNewCString(charset);
-  }
-
-  return (*result) ? NS_OK : NS_ERROR_OUT_OF_MEMORY;
-}
-
-NS_IMETHODIMP nsPluginInstanceOwner::GetAlignment(const char* *result)
-{
-  return GetAttribute("ALIGN", result);
-}
-  
-NS_IMETHODIMP nsPluginInstanceOwner::GetWidth(uint32_t *result)
-{
-  NS_ENSURE_ARG_POINTER(result);
-
-  NS_ENSURE_TRUE(mPluginWindow, NS_ERROR_NULL_POINTER);
-
-  *result = mPluginWindow->width;
-
-  return NS_OK;
-}
-  
-NS_IMETHODIMP nsPluginInstanceOwner::GetHeight(uint32_t *result)
-{
-  NS_ENSURE_ARG_POINTER(result);
-
-  NS_ENSURE_TRUE(mPluginWindow, NS_ERROR_NULL_POINTER);
-
-  *result = mPluginWindow->height;
-
-  return NS_OK;
-}
-
-  
-NS_IMETHODIMP nsPluginInstanceOwner::GetBorderVertSpace(uint32_t *result)
-{
-  nsresult    rv;
-  const char  *vspace;
-
-  rv = GetAttribute("VSPACE", &vspace);
-
-  if (NS_OK == rv) {
-    if (*result != 0)
-      *result = (uint32_t)atol(vspace);
-    else
-      *result = 0;
-  }
-  else
-    *result = 0;
-
-  return rv;
-}
-  
-NS_IMETHODIMP nsPluginInstanceOwner::GetBorderHorizSpace(uint32_t *result)
-{
-  nsresult    rv;
-  const char  *hspace;
-
-  rv = GetAttribute("HSPACE", &hspace);
-
-  if (NS_OK == rv) {
-    if (*result != 0)
-      *result = (uint32_t)atol(hspace);
-    else
-      *result = 0;
-  }
-  else
-    *result = 0;
-
-  return rv;
-}
 
 // Cache the attributes and/or parameters of our tag into a single set
 // of arrays to be compatible with Netscape 4.x. The attributes go first,
 // followed by a PARAM/null and then any PARAM tags. Also, hold the
 // cached array around for the duration of the life of the instance
 // because Netscape 4.x did. See bug 111008.
 nsresult nsPluginInstanceOwner::EnsureCachedAttrParamArrays()
 {
--- a/dom/plugins/base/nsPluginInstanceOwner.h
+++ b/dom/plugins/base/nsPluginInstanceOwner.h
@@ -6,17 +6,16 @@
 
 #ifndef nsPluginInstanceOwner_h_
 #define nsPluginInstanceOwner_h_
 
 #include "mozilla/Attributes.h"
 #include "npapi.h"
 #include "nsCOMPtr.h"
 #include "nsIPluginInstanceOwner.h"
-#include "nsIPluginTagInfo.h"
 #include "nsIPrivacyTransitionObserver.h"
 #include "nsIDOMEventListener.h"
 #include "nsPluginHost.h"
 #include "nsPluginNativeWindow.h"
 #include "nsWeakReference.h"
 #include "gfxRect.h"
 
 #ifdef XP_MACOSX
@@ -41,17 +40,16 @@ class gfxXlibSurface;
 
 #ifdef XP_OS2
 #define INCL_PM
 #define INCL_GPI
 #include <os2.h>
 #endif
 
 class nsPluginInstanceOwner : public nsIPluginInstanceOwner,
-                              public nsIPluginTagInfo,
                               public nsIDOMEventListener,
                               public nsIPrivacyTransitionObserver,
                               public nsSupportsWeakReference
 {
 public:
   nsPluginInstanceOwner();
   virtual ~nsPluginInstanceOwner();
   
@@ -70,18 +68,75 @@ public:
   NPBool     ConvertPoint(double sourceX, double sourceY, NPCoordinateSpace sourceSpace,
                           double *destX, double *destY, NPCoordinateSpace destSpace) MOZ_OVERRIDE;
   
   virtual NPError InitAsyncSurface(NPSize *size, NPImageFormat format,
                                    void *initData, NPAsyncSurface *surface) MOZ_OVERRIDE;
   virtual NPError FinalizeAsyncSurface(NPAsyncSurface *surface) MOZ_OVERRIDE;
   virtual void SetCurrentAsyncSurface(NPAsyncSurface *surface, NPRect *changed) MOZ_OVERRIDE;
 
-  //nsIPluginTagInfo interface
-  NS_DECL_NSIPLUGINTAGINFO
+  /**
+   * Get the type of the HTML tag that was used ot instantiate this
+   * plugin.  Currently supported tags are EMBED, OBJECT and APPLET.
+   */
+  NS_IMETHOD GetTagType(nsPluginTagType *aResult);
+
+  /**
+   * Get a ptr to the paired list of parameter names and values,
+   * returns the length of the array.
+   *
+   * Each name or value is a null-terminated string.
+   */
+  NS_IMETHOD GetParameters(uint16_t& aCount,
+                           const char*const*& aNames,
+                           const char*const*& aValues);
+
+  /**
+   * Get the value for the named parameter.  Returns null
+   * if the parameter was not set.
+   *
+   * @param aName   - name of the parameter
+   * @param aResult - parameter value
+   * @result        - NS_OK if this operation was successful
+   */
+  NS_IMETHOD GetParameter(const char* aName, const char* *aResult);
+
+  /**
+   * QueryInterface on nsIPluginInstancePeer to get this.
+   *
+   * (Corresponds to NPP_New's argc, argn, and argv arguments.)
+   * Get a ptr to the paired list of attribute names and values,
+   * returns the length of the array.
+   *
+   * Each name or value is a null-terminated string.
+   */
+  NS_IMETHOD GetAttributes(uint16_t& aCount,
+                           const char*const*& aNames,
+                           const char*const*& aValues);
+
+
+  /**
+   * Gets the value for the named attribute.
+   *
+   * @param aName   - the name of the attribute to find
+   * @param aResult - the resulting attribute
+   * @result - NS_OK if this operation was successful, NS_ERROR_FAILURE if
+   * this operation failed. result is set to NULL if the attribute is not found
+   * else to the found value.
+   */
+  NS_IMETHOD GetAttribute(const char* aName, const char* *aResult);
+
+  /**
+   * Returns the DOM element corresponding to the tag which references
+   * this plugin in the document.
+   *
+   * @param aDOMElement - resulting DOM element
+   * @result - NS_OK if this operation was successful
+   */
+  NS_IMETHOD GetDOMElement(nsIDOMElement* * aResult);
   
   // nsIDOMEventListener interfaces 
   NS_DECL_NSIDOMEVENTLISTENER
   
   nsresult ProcessMouseDown(nsIDOMEvent* aKeyEvent);
   nsresult ProcessKeyPress(nsIDOMEvent* aKeyEvent);
   nsresult Destroy();