Backout changesets 8e9aea2febed, 604544452285 and 9f150c4e1a48 because of Mac OS X 32-bit reftest orange
authorEhsan Akhgari <ehsan@mozilla.com>
Thu, 08 Sep 2011 11:30:22 -0400
changeset 76734 f4e1e9d38bc0b80983ca2fecd0c20f45360308b7
parent 76733 2b84c0ca82b620ffeef59dd0aac52303bb785c71
child 76735 0907fce1e6fcfc545933a2f71471f19a04050dad
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone9.0a1
backs out8e9aea2febedf77752562fd7ab21ddccfae022ea
604544452285ebe690bf00ce554c507de16db608
9f150c4e1a48ead55879da80826709267909dff8
Backout changesets 8e9aea2febed, 604544452285 and 9f150c4e1a48 because of Mac OS X 32-bit reftest orange
browser/components/sessionstore/src/nsSessionStore.js
browser/components/sessionstore/test/browser/Makefile.in
browser/components/sessionstore/test/browser/browser_665702-state_session.js
content/media/nsAudioStream.cpp
layout/base/nsDocumentViewer.cpp
toolkit/components/alerts/resources/content/alert.js
--- a/browser/components/sessionstore/src/nsSessionStore.js
+++ b/browser/components/sessionstore/src/nsSessionStore.js
@@ -2476,29 +2476,17 @@ SessionStoreService.prototype = {
       this.activeWindowSSiCache = activeWindow.__SSi || "";
     }
     ix = windows.indexOf(this.activeWindowSSiCache);
     // We don't want to restore focus to a minimized window or a window which had all its
     // tabs stripped out (doesn't exist).
     if (ix != -1 && total[ix] && total[ix].sizemode == "minimized")
       ix = -1;
 
-    let session = {
-      state: this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR,
-      lastUpdate: Date.now(),
-      startTime: this._sessionStartTime,
-      recentCrashes: this._recentCrashes
-    };
-
-    return {
-      windows: total,
-      selectedWindow: ix + 1,
-      _closedWindows: lastClosedWindowsCopy,
-      session: session
-    };
+    return { windows: total, selectedWindow: ix + 1, _closedWindows: lastClosedWindowsCopy };
   },
 
   /**
    * serialize session data for a window 
    * @param aWindow
    *        Window reference
    * @returns string
    */
@@ -3533,16 +3521,24 @@ SessionStoreService.prototype = {
         this._resume_session_once_on_shutdown =
           this._prefBranch.getBoolPref("sessionstore.resume_session_once");
         this._prefBranch.setBoolPref("sessionstore.resume_session_once", true);
         // flush the preference file so preference will be saved in case of a crash
         Services.prefs.savePrefFile(null);
       }
     }
 
+    oState.session = {
+      state: this._loadState == STATE_RUNNING ? STATE_RUNNING_STR : STATE_STOPPED_STR,
+      lastUpdate: Date.now(),
+      startTime: this._sessionStartTime
+    };
+    if (this._recentCrashes)
+      oState.session.recentCrashes = this._recentCrashes;
+
     // Persist the last session if we deferred restoring it
     if (this._lastSessionState)
       oState.lastSessionState = this._lastSessionState;
 
     this._saveStateObject(oState);
   },
 
   /**
--- a/browser/components/sessionstore/test/browser/Makefile.in
+++ b/browser/components/sessionstore/test/browser/Makefile.in
@@ -147,17 +147,16 @@ include $(topsrcdir)/config/rules.mk
 	browser_624727.js \
 	browser_625257.js \
 	browser_628270.js \
 	browser_635418.js \
 	browser_636279.js \
 	browser_645428.js \
 	browser_659591.js \
 	browser_662812.js \
-	browser_665702-state_session.js \
 	$(NULL)
 
 ifneq ($(OS_ARCH),Darwin)
 _BROWSER_TEST_FILES += \
 	browser_597071.js \
 	browser_625016.js \
 	$(NULL)
 endif
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser/browser_665702-state_session.js
+++ /dev/null
@@ -1,24 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
-   http://creativecommons.org/publicdomain/zero/1.0/ */
-
-function compareArray(a, b) {
-  if (a.length !== b.length) {
-    return false;
-  }
-  for (let i = 0; i < a.length; i++) {
-    if (a[i] !== b[i]) {
-      return false;
-    }
-  }
-  return true;
-}
-
-function test() {
-  let currentState = JSON.parse(ss.getBrowserState());
-  ok(currentState.session, "session data returned by getBrowserState");
-
-  let keys = Object.keys(currentState.session);
-  let expectedKeys = ["state", "lastUpdate", "startTime", "recentCrashes"];
-  ok(compareArray(keys.sort(), expectedKeys.sort()),
-     "session object from getBrowserState has correct keys");
-}
--- a/content/media/nsAudioStream.cpp
+++ b/content/media/nsAudioStream.cpp
@@ -408,17 +408,17 @@ NS_IMPL_THREADSAFE_ISUPPORTS0(nsAudioStr
 
 nsresult nsAudioStreamLocal::Init(PRInt32 aNumChannels, PRInt32 aRate, SampleFormat aFormat)
 {
   mRate = aRate;
   mChannels = aNumChannels;
   mFormat = aFormat;
 
   if (sa_stream_create_pcm(reinterpret_cast<sa_stream_t**>(&mAudioHandle),
-                           "Mozilla", 
+                           NULL, 
                            SA_MODE_WRONLY, 
                            SA_PCM_FORMAT_S16_NE,
                            aRate,
                            aNumChannels) != SA_SUCCESS) {
     mAudioHandle = nsnull;
     mInError = PR_TRUE;
     PR_LOG(gAudioStreamLog, PR_LOG_ERROR, ("nsAudioStreamLocal: sa_stream_create_pcm error"));
     return NS_ERROR_FAILURE;
--- a/layout/base/nsDocumentViewer.cpp
+++ b/layout/base/nsDocumentViewer.cpp
@@ -3294,18 +3294,27 @@ NS_IMETHODIMP DocumentViewerImpl::SizeTo
                   NS_ERROR_FAILURE);
    width = presContext->AppUnitsToDevPixels(shellArea.width);
    height = presContext->AppUnitsToDevPixels(shellArea.height);
 
    nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
    docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
    NS_ENSURE_TRUE(treeOwner, NS_ERROR_FAILURE);
 
-   NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width, height),
-                     NS_ERROR_FAILURE);
+   /* presContext's size was calculated in app units and has already been
+      rounded to the equivalent pixels (so the width/height calculation
+      we just performed was probably exact, though it was based on
+      values already rounded during ResizeReflow). In a surprising
+      number of instances, this rounding makes a window which for want
+      of one extra pixel's width ends up wrapping the longest line of
+      text during actual window layout. This makes the window too short,
+      generally clipping the OK/Cancel buttons. Here we add one pixel
+      to the calculated width, to circumvent this problem. */
+   NS_ENSURE_SUCCESS(treeOwner->SizeShellTo(docShellAsItem, width+1, height),
+      NS_ERROR_FAILURE);
 
    return NS_OK;
 }
 
 
 NS_IMPL_ISUPPORTS1(nsDocViewerSelectionListener, nsISelectionListener)
 
 nsresult nsDocViewerSelectionListener::Init(DocumentViewerImpl *aDocViewer)
--- a/toolkit/components/alerts/resources/content/alert.js
+++ b/toolkit/components/alerts/resources/content/alert.js
@@ -119,16 +119,21 @@ function onAlertLoad()
       document.documentElement.pack = "end";
   }
 
   var alertBox = document.getElementById("alertBox");
   alertBox.orient = (gOrigin & NS_ALERT_HORIZONTAL) ? "vertical" : "horizontal";
 
   sizeToContent();
 
+  // Work around a bug where sizeToContent() leaves a border outside of the content
+  var contentDim = document.getElementById("alertBox").boxObject;
+  if (window.innerWidth == contentDim.width + 1)
+    --window.innerWidth;
+
   // Start with a 1px width/height, because 0 causes trouble with gtk1/2
   gCurrentSize = 1;
 
   // Determine final size
   if (gOrigin & NS_ALERT_HORIZONTAL)
   {
     gFinalSize = window.outerWidth;
     window.outerWidth = gCurrentSize;