Bug 1302855 - Fold browsercomps into xul; r=bsmedberg draft
authorEnes Goktas <egoktas@mozilla.com>
Tue, 27 Sep 2016 19:54:37 -0700
changeset 418242 8273a882cf752233ecde549b962257fe73baed17
parent 417914 66a77b9bfe5dcacd50eccf85de7c0e7e15ce0ffd
child 532313 4b6b333989a96e18f7c60028f35b8bef6330091f
push id30649
push userbmo:enes.goktas@gmail.com
push dateWed, 28 Sep 2016 02:55:29 +0000
reviewersbsmedberg
bugs1302855
milestone52.0a1
Bug 1302855 - Fold browsercomps into xul; r=bsmedberg MozReview-Commit-ID: 8oaVngXFfh3
CLOBBER
browser/components/build/moz.build
browser/components/dirprovider/DirectoryProvider.cpp
browser/components/feeds/nsFeedSniffer.cpp
browser/components/feeds/nsFeedSniffer.h
browser/components/migration/nsIEHistoryEnumerator.cpp
browser/components/shell/nsGNOMEShellService.cpp
browser/components/shell/nsGNOMEShellService.h
browser/components/shell/nsMacShellService.cpp
browser/components/shell/nsWindowsShellService.cpp
browser/components/shell/nsWindowsShellService.h
browser/installer/package-manifest.in
widget/gtk/mozgtk/mozgtk.c
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Merge day clobber
\ No newline at end of file
+Bug 1302855 changed build system to fold browsercomps into xul
--- a/browser/components/build/moz.build
+++ b/browser/components/build/moz.build
@@ -7,36 +7,18 @@
 EXPORTS += [
     'nsBrowserCompsCID.h',
 ]
 
 SOURCES += [
     'nsModule.cpp',
 ]
 
-XPCOMBinaryComponent('browsercomps')
+Library('browsercomps')
+FINAL_LIBRARY = 'xul'
 
 LOCAL_INCLUDES += [
     '../about',
     '../dirprovider',
     '../feeds',
     '../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']
--- a/browser/components/dirprovider/DirectoryProvider.cpp
+++ b/browser/components/dirprovider/DirectoryProvider.cpp
@@ -15,17 +15,17 @@
 #include "nsAppDirectoryServiceDefs.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsCategoryManagerUtils.h"
 #include "nsComponentManagerUtils.h"
 #include "nsCOMArray.h"
 #include "nsDirectoryServiceUtils.h"
 #include "mozilla/ModuleUtils.h"
 #include "nsServiceManagerUtils.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "nsXULAppAPI.h"
 #include "nsIPrefLocalizedString.h"
 
 namespace mozilla {
 namespace browser {
 
 NS_IMPL_ISUPPORTS(DirectoryProvider,
                   nsIDirectoryServiceProvider,
--- a/browser/components/feeds/nsFeedSniffer.cpp
+++ b/browser/components/feeds/nsFeedSniffer.cpp
@@ -180,19 +180,25 @@ IsDocumentElement(const char *start, con
  * @param   substring
  *          The substring being tested for existence and root-ness.
  * @returns true if the substring exists and is the documentElement, false
  *          otherwise.
  */
 static bool
 ContainsTopLevelSubstring(nsACString& dataString, const char *substring) 
 {
-  int32_t offset = dataString.Find(substring);
-  if (offset == -1)
+  nsACString::const_iterator start, end;
+  dataString.BeginReading(start);
+  dataString.EndReading(end);
+
+  if (!FindInReadable(nsCString(substring), start, end)){
     return false;
+  }
+
+  auto offset = start.get() - dataString.Data();
 
   const char *begin = dataString.BeginReading();
 
   // Only do the validation when we find the substring.
   return IsDocumentElement(begin, begin + offset);
 }
 
 NS_IMETHODIMP
@@ -307,19 +313,20 @@ nsFeedSniffer::GetMIMETypeFromContent(ns
   isFeed = ContainsTopLevelSubstring(dataString, "<rss");
 
   // Atom 1.0
   if (!isFeed)
     isFeed = ContainsTopLevelSubstring(dataString, "<feed");
 
   // 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") &&
-      dataString.Find(NS_RDF) != -1 &&
-      dataString.Find(NS_RSS) != -1;
+      foundNS_RDF && foundNS_RSS;
   }
 
   // If we sniffed a feed, coerce our internal type
   if (isFeed && !HasAttachmentDisposition(channel))
     sniffedType.AssignLiteral(TYPE_MAYBE_FEED);
   else
     sniffedType.Truncate();
   return NS_OK;
--- a/browser/components/feeds/nsFeedSniffer.h
+++ b/browser/components/feeds/nsFeedSniffer.h
@@ -1,17 +1,17 @@
 /* -*- Mode: C++; tab-width: 8; 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/. */
 
 
 #include "nsIContentSniffer.h"
 #include "nsIStreamListener.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "mozilla/Attributes.h"
 
 class nsFeedSniffer final : public nsIContentSniffer,
                                    nsIStreamListener
 {
 public:
   NS_DECL_ISUPPORTS
   NS_DECL_NSICONTENTSNIFFER
--- a/browser/components/migration/nsIEHistoryEnumerator.cpp
+++ b/browser/components/migration/nsIEHistoryEnumerator.cpp
@@ -4,30 +4,31 @@
 
 #include "nsIEHistoryEnumerator.h"
 
 #include <urlhist.h>
 #include <shlguid.h>
 
 #include "nsArrayEnumerator.h"
 #include "nsCOMArray.h"
+#include "nsIURI.h"
 #include "nsIVariant.h"
 #include "nsNetUtil.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "nsWindowsMigrationUtils.h"
 #include "prtime.h"
 
 ////////////////////////////////////////////////////////////////////////////////
 //// nsIEHistoryEnumerator
 
 NS_IMPL_ISUPPORTS(nsIEHistoryEnumerator, nsISimpleEnumerator)
 
 nsIEHistoryEnumerator::nsIEHistoryEnumerator()
 {
-  ::CoInitialize(nullptr);  
+  ::CoInitialize(nullptr);
 }
 
 nsIEHistoryEnumerator::~nsIEHistoryEnumerator()
 {
   ::CoUninitialize();
 }
 
 void
--- a/browser/components/shell/nsGNOMEShellService.cpp
+++ b/browser/components/shell/nsGNOMEShellService.cpp
@@ -9,17 +9,17 @@
 #include "nsGNOMEShellService.h"
 #include "nsShellService.h"
 #include "nsIServiceManager.h"
 #include "nsIFile.h"
 #include "nsIProperties.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsIPrefService.h"
 #include "prenv.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "nsIGConfService.h"
 #include "nsIGIOService.h"
 #include "nsIGSettingsService.h"
 #include "nsIStringBundle.h"
 #include "nsIOutputStream.h"
 #include "nsIProcess.h"
 #include "nsServiceManagerUtils.h"
 #include "nsComponentManagerUtils.h"
@@ -65,26 +65,26 @@ static const ProtocolAssociation appProt
 static const MimeTypeAssociation appTypes[] = {
   { "text/html",             "htm html shtml" },
   { "application/xhtml+xml", "xhtml xht"      }
 };
 
 // GConf registry key constants
 #define DG_BACKGROUND "/desktop/gnome/background"
 
-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 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 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";
+#define kDesktopBGSchema "org.gnome.desktop.background"
+#define kDesktopImageGSKey "picture-uri"
+#define kDesktopOptionGSKey "picture-options"
+#define kDesktopDrawBGGSKey "draw-background"
+#define kDesktopColorGSKey "primary-color"
 
 nsresult
 nsGNOMEShellService::Init()
 {
   nsresult rv;
 
   // GConf, GSettings or GIO _must_ be available, or we do not allow
   // CreateInstance to succeed.
@@ -503,17 +503,18 @@ nsGNOMEShellService::GetDesktopBackgroun
             COLOR_16_TO_8_BIT(color.blue);
   return NS_OK;
 }
 
 static void
 ColorToCString(uint32_t aColor, nsCString& aResult)
 {
   // The #rrrrggggbbbb format is used to match gdk_color_to_string()
-  char *buf = aResult.BeginWriting(13);
+  aResult.SetLength(13);
+  char *buf = aResult.BeginWriting();
   if (!buf)
     return;
 
   uint16_t red = COLOR_8_TO_16_BIT((aColor >> 16) & 0xff);
   uint16_t green = COLOR_8_TO_16_BIT((aColor >> 8) & 0xff);
   uint16_t blue = COLOR_8_TO_16_BIT(aColor & 0xff);
 
   snprintf(buf, 14, "#%04x%04x%04x", red, green, blue);
--- a/browser/components/shell/nsGNOMEShellService.h
+++ b/browser/components/shell/nsGNOMEShellService.h
@@ -2,17 +2,17 @@
 /* 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 nsgnomeshellservice_h____
 #define nsgnomeshellservice_h____
 
 #include "nsIGNOMEShellService.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "mozilla/Attributes.h"
 
 class nsGNOMEShellService final : public nsIGNOMEShellService
 {
 public:
   nsGNOMEShellService() : mAppIsInPath(false) { }
 
   NS_DECL_ISUPPORTS
--- a/browser/components/shell/nsMacShellService.cpp
+++ b/browser/components/shell/nsMacShellService.cpp
@@ -15,17 +15,17 @@
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsIURL.h"
 #include "nsIWebBrowserPersist.h"
 #include "nsMacShellService.h"
 #include "nsIProperties.h"
 #include "nsServiceManagerUtils.h"
 #include "nsShellService.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "nsIDocShell.h"
 #include "nsILoadContext.h"
 
 #include <CoreFoundation/CoreFoundation.h>
 #include <ApplicationServices/ApplicationServices.h>
 
 #define NETWORK_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/Network.prefPane")
 #define DESKTOP_PREFPANE NS_LITERAL_CSTRING("/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane")
--- a/browser/components/shell/nsWindowsShellService.cpp
+++ b/browser/components/shell/nsWindowsShellService.cpp
@@ -7,16 +7,17 @@
 
 #include "imgIContainer.h"
 #include "imgIRequest.h"
 #include "mozilla/gfx/2D.h"
 #include "mozilla/RefPtr.h"
 #include "nsIDOMElement.h"
 #include "nsIDOMHTMLImageElement.h"
 #include "nsIImageLoadingContent.h"
+#include "nsIOutputStream.h"
 #include "nsIPrefService.h"
 #include "nsIPrefLocalizedString.h"
 #include "nsIServiceManager.h"
 #include "nsIStringBundle.h"
 #include "nsNetUtil.h"
 #include "nsServiceManagerUtils.h"
 #include "nsShellService.h"
 #include "nsIProcess.h"
@@ -460,29 +461,28 @@ nsWindowsShellService::IsDefaultBrowser(
       offset = oldValueData.Find("%APPPATH%");
       oldValueData.Replace(offset, 9, appLongPath);
       // The current registry value doesn't match the current or the old format.
       if (_wcsicmp(oldValueData.get(), currValue)) {
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
 
-      res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, PromiseFlatString(keyName).get(),
+      res = ::RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName.get(),
                             0, KEY_SET_VALUE, &theKey);
       if (REG_FAILED(res)) {
         // If updating the open command fails try to update it using the helper
         // application when setting Firefox as the default browser.
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
 
-      const nsString &flatValue = PromiseFlatString(valueData);
       res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
-                             (const BYTE *) flatValue.get(),
-                             (flatValue.Length() + 1) * sizeof(char16_t));
+                             (const BYTE *) valueData.get(),
+                             (valueData.Length() + 1) * sizeof(char16_t));
       // Close the key that was created.
       ::RegCloseKey(theKey);
       if (REG_FAILED(res)) {
         // If updating the open command fails try to update it using the helper
         // application when setting Firefox as the default browser.
         *aIsDefaultBrowser = false;
         return NS_OK;
       }
@@ -524,19 +524,18 @@ nsWindowsShellService::IsDefaultBrowser(
       DWORD len = sizeof currValue;
       res = ::RegQueryValueExW(theKey, L"", nullptr, nullptr,
                                (LPBYTE)currValue, &len);
       // Close the key that was opened.
       ::RegCloseKey(theKey);
       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.
-        const nsString &flatName = PromiseFlatString(keyName);
-        ::SHDeleteKeyW(HKEY_CURRENT_USER, flatName.get());
-        res = ::RegCreateKeyExW(HKEY_CURRENT_USER, flatName.get(), 0, nullptr,
+        ::SHDeleteKeyW(HKEY_CURRENT_USER, keyName.get());
+        res = ::RegCreateKeyExW(HKEY_CURRENT_USER, keyName.get(), 0, nullptr,
                                 REG_OPTION_NON_VOLATILE, KEY_SET_VALUE,
                                 nullptr, &theKey, nullptr);
         if (REG_FAILED(res)) {
           // If disabling DDE fails try to disable it using the helper
           // application when setting Firefox as the default browser.
           *aIsDefaultBrowser = false;
           return NS_OK;
         }
@@ -578,20 +577,19 @@ nsWindowsShellService::IsDefaultBrowser(
     if (REG_FAILED(res) ||
         _wcsicmp(oldValueOpen.get(), currValue)) {
       ::RegCloseKey(theKey);
       return NS_OK;
     }
 
     NS_ConvertUTF8toUTF16 valueData(VAL_OPEN);
     valueData.Replace(offset, 9, appLongPath);
-    const nsString &flatValue = PromiseFlatString(valueData);
     res = ::RegSetValueExW(theKey, L"", 0, REG_SZ,
-                           (const BYTE *) flatValue.get(),
-                           (flatValue.Length() + 1) * sizeof(char16_t));
+                           (const BYTE *) valueData.get(),
+                           (valueData.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
     // update it using the helper application when setting Firefox as the
     // default browser.
     if (REG_FAILED(res)) {
       *aIsDefaultBrowser = false;
     }
--- a/browser/components/shell/nsWindowsShellService.h
+++ b/browser/components/shell/nsWindowsShellService.h
@@ -2,17 +2,17 @@
 /* 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 nswindowsshellservice_h____
 #define nswindowsshellservice_h____
 
 #include "nscore.h"
-#include "nsStringAPI.h"
+#include "nsString.h"
 #include "nsIWindowsShellService.h"
 #include "nsITimer.h"
 
 #include <windows.h>
 #include <ole2.h>
 
 class nsWindowsShellService : public nsIWindowsShellService
 {
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -144,17 +144,16 @@
 
 ; [Components]
 #ifdef MOZ_ARTIFACT_BUILDS
 @RESPATH@/components/prebuilt-interfaces.manifest
 @RESPATH@/components/interfaces.xpt
 @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
 @BINPATH@/Accessible.tlb
 @BINPATH@/AccessibleMarshal.dll
 @BINPATH@/IA2Marshal.dll
 #endif
 @RESPATH@/components/accessibility.xpt
@@ -440,17 +439,16 @@
 @RESPATH@/components/ProcessSingleton.manifest
 @RESPATH@/components/MainProcessSingleton.js
 @RESPATH@/components/ContentProcessSingleton.js
 @RESPATH@/browser/components/nsSessionStore.manifest
 @RESPATH@/browser/components/nsSessionStartup.js
 @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
 @RESPATH@/components/nsLivemarkService.js
 @RESPATH@/components/nsTaggingService.js
 @RESPATH@/components/UnifiedComplete.js
 @RESPATH@/components/nsPlacesExpiration.js
 @RESPATH@/components/PageIconProtocolHandler.js
--- a/widget/gtk/mozgtk/mozgtk.c
+++ b/widget/gtk/mozgtk/mozgtk.c
@@ -4,16 +4,17 @@
 #define STUB(symbol) MOZ_EXPORT void symbol (void) { MOZ_CRASH(); }
 
 #ifdef COMMON_SYMBOLS
 STUB(gdk_atom_intern)
 STUB(gdk_atom_name)
 STUB(gdk_beep)
 STUB(gdk_cairo_create)
 STUB(gdk_color_free)
+STUB(gdk_color_parse)
 STUB(gdk_cursor_new_for_display)
 STUB(gdk_cursor_new_from_name)
 STUB(gdk_cursor_new_from_pixbuf)
 STUB(gdk_display_close)
 STUB(gdk_display_get_default)
 STUB(gdk_display_get_default_screen)
 STUB(gdk_display_get_pointer)
 STUB(gdk_display_get_window_at_pointer)