Commit 1d7f3225 authored by Pier Angelo Vendrame's avatar Pier Angelo Vendrame 🎃 Committed by morgan
Browse files

fixup! TB 2176: Rebrand Firefox to TorBrowser

BB 44050: Use org.torproject rather than org.mozilla for D-bus.
parent 9dc8507f
Loading
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ bool nsDBusRemoteClient::GetRemoteDestinationName(const char* aProgram,
  mozilla::XREAppData::SanitizeNameForDBus(profileName);

  aDestinationName =
      nsPrintfCString("org.mozilla.%s.%s", aProgram, profileName.get());
      nsPrintfCString("org.torproject.%s.%s", aProgram, profileName.get());
  if (aDestinationName.Length() > DBUS_MAXIMUM_NAME_LENGTH)
    aDestinationName.Truncate(DBUS_MAXIMUM_NAME_LENGTH);

@@ -91,7 +91,7 @@ bool nsDBusRemoteClient::GetRemoteDestinationName(const char* aProgram,
  if (!sDBusValidateBusName(aDestinationName.get(), nullptr)) {
    // We don't have a valid busName yet - try to create a default one.
    aDestinationName =
        nsPrintfCString("org.mozilla.%s.%s", aProgram, "default");
        nsPrintfCString("org.torproject.%s.%s", aProgram, "default");
    if (!sDBusValidateBusName(aDestinationName.get(), nullptr)) {
      // We failed completelly to get a valid bus name - just quit
      // to prevent crash at dbus_bus_request_name().
@@ -122,7 +122,7 @@ nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProfile,
  }

  nsAutoCString pathName;
  pathName = nsPrintfCString("/org/mozilla/%s/Remote", appName.get());
  pathName = nsPrintfCString("/org/torproject/%s/Remote", appName.get());

  static auto sDBusValidatePathName = (bool (*)(const char*, DBusError*))dlsym(
      RTLD_DEFAULT, "dbus_validate_path");
@@ -133,7 +133,7 @@ nsresult nsDBusRemoteClient::DoSendDBusCommandLine(const char* aProfile,
  }

  nsAutoCString remoteInterfaceName;
  remoteInterfaceName = nsPrintfCString("org.mozilla.%s", appName.get());
  remoteInterfaceName = nsPrintfCString("org.torproject.%s", appName.get());

  LOG("  DBus destination: %s\n", destinationName.get());
  LOG("  DBus path: %s\n", pathName.get());
+6 −5
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@ static const char* introspect_template =
    "1.0//EN\"\n"
    "\"http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd\">\n"
    "<node>\n"
    " <interface name=\"org.mozilla.%s\">\n"
    " <interface name=\"org.torproject.%s\">\n"
    "   <method name=\"OpenURL\">\n"
    "     <arg name=\"url\" direction=\"in\" type=\"ay\"/>\n"
    "   </method>\n"
@@ -38,7 +38,7 @@ static const char* introspect_template =
bool nsDBusRemoteServer::HandleOpenURL(const gchar* aInterfaceName,
                                       const gchar* aMethodName,
                                       Span<const gchar> aParam) {
  nsPrintfCString ourInterfaceName("org.mozilla.%s", mAppName.get());
  nsPrintfCString ourInterfaceName("org.torproject.%s", mAppName.get());

  if ((strcmp("OpenURL", aMethodName) != 0) ||
      (strcmp(ourInterfaceName.get(), aInterfaceName) != 0)) {
@@ -131,7 +131,7 @@ static const GDBusInterfaceVTable gInterfaceVTable = {
    HandleMethodCall, HandleGetProperty, HandleSetProperty};

void nsDBusRemoteServer::OnBusAcquired(GDBusConnection* aConnection) {
  mPathName = nsPrintfCString("/org/mozilla/%s/Remote", mAppName.get());
  mPathName = nsPrintfCString("/org/torproject/%s/Remote", mAppName.get());
  static auto sDBusValidatePathName = (bool (*)(const char*, DBusError*))dlsym(
      RTLD_DEFAULT, "dbus_validate_path");
  if (!sDBusValidatePathName ||
@@ -205,7 +205,7 @@ nsresult nsDBusRemoteServer::Startup(const char* aAppName,

  mozilla::XREAppData::SanitizeNameForDBus(profileName);

  nsPrintfCString busName("org.mozilla.%s.%s", mAppName.get(),
  nsPrintfCString busName("org.torproject.%s.%s", mAppName.get(),
                          profileName.get());
  if (busName.Length() > DBUS_MAXIMUM_NAME_LENGTH) {
    busName.Truncate(DBUS_MAXIMUM_NAME_LENGTH);
@@ -220,7 +220,8 @@ nsresult nsDBusRemoteServer::Startup(const char* aAppName,

  // We don't have a valid busName yet - try to create a default one.
  if (!sDBusValidateBusName(busName.get(), nullptr)) {
    busName = nsPrintfCString("org.mozilla.%s.%s", mAppName.get(), "default");
    busName =
        nsPrintfCString("org.torproject.%s.%s", mAppName.get(), "default");
    if (!sDBusValidateBusName(busName.get(), nullptr)) {
      // We failed completelly to get a valid bus name - just quit
      // to prevent crash at dbus_bus_request_name().