Bug 1018103 - Remove support for the "JavaScript-global-static-nameset" category; r=bholley
authorMs2ger <ms2ger@gmail.com>
Fri, 06 Jun 2014 10:06:26 +0200
changeset 207364 bf4000a8fce635ac0950dfaefef09757f954a368
parent 207363 b9f2aaf3eb9fbd632981d0db8cc919b9a583f19f
child 207365 5c269811a53e21686b158e6bda35c56c1b75685f
push id494
push userraliiev@mozilla.com
push dateMon, 25 Aug 2014 18:42:16 +0000
treeherdermozilla-release@a3cc3e46b571 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1018103, 1012320
milestone32.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 1018103 - Remove support for the "JavaScript-global-static-nameset" category; r=bholley The only in-tree consumer was removed in bug 1012320; the addons MXR and a web search suggest that it is unused outside the tree as well.
caps/include/nsScriptSecurityManager.h
dom/base/moz.build
dom/base/nsDOMClassInfo.cpp
dom/base/nsGlobalWindow.cpp
dom/base/nsIScriptExternalNameSet.h
dom/base/nsIScriptNameSpaceManager.h
dom/base/nsJSEnvironment.cpp
dom/base/nsJSEnvironment.h
dom/base/nsScriptNameSpaceManager.cpp
dom/base/nsScriptNameSpaceManager.h
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -8,17 +8,16 @@
 #define nsScriptSecurityManager_h__
 
 #include "nsIScriptSecurityManager.h"
 #include "nsIPrincipal.h"
 #include "nsCOMPtr.h"
 #include "nsIChannelEventSink.h"
 #include "nsIObserver.h"
 #include "plstr.h"
-#include "nsIScriptExternalNameSet.h"
 #include "js/TypeDecls.h"
 
 #include <stdint.h>
 
 class nsIDocShell;
 class nsCString;
 class nsIClassInfo;
 class nsIIOService;
--- a/dom/base/moz.build
+++ b/dom/base/moz.build
@@ -28,17 +28,16 @@ EXPORTS += [
     'nsDOMNavigationTiming.h',
     'nsDOMString.h',
     'nsFocusManager.h',
     'nsIDOMClassInfo.h',
     'nsIDOMScriptObjectFactory.h',
     'nsIGlobalObject.h',
     'nsIJSNativeInitializer.h',
     'nsIScriptContext.h',
-    'nsIScriptExternalNameSet.h',
     'nsIScriptGlobalObject.h',
     'nsIScriptNameSpaceManager.h',
     'nsIScriptObjectPrincipal.h',
     'nsIScriptTimeoutHandler.h',
     'nsJSEnvironment.h',
     'nsJSUtils.h',
     'nsPerformance.h',
     'nsPIDOMWindow.h',
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -51,17 +51,16 @@
 #include "nsCxPusher.h"
 #include "nsIDOMGlobalPropertyInitializer.h"
 #include "nsLocation.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/Telemetry.h"
 
 // Window scriptable helper includes
 #include "nsIDocShell.h"
-#include "nsIScriptExternalNameSet.h"
 #include "nsJSUtils.h"
 #include "nsScriptNameSpaceManager.h"
 #include "nsIJSNativeInitializer.h"
 #include "nsJSEnvironment.h"
 
 // DOM base includes
 #include "nsIDOMLocation.h"
 #include "nsIDOMWindow.h"
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -4302,21 +4302,16 @@ struct GlobalNameEnumeratorClosure
 static PLDHashOperator
 EnumerateGlobalName(const nsAString& aName,
                     const nsGlobalNameStruct& aNameStruct,
                     void* aClosure)
 {
   GlobalNameEnumeratorClosure* closure =
     static_cast<GlobalNameEnumeratorClosure*>(aClosure);
 
-  if (aNameStruct.mType == nsGlobalNameStruct::eTypeStaticNameSet) {
-    // We have no idea what names this might install.
-    return PL_DHASH_NEXT;
-  }
-
   if (nsWindowSH::NameStructEnabled(closure->mCx, closure->mWindow, aName,
                                     aNameStruct) &&
       (!aNameStruct.mConstructorEnabled ||
        aNameStruct.mConstructorEnabled(closure->mCx, closure->mWrapper))) {
     closure->mNames.AppendElement(aName);
   }
   return PL_DHASH_NEXT;
 }
deleted file mode 100644
--- a/dom/base/nsIScriptExternalNameSet.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* 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/. */
-
-#ifndef nsIScriptExternalNameSet_h__
-#define nsIScriptExternalNameSet_h__
-
-#include "nsISupports.h"
-
-#define NS_ISCRIPTEXTERNALNAMESET_IID \
-  {0xa6cf90da, 0x15b3, 0x11d2,        \
-  {0x93, 0x2e, 0x00, 0x80, 0x5f, 0x8a, 0xdd, 0x32}}
-
-class nsIScriptContext;
-
-/**
- * This interface represents a set of names or symbols that should be
- * added to the "global" namespace of a script context. A name set is
- * registered with the name set registry (see
- * <code>nsIScriptNameSetRegistry</code>) at component registration
- * time using the category manager.
- */
-
-class nsIScriptExternalNameSet : public nsISupports
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ISCRIPTEXTERNALNAMESET_IID)
-
-  /**
-   * Called to tell the name set to do any initialization it needs to
-   */
-  NS_IMETHOD InitializeNameSet(nsIScriptContext* aScriptContext) = 0;
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(nsIScriptExternalNameSet,
-                              NS_ISCRIPTEXTERNALNAMESET_IID)
-
-#endif /* nsIScriptExternalNameSet_h__ */
--- a/dom/base/nsIScriptNameSpaceManager.h
+++ b/dom/base/nsIScriptNameSpaceManager.h
@@ -17,18 +17,15 @@
 
 // a global property that is only accessible to privileged script 
 #define JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY \
   "JavaScript-global-privileged-property"
 
 #define JAVASCRIPT_NAVIGATOR_PROPERTY_CATEGORY \
   "JavaScript-navigator-property"
 
-#define JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY \
-  "JavaScript-global-static-nameset"
-
 #define JAVASCRIPT_DOM_CLASS \
   "JavaScript-DOM-class"
 
 #define JAVASCRIPT_DOM_INTERFACE \
   "JavaScript-DOM-interface"
 
 #endif /* nsIScriptNameSpaceManager_h__ */
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -973,25 +973,16 @@ nsJSContext::InitContext()
   ::JS_SetErrorReporter(mContext, NS_ScriptErrorReporter);
 
   JSOptionChangedCallback(js_options_dot_str, this);
 
   return NS_OK;
 }
 
 nsresult
-nsJSContext::InitializeExternalClasses()
-{
-  nsScriptNameSpaceManager *nameSpaceManager = GetNameSpaceManager();
-  NS_ENSURE_TRUE(nameSpaceManager, NS_ERROR_NOT_INITIALIZED);
-
-  return nameSpaceManager->InitForContext(this);
-}
-
-nsresult
 nsJSContext::SetProperty(JS::Handle<JSObject*> aTarget, const char* aPropName, nsISupports* aArgs)
 {
   nsCxPusher pusher;
   pusher.Push(mContext);
 
   JS::AutoValueVector args(mContext);
 
   JS::Rooted<JSObject*> global(mContext, GetWindowProxy());
@@ -1635,19 +1626,16 @@ static const JSFunctionSpec JProfFunctio
     JS_FS_END
 };
 
 #endif /* defined(MOZ_JPROF) */
 
 nsresult
 nsJSContext::InitClasses(JS::Handle<JSObject*> aGlobalObj)
 {
-  nsresult rv = InitializeExternalClasses();
-  NS_ENSURE_SUCCESS(rv, rv);
-
   JSOptionChangedCallback(js_options_dot_str, this);
   AutoPushJSContext cx(mContext);
 
   // Attempt to initialize profiling functions
   ::JS_DefineProfilingFunctions(cx, aGlobalObj);
 
 #ifdef NS_TRACE_MALLOC
   if (nsContentUtils::IsCallerChrome()) {
@@ -1663,17 +1651,17 @@ nsJSContext::InitClasses(JS::Handle<JSOb
   }
 #endif
 
 #ifdef MOZ_JPROF
   // Attempt to initialize JProf functions
   ::JS_DefineFunctions(cx, aGlobalObj, JProfFunctions);
 #endif
 
-  return rv;
+  return NS_OK;
 }
 
 void
 nsJSContext::WillInitializeContext()
 {
   mIsInitialized = false;
 }
 
--- a/dom/base/nsJSEnvironment.h
+++ b/dom/base/nsJSEnvironment.h
@@ -125,18 +125,16 @@ public:
   nsIScriptGlobalObject* GetCachedGlobalObject()
   {
     // Verify that we have a global so that this
     // does always return a null when GetGlobalObject() is null.
     JSObject* global = GetWindowProxy();
     return global ? mGlobalObjectRef.get() : nullptr;
   }
 protected:
-  nsresult InitializeExternalClasses();
-
   // Helper to convert xpcom datatypes to jsvals.
   nsresult ConvertSupportsTojsvals(nsISupports *aArgs,
                                    JS::Handle<JSObject*> aScope,
                                    JS::AutoValueVector &aArgsOut);
 
   nsresult AddSupportsPrimitiveTojsvals(nsISupports *aArg, JS::Value *aArgv);
 
   // Report the pending exception on our mContext, if any.  This
--- a/dom/base/nsScriptNameSpaceManager.cpp
+++ b/dom/base/nsScriptNameSpaceManager.cpp
@@ -7,17 +7,16 @@
 #include "nsScriptNameSpaceManager.h"
 #include "nsCOMPtr.h"
 #include "nsIComponentManager.h"
 #include "nsIComponentRegistrar.h"
 #include "nsICategoryManager.h"
 #include "nsIServiceManager.h"
 #include "nsXPCOM.h"
 #include "nsISupportsPrimitives.h"
-#include "nsIScriptExternalNameSet.h"
 #include "nsIScriptNameSpaceManager.h"
 #include "nsIScriptContext.h"
 #include "nsIInterfaceInfoManager.h"
 #include "nsIInterfaceInfo.h"
 #include "xptinfo.h"
 #include "nsXPIDLString.h"
 #include "nsPrintfCString.h"
 #include "nsReadableUtils.h"
@@ -363,74 +362,32 @@ nsScriptNameSpaceManager::Init()
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = FillHash(cm, JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY);
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = FillHash(cm, JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY);
   NS_ENSURE_SUCCESS(rv, rv);
 
-  rv = FillHash(cm, JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   rv = FillHash(cm, JAVASCRIPT_NAVIGATOR_PROPERTY_CATEGORY);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Initial filling of the has table has been done.
   // Now, listen for changes.
   nsCOMPtr<nsIObserverService> serv = 
     mozilla::services::GetObserverService();
 
   if (serv) {
     serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_ADDED_OBSERVER_ID, true);
     serv->AddObserver(this, NS_XPCOM_CATEGORY_ENTRY_REMOVED_OBSERVER_ID, true);
   }
 
   return NS_OK;
 }
 
-struct NameSetClosure {
-  nsIScriptContext* ctx;
-  nsresult rv;
-};
-
-static PLDHashOperator
-NameSetInitCallback(PLDHashTable *table, PLDHashEntryHdr *hdr,
-                    uint32_t number, void *arg)
-{
-  GlobalNameMapEntry *entry = static_cast<GlobalNameMapEntry *>(hdr);
-
-  if (entry->mGlobalName.mType == nsGlobalNameStruct::eTypeStaticNameSet) {
-    nsresult rv = NS_OK;
-    nsCOMPtr<nsIScriptExternalNameSet> ns =
-      do_CreateInstance(entry->mGlobalName.mCID, &rv);
-    NS_ENSURE_SUCCESS(rv, PL_DHASH_NEXT);
-
-    NameSetClosure *closure = static_cast<NameSetClosure *>(arg);
-    closure->rv = ns->InitializeNameSet(closure->ctx);
-    if (NS_FAILED(closure->rv)) {
-      NS_ERROR("Initing external script classes failed!");
-      return PL_DHASH_STOP;
-    }
-  }
-
-  return PL_DHASH_NEXT;
-}
-
-nsresult
-nsScriptNameSpaceManager::InitForContext(nsIScriptContext *aContext)
-{
-  NameSetClosure closure;
-  closure.ctx = aContext;
-  closure.rv = NS_OK;
-  PL_DHashTableEnumerate(&mGlobalNames, NameSetInitCallback, &closure);
-
-  return closure.rv;
-}
-
 nsGlobalNameStruct*
 nsScriptNameSpaceManager::LookupNameInternal(const nsAString& aName,
                                              const char16_t **aClassName)
 {
   GlobalNameMapEntry *entry =
     static_cast<GlobalNameMapEntry *>
                (PL_DHashTableOperate(&mGlobalNames, &aName,
                                         PL_DHASH_LOOKUP));
@@ -614,18 +571,16 @@ nsScriptNameSpaceManager::OperateCategor
   nsGlobalNameStruct::nametype type;
   if (strcmp(aCategory, JAVASCRIPT_GLOBAL_CONSTRUCTOR_CATEGORY) == 0) {
     type = nsGlobalNameStruct::eTypeExternalConstructor;
   } else if (strcmp(aCategory, JAVASCRIPT_GLOBAL_PROPERTY_CATEGORY) == 0 ||
              strcmp(aCategory, JAVASCRIPT_GLOBAL_PRIVILEGED_PROPERTY_CATEGORY) == 0) {
     type = nsGlobalNameStruct::eTypeProperty;
   } else if (strcmp(aCategory, JAVASCRIPT_NAVIGATOR_PROPERTY_CATEGORY) == 0) {
     type = nsGlobalNameStruct::eTypeNavigatorProperty;
-  } else if (strcmp(aCategory, JAVASCRIPT_GLOBAL_STATIC_NAMESET_CATEGORY) == 0) {
-    type = nsGlobalNameStruct::eTypeStaticNameSet;
   } else {
     return NS_OK;
   }
 
   nsCOMPtr<nsISupportsCString> strWrapper = do_QueryInterface(aEntry);
 
   if (!strWrapper) {
     NS_WARNING("Category entry not an nsISupportsCString!");
--- a/dom/base/nsScriptNameSpaceManager.h
+++ b/dom/base/nsScriptNameSpaceManager.h
@@ -44,17 +44,16 @@ struct nsGlobalNameStruct
 
   enum nametype {
     eTypeNotInitialized,
     eTypeNewDOMBinding,
     eTypeInterface,
     eTypeProperty,
     eTypeNavigatorProperty,
     eTypeExternalConstructor,
-    eTypeStaticNameSet,
     eTypeClassConstructor,
     eTypeClassProto,
     eTypeExternalClassInfoCreator,
     eTypeExternalClassInfo,
     eTypeExternalConstructorAlias
   } mType;
 
   // mChromeOnly is only used for structs that define non-WebIDL things
@@ -94,17 +93,16 @@ public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSIOBSERVER
   NS_DECL_NSIMEMORYREPORTER
 
   nsScriptNameSpaceManager();
   virtual ~nsScriptNameSpaceManager();
 
   nsresult Init();
-  nsresult InitForContext(nsIScriptContext *aContext);
 
   // Returns a nsGlobalNameStruct for aName, or null if one is not
   // found. The returned nsGlobalNameStruct is only guaranteed to be
   // valid until the next call to any of the methods in this class.
   // It also returns a pointer to the string buffer of the classname
   // in the nsGlobalNameStruct.
   const nsGlobalNameStruct* LookupName(const nsAString& aName,
                                        const char16_t **aClassName = nullptr)