mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 507073 - Don't build nsBrowserDirectoryProvider as a separate library. r=vlad
--HG-- rename : browser/components/dirprovider/nsBrowserDirectoryProvider.cpp => browser/components/dirprovider/DirectoryProvider.cpp
This commit is contained in:
parent
9a849e8382
commit
1f2cb76806
@ -36,6 +36,7 @@ LOCAL_INCLUDES = \
|
||||
-I$(srcdir)/../places/src \
|
||||
-I$(srcdir)/../privatebrowsing/src \
|
||||
-I$(srcdir)/../about \
|
||||
-I$(srcdir)/../dirprovider \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
@ -47,6 +48,7 @@ SHARED_LIBRARY_LIBS = \
|
||||
../places/src/$(LIB_PREFIX)browserplaces_s.$(LIB_SUFFIX) \
|
||||
../privatebrowsing/src/$(LIB_PREFIX)privatebrowsing_s.$(LIB_SUFFIX) \
|
||||
../about/$(LIB_PREFIX)browserabout_s.$(LIB_SUFFIX) \
|
||||
../dirprovider/$(LIB_PREFIX)browserdir_s.$(LIB_SUFFIX) \
|
||||
$(NULL)
|
||||
|
||||
ifneq (,$(filter windows cocoa gtk2, $(MOZ_WIDGET_TOOLKIT)))
|
||||
|
@ -106,3 +106,6 @@
|
||||
#define NS_BROWSER_ABOUT_REDIRECTOR_CID \
|
||||
{ 0x7e4bb6ad, 0x2fc4, 0x4dc6, { 0x89, 0xef, 0x23, 0xe8, 0xe5, 0xcc, 0xf9, 0x80 } }
|
||||
|
||||
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
|
||||
#define NS_BROWSERDIRECTORYPROVIDER_CID \
|
||||
{ 0x6deb193c, 0xf87d, 0x4078, { 0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 } }
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#include "nsBrowserCompsCID.h"
|
||||
#include "DirectoryProvider.h"
|
||||
#include "nsPlacesImportExportService.h"
|
||||
|
||||
#if defined(XP_WIN)
|
||||
@ -84,6 +85,7 @@ using namespace mozilla::browser;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(DirectoryProvider)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsPlacesImportExportService)
|
||||
#if defined(XP_WIN)
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsWindowsShellService)
|
||||
@ -124,6 +126,14 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrivateBrowsingServiceWrapper, Init)
|
||||
|
||||
static const nsModuleComponentInfo components[] =
|
||||
{
|
||||
{ "Browser Directory Provider",
|
||||
NS_BROWSERDIRECTORYPROVIDER_CID,
|
||||
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
|
||||
DirectoryProviderConstructor,
|
||||
DirectoryProvider::Register,
|
||||
DirectoryProvider::Unregister
|
||||
},
|
||||
|
||||
#if defined(XP_WIN)
|
||||
{ "Browser Shell Service",
|
||||
NS_SHELLSERVICE_CID,
|
||||
|
@ -36,6 +36,7 @@
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "DirectoryProvider.h"
|
||||
|
||||
#include "nsIFile.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
@ -56,52 +57,15 @@
|
||||
#include "nsStringAPI.h"
|
||||
#include "nsXULAppAPI.h"
|
||||
|
||||
class nsBrowserDirectoryProvider :
|
||||
public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
static NS_METHOD Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
private:
|
||||
nsresult RestoreBookmarksFromBackup(const nsACString& aLeafName,
|
||||
nsIFile* aParentDir, nsIFile* aTarget);
|
||||
void EnsureProfileFile(const nsACString& aLeafName,
|
||||
nsIFile* aParentDir, nsIFile* aTarget);
|
||||
|
||||
class AppendingEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
AppendingEnumerator(nsISimpleEnumerator* aBase,
|
||||
char const *const *aAppendList);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISimpleEnumerator> mBase;
|
||||
char const *const *const mAppendList;
|
||||
nsCOMPtr<nsIFile> mNext;
|
||||
};
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS2(nsBrowserDirectoryProvider,
|
||||
NS_IMPL_ISUPPORTS2(DirectoryProvider,
|
||||
nsIDirectoryServiceProvider,
|
||||
nsIDirectoryServiceProvider2)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::GetFile(const char *aKey, PRBool *aPersist,
|
||||
nsIFile* *aResult)
|
||||
DirectoryProvider::GetFile(const char *aKey, PRBool *aPersist, nsIFile* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -290,8 +254,7 @@ AppendDistroSearchDirs(nsIProperties* aDirSvc, nsCOMArray<nsIFile> &array)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
||||
nsISimpleEnumerator* *aResult)
|
||||
DirectoryProvider::GetFiles(const char *aKey, nsISimpleEnumerator* *aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -331,17 +294,10 @@ nsBrowserDirectoryProvider::GetFiles(const char *aKey,
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
static char const kContractID[] = "@mozilla.org/browser/directory-provider;1";
|
||||
|
||||
// {6DEB193C-F87D-4078-BC78-5E64655B4D62}
|
||||
#define NS_BROWSERDIRECTORYPROVIDER_CID \
|
||||
{ 0x6deb193c, 0xf87d, 0x4078, { 0xbc, 0x78, 0x5e, 0x64, 0x65, 0x5b, 0x4d, 0x62 } }
|
||||
|
||||
NS_METHOD
|
||||
nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
DirectoryProvider::Register(nsIComponentManager* aCompMgr, nsIFile* aPath,
|
||||
const char *aLoaderStr, const char *aType,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -352,15 +308,16 @@ nsBrowserDirectoryProvider::Register(nsIComponentManager* aCompMgr,
|
||||
|
||||
rv = catMan->AddCategoryEntry(XPCOM_DIRECTORY_PROVIDER_CATEGORY,
|
||||
"browser-directory-provider",
|
||||
kContractID, PR_TRUE, PR_TRUE, nsnull);
|
||||
NS_BROWSERDIRECTORYPROVIDER_CONTRACTID,
|
||||
PR_TRUE, PR_TRUE, nsnull);
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
DirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
@ -374,32 +331,17 @@ nsBrowserDirectoryProvider::Unregister(nsIComponentManager* aCompMgr,
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsBrowserDirectoryProvider)
|
||||
|
||||
static const nsModuleComponentInfo components[] = {
|
||||
{
|
||||
"nsBrowserDirectoryProvider",
|
||||
NS_BROWSERDIRECTORYPROVIDER_CID,
|
||||
kContractID,
|
||||
nsBrowserDirectoryProviderConstructor,
|
||||
nsBrowserDirectoryProvider::Register,
|
||||
nsBrowserDirectoryProvider::Unregister
|
||||
}
|
||||
};
|
||||
|
||||
NS_IMPL_NSGETMODULE(BrowserDirProvider, components)
|
||||
NS_IMPL_ISUPPORTS1(nsBrowserDirectoryProvider::AppendingEnumerator,
|
||||
nsISimpleEnumerator)
|
||||
NS_IMPL_ISUPPORTS1(DirectoryProvider::AppendingEnumerator, nsISimpleEnumerator)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
|
||||
DirectoryProvider::AppendingEnumerator::HasMoreElements(PRBool *aResult)
|
||||
{
|
||||
*aResult = mNext ? PR_TRUE : PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
DirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
{
|
||||
if (aResult)
|
||||
NS_ADDREF(*aResult = mNext);
|
||||
@ -440,7 +382,7 @@ nsBrowserDirectoryProvider::AppendingEnumerator::GetNext(nsISupports* *aResult)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
DirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
(nsISimpleEnumerator* aBase,
|
||||
char const *const *aAppendList) :
|
||||
mBase(aBase),
|
||||
@ -449,3 +391,6 @@ nsBrowserDirectoryProvider::AppendingEnumerator::AppendingEnumerator
|
||||
// Initialize mNext to begin.
|
||||
GetNext(nsnull);
|
||||
}
|
||||
|
||||
} // namespace browser
|
||||
} // namespace mozilla
|
89
browser/components/dirprovider/DirectoryProvider.h
Normal file
89
browser/components/dirprovider/DirectoryProvider.h
Normal file
@ -0,0 +1,89 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is the Mozilla Firefox browser.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Benjamin Smedberg <benjamin@smedbergs.us>
|
||||
*
|
||||
* Portions created by the Initial Developer are Copyright (C) 2005
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#ifndef DirectoryProvider_h__
|
||||
#define DirectoryProvider_h__
|
||||
|
||||
#include "nsIDirectoryService.h"
|
||||
#include "nsComponentManagerUtils.h"
|
||||
#include "nsISimpleEnumerator.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIGenericFactory.h"
|
||||
|
||||
#define NS_BROWSERDIRECTORYPROVIDER_CONTRACTID \
|
||||
"@mozilla.org/browser/directory-provider;1"
|
||||
|
||||
namespace mozilla {
|
||||
namespace browser {
|
||||
|
||||
class DirectoryProvider : public nsIDirectoryServiceProvider2
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER
|
||||
NS_DECL_NSIDIRECTORYSERVICEPROVIDER2
|
||||
|
||||
static NS_METHOD Register(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const char *aType,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
static NS_METHOD Unregister(nsIComponentManager* aCompMgr,
|
||||
nsIFile* aPath, const char *aLoaderStr,
|
||||
const nsModuleComponentInfo *aInfo);
|
||||
|
||||
private:
|
||||
class AppendingEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSISIMPLEENUMERATOR
|
||||
|
||||
AppendingEnumerator(nsISimpleEnumerator* aBase,
|
||||
char const *const *aAppendList);
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsISimpleEnumerator> mBase;
|
||||
char const *const *const mAppendList;
|
||||
nsCOMPtr<nsIFile> mNext;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace browser
|
||||
} // namespace mozilla
|
||||
|
||||
#endif // DirectoryProvider_h__
|
@ -42,12 +42,13 @@ VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = browsercomps
|
||||
LIBRARY_NAME = browserdirprovider
|
||||
SHORT_LIBNAME = brwsrdir
|
||||
IS_COMPONENT = 1
|
||||
MODULE_NAME = BrowserDirProvider
|
||||
FORCE_SHARED_LIB = 1
|
||||
MODULE = browserdir
|
||||
LIBRARY_NAME = browserdir_s
|
||||
|
||||
DIRS = tests
|
||||
|
||||
FORCE_STATIC_LIB = 1
|
||||
FORCE_USE_PIC = 1
|
||||
|
||||
# Because we are an application component, link against the CRT statically
|
||||
# (on Windows, but only if we're not building our own CRT for jemalloc)
|
||||
@ -55,7 +56,12 @@ ifndef MOZ_MEMORY
|
||||
USE_STATIC_LIBS = 1
|
||||
endif
|
||||
|
||||
CPPSRCS = nsBrowserDirectoryProvider.cpp
|
||||
EXPORTS_NAMESPACES = mozilla/browser
|
||||
EXPORTS_mozilla/browser = DirectoryProvider.h
|
||||
|
||||
CPPSRCS = DirectoryProvider.cpp
|
||||
|
||||
LOCAL_INCLUDES = -I$(srcdir)/../build
|
||||
|
||||
EXTRA_DSO_LDOPTS = \
|
||||
$(XPCOM_GLUE_LDOPTS) \
|
||||
|
49
browser/components/dirprovider/tests/Makefile.in
Normal file
49
browser/components/dirprovider/tests/Makefile.in
Normal file
@ -0,0 +1,49 @@
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License"); you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2009
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Ryan Flint <rflint@mozilla.com> (Original Author)
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
DEPTH = ../../../..
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
relativesrcdir = browser/components/dirprovider/tests
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MODULE = test_browserdir
|
||||
|
||||
XPCSHELL_TESTS = unit
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -0,0 +1,52 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ryan Flint <rflint@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
|
||||
var gProfD = do_get_profile();
|
||||
var gDirSvc = Cc["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties);
|
||||
var gPrefSvc = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
|
||||
function writeTestFile(aParent, aName) {
|
||||
let file = aParent.clone();
|
||||
file.append(aName);
|
||||
file.createUnique(Ci.nsIFile.NORMAL_FILE_TYPE, 0644);
|
||||
return file;
|
||||
}
|
||||
|
@ -0,0 +1,46 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ryan Flint <rflint@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
// We need to run this test separately since DirectoryProvider persists BMarks
|
||||
|
||||
function run_test() {
|
||||
let dir = gProfD.clone();
|
||||
let tfile = writeTestFile(dir, "bookmarkfile.test");
|
||||
gPrefSvc.setCharPref("browser.bookmarks.file", tfile.path);
|
||||
|
||||
let bmarks = gDirSvc.get("BMarks", Ci.nsIFile);
|
||||
do_check_true(tfile.equals(bmarks));
|
||||
}
|
91
browser/components/dirprovider/tests/unit/test_keys.js
Normal file
91
browser/components/dirprovider/tests/unit/test_keys.js
Normal file
@ -0,0 +1,91 @@
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is Mozilla Foundation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Ryan Flint <rflint@mozilla.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
function test_usr_micsum() {
|
||||
let mdir = gProfD.clone();
|
||||
mdir.append("microsummary-generators");
|
||||
|
||||
let tmdir = gDirSvc.get("UsrMicsumGens", Ci.nsIFile);
|
||||
do_check_true(tmdir.equals(mdir));
|
||||
|
||||
if (!tmdir.exists())
|
||||
tmdir.create(Ci.nsIFile.DIRECTORY_TYPE, 0777);
|
||||
|
||||
do_check_true(tmdir.isWritable());
|
||||
|
||||
let tfile = writeTestFile(tmdir, "usrmicsum");
|
||||
do_check_true(tfile.exists());
|
||||
|
||||
mdir.append(tfile.leafName);
|
||||
do_check_true(mdir.exists());
|
||||
}
|
||||
|
||||
function test_app_micsum() {
|
||||
let mdir = gDirSvc.get("XCurProcD", Ci.nsIFile);
|
||||
mdir.append("microsummary-generators");
|
||||
|
||||
let tmdir = gDirSvc.get("MicsumGens", Ci.nsIFile);
|
||||
do_check_true(tmdir.equals(mdir));
|
||||
}
|
||||
|
||||
function test_bookmarkhtml() {
|
||||
let bmarks = gProfD.clone();
|
||||
bmarks.append("bookmarks.html");
|
||||
|
||||
let tbmarks = gDirSvc.get("BMarks", Ci.nsIFile);
|
||||
do_check_true(bmarks.equals(tbmarks));
|
||||
}
|
||||
|
||||
function test_prefoverride() {
|
||||
let dir = gDirSvc.get("DefRt", Ci.nsIFile);
|
||||
dir.append("existing-profile-defaults.js");
|
||||
|
||||
let tdir = gDirSvc.get("ExistingPrefOverride", Ci.nsIFile);
|
||||
do_check_true(dir.equals(tdir));
|
||||
}
|
||||
|
||||
function run_test() {
|
||||
[test_usr_micsum,
|
||||
test_app_micsum,
|
||||
test_bookmarkhtml,
|
||||
test_prefoverride
|
||||
].forEach(function(f) {
|
||||
do_test_pending();
|
||||
print("Running test: " + f.name);
|
||||
f();
|
||||
do_test_finished();
|
||||
});
|
||||
}
|
@ -69,6 +69,8 @@ components/aboutRights.js
|
||||
components/aboutRobots.js
|
||||
components/aboutSessionRestore.js
|
||||
components/compreg.dat
|
||||
components/@DLL_PREFIX@browserdirprovider@DLL_SUFFIX@
|
||||
components/@DLL_PREFIX@brwsrdir@DLL_SUFFIX@
|
||||
components/@DLL_PREFIX@myspell@DLL_SUFFIX@
|
||||
components/@DLL_PREFIX@spellchecker@DLL_SUFFIX@
|
||||
components/@DLL_PREFIX@spellchk@DLL_SUFFIX@
|
||||
|
Loading…
Reference in New Issue
Block a user