Bug 1497707, part 5 - Inline mozilla::ModuleLoader into mozJSComponentLoader. r=froydnj
authorAndrew McCreight <continuation@gmail.com>
Tue, 23 Oct 2018 00:46:49 +0000
changeset 490836 ded047a09c690d95cbe1a2c8babdfa8d917cf29b
parent 490835 e44f3f8cde9c63cc407b959f816d2999a0200eec
child 490837 9840ad3f518afe551c11dd74f786304e476a707d
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersfroydnj
bugs1497707
milestone65.0a1
Bug 1497707, part 5 - Inline mozilla::ModuleLoader into mozJSComponentLoader. r=froydnj Now that the XPCOM component loader infrastructure has stopped pretending to support other file extensions, this intermediate interface is no longer needed. Depends on D8171 Differential Revision: https://phabricator.services.mozilla.com/D8172
js/xpconnect/loader/mozJSComponentLoader.cpp
js/xpconnect/loader/mozJSComponentLoader.h
xpcom/components/ModuleLoader.h
xpcom/components/moz.build
xpcom/components/nsComponentManager.h
--- a/js/xpconnect/loader/mozJSComponentLoader.cpp
+++ b/js/xpconnect/loader/mozJSComponentLoader.cpp
@@ -310,17 +310,16 @@ mozJSComponentLoader::~mozJSComponentLoa
 
     sSelf = nullptr;
 }
 
 mozJSComponentLoader*
 mozJSComponentLoader::sSelf;
 
 NS_IMPL_ISUPPORTS(mozJSComponentLoader,
-                  mozilla::ModuleLoader,
                   nsIObserver)
 
 nsresult
 mozJSComponentLoader::ReallyInit()
 {
     MOZ_ASSERT(!mInitialized);
 
     const char* shareGlobal = PR_GetEnv("MOZ_LOADER_SHARE_GLOBAL");
--- a/js/xpconnect/loader/mozJSComponentLoader.h
+++ b/js/xpconnect/loader/mozJSComponentLoader.h
@@ -3,18 +3,19 @@
 /* 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 mozJSComponentLoader_h
 #define mozJSComponentLoader_h
 
 #include "mozilla/dom/ScriptSettings.h"
+#include "mozilla/FileLocation.h"
 #include "mozilla/MemoryReporting.h"
-#include "mozilla/ModuleLoader.h"
+#include "mozilla/Module.h"
 #include "nsAutoPtr.h"
 #include "nsISupports.h"
 #include "nsIObserver.h"
 #include "nsIURI.h"
 #include "nsClassHashtable.h"
 #include "nsDataHashtable.h"
 #include "jsapi.h"
 
@@ -35,32 +36,30 @@ namespace mozilla {
   {0x6bd13476, 0x1dd2, 0x11b2,                                                \
     { 0xbb, 0xef, 0xf0, 0xcc, 0xb5, 0xfa, 0x64, 0xb6 }}
 #define MOZJSCOMPONENTLOADER_CONTRACTID "@mozilla.org/moz/jsloader;1"
 
 #if defined(NIGHTLY_BUILD) || defined(MOZ_DEV_EDITION) || defined(DEBUG)
 #define STARTUP_RECORDER_ENABLED
 #endif
 
-class mozJSComponentLoader final : public mozilla::ModuleLoader,
-                                   public nsIObserver
+class mozJSComponentLoader final : public nsIObserver
 {
  public:
     NS_DECL_ISUPPORTS
     NS_DECL_NSIOBSERVER
 
     mozJSComponentLoader();
 
     void LoadedModules(uint32_t* aLength, char*** aModules);
     void LoadedComponents(uint32_t* aLength, char*** aComponents);
     nsresult GetModuleImportStack(const nsACString& aLocation, nsACString& aRetval);
     nsresult GetComponentLoadStack(const nsACString& aLocation, nsACString& aRetval);
 
-    // ModuleLoader
-    const mozilla::Module* LoadModule(mozilla::FileLocation& aFile) override;
+    const mozilla::Module* LoadModule(mozilla::FileLocation& aFile);
 
     void FindTargetObject(JSContext* aCx,
                           JS::MutableHandleObject aTargetObject);
 
     static already_AddRefed<mozJSComponentLoader> GetOrCreate();
 
     static mozJSComponentLoader* Get() { return sSelf; }
 
deleted file mode 100644
--- a/xpcom/components/ModuleLoader.h
+++ /dev/null
@@ -1,44 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 mozilla_ModuleLoader_h
-#define mozilla_ModuleLoader_h
-
-#include "nsISupports.h"
-#include "mozilla/Module.h"
-#include "mozilla/FileLocation.h"
-
-#define MOZILLA_MODULELOADER_PSEUDO_IID \
-{ 0xD951A8CE, 0x6E9F, 0x464F, \
-  { 0x8A, 0xC8, 0x14, 0x61, 0xC0, 0xD3, 0x63, 0xC8 } }
-
-namespace mozilla {
-
-/**
- * Module loaders are responsible for loading a component file. The static
- * component loader is special and does not use this abstract interface.
- *
- * @note Implementations of this interface should be threadsafe,
- *       methods may be called from any thread.
- */
-class ModuleLoader : public nsISupports
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(MOZILLA_MODULELOADER_PSEUDO_IID)
-
-  /**
-   * Return the module for a specified file. The caller should cache
-   * the module: the implementer should not expect for the same file
-   * to be loaded multiple times. The Module object should either be
-   * statically or permanently allocated; it will not be freed.
-   */
-  virtual const Module* LoadModule(mozilla::FileLocation& aFile) = 0;
-};
-NS_DEFINE_STATIC_IID_ACCESSOR(ModuleLoader, MOZILLA_MODULELOADER_PSEUDO_IID)
-
-} // namespace mozilla
-
-#endif // mozilla_ModuleLoader_h
--- a/xpcom/components/moz.build
+++ b/xpcom/components/moz.build
@@ -21,17 +21,16 @@ EXPORTS += [
     'nsCategoryManagerUtils.h',
     'nsComponentManagerUtils.h',
     'nsServiceManagerUtils.h',
 ]
 
 EXPORTS.mozilla += [
     'GenericFactory.h',
     'Module.h',
-    'ModuleLoader.h',
     'ModuleUtils.h',
 ]
 
 UNIFIED_SOURCES += [
     'GenericFactory.cpp',
     'ManifestParser.cpp',
     'nsCategoryCache.cpp',
     'nsCategoryManager.cpp',
--- a/xpcom/components/nsComponentManager.h
+++ b/xpcom/components/nsComponentManager.h
@@ -14,17 +14,16 @@
 #include "nsIComponentRegistrar.h"
 #include "nsIMemoryReporter.h"
 #include "nsIServiceManager.h"
 #include "nsIFile.h"
 #include "mozilla/ArenaAllocator.h"
 #include "mozilla/Atomics.h"
 #include "mozilla/MemoryReporting.h"
 #include "mozilla/Module.h"
-#include "mozilla/ModuleLoader.h"
 #include "mozilla/Mutex.h"
 #include "nsXULAppAPI.h"
 #include "nsIFactory.h"
 #include "nsIInterfaceRequestor.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "PLDHashTable.h"
 #include "prtime.h"
 #include "nsCOMPtr.h"