Merge inbound to mozilla-central a=merge
authorarthur.iakab <aiakab@mozilla.com>
Sun, 03 Feb 2019 11:51:35 +0200
changeset 456582 1b713c9f40d5817de78f88ac3414cc90bf7531f4
parent 456581 12b2328eedd1c1d8863a4ee2c18591eaf2a522dd (current diff)
parent 456562 a2168937e103c506b88a3486e21f0739a673e358 (diff)
child 456583 55bcbbc351541e7b942a958b2eb58156d670808b
child 456588 a9e0cc55d71ad830d58994bc994b7aba1df69ac6
push id111660
push useraiakab@mozilla.com
push dateSun, 03 Feb 2019 09:55:50 +0000
treeherdermozilla-inbound@1b713c9f40d5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmerge
milestone67.0a1
first release with
nightly linux32
1b713c9f40d5 / 67.0a1 / 20190203095148 / files
nightly linux64
1b713c9f40d5 / 67.0a1 / 20190203095148 / files
nightly mac
1b713c9f40d5 / 67.0a1 / 20190203095148 / files
nightly win32
1b713c9f40d5 / 67.0a1 / 20190203095148 / files
nightly win64
1b713c9f40d5 / 67.0a1 / 20190203095148 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge inbound to mozilla-central a=merge
layout/base/nsPresContext.cpp
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -783,16 +783,19 @@ nsresult nsPresContext::Init(nsDeviceCon
             mRefreshDriver = parent->GetPresContext()->RefreshDriver();
           }
         }
       }
     }
 
     if (!mRefreshDriver) {
       mRefreshDriver = new nsRefreshDriver(this);
+      if (XRE_IsContentProcess()) {
+        mRefreshDriver->InitializeTimer();
+      }
     }
   }
 
   // Register callbacks so we're notified when the preferences change
   Preferences::RegisterPrefixCallbacks(
       PREF_CHANGE_METHOD(nsPresContext::PreferenceChanged),
       gPrefixCallbackPrefs, this);
   Preferences::RegisterCallbacks(
--- a/layout/base/nsRefreshDriver.h
+++ b/layout/base/nsRefreshDriver.h
@@ -419,16 +419,22 @@ class nsRefreshDriver final : public moz
                                             uint32_t aDelay);
   static void CancelIdleRunnable(nsIRunnable* aRunnable);
 
   void NotifyDOMContentLoaded();
 
   // Schedule a refresh so that any delayed events will run soon.
   void RunDelayedEventsSoon();
 
+  void InitializeTimer()
+  {
+    MOZ_ASSERT(!mActiveTimer);
+    EnsureTimerStarted();
+  }
+
  private:
   typedef nsTObserverArray<nsARefreshObserver*> ObserverArray;
   typedef nsTArray<RefPtr<VVPResizeEvent>> VisualViewportResizeEventArray;
   typedef nsTArray<RefPtr<mozilla::Runnable>> ScrollEventArray;
   typedef nsTArray<RefPtr<VVPScrollEvent>> VisualViewportScrollEventArray;
   typedef nsTHashtable<nsISupportsHashKey> RequestTable;
   struct ImageStartData {
     ImageStartData() {}
--- a/toolkit/xre/nsUpdateDriver.cpp
+++ b/toolkit/xre/nsUpdateDriver.cpp
@@ -631,18 +631,23 @@ static void ApplyUpdate(nsIFile *greDir,
 #if defined(XP_UNIX) && !defined(XP_MACOSX)
   // We use execv to spawn the updater process on all UNIX systems except Mac
   // OSX since it is known to cause problems on the Mac.  Windows has execv, but
   // it is a faked implementation that doesn't really replace the current
   // process. Instead it spawns a new process, so we gain nothing from using
   // execv on Windows.
   if (restart) {
     exit(execv(updaterPath.get(), argv));
-  } else {
-    *outpid = PR_CreateProcess(updaterPath.get(), argv, nullptr, nullptr);
+  }
+  *outpid = fork();
+  if (*outpid == -1) {
+    delete[] argv;
+    return;
+  } else if (*outpid == 0) {
+    exit(execv(updaterPath.get(), argv));
   }
   delete[] argv;
 #elif defined(XP_WIN)
   if (isStaged) {
     // Launch the updater to replace the installation with the staged updated.
     if (!WinLaunchChild(updaterPathW.get(), argc, argv)) {
       delete[] argv;
       return;
@@ -697,16 +702,35 @@ static bool ProcessHasTerminated(Process
   if (WaitForSingleObject(pt, 1000)) {
     return false;
   }
   CloseHandle(pt);
   return true;
 #elif defined(XP_MACOSX)
   // We're waiting for the process to terminate in LaunchChildMac.
   return true;
+#elif defined(XP_UNIX)
+  int exitStatus;
+  pid_t exited = waitpid(pt, &exitStatus, WNOHANG);
+  if (exited == 0) {
+    // Process is still running.
+    sleep(1);
+    return false;
+  }
+  if (exited == -1) {
+    LOG(("Error while checking if the updater process is finished"));
+    // This shouldn't happen, but if it does, the updater process is lost to us,
+    // so the best we can do is pretend that it's exited.
+    return true;
+  }
+  // If we get here, the process has exited; make sure it exited normally.
+  if (WIFEXITED(exitStatus) && (WEXITSTATUS(exitStatus) != 0)) {
+    LOG(("Error while running the updater process, check update.log"));
+  }
+  return true;
 #else
   // No way to have a non-blocking implementation on these platforms,
   // because we're using NSPR and it only provides a blocking wait.
   int32_t exitCode;
   PR_WaitProcess(pt, &exitCode);
   if (exitCode != 0) {
     LOG(("Error while running the updater process, check update.log"));
   }
--- a/toolkit/xre/nsUpdateDriver.h
+++ b/toolkit/xre/nsUpdateDriver.h
@@ -14,17 +14,17 @@
 #include "nsString.h"
 #include "mozilla/Attributes.h"
 
 class nsIFile;
 
 #if defined(XP_WIN)
 #  include <windows.h>
 typedef HANDLE ProcessType;
-#elif defined(XP_MACOSX)
+#elif defined(XP_UNIX)
 typedef pid_t ProcessType;
 #else
 #  include "prproces.h"
 typedef PRProcess *ProcessType;
 #endif
 
 /**
  * This function processes any available updates.  As part of that process, it