Bug 1382099 - Remove MOZ_WIDGET_GONK from xpcom/. r=erahm.
authorNicholas Nethercote <nnethercote@mozilla.com>
Fri, 21 Jul 2017 10:45:39 +1000
changeset 418724 9100cfabc9edb9fbf800d3b6181307b9f4bf3fb7
parent 418723 ca6ed7d3d71178baf3f6430be3bab85b0ce1f09b
child 418725 5202dd1a9e218f133380a7fd4b1257d8a99f9c55
push id7566
push usermtabara@mozilla.com
push dateWed, 02 Aug 2017 08:25:16 +0000
treeherdermozilla-beta@86913f512c3c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerserahm
bugs1382099
milestone56.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1382099 - Remove MOZ_WIDGET_GONK from xpcom/. r=erahm. As well as the straightforward things, this lets us remove ReadSysFile and WriteSysFile, which in turn lets us remove TestFileUtils.cpp.
xpcom/base/nsMemoryReporterManager.cpp
xpcom/base/nsSystemInfo.cpp
xpcom/build/BinaryPath.h
xpcom/build/XPCOMInit.cpp
xpcom/glue/FileUtils.cpp
xpcom/glue/FileUtils.h
xpcom/glue/moz.build
xpcom/glue/tests/gtest/TestFileUtils.cpp
xpcom/glue/tests/gtest/moz.build
xpcom/threads/ThreadStackHelper.cpp
--- a/xpcom/base/nsMemoryReporterManager.cpp
+++ b/xpcom/base/nsMemoryReporterManager.cpp
@@ -1606,20 +1606,16 @@ nsMemoryReporterManager::nsMemoryReporte
 nsMemoryReporterManager::~nsMemoryReporterManager()
 {
   delete mStrongReporters;
   delete mWeakReporters;
   NS_ASSERTION(!mSavedStrongReporters, "failed to restore strong reporters");
   NS_ASSERTION(!mSavedWeakReporters, "failed to restore weak reporters");
 }
 
-#ifdef MOZ_WIDGET_GONK
-#define DEBUG_CHILD_PROCESS_MEMORY_REPORTING 1
-#endif
-
 #ifdef DEBUG_CHILD_PROCESS_MEMORY_REPORTING
 #define MEMORY_REPORTING_LOG(format, ...) \
   printf_stderr("++++ MEMORY REPORTING: " format, ##__VA_ARGS__);
 #else
 #define MEMORY_REPORTING_LOG(...)
 #endif
 
 NS_IMETHODIMP
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -44,22 +44,16 @@
 #include <string>
 #endif
 
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #include "mozilla/dom/ContentChild.h"
 #endif
 
-#ifdef MOZ_WIDGET_GONK
-#include <sys/system_properties.h>
-#include "mozilla/Preferences.h"
-#include "nsPrintfCString.h"
-#endif
-
 #ifdef ANDROID
 extern "C" {
 NS_EXPORT int android_sdk_version;
 }
 #endif
 
 #ifdef XP_MACOSX
 #include <sys/sysctl.h>
@@ -749,54 +743,16 @@ nsSystemInfo::Init()
       SetupAndroidInfo(info);
     }
   } else {
     GetAndroidSystemInfo(&info);
     SetupAndroidInfo(info);
   }
 #endif
 
-#ifdef MOZ_WIDGET_GONK
-  char sdk[PROP_VALUE_MAX];
-  if (__system_property_get("ro.build.version.sdk", sdk)) {
-    android_sdk_version = atoi(sdk);
-    SetPropertyAsInt32(NS_LITERAL_STRING("sdk_version"), android_sdk_version);
-
-    SetPropertyAsACString(NS_LITERAL_STRING("secondaryLibrary"),
-                          nsPrintfCString("SDK %u", android_sdk_version));
-  }
-
-  char characteristics[PROP_VALUE_MAX];
-  if (__system_property_get("ro.build.characteristics", characteristics)) {
-    if (!strcmp(characteristics, "tablet")) {
-      SetPropertyAsBool(NS_LITERAL_STRING("tablet"), true);
-    } else if (!strcmp(characteristics, "tv")) {
-      SetPropertyAsBool(NS_LITERAL_STRING("tv"), true);
-    }
-  }
-
-  nsAutoString str;
-  rv = GetPropertyAsAString(NS_LITERAL_STRING("version"), str);
-  if (NS_SUCCEEDED(rv)) {
-    SetPropertyAsAString(NS_LITERAL_STRING("kernel_version"), str);
-  }
-
-  const nsAdoptingString& b2g_os_name =
-    mozilla::Preferences::GetString("b2g.osName");
-  if (b2g_os_name) {
-    SetPropertyAsAString(NS_LITERAL_STRING("name"), b2g_os_name);
-  }
-
-  const nsAdoptingString& b2g_version =
-    mozilla::Preferences::GetString("b2g.version");
-  if (b2g_version) {
-    SetPropertyAsAString(NS_LITERAL_STRING("version"), b2g_version);
-  }
-#endif
-
 #if defined(XP_LINUX) && defined(MOZ_SANDBOX)
   SandboxInfo sandInfo = SandboxInfo::Get();
 
   SetPropertyAsBool(NS_LITERAL_STRING("hasSeccompBPF"),
                     sandInfo.Test(SandboxInfo::kHasSeccompBPF));
   SetPropertyAsBool(NS_LITERAL_STRING("hasSeccompTSync"),
                     sandInfo.Test(SandboxInfo::kHasSeccompTSync));
   SetPropertyAsBool(NS_LITERAL_STRING("hasUserNamespaces"),
--- a/xpcom/build/BinaryPath.h
+++ b/xpcom/build/BinaryPath.h
@@ -131,22 +131,16 @@ private:
   }
 
 #elif defined(ANDROID)
   static nsresult Get(const char* argv0, char aResult[MAXPATHLEN])
   {
     // On Android, we use the GRE_HOME variable that is set by the Java
     // bootstrap code.
     const char* greHome = getenv("GRE_HOME");
-#if defined(MOZ_WIDGET_GONK)
-    if (!greHome) {
-      greHome = "/system/b2g";
-    }
-#endif
-
     if (!greHome) {
       return NS_ERROR_FAILURE;
     }
 
     snprintf(aResult, MAXPATHLEN, "%s/%s", greHome, "dummy");
     aResult[MAXPATHLEN - 1] = '\0';
     return NS_OK;
   }
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -1069,23 +1069,12 @@ ShutdownXPCOM(nsIServiceManager* aServMg
 
   delete sMainHangMonitor;
   sMainHangMonitor = nullptr;
 
   BackgroundHangMonitor::Shutdown();
 
   NS_LogTerm();
 
-#if defined(MOZ_WIDGET_GONK)
-  // This _exit(0) call is intended to be temporary, to get shutdown leak
-  // checking working on non-B2G platforms.
-  // On debug B2G, the child process crashes very late.  Instead, just
-  // give up so at least we exit cleanly. See bug 1071866.
-  if (XRE_IsContentProcess()) {
-      NS_WARNING("Exiting child process early!");
-      _exit(0);
-  }
-#endif
-
   return NS_OK;
 }
 
 } // namespace mozilla
--- a/xpcom/glue/FileUtils.cpp
+++ b/xpcom/glue/FileUtils.cpp
@@ -119,110 +119,16 @@ mozilla::fallocate(PRFileDesc* aFD, int6
   }
 
   PR_Seek64(aFD, oldpos, PR_SEEK_SET);
   return nWrite == 1;
 #endif
   return false;
 }
 
-#ifdef ReadSysFile_PRESENT
-
-bool
-mozilla::ReadSysFile(
-  const char* aFilename,
-  char* aBuf,
-  size_t aBufSize)
-{
-  int fd = MOZ_TEMP_FAILURE_RETRY(open(aFilename, O_RDONLY));
-  if (fd < 0) {
-    return false;
-  }
-  ScopedClose autoClose(fd);
-  if (aBufSize == 0) {
-    return true;
-  }
-  ssize_t bytesRead;
-  size_t offset = 0;
-  do {
-    bytesRead = MOZ_TEMP_FAILURE_RETRY(read(fd, aBuf + offset,
-                                            aBufSize - offset));
-    if (bytesRead == -1) {
-      return false;
-    }
-    offset += bytesRead;
-  } while (bytesRead > 0 && offset < aBufSize);
-  MOZ_ASSERT(offset <= aBufSize);
-  if (offset > 0 && aBuf[offset - 1] == '\n') {
-    offset--;
-  }
-  if (offset == aBufSize) {
-    MOZ_ASSERT(offset > 0);
-    offset--;
-  }
-  aBuf[offset] = '\0';
-  return true;
-}
-
-bool
-mozilla::ReadSysFile(
-  const char* aFilename,
-  int* aVal)
-{
-  char valBuf[32];
-  if (!ReadSysFile(aFilename, valBuf, sizeof(valBuf))) {
-    return false;
-  }
-  return sscanf(valBuf, "%d", aVal) == 1;
-}
-
-bool
-mozilla::ReadSysFile(
-  const char* aFilename,
-  bool* aVal)
-{
-  int v;
-  if (!ReadSysFile(aFilename, &v)) {
-    return false;
-  }
-  *aVal = (v != 0);
-  return true;
-}
-
-#endif /* ReadSysFile_PRESENT */
-
-#ifdef WriteSysFile_PRESENT
-
-bool
-mozilla::WriteSysFile(
-  const char* aFilename,
-  const char* aBuf)
-{
-  size_t aBufSize = strlen(aBuf);
-  int fd = MOZ_TEMP_FAILURE_RETRY(open(aFilename, O_WRONLY));
-  if (fd < 0) {
-    return false;
-  }
-  ScopedClose autoClose(fd);
-  ssize_t bytesWritten;
-  size_t offset = 0;
-  do {
-    bytesWritten = MOZ_TEMP_FAILURE_RETRY(write(fd, aBuf + offset,
-                                                aBufSize - offset));
-    if (bytesWritten == -1) {
-      return false;
-    }
-    offset += bytesWritten;
-  } while (bytesWritten > 0 && offset < aBufSize);
-  MOZ_ASSERT(offset == aBufSize);
-  return true;
-}
-
-#endif /* WriteSysFile_PRESENT */
-
 void
 mozilla::ReadAheadLib(nsIFile* aFile)
 {
 #if defined(XP_WIN)
   nsAutoString path;
   if (!aFile || NS_FAILED(aFile->GetPath(path))) {
     return;
   }
--- a/xpcom/glue/FileUtils.h
+++ b/xpcom/glue/FileUtils.h
@@ -155,66 +155,21 @@ void ReadAheadFile(pathstr_t aFilePath, 
  * @param aFd file descriptor opened for read access
  * (on Windows, file must be opened with FILE_FLAG_SEQUENTIAL_SCAN)
  * @param aOffset Offset into the file to begin preloading
  * @param aCount Number of bytes to preload (SIZE_MAX implies file size)
  */
 void ReadAhead(filedesc_t aFd, const size_t aOffset = 0,
                const size_t aCount = SIZE_MAX);
 
-
-#if defined(MOZ_WIDGET_GONK) || defined(XP_UNIX)
+#if defined(XP_UNIX)
 #define MOZ_TEMP_FAILURE_RETRY(exp) (__extension__({ \
   typeof (exp) _rc; \
   do { \
     _rc = (exp); \
   } while (_rc == -1 && errno == EINTR); \
   _rc; \
 }))
 #endif
 
-/* Define ReadSysFile() and WriteSysFile() only on GONK to avoid unnecessary
- * libxul bloat. Also define it in debug builds, so that unit tests for it can
- * be written and run in non-GONK builds. */
-#if (defined(MOZ_WIDGET_GONK) || defined(DEBUG)) && defined(XP_UNIX)
-
-#ifndef ReadSysFile_PRESENT
-#define ReadSysFile_PRESENT
-#endif /* ReadSysFile_PRESENT */
-
-#ifndef WriteSysFile_PRESENT
-#define WriteSysFile_PRESENT
-#endif /* WriteSysFile_PRESENT */
-
-/**
- * Read the contents of a file.
- * This function is intended for reading a single-lined text files from
- * /sys/. If the file ends with a newline ('\n') then it will be discarded.
- * The output buffer will always be '\0'-terminated on successful completion.
- * If aBufSize == 0, then this function will return true if the file exists
- * and is readable (it will not attempt to read anything from it).
- * On failure the contents of aBuf after this call will be undefined and the
- * value of the global variable errno will be set accordingly.
- * @return true on success, notice that less than requested bytes could have
- * been read if the file was smaller
- */
-bool ReadSysFile(const char* aFilename, char* aBuf, size_t aBufSize);
-
-/**
- * Parse the contents of a file, assuming it contains a decimal integer.
- * @return true on success
- */
-bool ReadSysFile(const char* aFilename, int* aVal);
-
-/**
- * Parse the contents of a file, assuming it contains a boolean value
- * (either 0 or 1).
- * @return true on success
- */
-bool ReadSysFile(const char* aFilename, bool* aVal);
-
-bool WriteSysFile(const char* aFilename, const char* aBuf);
-
-#endif /* (MOZ_WIDGET_GONK || DEBUG) && XP_UNIX */
-
 } // namespace mozilla
 
 #endif
--- a/xpcom/glue/moz.build
+++ b/xpcom/glue/moz.build
@@ -11,11 +11,8 @@ DIRS += ['standalone']
 
 EXPORTS += [
     'nsStringGlue.h',
 ]
 
 EXPORTS.mozilla += [
     'FileUtils.h',
 ]
-
-if CONFIG['ENABLE_TESTS']:
-    DIRS += ['tests/gtest']
deleted file mode 100644
--- a/xpcom/glue/tests/gtest/TestFileUtils.cpp
+++ /dev/null
@@ -1,283 +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: */
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/
- */
-
-/* Test ReadSysFile() */
-
-#include <sys/types.h>
-#include <sys/stat.h>
-
-#include <errno.h>
-#include <fcntl.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "FileUtils.h"
-
-#include "gtest/gtest.h"
-
-namespace mozilla {
-
-#ifdef ReadSysFile_PRESENT
-
-/**
- * Create a file with the specified contents.
- */
-static bool
-WriteFile(
-  const char* aFilename,
-  const void* aContents,
-  size_t aContentsLen)
-{
-  int fd;
-  ssize_t ret;
-  size_t offt;
-
-  fd = MOZ_TEMP_FAILURE_RETRY(
-    open(aFilename, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR));
-  if (fd == -1) {
-    fprintf(stderr, "open(): %s: %s\n", aFilename, strerror(errno));
-    return false;
-  }
-
-  offt = 0;
-  do {
-    ret = MOZ_TEMP_FAILURE_RETRY(
-      write(fd, (char*)aContents + offt, aContentsLen - offt));
-    if (ret == -1) {
-      fprintf(stderr, "write(): %s: %s\n", aFilename, strerror(errno));
-      close(fd);
-      return false;
-    }
-    offt += ret;
-  } while (offt < aContentsLen);
-
-  ret = MOZ_TEMP_FAILURE_RETRY(close(fd));
-  if (ret == -1) {
-    fprintf(stderr, "close(): %s: %s\n", aFilename, strerror(errno));
-    return false;
-  }
-  return true;
-}
-
-TEST(ReadSysFile, Nonexistent) {
-  bool ret;
-  int errno_saved;
-
-  ret = ReadSysFile("/nonexistent", nullptr, 0);
-  errno_saved = errno;
-
-  ASSERT_FALSE(ret);
-  ASSERT_EQ(errno_saved, ENOENT);
-}
-
-TEST(ReadSysFile, Main) {
-  /* Use a different file name for each test since different tests could be
-  executed concurrently. */
-  static const char* fn = "TestReadSysFileMain";
-  /* If we have a file which contains "abcd" and we read it with ReadSysFile(),
-  providing a buffer of size 10 bytes, we would expect 5 bytes to be written
-  to that buffer: "abcd\0". */
-  struct
-  {
-    /* input (file contents), e.g. "abcd" */
-    const char* input;
-    /* pretended output buffer size, e.g. 10; the actual buffer is larger
-    and we check if anything was written past the end of the allowed length */
-    size_t output_size;
-    /* expected number of bytes written to the output buffer, including the
-    terminating '\0', e.g. 5 */
-    size_t output_len;
-    /* expected output buffer contents, e.g. "abcd\0", the first output_len
-    bytes of the output buffer should match the first 'output_len' bytes from
-    'output', the rest of the output buffer should be untouched. */
-    const char* output;
-  } tests[] = {
-    /* No new lines */
-    {"", 0, 0, ""},
-    {"", 1, 1, "\0"}, /* \0 is redundant, but we write it for clarity */
-    {"", 9, 1, "\0"},
-
-    {"a", 0, 0, ""},
-    {"a", 1, 1, "\0"},
-    {"a", 2, 2, "a\0"},
-    {"a", 9, 2, "a\0"},
-
-    {"abcd", 0, 0, ""},
-    {"abcd", 1, 1, "\0"},
-    {"abcd", 2, 2, "a\0"},
-    {"abcd", 3, 3, "ab\0"},
-    {"abcd", 4, 4, "abc\0"},
-    {"abcd", 5, 5, "abcd\0"},
-    {"abcd", 9, 5, "abcd\0"},
-
-    /* A single trailing new line */
-    {"\n", 0, 0, ""},
-    {"\n", 1, 1, "\0"},
-    {"\n", 2, 1, "\0"},
-    {"\n", 9, 1, "\0"},
-
-    {"a\n", 0, 0, ""},
-    {"a\n", 1, 1, "\0"},
-    {"a\n", 2, 2, "a\0"},
-    {"a\n", 3, 2, "a\0"},
-    {"a\n", 9, 2, "a\0"},
-
-    {"abcd\n", 0, 0, ""},
-    {"abcd\n", 1, 1, "\0"},
-    {"abcd\n", 2, 2, "a\0"},
-    {"abcd\n", 3, 3, "ab\0"},
-    {"abcd\n", 4, 4, "abc\0"},
-    {"abcd\n", 5, 5, "abcd\0"},
-    {"abcd\n", 6, 5, "abcd\0"},
-    {"abcd\n", 9, 5, "abcd\0"},
-
-    /* Multiple trailing new lines */
-    {"\n\n", 0, 0, ""},
-    {"\n\n", 1, 1, "\0"},
-    {"\n\n", 2, 2, "\n\0"},
-    {"\n\n", 3, 2, "\n\0"},
-    {"\n\n", 9, 2, "\n\0"},
-
-    {"a\n\n", 0, 0, ""},
-    {"a\n\n", 1, 1, "\0"},
-    {"a\n\n", 2, 2, "a\0"},
-    {"a\n\n", 3, 3, "a\n\0"},
-    {"a\n\n", 4, 3, "a\n\0"},
-    {"a\n\n", 9, 3, "a\n\0"},
-
-    {"abcd\n\n", 0, 0, ""},
-    {"abcd\n\n", 1, 1, "\0"},
-    {"abcd\n\n", 2, 2, "a\0"},
-    {"abcd\n\n", 3, 3, "ab\0"},
-    {"abcd\n\n", 4, 4, "abc\0"},
-    {"abcd\n\n", 5, 5, "abcd\0"},
-    {"abcd\n\n", 6, 6, "abcd\n\0"},
-    {"abcd\n\n", 7, 6, "abcd\n\0"},
-    {"abcd\n\n", 9, 6, "abcd\n\0"},
-
-    /* New line in the middle */
-    {"ab\ncd", 9, 6, "ab\ncd\0"},
-  };
-
-  for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-    ASSERT_TRUE(WriteFile(fn, tests[i].input, strlen(tests[i].input)));
-    /* Leave the file to exist if some of the assertions fail. */
-
-    char buf[128];
-    static const char unmodified = 'X';
-
-    memset(buf, unmodified, sizeof(buf));
-
-    ASSERT_TRUE(ReadSysFile(fn, buf, tests[i].output_size));
-
-    if (tests[i].output_size == 0) {
-      /* The buffer must be unmodified. We check only the first byte. */
-      ASSERT_EQ(unmodified, buf[0]);
-    } else {
-      ASSERT_EQ(tests[i].output_len, strlen(buf) + 1);
-      ASSERT_STREQ(tests[i].output, buf);
-      /* Check that the first byte after the trailing '\0' has not been
-      modified. */
-      ASSERT_EQ(unmodified, buf[tests[i].output_len]);
-    }
-  }
-
-  unlink(fn);
-}
-
-TEST(ReadSysFile, Int) {
-  static const char* fn = "TestReadSysFileInt";
-  struct
-  {
-    /* input (file contents), e.g. "5" */
-    const char* input;
-    /* expected return value, if false, then the output is not checked */
-    bool ret;
-    /* expected result */
-    int output;
-  } tests[] = {
-    {"0", true, 0},
-    {"00", true, 0},
-    {"1", true, 1},
-    {"5", true, 5},
-    {"55", true, 55},
-
-    {" 123", true, 123},
-    {"123 ", true, 123},
-    {" 123 ", true, 123},
-    {"123\n", true, 123},
-
-    {"", false, 0},
-    {" ", false, 0},
-    {"a", false, 0},
-
-    {"-1", true, -1},
-    {" -456 ", true, -456},
-    {" -78.9 ", true, -78},
-  };
-
-  for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-    ASSERT_TRUE(WriteFile(fn, tests[i].input, strlen(tests[i].input)));
-    /* Leave the file to exist if some of the assertions fail. */
-
-    bool ret;
-    int output = 424242;
-
-    ret = ReadSysFile(fn, &output);
-
-    ASSERT_EQ(tests[i].ret, ret);
-
-    if (ret) {
-      ASSERT_EQ(tests[i].output, output);
-    }
-  }
-
-  unlink(fn);
-}
-
-TEST(ReadSysFile, Bool) {
-  static const char* fn = "TestReadSysFileBool";
-  struct
-  {
-    /* input (file contents), e.g. "1" */
-    const char* input;
-    /* expected return value */
-    bool ret;
-    /* expected result */
-    bool output;
-  } tests[] = {
-    {"0", true, false},
-    {"00", true, false},
-    {"1", true, true},
-    {"5", true, true},
-    {"23", true, true},
-    {"-1", true, true},
-
-    {"", false, true /* unused */},
-  };
-
-  for (size_t i = 0; i < sizeof(tests) / sizeof(tests[0]); i++) {
-    ASSERT_TRUE(WriteFile(fn, tests[i].input, strlen(tests[i].input)));
-    /* Leave the file to exist if some of the assertions fail. */
-
-    bool ret;
-    bool output;
-
-    ret = ReadSysFile(fn, &output);
-
-    ASSERT_EQ(tests[i].ret, ret);
-
-    if (ret) {
-      ASSERT_EQ(tests[i].output, output);
-    }
-  }
-
-  unlink(fn);
-}
-
-#endif /* ReadSysFile_PRESENT */
-
-} // namespace mozilla
deleted file mode 100644
--- a/xpcom/glue/tests/gtest/moz.build
+++ /dev/null
@@ -1,18 +0,0 @@
-# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
-# vim: set filetype=python:
-# 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/.
-
-UNIFIED_SOURCES += [
-    'TestFileUtils.cpp',
-]
-
-LOCAL_INCLUDES = [
-    '../..',
-]
-
-FINAL_LIBRARY = 'xul-gtest'
-
-if CONFIG['GNU_CXX']:
-    CXXFLAGS += ['-Wno-error=shadow']
--- a/xpcom/threads/ThreadStackHelper.cpp
+++ b/xpcom/threads/ThreadStackHelper.cpp
@@ -184,26 +184,16 @@ ThreadStackHelper::GetStacksInternal(Sta
 }
 
 bool
 ThreadStackHelper::PrepareStackBuffer(Stack& aStack)
 {
   // Return false to skip getting the stack and return an empty stack
   aStack.clear();
 #ifdef MOZ_THREADSTACKHELPER_PSEUDO
-  /* Normally, provided the profiler is enabled, it would be an error if we
-     don't have a pseudostack here (the thread probably forgot to call
-     profiler_register_thread). However, on B2G, profiling secondary threads
-     may be disabled despite profiler being enabled. This is by-design and
-     is not an error. */
-#ifdef MOZ_WIDGET_GONK
-  if (!mPseudoStack) {
-    return false;
-  }
-#endif
   MOZ_ASSERT(mPseudoStack);
   if (!aStack.reserve(mMaxStackSize) ||
       !aStack.reserve(aStack.capacity()) || // reserve up to the capacity
       !aStack.EnsureBufferCapacity(mMaxBufferSize)) {
     return false;
   }
   return true;
 #else