diff options
author | wolfbeast <mcwerewolf@gmail.com> | 2018-02-11 13:01:08 +0100 |
---|---|---|
committer | wolfbeast <mcwerewolf@gmail.com> | 2018-02-11 13:01:08 +0100 |
commit | e45706ca3acbb6530419433212becc61d5953a2d (patch) | |
tree | 09839ca2d524b28c1cdab2349bcdbd938668f139 /browser | |
parent | 154d68048274383cbbff5412942ada5f88c152ca (diff) | |
download | uxp-e45706ca3acbb6530419433212becc61d5953a2d.tar.gz |
Un-fold browsercomps.* from libxul
This resolves #16.
Diffstat (limited to 'browser')
-rw-r--r-- | browser/components/build/moz.build | 22 | ||||
-rw-r--r-- | browser/components/dirprovider/DirectoryProvider.cpp | 2 | ||||
-rw-r--r-- | browser/components/feeds/nsFeedSniffer.cpp | 15 | ||||
-rw-r--r-- | browser/components/feeds/nsFeedSniffer.h | 2 | ||||
-rw-r--r-- | browser/components/migration/nsIEHistoryEnumerator.cpp | 5 | ||||
-rw-r--r-- | browser/components/shell/nsGNOMEShellService.cpp | 23 | ||||
-rw-r--r-- | browser/components/shell/nsGNOMEShellService.h | 2 | ||||
-rw-r--r-- | browser/components/shell/nsMacShellService.cpp | 2 | ||||
-rw-r--r-- | browser/components/shell/nsWindowsShellService.cpp | 18 | ||||
-rw-r--r-- | browser/components/shell/nsWindowsShellService.h | 2 | ||||
-rw-r--r-- | browser/installer/package-manifest.in | 2 |
11 files changed, 54 insertions, 41 deletions
diff --git a/browser/components/build/moz.build b/browser/components/build/moz.build index 8c99b74ddb..622cf449ce 100644 --- a/browser/components/build/moz.build +++ b/browser/components/build/moz.build @@ -12,8 +12,7 @@ SOURCES += [ 'nsModule.cpp', ] -Library('browsercomps') -FINAL_LIBRARY = 'xul' +XPCOMBinaryComponent('browsercomps') LOCAL_INCLUDES += [ '../about', @@ -22,3 +21,22 @@ LOCAL_INCLUDES += [ '../migration', '../shell', ] + +if CONFIG['OS_ARCH'] == 'WINNT': + OS_LIBS += [ + 'esent', + 'netapi32', + 'ole32', + 'shell32', + 'shlwapi', + 'version', + ] + DELAYLOAD_DLLS += [ + 'esent.dll', + 'netapi32.dll', + ] + +# Mac: Need to link with CoreFoundation for Mac Migrators (PList reading code) +# GTK2: Need to link with glib for GNOME shell service +if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'gtk2', 'gtk3'): + OS_LIBS += CONFIG['TK_LIBS'] diff --git a/browser/components/dirprovider/DirectoryProvider.cpp b/browser/components/dirprovider/DirectoryProvider.cpp index 7b4f81c7d2..8b7c0b9e0a 100644 --- a/browser/components/dirprovider/DirectoryProvider.cpp +++ b/browser/components/dirprovider/DirectoryProvider.cpp @@ -20,7 +20,7 @@ #include "nsDirectoryServiceUtils.h" #include "mozilla/ModuleUtils.h" #include "nsServiceManagerUtils.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "nsXULAppAPI.h" #include "nsIPrefLocalizedString.h" diff --git a/browser/components/feeds/nsFeedSniffer.cpp b/browser/components/feeds/nsFeedSniffer.cpp index f2d0da7766..f314d3d3bd 100644 --- a/browser/components/feeds/nsFeedSniffer.cpp +++ b/browser/components/feeds/nsFeedSniffer.cpp @@ -185,15 +185,9 @@ IsDocumentElement(const char *start, const char* end) static bool ContainsTopLevelSubstring(nsACString& dataString, const char *substring) { - nsACString::const_iterator start, end; - dataString.BeginReading(start); - dataString.EndReading(end); - - if (!FindInReadable(nsCString(substring), start, end)){ + int32_t offset = dataString.Find(substring); + if (offset == -1) return false; - } - - auto offset = start.get() - dataString.Data(); const char *begin = dataString.BeginReading(); @@ -318,10 +312,9 @@ nsFeedSniffer::GetMIMETypeFromContent(nsIRequest* request, // RSS 1.0 if (!isFeed) { - bool foundNS_RDF = FindInReadable(NS_LITERAL_CSTRING(NS_RDF), dataString); - bool foundNS_RSS = FindInReadable(NS_LITERAL_CSTRING(NS_RSS), dataString); isFeed = ContainsTopLevelSubstring(dataString, "<rdf:RDF") && - foundNS_RDF && foundNS_RSS; + dataString.Find(NS_RDF) != -1 && + dataString.Find(NS_RSS) != -1; } // If we sniffed a feed, coerce our internal type diff --git a/browser/components/feeds/nsFeedSniffer.h b/browser/components/feeds/nsFeedSniffer.h index b7ac002bdf..a0eb9862ce 100644 --- a/browser/components/feeds/nsFeedSniffer.h +++ b/browser/components/feeds/nsFeedSniffer.h @@ -6,7 +6,7 @@ #include "nsIContentSniffer.h" #include "nsIStreamListener.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "mozilla/Attributes.h" class nsFeedSniffer final : public nsIContentSniffer, diff --git a/browser/components/migration/nsIEHistoryEnumerator.cpp b/browser/components/migration/nsIEHistoryEnumerator.cpp index 116e9a8608..0b377d27e9 100644 --- a/browser/components/migration/nsIEHistoryEnumerator.cpp +++ b/browser/components/migration/nsIEHistoryEnumerator.cpp @@ -9,10 +9,9 @@ #include "nsArrayEnumerator.h" #include "nsCOMArray.h" -#include "nsIURI.h" #include "nsIVariant.h" #include "nsNetUtil.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "nsWindowsMigrationUtils.h" #include "prtime.h" @@ -23,7 +22,7 @@ NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator) nsIEHistoryEnumerator::nsIEHistoryEnumerator() { - ::CoInitialize(nullptr); + ::CoInitialize(nullptr); } nsIEHistoryEnumerator::~nsIEHistoryEnumerator() diff --git a/browser/components/shell/nsGNOMEShellService.cpp b/browser/components/shell/nsGNOMEShellService.cpp index f6c2613d41..1001a52ae1 100644 --- a/browser/components/shell/nsGNOMEShellService.cpp +++ b/browser/components/shell/nsGNOMEShellService.cpp @@ -14,7 +14,7 @@ #include "nsDirectoryServiceDefs.h" #include "nsIPrefService.h" #include "prenv.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "nsIGConfService.h" #include "nsIGIOService.h" #include "nsIGSettingsService.h" @@ -70,16 +70,16 @@ static const MimeTypeAssociation appTypes[] = { // GConf registry key constants #define DG_BACKGROUND "/desktop/gnome/background" -#define kDesktopImageKey DG_BACKGROUND "/picture_filename" -#define kDesktopOptionsKey DG_BACKGROUND "/picture_options" -#define kDesktopDrawBGKey DG_BACKGROUND "/draw_background" -#define kDesktopColorKey DG_BACKGROUND "/primary_color" +static const char kDesktopImageKey[] = DG_BACKGROUND "/picture_filename"; +static const char kDesktopOptionsKey[] = DG_BACKGROUND "/picture_options"; +static const char kDesktopDrawBGKey[] = DG_BACKGROUND "/draw_background"; +static const char kDesktopColorKey[] = DG_BACKGROUND "/primary_color"; -#define kDesktopBGSchema "org.gnome.desktop.background" -#define kDesktopImageGSKey "picture-uri" -#define kDesktopOptionGSKey "picture-options" -#define kDesktopDrawBGGSKey "draw-background" -#define kDesktopColorGSKey "primary-color" +static const char kDesktopBGSchema[] = "org.gnome.desktop.background"; +static const char kDesktopImageGSKey[] = "picture-uri"; +static const char kDesktopOptionGSKey[] = "picture-options"; +static const char kDesktopDrawBGGSKey[] = "draw-background"; +static const char kDesktopColorGSKey[] = "primary-color"; nsresult nsGNOMEShellService::Init() @@ -508,8 +508,7 @@ static void ColorToCString(uint32_t aColor, nsCString& aResult) { // The #rrrrggggbbbb format is used to match gdk_color_to_string() - aResult.SetLength(13); - char *buf = aResult.BeginWriting(); + char *buf = aResult.BeginWriting(13); if (!buf) return; diff --git a/browser/components/shell/nsGNOMEShellService.h b/browser/components/shell/nsGNOMEShellService.h index b3ef1a9186..a7b0038021 100644 --- a/browser/components/shell/nsGNOMEShellService.h +++ b/browser/components/shell/nsGNOMEShellService.h @@ -7,7 +7,7 @@ #define nsgnomeshellservice_h____ #include "nsIGNOMEShellService.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "mozilla/Attributes.h" class nsGNOMEShellService final : public nsIGNOMEShellService diff --git a/browser/components/shell/nsMacShellService.cpp b/browser/components/shell/nsMacShellService.cpp index 48db4896b3..d8d64039d3 100644 --- a/browser/components/shell/nsMacShellService.cpp +++ b/browser/components/shell/nsMacShellService.cpp @@ -20,7 +20,7 @@ #include "nsIProperties.h" #include "nsServiceManagerUtils.h" #include "nsShellService.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "nsIDocShell.h" #include "nsILoadContext.h" diff --git a/browser/components/shell/nsWindowsShellService.cpp b/browser/components/shell/nsWindowsShellService.cpp index 53d128cb96..6c43d95db8 100644 --- a/browser/components/shell/nsWindowsShellService.cpp +++ b/browser/components/shell/nsWindowsShellService.cpp @@ -12,7 +12,6 @@ #include "nsIDOMElement.h" #include "nsIDOMHTMLImageElement.h" #include "nsIImageLoadingContent.h" -#include "nsIOutputStream.h" #include "nsIPrefService.h" #include "nsIPrefLocalizedString.h" #include "nsIServiceManager.h" @@ -466,7 +465,7 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } - res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName.get(), + res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, PromiseFlatString(keyName).get(), 0, KEY_SET_VALUE, &theKey); if (REG_FAILED(res)) { // If updating the open command fails try to update it using the helper @@ -475,9 +474,10 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, return NS_OK; } + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); if (REG_FAILED(res)) { @@ -529,8 +529,9 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, if (REG_FAILED(res) || char16_t('\0') != *currValue) { // Key wasn't set or was set to something other than our registry entry. // Delete the key along with all of its childrean and then recreate it. - ::SHDeleteKeyW(HKEY_CURRENT_USER, keyName.get()); - res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, nullptr, + const nsString &flatName = PromiseFlatString(keyName); + ::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get()); + res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr, REG_OPTION_NON_VOLATILE, KEY_SET_VALUE, nullptr, &theKey, nullptr); if (REG_FAILED(res)) { @@ -582,9 +583,10 @@ nsWindowsShellService::IsDefaultBrowser(bool aStartupCheck, NS_ConvertUTF8toUTF16 valueData(VAL_OPEN); valueData.Replace(offset, 9, appLongPath); + const nsString &flatValue = PromiseFlatString(valueData); res = ::RegSetValueExW(theKey, L"", 0, REG_SZ, - (const BYTE *) valueData.get(), - (valueData.Length() + 1) * sizeof(char16_t)); + (const BYTE *) flatValue.get(), + (flatValue.Length() + 1) * sizeof(char16_t)); // Close the key that was created. ::RegCloseKey(theKey); // If updating the FTP protocol handlers shell open command fails try to diff --git a/browser/components/shell/nsWindowsShellService.h b/browser/components/shell/nsWindowsShellService.h index b9c473a150..06c6c3c9bb 100644 --- a/browser/components/shell/nsWindowsShellService.h +++ b/browser/components/shell/nsWindowsShellService.h @@ -7,7 +7,7 @@ #define nswindowsshellservice_h____ #include "nscore.h" -#include "nsString.h" +#include "nsStringAPI.h" #include "nsIWindowsShellService.h" #include "nsITimer.h" diff --git a/browser/installer/package-manifest.in b/browser/installer/package-manifest.in index 1ad59925ed..ba7904719a 100644 --- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -156,6 +156,7 @@ @RESPATH@/browser/components/prebuilt-interfaces.manifest @RESPATH@/browser/components/interfaces.xpt #endif +@RESPATH@/browser/components/components.manifest @RESPATH@/components/alerts.xpt #ifdef ACCESSIBILITY #ifdef XP_WIN32 @@ -441,6 +442,7 @@ @RESPATH@/browser/components/nsSessionStore.js @RESPATH@/components/nsURLFormatter.manifest @RESPATH@/components/nsURLFormatter.js +@RESPATH@/browser/components/@DLL_PREFIX@browsercomps@DLL_SUFFIX@ @RESPATH@/components/txEXSLTRegExFunctions.manifest @RESPATH@/components/txEXSLTRegExFunctions.js @RESPATH@/components/toolkitplaces.manifest |