kenz-gelsoft / gecko-dev

Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
https://firefox-source-docs.mozilla.org/setup/index.html
Other
12 stars 1 forks source link

ProcInfo_linux.cpp doesn't work #62

Open kenz-gelsoft opened 2 hours ago

kenz-gelsoft commented 2 hours ago

it utilize procfs which Haiku doesn't support

kenz-gelsoft commented 2 hours ago

ProcInfo_linux.cpp

class StatReader {
// (snip)
  // Reads the stat file and puts its content in a nsString.
  nsresult ReadFile(nsAutoString& aFileContent) {
    if (mFilepath.IsEmpty()) {
      if (mPid == 0) {
        mFilepath.AssignLiteral("/proc/self/stat");
      } else {
        mFilepath.AppendPrintf("/proc/%u/stat", unsigned(mPid));
      }

called from ProcInfo_common.cpp

RefPtr<ProcInfoPromise> GetProcInfo(nsTArray<ProcInfoRequest>&& aRequests) {
  auto holder = MakeUnique<MozPromiseHolder<ProcInfoPromise>>();
  RefPtr<ProcInfoPromise> promise = holder->Ensure(__func__);

  nsresult rv = NS_OK;
  nsCOMPtr<nsIEventTarget> target =
      do_GetService(NS_STREAMTRANSPORTSERVICE_CONTRACTID, &rv);
  if (NS_FAILED(rv)) {
    NS_WARNING("Failed to get stream transport service");
    holder->Reject(rv, __func__);
    return promise;
  }

  RefPtr<nsIRunnable> r = NS_NewRunnableFunction(
      __func__,
      [holder = std::move(holder),
       requests = std::move(aRequests)]() mutable -> void {
        holder->ResolveOrReject(GetProcInfoSync(std::move(requests)), __func__);
      });

called from JS

1   mozilla::GetProcInfo                               ProcInfo_common.cpp    18   0xdacb714 
2   mozilla::dom::ChromeUtils::RequestProcInfo         ChromeUtils.cpp        1640 0xa123ba4 
3   mozilla::dom::ChromeUtils_Binding::requestProcInfo ChromeUtilsBinding.cpp 5589 0xaf79b8f 
4   mozilla::dom::StaticMethodPromiseWrapper           BindingUtils.cpp       3307 0xb3252e2 
5   CallJSNative                                       Interpreter.cpp        481  0xddc6dde 
6   js::InternalCallOrConstruct                        Interpreter.cpp        575  0xddc64f0 
7   InternalCall                                       Interpreter.cpp        642  0xddc78b8 
8   js::CallFromStack                                  Interpreter.cpp        647  0xddd5042 
9   js::Interpret                                      Interpreter.cpp        3190 0xddd5042 
10  MaybeEnterInterpreterTrampoline                    Interpreter.cpp        395  0xddc5f36 
11  js::RunScript                                      Interpreter.cpp        453  0xddc5f36 
12  js::InternalCallOrConstruct                        Interpreter.cpp        607  0xddc650d 
13  InternalCall                                       Interpreter.cpp        642  0xddc78b8 
14  js::Call                                           Interpreter.cpp        674  0xddc7ac9 
15  js::PromiseObject::create                          Promise.cpp            2879 0xe06a7e5 
16  PromiseConstructor                                 Promise.cpp            2784 0xe069f0f 
17  CallJSNative                                       Interpreter.cpp        481  0xddc6dde 
18  CallJSNativeConstructor                            Interpreter.cpp        497  0xdded816 
19  InternalConstruct                                  Interpreter.cpp        703  0xddc8337 
20  js::ConstructFromStack                             Interpreter.cpp        750  0xddd4fe6 
...