Backed out 6 changesets (bug 1439875) for failing mochitest clipboard at browser/components/customizableui/test/browser_editcontrols_update.js and mochitest headless at dom/events/test/pointerevents/test_bug1414336.html on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Tue, 13 Mar 2018 18:37:16 +0200
changeset 461506 01685f397a53f847ed31a75d7674edd42bba5b4b
parent 461505 fc923e676ed2529270ea6871320fc3b04bab6234
child 461507 9f3705faaa8ca660cf75f87fa4180e773212ecdc
push id9165
push userasasaki@mozilla.com
push dateThu, 26 Apr 2018 21:04:54 +0000
treeherdermozilla-beta@064c3804de2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1439875, 1414336
milestone61.0a1
backs outf21bdb9b67e8c34c189b840421c2d4528b421811
bd81fafecd9520d7e3b91f513fe1dafd7f8b702b
3296aef962768e12136dbd2d3e4c564662ba4735
a1237d0711a2d8eeb9aba92b5ef88a0cc4b951df
fc25cbe8e22e3913e70a149babc852a2dce26318
25e681a47121958efdb098761e654aaedb763cf0
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
Backed out 6 changesets (bug 1439875) for failing mochitest clipboard at browser/components/customizableui/test/browser_editcontrols_update.js and mochitest headless at dom/events/test/pointerevents/test_bug1414336.html on a CLOSED TREE Backed out changeset f21bdb9b67e8 (bug 1439875) Backed out changeset bd81fafecd95 (bug 1439875) Backed out changeset 3296aef96276 (bug 1439875) Backed out changeset a1237d0711a2 (bug 1439875) Backed out changeset fc25cbe8e22e (bug 1439875) Backed out changeset 25e681a47121 (bug 1439875)
browser/base/content/browser.js
browser/base/content/test/performance/browser_startup_flicker.js
browser/base/content/test/performance/browser_startup_images.js
browser/base/content/test/performance/browser_windowopen_flicker.js
browser/base/content/test/performance/browser_windowopen_reflows.js
browser/components/extensions/ext-windows.js
browser/components/extensions/test/browser/browser_ext_windows_create.js
dom/xul/XULDocument.cpp
xpfe/appshell/nsIXULWindow.idl
xpfe/appshell/nsXULWindow.cpp
xpfe/appshell/nsXULWindow.h
--- a/browser/base/content/browser.js
+++ b/browser/base/content/browser.js
@@ -1189,53 +1189,29 @@ function RedirectLoad({ target: browser,
       }
     };
     Services.obs.addObserver(delayedStartupFinished,
                              "browser-delayed-startup-finished");
   }
 }
 
 if (document.documentElement.getAttribute("windowtype") == "navigator:browser") {
-  document.addEventListener("MozBeforeInitialXULLayout", function() {
-    gBrowserInit.onBeforeInitialXULLayout();
-  }, { once: true });
-  document.addEventListener("DOMContentLoaded", function() {
+  addEventListener("DOMContentLoaded", function() {
     gBrowserInit.onDOMContentLoaded();
   }, { once: true });
 }
 
 let _resolveDelayedStartup;
 var delayedStartupPromise = new Promise(resolve => {
   _resolveDelayedStartup = resolve;
 });
 
 var gBrowserInit = {
   delayedStartupFinished: false,
 
-  onBeforeInitialXULLayout() {
-    // Set a sane starting width/height for all resolutions on new profiles.
-    if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
-      // When the fingerprinting resistance is enabled, making sure that we don't
-      // have a maximum window to interfere with generating rounded window dimensions.
-      document.documentElement.setAttribute("sizemode", "normal");
-    } else if (!document.documentElement.hasAttribute("width")) {
-      const TARGET_WIDTH = 1280;
-      const TARGET_HEIGHT = 1040;
-      let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
-      let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
-
-      document.documentElement.setAttribute("width", width);
-      document.documentElement.setAttribute("height", height);
-
-      if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
-        document.documentElement.setAttribute("sizemode", "maximized");
-      }
-    }
-  },
-
   onDOMContentLoaded() {
     window.QueryInterface(Ci.nsIInterfaceRequestor)
           .getInterface(nsIWebNavigation)
           .QueryInterface(Ci.nsIDocShellTreeItem).treeOwner
           .QueryInterface(Ci.nsIInterfaceRequestor)
           .getInterface(Ci.nsIXULWindow)
           .XULBrowserWindow = window.XULBrowserWindow;
     window.QueryInterface(Ci.nsIDOMChromeWindow).browserDOMWindow =
@@ -1265,16 +1241,35 @@ var gBrowserInit = {
       if (linkedBrowser) {
         remoteType = linkedBrowser.remoteType;
         isRemote = remoteType != E10SUtils.NOT_REMOTE;
         sameProcessAsFrameLoader = linkedBrowser.frameLoader;
       }
       initBrowser.removeAttribute("blank");
     }
 
+    // Set a sane starting width/height for all resolutions on new profiles.
+    if (Services.prefs.getBoolPref("privacy.resistFingerprinting")) {
+      // When the fingerprinting resistance is enabled, making sure that we don't
+      // have a maximum window to interfere with generating rounded window dimensions.
+      document.documentElement.setAttribute("sizemode", "normal");
+    } else if (!document.documentElement.hasAttribute("width")) {
+      const TARGET_WIDTH = 1280;
+      const TARGET_HEIGHT = 1040;
+      let width = Math.min(screen.availWidth * .9, TARGET_WIDTH);
+      let height = Math.min(screen.availHeight * .9, TARGET_HEIGHT);
+
+      document.documentElement.setAttribute("width", width);
+      document.documentElement.setAttribute("height", height);
+
+      if (width < TARGET_WIDTH && height < TARGET_HEIGHT) {
+        document.documentElement.setAttribute("sizemode", "maximized");
+      }
+    }
+
     gBrowser.updateBrowserRemoteness(initBrowser, isRemote, {
       remoteType, sameProcessAsFrameLoader
     });
 
     gUIDensity.init();
 
     if (AppConstants.CAN_DRAW_IN_TITLEBAR) {
       gDragSpaceObserver.init();
--- a/browser/base/content/test/performance/browser_startup_flicker.js
+++ b/browser/base/content/test/performance/browser_startup_flicker.js
@@ -17,26 +17,26 @@ add_task(async function() {
   let frames = Cu.cloneInto(startupRecorder.data.frames, {});
 
   let unexpectedRects = 0;
   let alreadyFocused = false;
   for (let i = 1; i < frames.length; ++i) {
     let frame = frames[i], previousFrame = frames[i - 1];
     let rects = compareFrames(frame, previousFrame);
 
-    // The first screenshot we get in OSX / Windows shows an unfocused browser
-    // window for some reason. See bug 1445161.
-    //
+    // The first screenshot we get shows an unfocused browser window for some
+    // reason. This is likely due to the test harness, so we want to ignore it.
     // We'll assume the changes we are seeing are due to this focus change if
     // there are at least 5 areas that changed near the top of the screen, but
     // will only ignore this once (hence the alreadyFocused variable).
     if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
       alreadyFocused = true;
+      // This is likely an issue caused by the test harness, but log it anyway.
       todo(false,
-           "bug 1445161 - the window should be focused at first paint, " + rects.toSource());
+           "the window should be focused at first paint, " + rects.toSource());
       continue;
     }
 
     rects = rects.filter(rect => {
       let width = frame.width;
 
       let exceptions = [
         /**
--- a/browser/base/content/test/performance/browser_startup_images.js
+++ b/browser/base/content/test/performance/browser_startup_images.js
@@ -56,17 +56,16 @@ const whitelist = [
     file: "resource://gre-resources/broken-image.png",
     platforms: ["win", "macosx"],
     intermittentNotLoaded: ["win", "macosx"],
   },
 
   {
     file: "chrome://browser/skin/chevron.svg",
     platforms: ["win", "linux", "macosx"],
-    intermittentShown: ["win"],
   },
 
   {
     file: "chrome://global/skin/icons/resizer.png",
     platforms: ["win"],
   },
 
   {
--- a/browser/base/content/test/performance/browser_windowopen_flicker.js
+++ b/browser/base/content/test/performance/browser_windowopen_flicker.js
@@ -66,35 +66,27 @@ add_task(async function() {
       Services.tm.idleDispatchToMainThread(() => {
         waitForIdle(count - 1);
       });
     })();
   });
   win.removeEventListener("MozAfterPaint", afterPaintListener);
 
   let unexpectedRects = 0;
-  let alreadyFocused = false;
+  let ignoreTinyPaint = true;
   for (let i = 1; i < frames.length; ++i) {
     let frame = frames[i], previousFrame = frames[i - 1];
-    let rects = compareFrames(frame, previousFrame);
-
-    // The first screenshot we get in OSX / Windows shows an unfocused browser
-    // window for some reason. See bug 1445161.
-    //
-    // We'll assume the changes we are seeing are due to this focus change if
-    // there are at least 5 areas that changed near the top of the screen, but
-    // will only ignore this once (hence the alreadyFocused variable).
-    if (!alreadyFocused && rects.length > 5 && rects.every(r => r.y2 < 100)) {
-      alreadyFocused = true;
-      todo(false,
-           "bug 1445161 - the window should be focused at first paint, " + rects.toSource());
+    if (ignoreTinyPaint &&
+        previousFrame.width == 1 && previousFrame.height == 1) {
+      todo(false, "shouldn't initially paint a 1x1px window");
       continue;
     }
 
-    rects = rects.filter(rect => {
+    ignoreTinyPaint = false;
+    let rects = compareFrames(frame, previousFrame).filter(rect => {
       let inRange = (val, min, max) => min <= val && val <= max;
       let width = frame.width;
 
       let exceptions = [
         {name: "bug 1421463 - reload toolbar icon shouldn't flicker",
          condition: r => r.h == 13 && inRange(r.w, 14, 16) && // icon size
                          inRange(r.y1, 40, 80) && // in the toolbar
                          // near the left side of the screen
--- a/browser/base/content/test/performance/browser_windowopen_reflows.js
+++ b/browser/base/content/test/performance/browser_windowopen_reflows.js
@@ -57,15 +57,19 @@ add_task(async function() {
   // opened in previous tests.
   Services.obs.notifyObservers(null, "startupcache-invalidate");
   Services.obs.notifyObservers(null, "chrome-flush-skin-caches");
   Services.obs.notifyObservers(null, "chrome-flush-caches");
 
   let win = OpenBrowserWindow();
 
   await withReflowObserver(async function() {
-    await TestUtils.topicObserved("browser-delayed-startup-finished",
-                                  subject => subject == win);
+    let resizeEvent = BrowserTestUtils.waitForEvent(win, "resize");
+    let delayedStartup =
+      TestUtils.topicObserved("browser-delayed-startup-finished",
+                              subject => subject == win);
+    await resizeEvent;
+    await delayedStartup;
   }, EXPECTED_REFLOWS, win);
 
   await BrowserTestUtils.closeWindow(win);
 });
 
--- a/browser/components/extensions/ext-windows.js
+++ b/browser/components/extensions/ext-windows.js
@@ -175,20 +175,24 @@ this.windows = class extends ExtensionAP
 
           let win = windowManager.getWrapper(window);
           win.updateGeometry(createData);
 
           // TODO: focused, type
 
           return new Promise(resolve => {
             window.addEventListener("load", function() {
+              if (["maximized", "normal"].includes(createData.state)) {
+                window.document.documentElement.setAttribute("sizemode", createData.state);
+              }
               resolve(promiseObserved("browser-delayed-startup-finished", win => win == window));
             }, {once: true});
           }).then(() => {
-            if (["minimized", "fullscreen", "docked", "normal", "maximized"].includes(createData.state)) {
+            // Some states only work after delayed-startup-finished
+            if (["minimized", "fullscreen", "docked"].includes(createData.state)) {
               win.state = createData.state;
             }
             if (allowScriptsToClose) {
               for (let {linkedBrowser} of window.gBrowser.tabs) {
                 onXULFrameLoaderCreated({target: linkedBrowser});
                 // eslint-disable-next-line mozilla/balanced-listeners
                 linkedBrowser.addEventListener("XULFrameLoaderCreated", onXULFrameLoaderCreated);
               }
--- a/browser/components/extensions/test/browser/browser_ext_windows_create.js
+++ b/browser/components/extensions/test/browser/browser_ext_windows_create.js
@@ -98,17 +98,17 @@ add_task(async function testWindowCreate
 
   extension.onMessage("check-window", expected => {
     if (expected.state != null) {
       let {windowState} = latestWindow;
       if (latestWindow.fullScreen) {
         windowState = latestWindow.STATE_FULLSCREEN;
       }
 
-      if (expected.state == "STATE_NORMAL") {
+      if (expected.state == "STATE_NORMAL" && AppConstants.platform == "macosx") {
         ok(windowState == window.STATE_NORMAL || windowState == window.STATE_MAXIMIZED,
            `Expected windowState (currently ${windowState}) to be STATE_NORMAL but will accept STATE_MAXIMIZED`);
       } else {
         is(windowState, window[expected.state],
            `Expected window state to be ${expected.state}`);
       }
     }
     if (expected.hiddenChrome) {
--- a/dom/xul/XULDocument.cpp
+++ b/dom/xul/XULDocument.cpp
@@ -2657,39 +2657,40 @@ XULDocument::DoneWalking()
         // the |if (!mDocumentLoaded)| check above and since
         // mInitialLayoutComplete will be false will follow the else branch
         // there too.  See the big comment there for how such reentry can
         // happen.
         mDocumentLoaded = true;
 
         NotifyPossibleTitleChange(false);
 
-        nsContentUtils::DispatchTrustedEvent(
-            this,
-            static_cast<nsIDocument*>(this),
-            NS_LITERAL_STRING("MozBeforeInitialXULLayout"),
-            true,
-            false);
-
         // Before starting layout, check whether we're a toplevel chrome
-        // window.  If we are, setup some state so that we don't have to restyle
-        // the whole tree after StartLayout.
-        if (nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell()) {
+        // window.  If we are, set our chrome flags now, so that we don't have
+        // to restyle the whole frame tree after StartLayout.
+        nsCOMPtr<nsIDocShellTreeItem> item = GetDocShell();
+        if (item) {
             nsCOMPtr<nsIDocShellTreeOwner> owner;
             item->GetTreeOwner(getter_AddRefs(owner));
-            if (nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(owner)) {
+            nsCOMPtr<nsIXULWindow> xulWin = do_GetInterface(owner);
+            if (xulWin) {
                 nsCOMPtr<nsIDocShell> xulWinShell;
                 xulWin->GetDocShell(getter_AddRefs(xulWinShell));
                 if (SameCOMIdentity(xulWinShell, item)) {
-                    // We're the chrome document!
-                    xulWin->BeforeStartLayout();
+                    // We're the chrome document!  Apply our chrome flags now.
+                    xulWin->ApplyChromeFlags();
                 }
             }
         }
 
+        nsContentUtils::DispatchTrustedEvent(this,
+                static_cast<nsIDocument*>(this),
+                NS_LITERAL_STRING("MozBeforeInitialXULLayout"),
+                true,
+                false);
+
         StartLayout();
 
         if (mIsWritingFastLoad && IsChromeURI(mDocumentURI))
             nsXULPrototypeCache::GetInstance()->WritePrototype(mMasterPrototype);
 
         NS_ASSERTION(mDelayFrameLoaderInitialization,
                      "mDelayFrameLoaderInitialization should be true!");
         mDelayFrameLoaderInitialization = false;
--- a/xpfe/appshell/nsIXULWindow.idl
+++ b/xpfe/appshell/nsIXULWindow.idl
@@ -123,24 +123,22 @@ interface nsIXULWindow : nsISupports
   nsIXULWindow createNewWindow(in int32_t aChromeFlags,
                                in nsITabParent aOpeningTab,
                                in mozIDOMWindowProxy aOpener,
                                in unsigned long long aNextTabParentId);
 
   attribute nsIXULBrowserWindow XULBrowserWindow;
 
   /**
-   * Back-door method to make sure some stuff is done when the document is
-   * ready for layout, that would cause expensive computation otherwise later.
-   *
-   * Do NOT call this unless you know what you're doing!  In particular,
+   * Back-door method to force application of chrome flags at a particular
+   * time.  Do NOT call this unless you know what you're doing!  In particular,
    * calling this when this XUL window doesn't yet have a document in its
    * docshell could cause problems.
    */
-  [noscript] void beforeStartLayout();
+  [noscript] void applyChromeFlags();
 
   /**
    * Given the dimensions of some content area held within this
    * XUL window, and assuming that that content area will change
    * its dimensions in linear proportion to the dimensions of this
    * XUL window, changes the size of the XUL window so that the
    * content area reaches a particular size.
    *
--- a/xpfe/appshell/nsXULWindow.cpp
+++ b/xpfe/appshell/nsXULWindow.cpp
@@ -269,19 +269,18 @@ NS_IMETHODIMP nsXULWindow::GetChromeFlag
 }
 
 NS_IMETHODIMP nsXULWindow::SetChromeFlags(uint32_t aChromeFlags)
 {
   NS_ASSERTION(!mChromeFlagsFrozen,
                "SetChromeFlags() after AssumeChromeFlagsAreFrozen()!");
 
   mChromeFlags = aChromeFlags;
-  if (mChromeLoaded) {
-    ApplyChromeFlags();
-  }
+  if (mChromeLoaded)
+    NS_ENSURE_SUCCESS(ApplyChromeFlags(), NS_ERROR_FAILURE);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::AssumeChromeFlagsAreFrozen()
 {
   mChromeFlagsFrozen = true;
   return NS_OK;
 }
@@ -1079,17 +1078,92 @@ GetWindowOuterInnerDiff(nsIWidget* aWind
 void nsXULWindow::OnChromeLoaded()
 {
   nsresult rv = EnsureContentTreeOwner();
 
   if (NS_SUCCEEDED(rv)) {
     mChromeLoaded = true;
     ApplyChromeFlags();
     SyncAttributesToWidget();
-    SizeShell();
+
+    int32_t specWidth = -1, specHeight = -1;
+    bool gotSize = false;
+    bool isContent = false;
+
+    GetHasPrimaryContent(&isContent);
+
+    CSSIntSize windowDiff = mWindow
+      ? RoundedToInt(GetWindowOuterInnerDiff(mWindow) /
+                     mWindow->GetDefaultScale())
+      : CSSIntSize();
+
+    // If this window has a primary content and fingerprinting resistance is
+    // enabled, we enforce this window to rounded dimensions.
+    if (isContent && nsContentUtils::ShouldResistFingerprinting()) {
+      ForceRoundedDimensions();
+    } else if (!mIgnoreXULSize) {
+      gotSize = LoadSizeFromXUL(specWidth, specHeight);
+      specWidth += windowDiff.width;
+      specHeight += windowDiff.height;
+    }
+
+    bool positionSet = !mIgnoreXULPosition;
+    nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
+#if defined(XP_UNIX) && !defined(XP_MACOSX)
+    // don't override WM placement on unix for independent, top-level windows
+    // (however, we think the benefits of intelligent dependent window placement
+    // trump that override.)
+    if (!parentWindow)
+      positionSet = false;
+#endif
+    if (positionSet) {
+      // We have to do this before sizing the window, because sizing depends
+      // on the resolution of the screen we're on. But positioning needs to
+      // know the size so that it can constrain to screen bounds.... as an
+      // initial guess here, we'll use the specified size (if any).
+      positionSet = LoadPositionFromXUL(specWidth, specHeight);
+    }
+
+    if (gotSize) {
+      SetSpecifiedSize(specWidth, specHeight);
+    }
+
+    if (mIntrinsicallySized) {
+      // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
+      nsCOMPtr<nsIContentViewer> cv;
+      mDocShell->GetContentViewer(getter_AddRefs(cv));
+      if (cv) {
+        nsCOMPtr<nsIDocShellTreeItem> docShellAsItem = do_QueryInterface(mDocShell);
+        nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
+        docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
+        if (treeOwner) {
+          // GetContentSize can fail, so initialise |width| and |height| to be
+          // on the safe side.
+          int32_t width = 0, height = 0;
+          if (NS_SUCCEEDED(cv->GetContentSize(&width, &height))) {
+            treeOwner->SizeShellTo(docShellAsItem, width, height);
+            // Update specified size for the final LoadPositionFromXUL call.
+            specWidth = width + windowDiff.width;
+            specHeight = height + windowDiff.height;
+          }
+        }
+      }
+    }
+
+    // Now that we have set the window's final size, we can re-do its
+    // positioning so that it is properly constrained to the screen.
+    if (positionSet) {
+      LoadPositionFromXUL(specWidth, specHeight);
+    }
+
+    LoadMiscPersistentAttributesFromXUL();
+
+    if (mCenterAfterLoad && !positionSet) {
+      Center(parentWindow, parentWindow ? false : true, false);
+    }
 
     if (mShowAfterLoad) {
       SetVisibility(true);
       // At this point the window may have been closed during Show(), so
       // nsXULWindow::Destroy may already have been called. Take care!
     }
   }
   mPersistentAttributesMask |= PAD_POSITION | PAD_SIZE | PAD_MISC;
@@ -2183,23 +2257,20 @@ bool nsXULWindow::GetContentScrollbarVis
 }
 
 // during spinup, attributes that haven't been loaded yet can't be dirty
 void nsXULWindow::PersistentAttributesDirty(uint32_t aDirtyFlags)
 {
   mPersistentAttributesDirty |= aDirtyFlags & mPersistentAttributesMask;
 }
 
-void
-nsXULWindow::ApplyChromeFlags()
+NS_IMETHODIMP nsXULWindow::ApplyChromeFlags()
 {
   nsCOMPtr<dom::Element> window = GetWindowDOMElement();
-  if (!window) {
-    return;
-  }
+  NS_ENSURE_TRUE(window, NS_ERROR_FAILURE);
 
   if (mChromeLoaded) {
     // The two calls in this block don't need to happen early because they
     // don't cause a global restyle on the document.  Not only that, but the
     // scrollbar stuff needs a content area to toggle the scrollbars on anyway.
     // So just don't do these until mChromeLoaded is true.
 
     // Scrollbars have their own special treatment.
@@ -2228,107 +2299,20 @@ nsXULWindow::ApplyChromeFlags()
   if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_STATUSBAR))
     newvalue.AppendLiteral("status ");
 
   if (! (mChromeFlags & nsIWebBrowserChrome::CHROME_EXTRA))
     newvalue.AppendLiteral("extrachrome ");
 
   // Note that if we're not actually changing the value this will be a no-op,
   // so no need to compare to the old value.
-  IgnoredErrorResult rv;
+  ErrorResult rv;
   window->SetAttribute(NS_LITERAL_STRING("chromehidden"), newvalue, rv);
-}
-
-NS_IMETHODIMP
-nsXULWindow::BeforeStartLayout()
-{
-  ApplyChromeFlags();
-  SyncAttributesToWidget();
-  SizeShell();
-  return NS_OK;
-}
-
-void
-nsXULWindow::SizeShell()
-{
-  int32_t specWidth = -1, specHeight = -1;
-  bool gotSize = false;
-  bool isContent = false;
-
-  GetHasPrimaryContent(&isContent);
-
-  CSSIntSize windowDiff = mWindow
-    ? RoundedToInt(GetWindowOuterInnerDiff(mWindow) /
-                   mWindow->GetDefaultScale())
-    : CSSIntSize();
-
-  // If this window has a primary content and fingerprinting resistance is
-  // enabled, we enforce this window to rounded dimensions.
-  if (isContent && nsContentUtils::ShouldResistFingerprinting()) {
-    ForceRoundedDimensions();
-  } else if (!mIgnoreXULSize) {
-    gotSize = LoadSizeFromXUL(specWidth, specHeight);
-    specWidth += windowDiff.width;
-    specHeight += windowDiff.height;
-  }
 
-  bool positionSet = !mIgnoreXULPosition;
-  nsCOMPtr<nsIXULWindow> parentWindow(do_QueryReferent(mParentWindow));
-#if defined(XP_UNIX) && !defined(XP_MACOSX)
-  // don't override WM placement on unix for independent, top-level windows
-  // (however, we think the benefits of intelligent dependent window placement
-  // trump that override.)
-  if (!parentWindow)
-    positionSet = false;
-#endif
-  if (positionSet) {
-    // We have to do this before sizing the window, because sizing depends
-    // on the resolution of the screen we're on. But positioning needs to
-    // know the size so that it can constrain to screen bounds.... as an
-    // initial guess here, we'll use the specified size (if any).
-    positionSet = LoadPositionFromXUL(specWidth, specHeight);
-  }
-
-  if (gotSize) {
-    SetSpecifiedSize(specWidth, specHeight);
-  }
-
-  if (mIntrinsicallySized) {
-    // (if LoadSizeFromXUL set the size, mIntrinsicallySized will be false)
-    nsCOMPtr<nsIContentViewer> cv;
-    mDocShell->GetContentViewer(getter_AddRefs(cv));
-    if (cv) {
-      nsCOMPtr<nsIDocShellTreeItem> docShellAsItem = do_QueryInterface(mDocShell);
-      nsCOMPtr<nsIDocShellTreeOwner> treeOwner;
-      docShellAsItem->GetTreeOwner(getter_AddRefs(treeOwner));
-      if (treeOwner) {
-        // GetContentSize can fail, so initialise |width| and |height| to be
-        // on the safe side.
-        int32_t width = 0, height = 0;
-        if (NS_SUCCEEDED(cv->GetContentSize(&width, &height))) {
-          treeOwner->SizeShellTo(docShellAsItem, width, height);
-          // Update specified size for the final LoadPositionFromXUL call.
-          specWidth = width + windowDiff.width;
-          specHeight = height + windowDiff.height;
-        }
-      }
-    }
-  }
-
-  // Now that we have set the window's final size, we can re-do its
-  // positioning so that it is properly constrained to the screen.
-  if (positionSet) {
-    LoadPositionFromXUL(specWidth, specHeight);
-  }
-
-  LoadMiscPersistentAttributesFromXUL();
-
-  if (mChromeLoaded && mCenterAfterLoad && !positionSet) {
-    Center(parentWindow, parentWindow ? false : true, false);
-  }
+  return NS_OK;
 }
 
 NS_IMETHODIMP nsXULWindow::GetXULBrowserWindow(nsIXULBrowserWindow * *aXULBrowserWindow)
 {
   NS_IF_ADDREF(*aXULBrowserWindow = mXULBrowserWindow);
   return NS_OK;
 }
 
--- a/xpfe/appshell/nsXULWindow.h
+++ b/xpfe/appshell/nsXULWindow.h
@@ -88,18 +88,16 @@ protected:
    NS_IMETHOD EnsureChromeTreeOwner();
    NS_IMETHOD EnsureContentTreeOwner();
    NS_IMETHOD EnsurePrimaryContentTreeOwner();
    NS_IMETHOD EnsurePrompter();
    NS_IMETHOD EnsureAuthPrompter();
    NS_IMETHOD ForceRoundedDimensions();
    NS_IMETHOD GetAvailScreenSize(int32_t* aAvailWidth, int32_t* aAvailHeight);
 
-   void ApplyChromeFlags();
-   void SizeShell();
    void OnChromeLoaded();
    void StaggerPosition(int32_t &aRequestedX, int32_t &aRequestedY,
                         int32_t aSpecWidth, int32_t aSpecHeight);
    bool       LoadPositionFromXUL(int32_t aSpecWidth, int32_t aSpecHeight);
    bool       LoadSizeFromXUL(int32_t& aSpecWidth, int32_t& aSpecHeight);
    void       SetSpecifiedSize(int32_t aSpecWidth, int32_t aSpecHeight);
    bool       LoadMiscPersistentAttributesFromXUL();
    void       SyncAttributesToWidget();