Merge last green changeset of m-c to m-i
authorEd Morley <bmo@edmorley.co.uk>
Fri, 26 Aug 2011 10:26:46 +0100
changeset 75939 40861507b6c45809247c7ad503cb6609200b81a4
parent 75938 6eeb384db995e17790a20c7122dc66d6eab7b92f (current diff)
parent 75914 e87454393401329dd39dec6dc9526f4fc7f2c47a (diff)
child 75940 1b6030e09f9a3a8c46dd61f57b2bbb71d7f62874
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
milestone9.0a1
Merge last green changeset of m-c to m-i
browser/base/content/tabview/ui.js
browser/base/content/test/tabview/Makefile.in
content/html/content/test/test_bug345624-1.html
content/html/content/test/test_bug345624-2.html
content/html/content/test/test_bug555840.html
content/html/content/test/test_bug556007.html
content/html/content/test/test_bug595457.html
layout/generic/nsTextFrameThebes.cpp
--- a/browser/base/content/tabview/ui.js
+++ b/browser/base/content/tabview/ui.js
@@ -708,26 +708,24 @@ let UI = {
           self._privateBrowsing.wasInTabView = self.isTabViewVisible();
           if (self.isTabViewVisible())
             self.goToTab(gBrowser.selectedTab);
         }
       } else if (topic == "private-browsing-change-granted") {
         if (data == "enter" || data == "exit") {
           hideSearch();
           self._privateBrowsing.transitionMode = data;
-          self.storageBusy();
         }
       } else if (topic == "private-browsing-transition-complete") {
         // We use .transitionMode here, as aData is empty.
         if (self._privateBrowsing.transitionMode == "exit" &&
             self._privateBrowsing.wasInTabView)
           self.showTabView(false);
 
         self._privateBrowsing.transitionMode = "";
-        self.storageReady();
       }
     }
 
     Services.obs.addObserver(pbObserver, "private-browsing", false);
     Services.obs.addObserver(pbObserver, "private-browsing-change-granted", false);
     Services.obs.addObserver(pbObserver, "private-browsing-transition-complete", false);
 
     this._cleanupFunctions.push(function() {
@@ -864,18 +862,22 @@ let UI = {
 
   // ----------
   // Function: onTabSelect
   // Called when the user switches from one tab to another outside of the TabView UI.
   onTabSelect: function UI_onTabSelect(tab) {
     this._currentTab = tab;
 
     if (this.isTabViewVisible()) {
-      if (!this.restoredClosedTab && this._lastOpenedTab == tab && 
-        tab._tabViewTabItem) {
+      // We want to zoom in if:
+      // 1) we didn't just restore a tab via Ctrl+Shift+T
+      // 2) we're not in the middle of switching from/to private browsing
+      // 3) the currently selected tab is the last created tab and has a tabItem
+      if (!this.restoredClosedTab && !this._privateBrowsing.transitionMode &&
+          this._lastOpenedTab == tab && tab._tabViewTabItem) {
         tab._tabViewTabItem.zoomIn(true);
         this._lastOpenedTab = null;
         return;
       }
       if (this._closedLastVisibleTab ||
           (this._closedSelectedTabInTabView && !this.closedLastTabInTabView) ||
           this.restoredClosedTab) {
         if (this.restoredClosedTab) {
@@ -1125,28 +1127,36 @@ let UI = {
         self.ignoreKeypressForSearch = false;
         processBrowserKeys(event);
         return;
       }
 
       function getClosestTabBy(norm) {
         if (!self.getActiveTab())
           return null;
-        let centers =
-          [[item.bounds.center(), item]
-             for each(item in TabItems.getItems()) if (!item.parent || !item.parent.hidden)];
-        let myCenter = self.getActiveTab().bounds.center();
-        let matches = centers
-          .filter(function(item){return norm(item[0], myCenter)})
-          .sort(function(a,b){
-            return myCenter.distance(a[0]) - myCenter.distance(b[0]);
-          });
-        if (matches.length > 0)
-          return matches[0][1];
-        return null;
+
+        let activeTab = self.getActiveTab();
+        let activeTabGroup = activeTab.parent;
+        let myCenter = activeTab.bounds.center();
+        let match;
+
+        TabItems.getItems().forEach(function (item) {
+          if (!item.parent.hidden &&
+              (!activeTabGroup.expanded || activeTabGroup.id == item.parent.id)) {
+            let itemCenter = item.bounds.center();
+
+            if (norm(itemCenter, myCenter)) {
+              let itemDist = myCenter.distance(itemCenter);
+              if (!match || match[0] > itemDist)
+                match = [itemDist, item];
+            }
+          }
+        });
+
+        return match && match[1];
       }
 
       let preventDefault = true;
       let activeTab;
       let norm = null;
       switch (event.keyCode) {
         case KeyEvent.DOM_VK_RIGHT:
           norm = function(a, me){return a.x > me.x};
@@ -1608,21 +1618,25 @@ let UI = {
   },
 
   // ----------
   // Function: getFavIconUrlForTab
   // Gets fav icon url for the given xul:tab.
   getFavIconUrlForTab: function UI_getFavIconUrlForTab(tab) {
     let url;
 
-    // use the tab image if it doesn't start with http e.g. data:image/png, chrome://
-    if (tab.image && !(/^https?:/.test(tab.image)))
-      url = tab.image;
-    else
+    if (tab.image) {
+      // if starts with http/https, fetch icon from favicon service via the moz-anno protocal
+      if (/^https?:/.test(tab.image))
+        url = gFavIconService.getFaviconLinkForIcon(gWindow.makeURI(tab.image)).spec;
+      else
+        url = tab.image;
+    } else {
       url = gFavIconService.getFaviconImageForPage(tab.linkedBrowser.currentURI).spec;
+    }
 
     return url;
   },
 
   // ----------
   // Function: notifySessionRestoreEnabled
   // Notify the user that session restore has been automatically enabled
   // by showing a banner that expects no user interaction. It fades out after
--- a/browser/base/content/test/tabview/Makefile.in
+++ b/browser/base/content/test/tabview/Makefile.in
@@ -115,16 +115,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug626525.js \
                  browser_tabview_bug626791.js \
                  browser_tabview_bug627239.js \
                  browser_tabview_bug627288.js \
                  browser_tabview_bug627736.js \
                  browser_tabview_bug628061.js \
                  browser_tabview_bug628165.js \
                  browser_tabview_bug628270.js \
+                 browser_tabview_bug628887.js \
                  browser_tabview_bug629189.js \
                  browser_tabview_bug629195.js \
                  browser_tabview_bug630102.js \
                  browser_tabview_bug630157.js \
                  browser_tabview_bug631662.js \
                  browser_tabview_bug631752.js \
                  browser_tabview_bug633788.js \
                  browser_tabview_bug634077.js \
@@ -149,16 +150,17 @@ include $(topsrcdir)/config/rules.mk
                  browser_tabview_bug656778.js \
                  browser_tabview_bug656913.js \
                  browser_tabview_bug662266.js \
                  browser_tabview_bug663421.js \
                  browser_tabview_bug665502.js \
                  browser_tabview_bug669694.js \
                  browser_tabview_bug673196.js \
                  browser_tabview_bug673729.js \
+                 browser_tabview_bug679853.js \
                  browser_tabview_bug681599.js \
                  browser_tabview_click_group.js \
                  browser_tabview_dragdrop.js \
                  browser_tabview_exit_button.js \
                  browser_tabview_expander.js \
                  browser_tabview_firstrun_pref.js \
                  browser_tabview_group.js \
                  browser_tabview_launch.js \
--- a/browser/base/content/test/tabview/browser_tabview_bug600645.js
+++ b/browser/base/content/test/tabview/browser_tabview_bug600645.js
@@ -35,18 +35,28 @@ function onTabViewWindowLoaded() {
 
   let errorHandler = function(event) {
     newTab.removeEventListener("error", errorHandler, false);
 
     // since the browser code and test code are invoked when an error event is 
     // fired, a delay is used here to avoid the test code run before the browser 
     // code.
     executeSoon(function() {
-      is($icon.attr("src"), fi.defaultFavicon.spec,
-         "The icon is showing the default fav icon");
+      let iconSrc = $icon.attr("src");
+      let hasData = true;
+      try {
+        fi.getFaviconDataAsDataURL(iconSrc);
+      } catch(e) {
+        hasData = false;
+      }
+      ok(!hasData, "The icon src doesn't return any data");
+      // with moz-anno:favicon automatically redirects to the default favIcon 
+      // if the given url is invalid
+      ok(/^moz-anno:favicon:/.test(iconSrc),
+         "The icon url starts with moz-anno:favicon so the default fav icon would be displayed");
 
       // clean up
       gBrowser.removeTab(newTab);
       let endGame = function() {
         window.removeEventListener("tabviewhidden", endGame, false);
 
         ok(!TabView.isVisible(), "Tab View is hidden");
         finish();
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug628887.js
@@ -0,0 +1,50 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  waitForExplicitFinish();
+
+  newWindowWithTabView(function(win) {
+    registerCleanupFunction(function() win.close());
+
+    let cw = win.TabView.getContentWindow();
+    let groupItemOne = cw.GroupItems.groupItems[0];
+
+    let groupItemTwo = createGroupItemWithBlankTabs(win, 100, 100, 40, 2);
+    ok(groupItemTwo.isStacked(), "groupItem is now stacked");
+
+    is(win.gBrowser.tabs.length, 3, "There are three tabs");
+
+    // the focus should remain within the group after it's expanded
+    groupItemTwo.addSubscriber("expanded", function onExpanded() {
+      groupItemTwo.removeSubscriber("expanded", onExpanded);
+
+      ok(groupItemTwo.expanded, "groupItemTwo is expanded");
+      is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
+         "The first tab item in group item two is active in expanded mode");
+
+      EventUtils.synthesizeKey("VK_DOWN", {}, cw);
+      is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
+         "The first tab item is still active after pressing down key");
+
+      // the focus should goes to other group if the down arrow is pressed
+      groupItemTwo.addSubscriber("collapsed", function onExpanded() {
+        groupItemTwo.removeSubscriber("collapsed", onExpanded);
+
+        ok(!groupItemTwo.expanded, "groupItemTwo is not expanded");
+        is(cw.UI.getActiveTab(), groupItemTwo.getChild(0),
+           "The first tab item is active in group item two in collapsed mode");
+
+        EventUtils.synthesizeKey("VK_DOWN", {}, cw);
+        is(cw.UI.getActiveTab(), groupItemOne.getChild(0),
+           "The first tab item in group item one is active after pressing down key");
+
+        finish();
+      });
+
+      groupItemTwo.collapse();
+    });
+
+    groupItemTwo.expand();
+  });
+}
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabview/browser_tabview_bug679853.js
@@ -0,0 +1,32 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+function test() {
+  waitForExplicitFinish();
+
+  // clean up after ourselves
+  registerCleanupFunction(function () {
+    while (gBrowser.tabs.length > 1)
+      gBrowser.removeTab(gBrowser.tabs[1]);
+
+    hideTabView();
+  });
+
+  // select the new tab
+  gBrowser.selectedTab = gBrowser.addTab();
+
+  showTabView(function () {
+    // enter private browsing mode
+    togglePrivateBrowsing(function () {
+      ok(!TabView.isVisible(), "tabview is hidden");
+
+      showTabView(function () {
+        // leave private browsing mode
+        togglePrivateBrowsing(function () {
+          ok(TabView.isVisible(), "tabview is visible");
+          hideTabView(finish);
+        });
+      });
+    });
+  });
+}
--- a/configure.in
+++ b/configure.in
@@ -4792,19 +4792,17 @@ esac
 
 MOZ_ARG_ENABLE_STRING(application,
 [  --enable-application=APP
                           Options include:
                             browser (Firefox)
                             xulrunner
                             content/xslt (Standalone Transformiix XSLT)
                             netwerk (Standalone Necko)
-                            tools/update-packaging (AUS-related packaging tools)
-                            standalone (use this for standalone
-                              xpcom/xpconnect or to manually drive a build)],
+                            tools/update-packaging (AUS-related packaging tools)],
 [ MOZ_BUILD_APP=$enableval ] )
 
 MOZ_ARG_WITH_STRING(xulrunner-stub-name,
 [  --with-xulrunner-stub-name=appname   Create the xulrunner stub with the given name],
   XULRUNNER_STUB_NAME=$withval)
 
 if test -z "$XULRUNNER_STUB_NAME"; then
   case "$target_os" in
@@ -4872,22 +4870,16 @@ browser)
 xulrunner)
   AC_DEFINE(MOZ_XULRUNNER)
   ;;
 
 content/xslt)
   AC_DEFINE(TX_EXE)
   ;;
 
-standalone) 
-  MOZ_APP_NAME=mozilla
-  MOZ_APP_DISPLAYNAME=Mozilla
-  MOZ_APP_VERSION=$MOZILLA_VERSION
-  ;;
-
 esac
 
 AC_SUBST(MOZ_BUILD_APP)
 AC_SUBST(MOZ_PHOENIX)
 AC_SUBST(MOZ_XULRUNNER)
 
 AC_DEFINE_UNQUOTED(MOZ_BUILD_APP,$MOZ_BUILD_APP)
 
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1225,33 +1225,30 @@ nsXMLHttpRequest::GetResponseHeader(cons
     // Means no header
     _retval.SetIsVoid(PR_TRUE);
     rv = NS_OK;
   }
 
   return rv;
 }
 
-nsresult
-nsXMLHttpRequest::GetLoadGroup(nsILoadGroup **aLoadGroup)
+already_AddRefed<nsILoadGroup>
+nsXMLHttpRequest::GetLoadGroup() const
 {
-  NS_ENSURE_ARG_POINTER(aLoadGroup);
-  *aLoadGroup = nsnull;
-
   if (mState & XML_HTTP_REQUEST_BACKGROUND) {
-    return NS_OK;
+    return nsnull;
   }
 
   nsCOMPtr<nsIDocument> doc =
     nsContentUtils::GetDocumentFromScriptContext(mScriptContext);
   if (doc) {
-    *aLoadGroup = doc->GetDocumentLoadGroup().get();  // already_AddRefed
+    return doc->GetDocumentLoadGroup();
   }
 
-  return NS_OK;
+  return nsnull;
 }
 
 nsresult
 nsXMLHttpRequest::CreateReadystatechangeEvent(nsIDOMEvent** aDOMEvent)
 {
   nsresult rv = nsEventDispatcher::CreateEvent(nsnull, nsnull,
                                                NS_LITERAL_STRING("Events"),
                                                aDOMEvent);
@@ -1488,18 +1485,17 @@ nsXMLHttpRequest::Open(const nsACString&
     }
     uri->SetUserPass(userpass);
     authp = PR_TRUE;
   }
 
   // When we are called from JS we can find the load group for the page,
   // and add ourselves to it. This way any pending requests
   // will be automatically aborted if the user leaves the page.
-  nsCOMPtr<nsILoadGroup> loadGroup;
-  GetLoadGroup(getter_AddRefs(loadGroup));
+  nsCOMPtr<nsILoadGroup> loadGroup = GetLoadGroup();
 
   // get Content Security Policy from principal to pass into channel
   nsCOMPtr<nsIChannelPolicy> channelPolicy;
   nsCOMPtr<nsIContentSecurityPolicy> csp;
   rv = mPrincipal->GetCsp(getter_AddRefs(csp));
   NS_ENSURE_SUCCESS(rv, rv);
   if (csp) {
     channelPolicy = do_CreateInstance("@mozilla.org/nschannelpolicy;1");
@@ -1723,16 +1719,17 @@ nsXMLHttpRequest::OnStartRequest(nsIRequ
     DispatchProgressEvent(mUpload, NS_LITERAL_STRING(LOAD_STR),
                           PR_TRUE, mUploadTotal, mUploadTotal);
   }
 
   // Reset responseBody
   mResponseBody.Truncate();
   mResponseBodyUnicode.SetIsVoid(PR_TRUE);
   mResponseBlob = nsnull;
+  mResultArrayBuffer = nsnull;
 
   // Set up responseXML
   PRBool parseBody = mResponseType == XML_HTTP_RESPONSE_TYPE_DEFAULT ||
                      mResponseType == XML_HTTP_RESPONSE_TYPE_DOCUMENT;
   nsCOMPtr<nsIHttpChannel> httpChannel(do_QueryInterface(mChannel));
   if (parseBody && httpChannel) {
     nsCAutoString method;
     httpChannel->GetRequestMethod(method);
@@ -2070,17 +2067,17 @@ GetRequestBody(nsIVariant* aBody, nsIInp
 
       return NS_NewCStringInputStream(aResult,
                                       NS_ConvertUTF16toUTF8(string));
     }
 
     // nsIInputStream?
     nsCOMPtr<nsIInputStream> stream = do_QueryInterface(supports);
     if (stream) {
-      *aResult = stream.forget().get();
+      stream.forget(aResult);
       aCharset.Truncate();
 
       return NS_OK;
     }
 
     // nsIXHRSendable?
     nsCOMPtr<nsIXHRSendable> sendable = do_QueryInterface(supports);
     if (sendable) {
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -209,17 +209,17 @@ protected:
                 PRUint32 toOffset,
                 PRUint32 count,
                 PRUint32 *writeCount);
   nsresult CreateResponseArrayBuffer(JSContext* aCx);
   void CreateResponseBlob(nsIRequest *request);
   // Change the state of the object with this. The broadcast argument
   // determines if the onreadystatechange listener should be called.
   nsresult ChangeState(PRUint32 aState, PRBool aBroadcast = PR_TRUE);
-  nsresult GetLoadGroup(nsILoadGroup **aLoadGroup);
+  already_AddRefed<nsILoadGroup> GetLoadGroup() const;
   nsIURI *GetBaseURI();
 
   nsresult RemoveAddEventListener(const nsAString& aType,
                                   nsRefPtr<nsDOMEventListenerWrapper>& aCurrent,
                                   nsIDOMEventListener* aNew);
 
   nsresult GetInnerEventListener(nsRefPtr<nsDOMEventListenerWrapper>& aWrapper,
                                  nsIDOMEventListener** aListener);
--- a/content/base/test/test_XHR.html
+++ b/content/base/test/test_XHR.html
@@ -116,16 +116,27 @@ xhr.responseType = 'arraybuffer';
 xhr.send(null);
 is(xhr.status, 200, "wrong status");
 checkResponseTextAccessThrows(xhr);
 checkResponseXMLAccessThrows(xhr);
 ab = xhr.response;
 ok(ab != null, "should have a non-null arraybuffer");
 arraybuffer_equals_to(ab, "hello pass\n");
 
+// test reusing the same XHR (Bug 680816)
+xhr.open("GET", 'file_XHR_binary1.bin', false);
+xhr.responseType = 'arraybuffer';
+xhr.send(null);
+is(xhr.status, 200, "wrong status");
+ab2 = xhr.response;
+ok(ab2 != null, "should have a non-null arraybuffer");
+ok(ab2 != ab, "arraybuffer on XHR reuse should be distinct");
+arraybuffer_equals_to(ab, "hello pass\n");
+arraybuffer_equals_to(ab2, "\xaa\xee\0\x03\xff\xff\xff\xff\xbb\xbb\xbb\xbb");
+
 // with a binary file
 xhr = new XMLHttpRequest();
 xhr.open("GET", 'file_XHR_binary1.bin', false); 
 xhr.responseType = 'arraybuffer';
 xhr.send(null)
 is(xhr.status, 200, "wrong status");
 checkResponseTextAccessThrows(xhr);
 checkResponseXMLAccessThrows(xhr);
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -192,54 +192,49 @@ include $(topsrcdir)/config/rules.mk
 		test_bug567938-1.html \
 		test_bug567938-2.html \
 		test_bug567938-3.html \
 		test_bug567938-4.html \
 		test_bug569955.html \
 		test_bug573969.html \
 		test_bug549475.html \
 		test_bug585508.html \
-		test_bug345624-1.html \
-		test_bug345624-2.html \
 		test_bug561640.html \
 		test_bug566064.html \
 		test_bug582412-1.html \
 		test_bug582412-2.html \
 		test_bug558788-1.html \
 		test_bug558788-2.html \
 		test_bug561634.html \
 		test_bug588683-1.html \
 		test_bug588683-2.html \
 		test_bug588683-3.html \
 		test_bug588683-4.html \
 		test_bug590353-1.html \
 		test_bug590353-2.html \
 		test_bug593689.html \
-		test_bug555840.html \
 		test_bug561636.html \
 		test_bug590363.html \
 		test_bug557628.html \
 		test_bug592802.html \
 		test_bug595429.html \
 		test_bug595447.html \
 		test_bug595449.html \
-		test_bug595457.html \
 		test_bug557087-1.html \
 		test_bug557087-2.html \
 		test_bug557087-3.html \
 		test_bug557087-4.html \
 		test_bug557087-5.html \
 		test_bug557087-6.html \
 		test_bug586763.html \
 		test_bug587469.html \
 		test_bug598643.html \
 		test_bug596350.html \
 		test_bug598833-1.html \
 		test_bug600155.html \
-		test_bug556007.html \
 		test_bug606817.html \
 		test_bug297761.html \
 		file_bug297761.html \
 		test_bug607145.html \
 		test_bug596511.html \
 		reflect.js \
 		test_bug611189.html \
 		test_bug613113.html \
--- a/content/html/content/test/forms/Makefile.in
+++ b/content/html/content/test/forms/Makefile.in
@@ -43,24 +43,28 @@ relativesrcdir = content/html/content/te
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES = \
 		save_restore_radio_groups.sjs \
 		test_save_restore_radio_groups.html \
 		test_mozistextfield.html \
 		test_input_attributes_reflection.html \
+		test_input_list_attribute.html \
 		test_input_email.html \
 		test_input_url.html \
 		test_pattern_attribute.html \
 		test_required_attribute.html \
 		test_novalidate_attribute.html \
 		test_formaction_attribute.html \
 		test_formnovalidate_attribute.html \
 		test_label_control_attribute.html \
 		test_output_element.html \
 		test_button_attributes_reflection.html \
 		test_textarea_attributes_reflection.html \
+		test_validation.html \
+		test_maxlength_attribute.html \
+		test_datalist_element.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)
 
rename from content/html/content/test/test_bug555840.html
rename to content/html/content/test/forms/test_datalist_element.html
--- a/content/html/content/test/test_bug555840.html
+++ b/content/html/content/test/forms/test_datalist_element.html
@@ -1,20 +1,16 @@
 <!DOCTYPE HTML>
 <html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=555840
--->
 <head>
-  <title>Test for Bug 555840</title>
+  <title>Test for the datalist element</title>
   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
 </head>
 <body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=555840">Mozilla Bug 555840</a>
 <p id="display"></p>
 <div id="content" style="display: none">
   <datalist>
   </datalist>
 </div>
 <pre id="test">
 <script type="application/javascript">
 
@@ -50,36 +46,72 @@ function checkOptions()
     /* Non-option elements are not recognized. */
     [['input'], null, 0],
     [['input', 'option'], null, 1],
     [['input', 'textarea'], null, 0],
     /* .value and .label are not needed to be valid options. */
     [['option', 'option'], function(d) { d.childNodes[0].value = 'value'; }, 2],
     [['option', 'option'], function(d) { d.childNodes[0].label = 'label'; }, 2],
     [['option', 'option'], function(d) { d.childNodes[0].value = 'value'; d.childNodes[0].label = 'label'; }, 2],
+    [['select'],
+     function(d) {
+       var s = d.childNodes[0];
+       s.appendChild(new Option("foo"));
+       s.appendChild(new Option("bar"));
+     },
+     2],
+    [['select'],
+     function(d) {
+       var s = d.childNodes[0];
+       s.appendChild(new Option("foo"));
+       s.appendChild(new Option("bar"));
+       var label = document.createElement("label");
+       d.appendChild(label);
+       label.appendChild(new Option("foobar"));
+     },
+     3],
+    [['select'],
+     function(d) {
+       var s = d.childNodes[0];
+       s.appendChild(new Option("foo"));
+       s.appendChild(new Option("bar"));
+       var label = document.createElement("label");
+       d.appendChild(label);
+       label.appendChild(new Option("foobar"));
+       s.appendChild(new Option())
+     },
+     4],
+     [[], function(d) { d.appendChild(document.createElementNS("foo", "option")); }, 0]
   ];
 
   var d = document.getElementsByTagName('datalist')[0];
+  var cachedOptions = d.options;
 
-  for each (data in testData) {
-    for each (e in data[0]) {
+  testData.forEach(function(data) {
+    data[0].forEach(function(e) {
       d.appendChild(document.createElement(e));
-    }
+    })
 
     /* Modify children. */
     if (data[1]) {
       data[1](d);
     }
 
+    is(d.options, cachedOptions, "Should get the same object")
     is(d.options.length, data[2],
        "The number of recognized options should be " + data[2])
 
+    for (var i = 0; i < d.options.length; ++i) {
+      is(d.options[i].localName, "option",
+         "Should get an option for d.options[" + i + "]")
+    }
+
     /* Cleaning-up. */
-    for (; d.firstChild; d.removeChild(d.firstChild));
-  }
+    d.textContent = "";
+  })
 }
 
 checkClassesAndAttributes();
 checkOptions();
 
 </script>
 </pre>
 </body>
rename from content/html/content/test/test_bug556007.html
rename to content/html/content/test/forms/test_input_list_attribute.html
rename from content/html/content/test/test_bug345624-2.html
rename to content/html/content/test/forms/test_maxlength_attribute.html
--- a/content/html/content/test/test_bug345624-2.html
+++ b/content/html/content/test/forms/test_maxlength_attribute.html
@@ -56,19 +56,19 @@ function checkTooLongValidity(element)
   todo(element.validity.tooLong,
        "Element should be too long when maxlength < value length");
   todo_is(window.getComputedStyle(element, null).getPropertyValue('background-color'),
           "rgb(255, 0, 0)", ":invalid pseudo-class should apply");
 
   todo(!element.validity.valid,
        "Element should not be valid when it is too long");
 
-  todo(element.validationMessage,
-       "Please shorten this text to 2 characters or less (you are currently using 3 characters).",
-       "The validation message text is not correct");
+  todo_is(element.validationMessage,
+          "Please shorten this text to 2 characters or less (you are currently using 3 characters).",
+          "The validation message text is not correct");
   todo(!element.checkValidity(), "The element should not be valid");
   element.setCustomValidity("custom message");
   is(window.getComputedStyle(element, null).getPropertyValue('background-color'),
      "rgb(255, 0, 0)", ":invalid pseudo-class should apply");
   is(element.validationMessage, "custom message",
     "Custom message should be shown instead of too long one");
 }
 
rename from content/html/content/test/test_bug345624-1.html
rename to content/html/content/test/forms/test_validation.html
deleted file mode 100644
--- a/content/html/content/test/test_bug595457.html
+++ /dev/null
@@ -1,60 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=595457
--->
-<head>
-  <title>Test for Bug 595457</title>
-  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
-  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=595457">Mozilla Bug 595457</a>
-<p id="display"></p>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 595457 **/
-
-function checkDatalistOptions(aDatalist, aOptions)
-{
-  var datalistOptions = datalist.options;
-  var length = datalistOptions.length;
-
-  is(length, options.length, "datalist should have " + options.length + " options");
-
-  for (var i=0; i<length; ++i) {
-    is(datalistOptions[i], options[i], options[i] +
-                                       "should be in the datalist options");
-  }
-}
-
-var datalist = document.createElement("datalist");
-var select = document.createElement("select");
-var options = [ new Option("foo"), new Option("bar") ];
-
-datalist.appendChild(select);
-
-for each(option in options) {
-  select.appendChild(option);
-}
-
-checkDatalistOptions(datalist, options);
-
-var label = document.createElement("label");
-datalist.appendChild(label);
-
-options[2] = new Option("foobar");
-label.appendChild(options[2]);
-
-checkDatalistOptions(datalist, options);
-
-options[3] = new Option();
-datalist.appendChild(options[3]);
-
-checkDatalistOptions(datalist, options);
-
-</script>
-</pre>
-</body>
-</html>
--- a/gfx/layers/Layers.cpp
+++ b/gfx/layers/Layers.cpp
@@ -41,16 +41,17 @@
 #include "mozilla/layers/PLayers.h"
 #include "mozilla/layers/ShadowLayers.h"
 
 #include "ImageLayers.h"
 #include "Layers.h"
 #include "gfxPlatform.h"
 #include "ReadbackLayer.h"
 #include "gfxUtils.h"
+#include "nsPrintfCString.h"
 #include "mozilla/Util.h"
 
 using namespace mozilla::layers;
 using namespace mozilla::gfx;
 
 typedef FrameMetrics::ViewID ViewID;
 const ViewID FrameMetrics::NULL_SCROLL_ID = 0;
 const ViewID FrameMetrics::ROOT_SCROLL_ID = 1;
--- a/gfx/layers/ReadbackProcessor.h
+++ b/gfx/layers/ReadbackProcessor.h
@@ -35,16 +35,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_READBACKPROCESSOR_H
 #define GFX_READBACKPROCESSOR_H
 
 #include "ReadbackLayer.h"
 #include "ThebesLayerBuffer.h"
+#include "nsTArray.h"
 
 namespace mozilla {
 namespace layers {
 
 class ReadbackProcessor {
 public:
   /**
    * Called by the container before processing any child layers. Call this
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -79,16 +79,17 @@
 #include "nsComponentManagerUtils.h"
 #include "gfxContext.h"
 #include "prmem.h"
 #include "nsISupportsUtils.h"
 #include "plbase64.h"
 #include "nsCOMPtr.h"
 #include "nsIConsoleService.h"
 #include "nsServiceManagerUtils.h"
+#include "nsStringGlue.h"
 
 using mozilla::CheckedInt;
 
 static cairo_user_data_key_t gfxasurface_pointer_key;
 
 // Surfaces use refcounting that's tied to the cairo surface refcnt, to avoid
 // refcount mismatch issues.
 nsrefcnt
--- a/gfx/thebes/gfxColor.h
+++ b/gfx/thebes/gfxColor.h
@@ -33,20 +33,16 @@
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_COLOR_H
 #define GFX_COLOR_H
 
-#ifdef MOZILLA_INTERNAL_API
-#include "nsPrintfCString.h"
-#endif
-
 #include "gfxTypes.h"
 
 #include "prbit.h" // for PR_ROTATE_(LEFT,RIGHT)32
 #include "prio.h"  // for ntohl
 
 #define GFX_UINT32_FROM_BPTR(pbptr,i) (((PRUint32*)(pbptr))[i])
 
 #if defined(IS_BIG_ENDIAN)
@@ -168,17 +164,16 @@ struct THEBES_API gfxRGBA {
 
     enum PackedColorType {
         PACKED_ABGR,
         PACKED_ABGR_PREMULTIPLIED,
 
         PACKED_ARGB,
         PACKED_ARGB_PREMULTIPLIED,
 
-        PACKED_XBGR,
         PACKED_XRGB
     };
 
     gfxRGBA() { }
     /**
      * Intialize this color using explicit red, green, blue and alpha
      * values.
      */
@@ -188,17 +183,16 @@ struct THEBES_API gfxRGBA {
      * Initialize this color from a packed 32-bit color.
      * The color value is interpreted based on colorType;
      * all values use the native platform endianness.
      *
      * @see gfxRGBA::Packed
      */
     gfxRGBA(PRUint32 c, PackedColorType colorType = PACKED_ABGR) {
         if (colorType == PACKED_ABGR ||
-            colorType == PACKED_XBGR ||
             colorType == PACKED_ABGR_PREMULTIPLIED)
         {
             r = ((c >> 0) & 0xff) * (1.0 / 255.0);
             g = ((c >> 8) & 0xff) * (1.0 / 255.0);
             b = ((c >> 16) & 0xff) * (1.0 / 255.0);
             a = ((c >> 24) & 0xff) * (1.0 / 255.0);
         } else if (colorType == PACKED_ARGB ||
                    colorType == PACKED_XRGB ||
@@ -213,36 +207,21 @@ struct THEBES_API gfxRGBA {
         if (colorType == PACKED_ABGR_PREMULTIPLIED ||
             colorType == PACKED_ARGB_PREMULTIPLIED)
         {
             if (a > 0.0) {
                 r /= a;
                 g /= a;
                 b /= a;
             }
-        } else if (colorType == PACKED_XBGR ||
-                   colorType == PACKED_XRGB)
-        {
+        } else if (colorType == PACKED_XRGB) {
             a = 1.0;
         }
     }
 
-    /**
-     * Initialize this color by parsing the given string.
-     * XXX implement me!
-     */
-#if 0
-    gfxRGBA(const char* str) {
-        a = 1.0;
-        // if aString[0] is a #, parse it as hex
-        // if aString[0] is a letter, parse it as a color name
-        // if aString[0] is a number, parse it loosely as hex
-    }
-#endif
-
     bool operator==(const gfxRGBA& other) const
     {
         return r == other.r && g == other.g && b == other.b && a == other.a;
     }
     bool operator!=(const gfxRGBA& other) const
     {
         return !(*this == other);
     }
@@ -256,55 +235,43 @@ struct THEBES_API gfxRGBA {
      * double d = c * 255.0; v = ((PRUint8) d) << x. 
      */
     PRUint32 Packed(PackedColorType colorType = PACKED_ABGR) const {
         gfxFloat rb = (r * 255.0);
         gfxFloat gb = (g * 255.0);
         gfxFloat bb = (b * 255.0);
         gfxFloat ab = (a * 255.0);
 
-        if (colorType == PACKED_ABGR || colorType == PACKED_XBGR) {
+        if (colorType == PACKED_ABGR) {
             return (PRUint8(ab) << 24) |
                    (PRUint8(bb) << 16) |
                    (PRUint8(gb) << 8) |
                    (PRUint8(rb) << 0);
-        } else if (colorType == PACKED_ARGB || colorType == PACKED_XRGB) {
+        }
+        if (colorType == PACKED_ARGB || colorType == PACKED_XRGB) {
             return (PRUint8(ab) << 24) |
                    (PRUint8(rb) << 16) |
                    (PRUint8(gb) << 8) |
                    (PRUint8(bb) << 0);
         }
 
-        rb = (r*a) * 255.0;
-        gb = (g*a) * 255.0;
-        bb = (b*a) * 255.0;
+        rb *= a;
+        gb *= a;
+        bb *= a;
 
         if (colorType == PACKED_ABGR_PREMULTIPLIED) {
             return (((PRUint8)(ab) << 24) |
                     ((PRUint8)(bb) << 16) |
                     ((PRUint8)(gb) << 8) |
                     ((PRUint8)(rb) << 0));
-        } else if (colorType == PACKED_ARGB_PREMULTIPLIED) {
+        }
+        if (colorType == PACKED_ARGB_PREMULTIPLIED) {
             return (((PRUint8)(ab) << 24) |
                     ((PRUint8)(rb) << 16) |
                     ((PRUint8)(gb) << 8) |
                     ((PRUint8)(bb) << 0));
         }
 
         return 0;
     }
-
-#ifdef MOZILLA_INTERNAL_API
-    /**
-     * Convert this color to a hex value. For example, for rgb(255,0,0),
-     * this will return FF0000.
-     */
-    // XXX I'd really prefer to just have this return an nsACString
-    // Does this function even make sense, since we're just ignoring the alpha value?
-    void Hex(nsACString& result) const {
-        nsPrintfCString hex(8, "%02x%02x%02x", PRUint8(r*255.0), PRUint8(g*255.0), PRUint8(b*255.0));
-        result.Assign(hex);
-    }
-#endif
-
 };
 
 #endif /* _GFX_COLOR_H */
--- a/gfx/thebes/gfxPlatform.h
+++ b/gfx/thebes/gfxPlatform.h
@@ -37,43 +37,44 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef GFX_PLATFORM_H
 #define GFX_PLATFORM_H
 
 #include "prtypes.h"
 #include "prlog.h"
 #include "nsTArray.h"
-
+#include "nsString.h"
 #include "nsIObserver.h"
 
 #include "gfxTypes.h"
 #include "gfxASurface.h"
 #include "gfxColor.h"
 
 #include "qcms.h"
+
+#include "gfx2DGlue.h"
+#include "mozilla/RefPtr.h"
+
 #ifdef XP_OS2
 #undef OS2EMX_PLAIN_CHAR
 #endif
 
 class gfxImageSurface;
 class gfxFont;
 class gfxFontGroup;
 struct gfxFontStyle;
 class gfxUserFontSet;
 class gfxFontEntry;
 class gfxProxyFontEntry;
 class gfxPlatformFontList;
 class gfxTextRun;
 class nsIURI;
 class nsIAtom;
 
-#include "gfx2DGlue.h"
-#include "mozilla/RefPtr.h"
-
 extern cairo_user_data_key_t kDrawTarget;
 
 // pref lang id's for font prefs
 // !!! needs to match the list of pref font.default.xx entries listed in all.js !!!
 // !!! don't use as bit mask, this may grow larger !!!
 
 enum eFontPrefLang {
     eFontPrefLang_Western     =  0,
--- a/js/src/xpconnect/loader/mozJSLoaderUtils.cpp
+++ b/js/src/xpconnect/loader/mozJSLoaderUtils.cpp
@@ -30,18 +30,16 @@
  * use your version of this file under the terms of the MPL, indicate your
  * decision by deleting the provisions above and replace them with the notice
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
-#if !defined(XPCONNECT_STANDALONE)
-
 #include "nsAutoPtr.h"
 #include "nsScriptLoader.h"
 
 #include "jsapi.h"
 #include "jsxdrapi.h"
 
 #include "mozilla/scache/StartupCache.h"
 #include "mozilla/scache/StartupCacheUtils.h"
@@ -186,10 +184,8 @@ WriteCachedScript(StartupCache* cache, n
     nsAutoArrayPtr<char> buf;
     PRUint32 len;
     rv = NewBufferFromStorageStream(storageStream, getter_Transfers(buf), &len);
     NS_ENSURE_SUCCESS(rv, rv);
 
     rv = cache->PutBuffer(PromiseFlatCString(uri).get(), buf, len);
     return rv;
 }
-
-#endif /* XPCONNECT_STANDALONE */
--- a/layout/generic/nsTextFrameThebes.cpp
+++ b/layout/generic/nsTextFrameThebes.cpp
@@ -101,16 +101,17 @@
 
 #include "nsIServiceManager.h"
 #ifdef ACCESSIBILITY
 #include "nsAccessibilityService.h"
 #endif
 #include "nsAutoPtr.h"
 
 #include "nsBidiUtils.h"
+#include "nsPrintfCString.h"
 
 #include "gfxFont.h"
 #include "gfxContext.h"
 #include "gfxTextRunWordCache.h"
 #include "gfxImageSurface.h"
 
 #include "mozilla/dom/Element.h"
 #include "mozilla/Util.h" // for DebugOnly
--- a/layout/style/nsFontFaceLoader.cpp
+++ b/layout/style/nsFontFaceLoader.cpp
@@ -71,16 +71,17 @@
 #include "nsCrossSiteListenerProxy.h"
 #include "nsIContentSecurityPolicy.h"
 #include "nsIChannelPolicy.h"
 #include "nsChannelPolicy.h"
 
 #include "nsIConsoleService.h"
 
 #include "nsStyleSet.h"
+#include "nsPrintfCString.h"
 
 using namespace mozilla;
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo *gFontDownloaderLog = PR_NewLogModule("fontdownloader");
 #endif /* PR_LOGGING */
 
 #define LOG(args) PR_LOG(gFontDownloaderLog, PR_LOG_DEBUG, args)
--- a/netwerk/ipc/NeckoCommon.h
+++ b/netwerk/ipc/NeckoCommon.h
@@ -38,16 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef mozilla_net_NeckoCommon_h
 #define mozilla_net_NeckoCommon_h
 
 #include "nsXULAppAPI.h"
 #include "prenv.h"
+#include "nsPrintfCString.h"
 
 #if defined(DEBUG) || defined(ENABLE_TESTS)
 # define NECKO_ERRORS_ARE_FATAL_DEFAULT true
 #else
 # define NECKO_ERRORS_ARE_FATAL_DEFAULT false
 #endif 
 
 // TODO: Eventually remove NECKO_MAYBE_ABORT and DROP_DEAD (bug 575494).
new file mode 100644
--- /dev/null
+++ b/toolkit/themes/winstripe/mozapps/extensions/selectAddons-aero.css
@@ -0,0 +1,3 @@
+%define WINSTRIPE_AERO
+%include selectAddons.css
+%undef WINSTRIPE_AERO
--- a/toolkit/themes/winstripe/mozapps/extensions/selectAddons.css
+++ b/toolkit/themes/winstripe/mozapps/extensions/selectAddons.css
@@ -183,17 +183,26 @@
 .addon:not([active]) .addon-icon,
 #disable-list .addon-icon,
 #incompatible-list .addon-icon {
   filter: url("chrome://mozapps/skin/extensions/extensions.svg#greyscale");
 }
 
 #footer {
   padding: 15px 12px;
-  background-color: #f1f5fb;
-  box-shadow: 0px 1px 2px rgb(204,214,234) inset;
 }
 
 .progress-label,
 #footer-label {
+%ifdef WINSTRIPE_AERO
   font-style: italic;
+%endif
   color: GrayText;
 }
+
+%ifdef WINSTRIPE_AERO
+@media all and (-moz-windows-default-theme) {
+  #footer {
+    background-color: #f1f5fb;
+    box-shadow: 0px 1px 2px rgb(204,214,234) inset;
+  }
+}
+%endif
--- a/toolkit/themes/winstripe/mozapps/jar.mn
+++ b/toolkit/themes/winstripe/mozapps/jar.mn
@@ -81,17 +81,17 @@ toolkit.jar:
 % skin mozapps classic/1.0 %skin/classic/aero/mozapps/ os=WINNT osversion>=6
         skin/classic/aero/mozapps/downloads/downloadButtons.png            (downloads/downloadButtons-aero.png)
         skin/classic/aero/mozapps/downloads/downloadIcon.png               (downloads/downloadIcon-aero.png)
 *       skin/classic/aero/mozapps/downloads/downloads.css                  (downloads/downloads-aero.css)
         skin/classic/aero/mozapps/downloads/unknownContentType.css         (downloads/unknownContentType.css)
         skin/classic/aero/mozapps/extensions/about.css                     (extensions/about.css)
         skin/classic/aero/mozapps/extensions/blocklist.css                 (extensions/blocklist.css)
 *       skin/classic/aero/mozapps/extensions/extensions.css                (extensions/extensions-aero.css)
-*       skin/classic/aero/mozapps/extensions/selectAddons.css              (extensions/selectAddons.css)
+*       skin/classic/aero/mozapps/extensions/selectAddons.css              (extensions/selectAddons-aero.css)
         skin/classic/aero/mozapps/extensions/update.css                    (extensions/update.css)
         skin/classic/aero/mozapps/extensions/extensions.svg                (extensions/extensions.svg)
         skin/classic/aero/mozapps/extensions/themeGeneric.png              (extensions/themeGeneric-aero.png)
         skin/classic/aero/mozapps/extensions/category-search.png           (extensions/category-search.png)
         skin/classic/aero/mozapps/extensions/category-discover.png         (extensions/category-discover-aero.png)
         skin/classic/aero/mozapps/extensions/category-languages.png        (extensions/category-languages-aero.png)
         skin/classic/aero/mozapps/extensions/category-searchengines.png    (extensions/category-searchengines.png)
         skin/classic/aero/mozapps/extensions/category-extensions.png       (extensions/category-extensions-aero.png)
--- a/widget/src/android/AndroidBridge.cpp
+++ b/widget/src/android/AndroidBridge.cpp
@@ -534,17 +534,17 @@ AndroidBridge::GetClipboardText(nsAStrin
 
 void
 AndroidBridge::SetClipboardText(const nsAString& aText)
 {
     ALOG_BRIDGE("AndroidBridge::SetClipboardText");
     AutoLocalJNIFrame jniFrame;
     jstring jstr = mJNIEnv->NewString(nsPromiseFlatString(aText).get(),
                                       aText.Length());
-    mJNIEnv->CallStaticObjectMethod(mGeckoAppShellClass, jSetClipboardText, jstr);
+    mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jSetClipboardText, jstr);
 }
 
 bool
 AndroidBridge::ClipboardHasText()
 {
     ALOG_BRIDGE("AndroidBridge::ClipboardHasText");
 
     jstring jstrType =  
@@ -555,17 +555,17 @@ AndroidBridge::ClipboardHasText()
         return PR_FALSE;
     return PR_TRUE;
 }
 
 void
 AndroidBridge::EmptyClipboard()
 {
     ALOG_BRIDGE("AndroidBridge::EmptyClipboard");
-    mJNIEnv->CallStaticObjectMethod(mGeckoAppShellClass, jSetClipboardText, nsnull);
+    mJNIEnv->CallStaticVoidMethod(mGeckoAppShellClass, jSetClipboardText, nsnull);
 }
 
 void
 AndroidBridge::ShowAlertNotification(const nsAString& aImageUrl,
                                      const nsAString& aAlertTitle,
                                      const nsAString& aAlertText,
                                      const nsAString& aAlertCookie,
                                      nsIObserver *aAlertListener,
--- a/widget/src/cocoa/TextInputHandler.mm
+++ b/widget/src/cocoa/TextInputHandler.mm
@@ -44,16 +44,17 @@
 #endif // MOZ_LOGGING
 #include "prlog.h"
 
 #include "nsChildView.h"
 #include "nsObjCExceptions.h"
 #include "nsBidiUtils.h"
 #include "nsToolkit.h"
 #include "nsCocoaUtils.h"
+#include "nsPrintfCString.h"
 
 #ifdef __LP64__
 #include "ComplexTextInputPanel.h"
 #endif // __LP64__
 
 #ifndef NP_NO_CARBON
 #include <objc/runtime.h>
 #endif // NP_NO_CARBON
--- a/widget/src/gtk2/nsDeviceContextSpecG.cpp
+++ b/widget/src/gtk2/nsDeviceContextSpecG.cpp
@@ -968,21 +968,19 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::Di
 //----------------------------------------------------------------------
 nsresult GlobalPrinters::InitializeGlobalPrinters ()
 {
   if (PrintersAreAllocated()) {
     return NS_OK;
   }
 
   mGlobalPrinterList = new nsTArray<nsString>();
-  if (!mGlobalPrinterList) 
-    return NS_ERROR_OUT_OF_MEMORY;
 
   nsPSPrinterList psMgr;
-  if (NS_SUCCEEDED(psMgr.Init()) && psMgr.Enabled()) {
+  if (psMgr.Enabled()) {
     /* Get the list of PostScript-module printers */
     // XXX: this function is the only user of GetPrinterList
     // So it may be interesting to convert the nsCStrings
     // in this function, we would save one loop here
     nsTArray<nsCString> printerList;
     psMgr.GetPrinterList(printerList);
     for (PRUint32 i = 0; i < printerList.Length(); i++)
     {
--- a/widget/src/gtk2/nsPSPrinters.cpp
+++ b/widget/src/gtk2/nsPSPrinters.cpp
@@ -53,27 +53,23 @@ using namespace mozilla;
 #define NS_CUPS_PRINTER "CUPS/"
 #define NS_CUPS_PRINTER_LEN (sizeof(NS_CUPS_PRINTER) - 1)
 
 /* dummy printer name for the gfx/src/ps driver */
 #define NS_POSTSCRIPT_DRIVER_NAME "PostScript/"
 
 nsCUPSShim gCupsShim;
 
-/* Initialize the printer manager object */
-nsresult
-nsPSPrinterList::Init()
+nsPSPrinterList::nsPSPrinterList()
 {
     // Should we try cups?
-    PRBool useCups =
-        Preferences::GetBool("print.postscript.cups.enabled", PR_TRUE);
-    if (useCups && !gCupsShim.IsInitialized()) {
+    if (Preferences::GetBool("print.postscript.cups.enabled", PR_TRUE) &&
+        !gCupsShim.IsInitialized()) {
         gCupsShim.Init();
     }
-    return NS_OK;
 }
 
 
 /* Check whether the PostScript module has been disabled at runtime */
 PRBool
 nsPSPrinterList::Enabled()
 {
     const char *val = PR_GetEnv("MOZILLA_POSTSCRIPT_ENABLED");
--- a/widget/src/gtk2/nsPSPrinters.h
+++ b/widget/src/gtk2/nsPSPrinters.h
@@ -42,22 +42,17 @@
 #include "nsString.h"
 #include "nsTArray.h"
 #include "prtypes.h"
 
 class nsCUPSShim;
 
 class nsPSPrinterList {
     public:
-        /**
-         * Initialize a printer manager object.
-         * @return NS_ERROR_NOT_INITIALIZED if unable to access prefs
-         *         NS_OK for successful initialization.
-         */
-        nsresult Init();
+        nsPSPrinterList();
 
         /**
          * Is the PostScript module enabled or disabled?
          * @return PR_TRUE if enabled,
          *         PR_FALSE if not.
          */
         PRBool Enabled();
 
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -151,16 +151,17 @@
 #include "mozilla/Services.h"
 #include "nsNativeThemeWin.h"
 #include "nsWindowsDllInterceptor.h"
 #include "nsIWindowMediator.h"
 #include "nsIServiceManager.h"
 #include "nsWindowGfx.h"
 #include "gfxWindowsPlatform.h"
 #include "Layers.h"
+#include "nsPrintfCString.h"
 #include "mozilla/Preferences.h"
 
 #ifdef MOZ_ENABLE_D3D9_LAYER
 #include "LayerManagerD3D9.h"
 #endif
 
 #ifdef MOZ_ENABLE_D3D10_LAYER
 #include "LayerManagerD3D10.h"