merge the last green changeset on m-c to fx-team
authorTim Taubert <tim.taubert@gmx.de>
Mon, 03 Oct 2011 21:12:02 +0200
changeset 78715 0371c608f12646d6885bf6229bf8ea785a6bbcc7
parent 78714 cc34d8625f6b018dcb0e982f4e9053f5d9472d9f (current diff)
parent 78634 a896a9e237a08f8afecb5e80641618d7d4e8af8d (diff)
child 78716 362872311015e1d8c570f641cf44b6392039779b
push id506
push userclegnitto@mozilla.com
push dateWed, 09 Nov 2011 02:03:18 +0000
treeherdermozilla-aurora@63587fc7bb93 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone10.0a1
merge the last green changeset on m-c to fx-team
content/base/test/test_text_replaceWholeText.html
dom/interfaces/core/nsIDOMNameList.idl
modules/libpr0n/src/Endian.h
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -382,25 +382,20 @@ nsRootAccessible::ProcessDOMEvent(nsIDOM
     GetAccService()->GetAccessibleOrContainer(origTargetNode, weakShell);
   if (!accessible)
     return;
 
   nsDocAccessible* targetDocument = accessible->GetDocAccessible();
   NS_ASSERTION(targetDocument, "No document while accessible is in document?!");
 
   nsINode* targetNode = accessible->GetNode();
-  nsIContent* targetContent = targetNode->IsElement() ?
-    targetNode->AsElement() : nsnull;
-  nsIContent* origTargetContent = origTargetNode->IsElement() ?
-    origTargetNode->AsElement() : nsnull;
 
 #ifdef MOZ_XUL
-  bool isTree = targetContent ?
-    targetContent->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL) :
-    PR_FALSE;
+  bool isTree = targetNode->IsElement() &&
+    targetNode->AsElement()->NodeInfo()->Equals(nsGkAtoms::tree, kNameSpaceID_XUL);
 
   if (isTree) {
     nsRefPtr<nsXULTreeAccessible> treeAcc = do_QueryObject(accessible);
     NS_ASSERTION(treeAcc,
                  "Accessible for xul:tree isn't nsXULTreeAccessible.");
 
     if (treeAcc) {
       if (eventType.EqualsLiteral("TreeViewChanged")) {
--- a/browser/base/content/syncNotification.xml
+++ b/browser/base/content/syncNotification.xml
@@ -51,29 +51,30 @@
         <xul:spacer/>
         <children includes="notification"/>
       </xul:vbox>
       <children/>
     </content>
 
     <implementation>
       <constructor><![CDATA[
-        Cu.import("resource://services-sync/ext/Observers.js");
-        Cu.import("resource://services-sync/notifications.js");
+        let temp = {};
+        Cu.import("resource://services-sync/ext/Observers.js", temp);
+        temp.Observers.add("weave:notification:added", this.onNotificationAdded, this);
+        temp.Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
 
-        Observers.add("weave:notification:added", this.onNotificationAdded, this);
-        Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
-
-        for each (var notification in Notifications.notifications)
+        for each (var notification in Weave.Notifications.notifications)
           this._appendNotification(notification);
       ]]></constructor>
 
       <destructor><![CDATA[
-        Observers.remove("weave:notification:added", this.onNotificationAdded, this);
-        Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
+        let temp = {};
+        Cu.import("resource://services-sync/ext/Observers.js", temp);
+        temp.Observers.remove("weave:notification:added", this.onNotificationAdded, this);
+        temp.Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
       ]]></destructor>
 
       <method name="onNotificationAdded">
         <parameter name="subject"/>
         <parameter name="data"/>
         <body><![CDATA[
           this._appendNotification(subject);
         ]]></body>
@@ -135,17 +136,17 @@
          - its value in a JS property |_notification| that is not defined
          - in XBL as a field or property.  Maybe this is wrong, but it works.
          -->
       <property name="notification"
                 onget="return this._notification"
                 onset="this._notification = val; return val;"/>
       <method name="close">
         <body><![CDATA[
-          Notifications.remove(this.notification);
+          Weave.Notifications.remove(this.notification);
 
           // We should be able to call the base class's close method here
           // to remove the notification element from the notification box,
           // but we can't because of bug 373652, so instead we copied its code
           // and execute it below.
           var control = this.control;
           if (control)
             control.removeNotification(this);
--- a/browser/themes/winstripe/browser/browser-aero.css
+++ b/browser/themes/winstripe/browser/browser-aero.css
@@ -36,17 +36,17 @@
 
   .panel-promo-message {
     font-style: italic;
   }
 }
 
 @media all and (-moz-windows-default-theme) {
   #navigator-toolbox > toolbar:not(:-moz-lwtheme),
-  #addon-bar:not(:-moz-lwtheme) {
+  #browser-bottombox:not(:-moz-lwtheme) {
     background-color: @customToolbarColor@;
   }
 
   .tabbrowser-tab:not(:-moz-lwtheme),
   .tabs-newtab-button:not(:-moz-lwtheme) {
     background-image: @toolbarShadowOnTab@, @bgTabTexture@,
                       -moz-linear-gradient(@customToolbarColor@, @customToolbarColor@);
   }
@@ -163,16 +163,17 @@
   #main-window[sizemode=normal] #browser-border-end {
     display: -moz-box;
     background-color: @toolbarShadowColor@;
     width: 1px;
   }
   #main-window[sizemode=normal] #browser-bottombox {
     border: 1px solid @toolbarShadowColor@;
     border-top-style: none;
+    background-clip: padding-box;
   }
 
   #main-window[sizemode=normal][tabsontop=false] #PersonalToolbar:not(:-moz-lwtheme) {
     border-top-left-radius: 3.5px;
     border-top-right-radius: 3.5px;
   }
 
   /* Toolbar shadow behind tabs */
@@ -230,33 +231,16 @@
   #navigator-toolbox > toolbar:not(#toolbar-menubar):-moz-lwtheme {
     -moz-binding: url("chrome://global/content/bindings/toolbar.xml#toolbar-drag");
   }
 
   #appcontent:not(:-moz-lwtheme) {
     background-color: -moz-dialog;
   }
 
-  #browser-bottombox:not(:-moz-lwtheme) {
-    background-color: -moz-dialog;
-    background-clip: padding-box;
-  }
-
-  #main-window[sizemode=normal] #browser-bottombox:not(:-moz-lwtheme),
-  #main-window[sizemode=normal] #addon-bar:not(:-moz-lwtheme) {
-    border-bottom-left-radius: 4px;
-    border-bottom-right-radius: 4px;
-  }
-
-  #addon-bar:not(:-moz-lwtheme) {
-    -moz-appearance: none;
-    border-bottom-style: none;
-    background-image: -moz-linear-gradient(@toolbarHighlight@, rgba(255,255,255,0));
-  }
-
   #main-menubar:not(:-moz-lwtheme):not(:-moz-window-inactive) {
     background-color: rgba(255,255,255,.5);
     border-radius: 4px;
   }
 
   #urlbar,
   .searchbar-textbox {
     background-color: rgba(255,255,255,.725);
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -136,16 +136,20 @@
 #personal-bookmarks {
   min-height: 24px;
 }
 
 #print-preview-toolbar:not(:-moz-lwtheme) {
   -moz-appearance: toolbox;
 }
 
+#browser-bottombox:not(:-moz-lwtheme) {
+  background-color: -moz-dialog;
+}
+
 /* ::::: app menu button ::::: */
 
 #appmenu-button {
   -moz-appearance: none;
   background-clip: padding-box;
   border-radius: 0 0 4px 4px;
   border: 1px solid;
   border-top: none;
@@ -2462,22 +2466,24 @@ listitem.style-section {
 
 panel[dimmed="true"] {
   opacity: 0.5;
 }
 
 /* Add-on bar */
 
 #addon-bar {
+  -moz-appearance: none;
   min-height: 20px;
-  border-top: 1px solid ThreeDShadow !important;
-}
-
-#addon-bar:not(:-moz-lwtheme) {
-  -moz-appearance: statusbar;
+  border-top-style: none;
+  border-bottom-style: none;
+  padding-top: 1px;
+  background-image: -moz-linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
+  background-size: 100% 2px;
+  background-repeat: no-repeat;
 }
 
 #status-bar {
   -moz-appearance: none;
   background-color: transparent;
   border: none;
   min-height: 0;
 }
--- a/content/base/public/nsDeprecatedOperationList.h
+++ b/content/base/public/nsDeprecatedOperationList.h
@@ -66,16 +66,16 @@ DEPRECATED_OPERATION(RemoveChild)
 DEPRECATED_OPERATION(AppendChild)
 DEPRECATED_OPERATION(CloneNode)
 DEPRECATED_OPERATION(OwnerDocument)
 DEPRECATED_OPERATION(Normalize)
 DEPRECATED_OPERATION(IsSupported)
 DEPRECATED_OPERATION(IsEqualNode)
 DEPRECATED_OPERATION(TextContent)
 DEPRECATED_OPERATION(EnablePrivilege)
+DEPRECATED_OPERATION(Position)
+DEPRECATED_OPERATION(TotalSize)
 DEPRECATED_OPERATION(IsSameNode)
-DEPRECATED_OPERATION(ReplaceWholeText)
 DEPRECATED_OPERATION(GlobalStorage)
-DEPRECATED_OPERATION(XmlEncoding)
 DEPRECATED_OPERATION(XmlVersion)
 DEPRECATED_OPERATION(InputEncoding)
 DEPRECATED_OPERATION(XmlStandalone)
 DEPRECATED_OPERATION(IsElementContentWhitespace)
--- a/content/base/public/nsIFrameMessageManager.idl
+++ b/content/base/public/nsIFrameMessageManager.idl
@@ -59,34 +59,36 @@ interface nsIFrameMessageListener : nsIS
    * if the message is synchronous, possible return value is sent back
    * as JSON.
    *
    * When the listener is called, 'this' value is the target of the message.
    */
   void receiveMessage();
 };
 
-[scriptable, uuid(6b736edb-863d-40bd-bca2-62f44da803c0)]
+[scriptable, uuid(a27d8fcd-8de9-4a51-87f4-2b83bba901d5)]
 interface nsIFrameMessageManager : nsISupports
 {
   void addMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
   void removeMessageListener(in AString aMessage, in nsIFrameMessageListener aListener);
-  void sendAsyncMessage(/*in messageName, in JSON*/);
+  [implicit_jscontext,optional_argc]
+  void sendAsyncMessage([optional] in AString messageName, [optional] in jsval obj);
 };
 
-[scriptable, uuid(cdb1a40b-9862-426c-ae8a-f5ab84e20e32)]
+[scriptable, uuid(21e5d940-d457-4c0f-bb5e-35c159ed19e3)]
 interface nsISyncMessageSender : nsIFrameMessageManager
 {
   /**
    * Returns an array of JSON objects.
    */
-  void sendSyncMessage(/*in messageName, in JSON*/);
+  [implicit_jscontext,optional_argc]
+  jsval sendSyncMessage([optional] in AString messageName, [optional] in jsval obj);
 };
 
-[scriptable, uuid(6f23339f-2b5c-4f22-a03f-bb7ec101f83d)]
+[scriptable, uuid(78a1d024-60e3-4b7b-98cd-4c6b84b4f060)]
 interface nsIContentFrameMessageManager : nsISyncMessageSender
 {
   /**
    * The current top level window in the frame or null.
    */
   readonly attribute nsIDOMWindow content;
 
   /**
@@ -107,30 +109,30 @@ interface nsIContentFrameMessageManager 
 
    /**
     * Ascii base64 data to binary data and vice versa
     */
    DOMString atob(in DOMString aAsciiString);
    DOMString btoa(in DOMString aBase64Data);
 };
 
-[uuid(9c48d557-92fe-4edb-95fc-bfe97e77bdc3)]
+[uuid(1f7af930-a232-4a84-a049-73eaa45f2db5)]
 interface nsIInProcessContentFrameMessageManager : nsIContentFrameMessageManager
 {
   [notxpcom] nsIContent getOwnerContent();
 };
 
-[scriptable, uuid(6331bbca-2c9f-4766-b3c7-ae75554bf1ec)]
+[scriptable, uuid(e91b0939-a74a-4c4f-8cfd-17dd42e8642a)]
 interface nsITreeItemFrameMessageManager : nsIFrameMessageManager
 {
   readonly attribute unsigned long childCount;
   nsITreeItemFrameMessageManager getChildAt(in unsigned long aIndex);
 };
 
-[scriptable, uuid(9e5c0526-aa4c-49f0-afbb-57f489cd9b59)]
+[scriptable, uuid(14e1f147-793d-4788-bbbb-ae806ecdddbb)]
 interface nsIChromeFrameMessageManager : nsITreeItemFrameMessageManager
 {
   /**
    * Load a script in the (remote) frame. aURL must be the absolute URL.
    * data: URLs are also supported. For example data:,dump("foo\n");
    * If aAllowDelayedLoad is true, script will be loaded when the
    * remote frame becomes available. Otherwise the script will be loaded
    * only if the frame is already available.
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -1351,80 +1351,80 @@ nsAttrValue::GetStringBuffer(const nsASt
 }
 
 PRInt32
 nsAttrValue::StringToInteger(const nsAString& aValue, bool* aStrict,
                              PRInt32* aErrorCode,
                              bool aCanBePercent,
                              bool* aIsPercent) const
 {
-  *aStrict = PR_FALSE;
+  *aStrict = true;
   *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
   if (aCanBePercent) {
-    *aIsPercent = PR_FALSE;
+    *aIsPercent = false;
   }
 
   nsAString::const_iterator iter, end;
   aValue.BeginReading(iter);
   aValue.EndReading(end);
+
+  while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) {
+    *aStrict = false;
+    ++iter;
+  }
+
+  if (iter == end) {
+    return 0;
+  }
+
   bool negate = false;
+  if (*iter == PRUnichar('-')) {
+    negate = true;
+    ++iter;
+  } else if (*iter == PRUnichar('+')) {
+    *aStrict = false;
+    ++iter;
+  }
+
   PRInt32 value = 0;
-  if (iter != end) {
-    if (*iter == PRUnichar('-')) {
-      negate = PR_TRUE;
+  PRInt32 pValue = 0; // Previous value, used to check integer overflow
+  while (iter != end) {
+    if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
+      value = (value * 10) + (*iter - PRUnichar('0'));
       ++iter;
+      // Checking for integer overflow.
+      if (pValue > value) {
+        *aStrict = false;
+        *aErrorCode = NS_ERROR_ILLEGAL_VALUE;
+        break;
+      } else {
+        pValue = value;
+        *aErrorCode = NS_OK;
+      }
+    } else if (aCanBePercent && *iter == PRUnichar('%')) {
+      ++iter;
+      *aIsPercent = true;
+      if (iter != end) {
+        *aStrict = false;
+        break;
+      }
+    } else {
+      *aStrict = false;
+      break;
     }
-    if (iter != end) {
-      if ((*iter >= PRUnichar('1') || (*iter == PRUnichar('0') && !negate)) &&
-          *iter <= PRUnichar('9')) {
-        value = *iter - PRUnichar('0');
-        ++iter;
-        *aStrict = (value != 0 || iter == end ||
-                    (aCanBePercent && *iter == PRUnichar('%')));
-        while (iter != end && *aStrict) {
-          if (*iter >= PRUnichar('0') && *iter <= PRUnichar('9')) {
-            value = (value * 10) + (*iter - PRUnichar('0'));
-            ++iter;
-            if (iter != end && value > ((PR_INT32_MAX / 10) - 9)) {
-              *aStrict = PR_FALSE;
-            }
-          } else if (aCanBePercent && *iter == PRUnichar('%')) {
-            ++iter;
-            if (iter == end) {
-              *aIsPercent = PR_TRUE;
-            } else {
-              *aStrict = PR_FALSE;
-            }
-          } else {
-            *aStrict = PR_FALSE;
-          }
-        }
-        if (*aStrict) {
-          if (negate) {
-            value = -value;
-          }
-          if (!aCanBePercent || !*aIsPercent) {
-            *aErrorCode = NS_OK;
-#ifdef DEBUG
-            nsAutoString stringValue;
-            stringValue.AppendInt(value);
-            if (aCanBePercent && *aIsPercent) {
-              stringValue.AppendLiteral("%");
-            }
-            NS_ASSERTION(stringValue.Equals(aValue), "Wrong conversion!");
-#endif
-            return value;
-          }
-        }
-      }
+  }
+  if (negate) {
+    value = -value;
+    // Checking the special case of -0.
+    if (!value) {
+      *aStrict = false;
     }
   }
 
-  nsAutoString tmp(aValue);
-  return tmp.ToInteger(aErrorCode);
+  return value;
 }
 
 PRInt64
 nsAttrValue::SizeOf() const
 {
   PRInt64 size = sizeof(*this);
 
   switch (BaseType()) {
--- a/content/base/src/nsDOMLists.cpp
+++ b/content/base/src/nsDOMLists.cpp
@@ -33,18 +33,17 @@
  * 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 ***** */
 
 /*
- * Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
- * DOM3 stuff and some interfaces specified by WHATWG.
+ * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
  */
 
 #include "nsDOMLists.h"
 #include "nsDOMError.h"
 #include "nsIDOMClassInfo.h"
 #include "nsContentUtils.h"
 #include "nsINode.h"
 
@@ -90,97 +89,8 @@ nsDOMStringList::GetLength(PRUint32 *aLe
 
 NS_IMETHODIMP
 nsDOMStringList::Contains(const nsAString& aString, bool *aResult)
 {
   *aResult = mNames.Contains(aString);
 
   return NS_OK;
 }
-
-
-nsNameList::nsNameList()
-{
-}
-
-nsNameList::~nsNameList()
-{
-}
-DOMCI_DATA(NameList, nsNameList)
-
-NS_IMPL_ADDREF(nsNameList)
-NS_IMPL_RELEASE(nsNameList)
-NS_INTERFACE_TABLE_HEAD(nsNameList)
-  NS_OFFSET_AND_INTERFACE_TABLE_BEGIN(nsNameList)
-    NS_INTERFACE_TABLE_ENTRY(nsNameList, nsIDOMNameList)
-  NS_OFFSET_AND_INTERFACE_TABLE_END
-  NS_OFFSET_AND_INTERFACE_TABLE_TO_MAP_SEGUE
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(NameList)
-  NS_INTERFACE_MAP_END
-
-NS_IMETHODIMP
-nsNameList::GetName(PRUint32 aIndex, nsAString& aResult)
-{
-  if (aIndex >= mNames.Length()) {
-    SetDOMStringToNull(aResult);
-  } else {
-    aResult = mNames[aIndex];
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNameList::GetNamespaceURI(PRUint32 aIndex, nsAString& aResult)
-{
-  if (aIndex >= mNames.Length()) {
-    SetDOMStringToNull(aResult);
-  } else {
-    aResult = mNamespaceURIs[aIndex];
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNameList::GetLength(PRUint32 *aLength)
-{
-  *aLength = mNames.Length();
-
-  return NS_OK;
-}
-
-bool
-nsNameList::Add(const nsAString& aNamespaceURI, const nsAString& aName)
-{
-  PRUint32 count = mNamespaceURIs.Length();
-  if (mNamespaceURIs.InsertElementAt(count, aNamespaceURI)) {
-    if (mNames.InsertElementAt(count, aName)) {
-      return PR_TRUE;
-    }
-    mNamespaceURIs.RemoveElementAt(count);
-  }
-
-  return PR_FALSE;
-}
-
-NS_IMETHODIMP
-nsNameList::Contains(const nsAString& aName, bool *aResult)
-{
-  *aResult = mNames.Contains(aName);
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
-nsNameList::ContainsNS(const nsAString& aNamespaceURI, const nsAString& aName,
-                       bool *aResult)
-{
-  PRUint32 index = mNames.IndexOf(aName);
-  if (index != mNames.NoIndex) {
-    *aResult = mNamespaceURIs[index].Equals(aNamespaceURI);
-  }
-  else {
-    *aResult = PR_FALSE;
-  }
-
-  return NS_OK;
-}
--- a/content/base/src/nsDOMLists.h
+++ b/content/base/src/nsDOMLists.h
@@ -33,25 +33,23 @@
  * 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 ***** */
 
 /*
- * Implementations of nsIDOMDOMStringList and nsIDOMNameList, used by various
- * DOM3 stuff and some interfaces specified by WHATWG.
+ * Implementation of nsIDOMDOMStringList, used by various DOM stuff.
  */
 
 #ifndef nsDOMLists_h___
 #define nsDOMLists_h___
 
 #include "nsIDOMDOMStringList.h"
-#include "nsIDOMNameList.h"
 #include "nsTArray.h"
 #include "nsString.h"
 
 class nsDOMStringList : public nsIDOMDOMStringList
 {
 public:
   nsDOMStringList();
   virtual ~nsDOMStringList();
@@ -63,25 +61,9 @@ public:
   {
     return mNames.AppendElement(aName) != nsnull;
   }
 
 private:
   nsTArray<nsString> mNames;
 };
 
-class nsNameList : public nsIDOMNameList
-{
-public:
-  nsNameList();
-  virtual ~nsNameList();
-
-  NS_DECL_ISUPPORTS
-  NS_DECL_NSIDOMNAMELIST
-
-  bool Add(const nsAString& aNamespaceURI, const nsAString& aName);
-
-private:
-  nsTArray<nsString> mNamespaceURIs;
-  nsTArray<nsString> mNames;
-};
-
 #endif /* nsDOMLists_h___ */
--- a/content/base/src/nsDocument.cpp
+++ b/content/base/src/nsDocument.cpp
@@ -4488,21 +4488,16 @@ nsDocument::CreateCDATASection(const nsA
 
 NS_IMETHODIMP
 nsDocument::CreateProcessingInstruction(const nsAString& aTarget,
                                         const nsAString& aData,
                                         nsIDOMProcessingInstruction** aReturn)
 {
   *aReturn = nsnull;
 
-  // There are no PIs for HTML
-  if (IsHTML()) {
-    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-  }
-
   nsresult rv = nsContentUtils::CheckQName(aTarget, PR_FALSE);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (FindInReadable(NS_LITERAL_STRING("?>"), aData)) {
     return NS_ERROR_DOM_INVALID_CHARACTER_ERR;
   }
 
   nsCOMPtr<nsIContent> content;
@@ -5889,33 +5884,16 @@ nsDocument::GetInputEncoding(nsAString& 
     return GetCharacterSet(aInputEncoding);
   }
 
   SetDOMStringToNull(aInputEncoding);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsDocument::GetXmlEncoding(nsAString& aXmlEncoding)
-{
-  WarnOnceAbout(eXmlEncoding);
-  if (!IsHTML() &&
-      mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS &&
-      mXMLDeclarationBits & XML_DECLARATION_BITS_ENCODING_EXISTS) {
-    // XXX We don't store the encoding given in the xml declaration.
-    // For now, just output the inputEncoding which we do store.
-    GetInputEncoding(aXmlEncoding);
-  } else {
-    SetDOMStringToNull(aXmlEncoding);
-  }
-
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 nsDocument::GetXmlStandalone(bool *aXmlStandalone)
 {
   WarnOnceAbout(eXmlStandalone);
   *aXmlStandalone = 
     !IsHTML() &&
     mXMLDeclarationBits & XML_DECLARATION_BITS_DECLARATION_EXISTS &&
     mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_EXISTS &&
     mXMLDeclarationBits & XML_DECLARATION_BITS_STANDALONE_YES;
@@ -8462,229 +8440,229 @@ nsIDocument::SizeOf() const
   for (nsIContent* node = GetFirstChild(); node;
        node = node->GetNextNode(this)) {
     size += node->SizeOf();
   }
 
   return size;
 }
 
-// Returns the root document in a document hierarchy.
-static nsIDocument*
-GetRootDocument(nsIDocument* aDoc)
-{
-  if (!aDoc) {
-    return nsnull;
-  }
-  nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
-  if (!shell) {
-    return nsnull;
-  }
-  nsPresContext* ctx = shell->GetPresContext();
-  if (!ctx) {
-    return nsnull;
-  }
-  nsRootPresContext* rpc = ctx->GetRootPresContext();
-  if (!rpc) {
-    return nsnull;
-  }
-  return rpc->Document();
-}
-
-class nsDispatchFullScreenChange : public nsRunnable
-{
-public:
-  nsDispatchFullScreenChange(nsIDocument *aDoc)
-    : mDoc(aDoc)
-  {
-    mTarget = aDoc->GetFullScreenElement();
-    if (!mTarget) {
-      mTarget = aDoc;
-    }
-  }
-
-  NS_IMETHOD Run()
-  {
-    nsContentUtils::DispatchTrustedEvent(mDoc,
-                                         mTarget,
-                                         NS_LITERAL_STRING("mozfullscreenchange"),
-                                         PR_TRUE,
-                                         PR_FALSE);
-    return NS_OK;
-  }
-
-  nsCOMPtr<nsIDocument> mDoc;
-  nsCOMPtr<nsISupports> mTarget;
-};
-
-void
-nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
-{
-  if (mIsFullScreen != aIsFullScreen) {
-    nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
-    NS_DispatchToCurrentThread(event);
-  }
-  mIsFullScreen = aIsFullScreen;
-  if (!mIsFullScreen) {
-    // Full-screen is being turned off. Reset the full-screen element, to
-    // save us from having to traverse the document hierarchy again in
-    // MozCancelFullScreen().
-    ResetFullScreenElement();
-  }
-}
-
-static bool
-UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
-{
-  aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
-  aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
-  return PR_TRUE;
-}
-
-static void
-UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
-{
-  nsIDocument* root = GetRootDocument(aDoc);
-  if (root) {
-    UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
-  }
-}
-
-void
-nsDocument::ResetFullScreenElement()
-{
+// Returns the root document in a document hierarchy.
+static nsIDocument*
+GetRootDocument(nsIDocument* aDoc)
+{
+  if (!aDoc) {
+    return nsnull;
+  }
+  nsCOMPtr<nsIPresShell> shell = aDoc->GetShell();
+  if (!shell) {
+    return nsnull;
+  }
+  nsPresContext* ctx = shell->GetPresContext();
+  if (!ctx) {
+    return nsnull;
+  }
+  nsRootPresContext* rpc = ctx->GetRootPresContext();
+  if (!rpc) {
+    return nsnull;
+  }
+  return rpc->Document();
+}
+
+class nsDispatchFullScreenChange : public nsRunnable
+{
+public:
+  nsDispatchFullScreenChange(nsIDocument *aDoc)
+    : mDoc(aDoc)
+  {
+    mTarget = aDoc->GetFullScreenElement();
+    if (!mTarget) {
+      mTarget = aDoc;
+    }
+  }
+
+  NS_IMETHOD Run()
+  {
+    nsContentUtils::DispatchTrustedEvent(mDoc,
+                                         mTarget,
+                                         NS_LITERAL_STRING("mozfullscreenchange"),
+                                         PR_TRUE,
+                                         PR_FALSE);
+    return NS_OK;
+  }
+
+  nsCOMPtr<nsIDocument> mDoc;
+  nsCOMPtr<nsISupports> mTarget;
+};
+
+void
+nsDocument::UpdateFullScreenStatus(bool aIsFullScreen)
+{
+  if (mIsFullScreen != aIsFullScreen) {
+    nsCOMPtr<nsIRunnable> event(new nsDispatchFullScreenChange(this));
+    NS_DispatchToCurrentThread(event);
+  }
+  mIsFullScreen = aIsFullScreen;
+  if (!mIsFullScreen) {
+    // Full-screen is being turned off. Reset the full-screen element, to
+    // save us from having to traverse the document hierarchy again in
+    // MozCancelFullScreen().
+    ResetFullScreenElement();
+  }
+}
+
+static bool
+UpdateFullScreenStatus(nsIDocument* aDocument, void* aData)
+{
+  aDocument->UpdateFullScreenStatus(*static_cast<bool*>(aData));
+  aDocument->EnumerateSubDocuments(UpdateFullScreenStatus, aData);
+  return PR_TRUE;
+}
+
+static void
+UpdateFullScreenStatusInDocTree(nsIDocument* aDoc, bool aIsFullScreen)
+{
+  nsIDocument* root = GetRootDocument(aDoc);
+  if (root) {
+    UpdateFullScreenStatus(root, static_cast<void*>(&aIsFullScreen));
+  }
+}
+
+void
+nsDocument::ResetFullScreenElement()
+{
   if (mFullScreenElement) {
     nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_FALSE);
-  }
-  mFullScreenElement = nsnull;
-}
-
-static bool
-ResetFullScreenElement(nsIDocument* aDocument, void* aData)
-{
-  aDocument->ResetFullScreenElement();
-  aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
-  return PR_TRUE;
-}
-
-static void
-ResetFullScreenElementInDocTree(nsIDocument* aDoc)
-{
-  nsIDocument* root = GetRootDocument(aDoc);
-  if (root) {
-    ResetFullScreenElement(root, nsnull);
-  }
-}
-
-NS_IMETHODIMP
+  }
+  mFullScreenElement = nsnull;
+}
+
+static bool
+ResetFullScreenElement(nsIDocument* aDocument, void* aData)
+{
+  aDocument->ResetFullScreenElement();
+  aDocument->EnumerateSubDocuments(ResetFullScreenElement, aData);
+  return PR_TRUE;
+}
+
+static void
+ResetFullScreenElementInDocTree(nsIDocument* aDoc)
+{
+  nsIDocument* root = GetRootDocument(aDoc);
+  if (root) {
+    ResetFullScreenElement(root, nsnull);
+  }
+}
+
+NS_IMETHODIMP
 nsDocument::MozCancelFullScreen()
 {
   if (!nsContentUtils::IsRequestFullScreenAllowed()) {
     return NS_OK;
   }
   CancelFullScreen();
   return NS_OK;
-}
-
-void
-nsDocument::CancelFullScreen()
-{
-  if (!nsContentUtils::IsFullScreenApiEnabled() ||
-      !IsFullScreenDoc() ||
-      !GetWindow()) {
-    return;
-  }
-
-  // Disable full-screen mode in all documents in this hierarchy.
-  UpdateFullScreenStatusInDocTree(this, PR_FALSE);
-
-  // Move the window out of full-screen mode.
-  GetWindow()->SetFullScreen(PR_FALSE);
-
-  return;
-}
-
-bool
-nsDocument::IsFullScreenDoc()
-{
-  return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
-}
-
-void
-nsDocument::RequestFullScreen(Element* aElement)
-{
-  if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
-    return;
-  }
-
-  // Reset the full-screen elements of every document in this document
-  // hierarchy.
-  ResetFullScreenElementInDocTree(this);
-  
-  if (aElement->IsInDoc()) {
-    // Propagate up the document hierarchy, setting the full-screen element as
-    // the element's container in ancestor documents. Note we don't propagate
-    // down the document hierarchy, the full-screen element (or its container)
-    // is not visible there.
-    mFullScreenElement = aElement;
+}
+
+void
+nsDocument::CancelFullScreen()
+{
+  if (!nsContentUtils::IsFullScreenApiEnabled() ||
+      !IsFullScreenDoc() ||
+      !GetWindow()) {
+    return;
+  }
+
+  // Disable full-screen mode in all documents in this hierarchy.
+  UpdateFullScreenStatusInDocTree(this, PR_FALSE);
+
+  // Move the window out of full-screen mode.
+  GetWindow()->SetFullScreen(PR_FALSE);
+
+  return;
+}
+
+bool
+nsDocument::IsFullScreenDoc()
+{
+  return nsContentUtils::IsFullScreenApiEnabled() && mIsFullScreen;
+}
+
+void
+nsDocument::RequestFullScreen(Element* aElement)
+{
+  if (!aElement || !nsContentUtils::IsFullScreenApiEnabled() || !GetWindow()) {
+    return;
+  }
+
+  // Reset the full-screen elements of every document in this document
+  // hierarchy.
+  ResetFullScreenElementInDocTree(this);
+  
+  if (aElement->IsInDoc()) {
+    // Propagate up the document hierarchy, setting the full-screen element as
+    // the element's container in ancestor documents. Note we don't propagate
+    // down the document hierarchy, the full-screen element (or its container)
+    // is not visible there.
+    mFullScreenElement = aElement;
     // Set the full-screen state on the element, so the css-pseudo class
     // applies to the element.
-    nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
-    nsIDocument* child = this;
-    nsIDocument* parent;
-    while (parent = child->GetParentDocument()) {
-      nsIContent* content = parent->FindContentForSubDocument(child);
-      nsCOMPtr<Element> element(do_QueryInterface(content));
+    nsEventStateManager::SetFullScreenState(mFullScreenElement, PR_TRUE);
+    nsIDocument* child = this;
+    nsIDocument* parent;
+    while (parent = child->GetParentDocument()) {
+      nsIContent* content = parent->FindContentForSubDocument(child);
+      nsCOMPtr<Element> element(do_QueryInterface(content));
       // Containing frames also need the css-pseudo class applied.
-      nsEventStateManager::SetFullScreenState(element, PR_TRUE);
-      static_cast<nsDocument*>(parent)->mFullScreenElement = element;
-      child = parent;
-    }
-  }
-
-  // Set all documents in hierarchy to full-screen mode.
-  UpdateFullScreenStatusInDocTree(this, PR_TRUE);
-
-  // Make the window full-screen. Note we must make the state changes above
-  // before making the window full-screen, as then the document reports as
-  // being in full-screen mode when the Chrome "fullscreen" event fires,
-  // enabling browser.js to distinguish between browser and dom full-screen
-  // modes.
-  GetWindow()->SetFullScreen(PR_TRUE);
-}
-
-NS_IMETHODIMP
-nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
-{
-  NS_ENSURE_ARG_POINTER(aFullScreenElement);
-  if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
-    *aFullScreenElement = nsnull;
-    return NS_OK;
-  }
-  nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
-  NS_IF_ADDREF(*aFullScreenElement = e);
-  return NS_OK;
-}
-
-Element*
-nsDocument::GetFullScreenElement()
-{
-  if (!nsContentUtils::IsFullScreenApiEnabled() ||
-      (mFullScreenElement && !mFullScreenElement->IsInDoc())) {
-    return nsnull;
-  }
-  return mFullScreenElement;
-}
-
-NS_IMETHODIMP
-nsDocument::GetMozFullScreen(bool *aFullScreen)
-{
-  NS_ENSURE_ARG_POINTER(aFullScreen);
-  *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
-  return NS_OK;
+      nsEventStateManager::SetFullScreenState(element, PR_TRUE);
+      static_cast<nsDocument*>(parent)->mFullScreenElement = element;
+      child = parent;
+    }
+  }
+
+  // Set all documents in hierarchy to full-screen mode.
+  UpdateFullScreenStatusInDocTree(this, PR_TRUE);
+
+  // Make the window full-screen. Note we must make the state changes above
+  // before making the window full-screen, as then the document reports as
+  // being in full-screen mode when the Chrome "fullscreen" event fires,
+  // enabling browser.js to distinguish between browser and dom full-screen
+  // modes.
+  GetWindow()->SetFullScreen(PR_TRUE);
+}
+
+NS_IMETHODIMP
+nsDocument::GetMozFullScreenElement(nsIDOMHTMLElement **aFullScreenElement)
+{
+  NS_ENSURE_ARG_POINTER(aFullScreenElement);
+  if (!nsContentUtils::IsFullScreenApiEnabled() || !IsFullScreenDoc()) {
+    *aFullScreenElement = nsnull;
+    return NS_OK;
+  }
+  nsCOMPtr<nsIDOMHTMLElement> e(do_QueryInterface(GetFullScreenElement()));
+  NS_IF_ADDREF(*aFullScreenElement = e);
+  return NS_OK;
+}
+
+Element*
+nsDocument::GetFullScreenElement()
+{
+  if (!nsContentUtils::IsFullScreenApiEnabled() ||
+      (mFullScreenElement && !mFullScreenElement->IsInDoc())) {
+    return nsnull;
+  }
+  return mFullScreenElement;
+}
+
+NS_IMETHODIMP
+nsDocument::GetMozFullScreen(bool *aFullScreen)
+{
+  NS_ENSURE_ARG_POINTER(aFullScreen);
+  *aFullScreen = nsContentUtils::IsFullScreenApiEnabled() && IsFullScreenDoc();
+  return NS_OK;
 }
 
 PRInt64
 nsDocument::SizeOf() const
 {
   PRInt64 size = MemoryReporter::GetBasicSize<nsDocument, nsIDocument>(this);
   size += mAttrStyleSheet ? mAttrStyleSheet->DOMSizeOf() : 0;
   return size;
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -108,27 +108,27 @@
 #include "mozilla/AutoRestore.h"
 #include "mozilla/unused.h"
 
 #include "Layers.h"
 
 #include "ContentParent.h"
 #include "TabParent.h"
 #include "mozilla/layout/RenderFrameParent.h"
+#include "mozilla/dom/Element.h"
+#include "mozilla/Preferences.h"
 
-#include "mozilla/Preferences.h"
+#include "jsapi.h"
 
 using namespace mozilla;
 using namespace mozilla::dom;
 using namespace mozilla::layers;
 using namespace mozilla::layout;
 typedef FrameMetrics::ViewID ViewID;
 
-#include "jsapi.h"
-
 class nsAsyncDocShellDestroyer : public nsRunnable
 {
 public:
   nsAsyncDocShellDestroyer(nsIDocShell* aDocShell)
     : mDocShell(aDocShell)
   {
   }
 
@@ -310,17 +310,17 @@ NS_IMPL_CYCLE_COLLECTING_ADDREF(nsFrameL
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsFrameLoader)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsFrameLoader)
   NS_INTERFACE_MAP_ENTRY(nsIFrameLoader)
   NS_INTERFACE_MAP_ENTRY(nsIContentViewManager)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIFrameLoader)
 NS_INTERFACE_MAP_END
 
-nsFrameLoader::nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated)
+nsFrameLoader::nsFrameLoader(Element* aOwner, bool aNetworkCreated)
   : mOwnerContent(aOwner)
   , mDepthTooGreat(PR_FALSE)
   , mIsTopLevelContent(PR_FALSE)
   , mDestroyCalled(PR_FALSE)
   , mNeedsAsyncDestroy(PR_FALSE)
   , mInSwap(PR_FALSE)
   , mInShow(PR_FALSE)
   , mHideCalled(PR_FALSE)
@@ -331,17 +331,17 @@ nsFrameLoader::nsFrameLoader(nsIContent 
   , mCurrentRemoteFrame(nsnull)
   , mRemoteBrowser(nsnull)
   , mRenderMode(RENDER_MODE_DEFAULT)
   , mEventMode(EVENT_MODE_NORMAL_DISPATCH)
 {
 }
 
 nsFrameLoader*
-nsFrameLoader::Create(nsIContent* aOwner, bool aNetworkCreated)
+nsFrameLoader::Create(Element* aOwner, bool aNetworkCreated)
 {
   NS_ENSURE_TRUE(aOwner, nsnull);
   nsIDocument* doc = aOwner->GetOwnerDoc();
   NS_ENSURE_TRUE(doc && !doc->GetDisplayDocument() &&
                  ((!doc->IsLoadedAsData() && aOwner->GetCurrentDoc()) ||
                    doc->IsStaticDocument()),
                  nsnull);
 
@@ -957,18 +957,18 @@ nsFrameLoader::SwapWithOtherLoader(nsFra
                                    nsRefPtr<nsFrameLoader>& aFirstToSwap,
                                    nsRefPtr<nsFrameLoader>& aSecondToSwap)
 {
   NS_PRECONDITION((aFirstToSwap == this && aSecondToSwap == aOther) ||
                   (aFirstToSwap == aOther && aSecondToSwap == this),
                   "Swapping some sort of random loaders?");
   NS_ENSURE_STATE(!mInShow && !aOther->mInShow);
 
-  nsIContent* ourContent = mOwnerContent;
-  nsIContent* otherContent = aOther->mOwnerContent;
+  Element* ourContent = mOwnerContent;
+  Element* otherContent = aOther->mOwnerContent;
 
   if (!ourContent || !otherContent) {
     // Can't handle this
     return NS_ERROR_NOT_IMPLEMENTED;
   }
 
   // Make sure there are no same-origin issues
   bool equal;
@@ -1332,17 +1332,17 @@ nsFrameLoader::Destroy()
 NS_IMETHODIMP
 nsFrameLoader::GetDepthTooGreat(bool* aDepthTooGreat)
 {
   *aDepthTooGreat = mDepthTooGreat;
   return NS_OK;
 }
 
 void
-nsFrameLoader::SetOwnerContent(nsIContent* aContent)
+nsFrameLoader::SetOwnerContent(Element* aContent)
 {
   mOwnerContent = aContent;
   if (RenderFrameParent* rfp = GetCurrentRemoteFrame()) {
     rfp->OwnerContentChanged(aContent);
   }
 }
 
 bool
--- a/content/base/src/nsFrameLoader.h
+++ b/content/base/src/nsFrameLoader.h
@@ -48,17 +48,17 @@
 #include "nsStringFwd.h"
 #include "nsIFrameLoader.h"
 #include "nsPoint.h"
 #include "nsSize.h"
 #include "nsIURI.h"
 #include "nsAutoPtr.h"
 #include "nsFrameMessageManager.h"
 #include "Layers.h"
-#include "nsIContent.h"
+#include "mozilla/dom/Element.h"
 
 class nsIURI;
 class nsSubDocumentFrame;
 class nsIView;
 class nsIInProcessContentFrameMessageManager;
 class AutoResetInShow;
 
 namespace mozilla {
@@ -165,33 +165,34 @@ class nsFrameLoader : public nsIFrameLoa
                       public nsIContentViewManager
 {
   friend class AutoResetInShow;
   typedef mozilla::dom::PBrowserParent PBrowserParent;
   typedef mozilla::dom::TabParent TabParent;
   typedef mozilla::layout::RenderFrameParent RenderFrameParent;
 
 protected:
-  nsFrameLoader(nsIContent *aOwner, bool aNetworkCreated);
+  nsFrameLoader(mozilla::dom::Element* aOwner, bool aNetworkCreated);
 
 public:
   ~nsFrameLoader() {
     mNeedsAsyncDestroy = PR_TRUE;
     if (mMessageManager) {
       mMessageManager->Disconnect();
     }
     nsFrameLoader::Destroy();
   }
 
   bool AsyncScrollEnabled() const
   {
     return !!(mRenderMode & RENDER_MODE_ASYNC_SCROLL);
   }
 
-  static nsFrameLoader* Create(nsIContent* aOwner, bool aNetworkCreated);
+  static nsFrameLoader* Create(mozilla::dom::Element* aOwner,
+                               bool aNetworkCreated);
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsFrameLoader, nsIFrameLoader)
   NS_DECL_NSIFRAMELOADER
   NS_DECL_NSICONTENTVIEWMANAGER
   NS_HIDDEN_(nsresult) CheckForRecursiveLoad(nsIURI* aURI);
   nsresult ReallyStartLoading();
   void Finalize();
@@ -274,18 +275,18 @@ public:
    * <browser>.
    */
   void SetCurrentRemoteFrame(RenderFrameParent* aFrame)
   {
     mCurrentRemoteFrame = aFrame;
   }
   nsFrameMessageManager* GetFrameMessageManager() { return mMessageManager; }
 
-  nsIContent* GetOwnerContent() { return mOwnerContent; }
-  void SetOwnerContent(nsIContent* aContent);
+  mozilla::dom::Element* GetOwnerContent() { return mOwnerContent; }
+  void SetOwnerContent(mozilla::dom::Element* aContent);
 
 private:
 
   bool ShouldUseRemoteProcess();
 
   /**
    * If we are an IPC frame, set mRemoteFrame. Otherwise, create and
    * initialize mDocShell.
@@ -308,17 +309,17 @@ private:
   // Return true if remote browser created; nothing else to do
   bool TryRemoteBrowser();
 
   // Tell the remote browser that it's now "virtually visible"
   bool ShowRemoteFrame(const nsIntSize& size);
 
   nsCOMPtr<nsIDocShell> mDocShell;
   nsCOMPtr<nsIURI> mURIToLoad;
-  nsIContent *mOwnerContent; // WEAK
+  mozilla::dom::Element* mOwnerContent; // WEAK
 public:
   // public because a callback needs these.
   nsRefPtr<nsFrameMessageManager> mMessageManager;
   nsCOMPtr<nsIInProcessContentFrameMessageManager> mChildMessageManager;
 private:
   bool mDepthTooGreat : 1;
   bool mIsTopLevelContent : 1;
   bool mDestroyCalled : 1;
--- a/content/base/src/nsFrameMessageManager.cpp
+++ b/content/base/src/nsFrameMessageManager.cpp
@@ -1,30 +1,31 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
  *
  * Software distributed under the License is distributed on an "AS IS" basis,
  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
  * for the specific language governing rights and limitations under the
  * License.
  *
  * The Original Code is mozilla.org code.
  *
  * The Initial Developer of the Original Code is
- * Mozilla Corporation
+ * the Mozilla Foundation.
  * Portions created by the Initial Developer are Copyright (C) 2010
  * the Initial Developer. All Rights Reserved.
  *
  * Contributor(s):
+ *   Ms2ger <ms2ger@gmail.com>
  *
  * Alternatively, the contents of this file may be used under the terms of
  * either the GNU General Public License Version 2 or later (the "GPL"), or
  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
  * in which case the provisions of the GPL or the LGPL are applicable instead
  * of those above. If you wish to allow use of your version of this file only
  * under the terms of either the GPL or the LGPL, and not to allow others to
  * use your version of this file under the terms of the MPL, indicate your
@@ -183,101 +184,70 @@ nsFrameMessageManager::RemoveDelayedFram
   mPendingScripts.RemoveElement(aURL);
   return NS_OK;
 }
 
 static JSBool
 JSONCreator(const jschar* aBuf, uint32 aLen, void* aData)
 {
   nsAString* result = static_cast<nsAString*>(aData);
-  result->Append((PRUnichar*)aBuf, (PRUint32)aLen);
-  return JS_TRUE;
+  result->Append(static_cast<const PRUnichar*>(aBuf),
+                 static_cast<PRUint32>(aLen));
+  return true;
 }
 
-nsresult
-nsFrameMessageManager::GetParamsForMessage(nsAString& aMessageName,
+void
+nsFrameMessageManager::GetParamsForMessage(const jsval& aObject,
+                                           JSContext* aCx,
                                            nsAString& aJSON)
 {
-  aMessageName.Truncate();
   aJSON.Truncate();
-  nsAXPCNativeCallContext* ncc = nsnull;
-  nsresult rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
-  NS_ENSURE_SUCCESS(rv, rv);
-  NS_ENSURE_STATE(ncc);
-
-  JSContext* ctx = nsnull;
-  rv = ncc->GetJSContext(&ctx);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  PRUint32 argc;
-  jsval* argv = nsnull;
-  ncc->GetArgc(&argc);
-  ncc->GetArgvPtr(&argv);
-
-  JSAutoRequest ar(ctx);
-  JSString* str;
-  if (argc && (str = JS_ValueToString(ctx, argv[0])) && str) {
-    nsDependentJSString depStr;
-    if (!depStr.init(ctx, str)) {
-      return NS_ERROR_OUT_OF_MEMORY;
-    }
-    aMessageName.Assign(depStr);
-  }
-
-  if (argc >= 2) {
-    jsval v = argv[1];
-    JS_Stringify(ctx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
-  }
-  return NS_OK;
+  JSAutoRequest ar(aCx);
+  jsval v = aObject;
+  JS_Stringify(aCx, &v, nsnull, JSVAL_NULL, JSONCreator, &aJSON);
 }
 
 NS_IMETHODIMP
-nsFrameMessageManager::SendSyncMessage()
+nsFrameMessageManager::SendSyncMessage(const nsAString& aMessageName,
+                                       const jsval& aObject,
+                                       JSContext* aCx,
+                                       PRUint8 aArgc,
+                                       jsval* aRetval)
 {
   NS_ASSERTION(!IsGlobal(), "Should not call SendSyncMessage in chrome");
   NS_ASSERTION(!IsWindowLevel(), "Should not call SendSyncMessage in chrome");
   NS_ASSERTION(!mParentManager, "Should not have parent manager in content!");
+  *aRetval = JSVAL_VOID;
   if (mSyncCallback) {
     NS_ENSURE_TRUE(mCallbackData, NS_ERROR_NOT_INITIALIZED);
-    nsString messageName;
     nsString json;
-    nsresult rv = GetParamsForMessage(messageName, json);
-    NS_ENSURE_SUCCESS(rv, rv);
+    if (aArgc >= 2) {
+      GetParamsForMessage(aObject, aCx, json);
+    }
     InfallibleTArray<nsString> retval;
-    if (mSyncCallback(mCallbackData, messageName, json, &retval)) {
-      nsAXPCNativeCallContext* ncc = nsnull;
-      rv = nsContentUtils::XPConnect()->GetCurrentNativeCallContext(&ncc);
-      NS_ENSURE_SUCCESS(rv, rv);
-      NS_ENSURE_STATE(ncc);
-
-      JSContext* ctx = nsnull;
-      rv = ncc->GetJSContext(&ctx);
-      NS_ENSURE_SUCCESS(rv, rv);
-      JSAutoRequest ar(ctx);
-
+    if (mSyncCallback(mCallbackData, aMessageName, json, &retval)) {
+      JSAutoRequest ar(aCx);
       PRUint32 len = retval.Length();
-      JSObject* dataArray = JS_NewArrayObject(ctx, len, NULL);
+      JSObject* dataArray = JS_NewArrayObject(aCx, len, NULL);
       NS_ENSURE_TRUE(dataArray, NS_ERROR_OUT_OF_MEMORY);
 
       for (PRUint32 i = 0; i < len; ++i) {
-        if (retval[i].IsEmpty())
+        if (retval[i].IsEmpty()) {
           continue;
+        }
 
         jsval ret = JSVAL_VOID;
-        if (!JS_ParseJSON(ctx, (jschar*)retval[i].get(),
-                          (uint32)retval[i].Length(), &ret)) {
+        if (!JS_ParseJSON(aCx, static_cast<const jschar*>(retval[i].get()),
+                          retval[i].Length(), &ret)) {
           return NS_ERROR_UNEXPECTED;
         }
-        NS_ENSURE_TRUE(JS_SetElement(ctx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
+        NS_ENSURE_TRUE(JS_SetElement(aCx, dataArray, i, &ret), NS_ERROR_OUT_OF_MEMORY);
       }
 
-      jsval* retvalPtr;
-      ncc->GetRetValPtr(&retvalPtr);
-      *retvalPtr = OBJECT_TO_JSVAL(dataArray);
-      ncc->SetReturnValueWasSet(PR_TRUE);
+      *aRetval = OBJECT_TO_JSVAL(dataArray);
     }
   }
   return NS_OK;
 }
 
 nsresult
 nsFrameMessageManager::SendAsyncMessageInternal(const nsAString& aMessage,
                                                 const nsAString& aJSON)
@@ -290,23 +260,26 @@ nsFrameMessageManager::SendAsyncMessageI
   for (PRInt32 i = 0; i < len; ++i) {
     static_cast<nsFrameMessageManager*>(mChildManagers[i])->
       SendAsyncMessageInternal(aMessage, aJSON);
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsFrameMessageManager::SendAsyncMessage()
+nsFrameMessageManager::SendAsyncMessage(const nsAString& aMessageName,
+                                        const jsval& aObject,
+                                        JSContext* aCx,
+                                        PRUint8 aArgc)
 {
-  nsString messageName;
   nsString json;
-  nsresult rv = GetParamsForMessage(messageName, json);
-  NS_ENSURE_SUCCESS(rv, rv);
-  return SendAsyncMessageInternal(messageName, json);
+  if (aArgc >= 2) {
+    GetParamsForMessage(aObject, aCx, json);
+  }
+  return SendAsyncMessageInternal(aMessageName, json);
 }
 
 NS_IMETHODIMP
 nsFrameMessageManager::Dump(const nsAString& aStr)
 {
   fputs(NS_ConvertUTF16toUTF8(aStr).get(), stdout);
   fflush(stdout);
   return NS_OK;
@@ -423,24 +396,24 @@ nsFrameMessageManager::ReceiveMessage(ns
 
         js::AutoValueRooter objectsv(ctx);
         objectsv.set(OBJECT_TO_JSVAL(aObjectsArray));
         if (!JS_WrapValue(ctx, objectsv.jsval_addr()))
             return NS_ERROR_UNEXPECTED;
 
         jsval json = JSVAL_NULL;
         if (!aJSON.IsEmpty()) {
-          if (!JS_ParseJSON(ctx, (jschar*)nsString(aJSON).get(),
-                            (uint32)aJSON.Length(), &json)) {
+          if (!JS_ParseJSON(ctx, static_cast<const jschar*>(PromiseFlatString(aJSON).get()),
+                            aJSON.Length(), &json)) {
             json = JSVAL_NULL;
           }
         }
         JSString* jsMessage =
           JS_NewUCStringCopyN(ctx,
-                              reinterpret_cast<const jschar *>(nsString(aMessage).get()),
+                              static_cast<const jschar*>(PromiseFlatString(aMessage).get()),
                               aMessage.Length());
         NS_ENSURE_TRUE(jsMessage, NS_ERROR_OUT_OF_MEMORY);
         JS_DefineProperty(ctx, param, "target", targetv, NULL, NULL, JSPROP_ENUMERATE);
         JS_DefineProperty(ctx, param, "name",
                           STRING_TO_JSVAL(jsMessage), NULL, NULL, JSPROP_ENUMERATE);
         JS_DefineProperty(ctx, param, "sync",
                           BOOLEAN_TO_JSVAL(aSync), NULL, NULL, JSPROP_ENUMERATE);
         JS_DefineProperty(ctx, param, "json", json, NULL, NULL, JSPROP_ENUMERATE);
--- a/content/base/src/nsFrameMessageManager.h
+++ b/content/base/src/nsFrameMessageManager.h
@@ -145,17 +145,19 @@ public:
                        bool aLoadScripts = true);
   void RemoveChildManager(nsFrameMessageManager* aManager)
   {
     mChildManagers.RemoveObject(aManager);
   }
 
   void Disconnect(bool aRemoveFromParent = true);
   void SetCallbackData(void* aData, bool aLoadScripts = true);
-  nsresult GetParamsForMessage(nsAString& aMessageName, nsAString& aJSON);
+  void GetParamsForMessage(const jsval& aObject,
+                           JSContext* aCx,
+                           nsAString& aJSON);
   nsresult SendAsyncMessageInternal(const nsAString& aMessage,
                                     const nsAString& aJSON);
   JSContext* GetJSContext() { return mContext; }
   nsFrameMessageManager* GetParentManager() { return mParentManager; }
   void SetParentManager(nsFrameMessageManager* aParent)
   {
     NS_ASSERTION(!mParentManager, "We have parent manager already!");
     NS_ASSERTION(mChrome, "Should not set parent manager!");
--- a/content/base/src/nsGenericDOMDataNode.cpp
+++ b/content/base/src/nsGenericDOMDataNode.cpp
@@ -835,91 +835,16 @@ nsGenericDOMDataNode::GetWholeText(nsASt
     node = do_QueryInterface(parent->GetChildAt(first));
     node->GetData(tmp);
     aWholeText.Append(tmp);
   } while (first++ < last);
 
   return NS_OK;
 }
 
-nsresult
-nsGenericDOMDataNode::ReplaceWholeText(const nsAString& aContent,
-                                       nsIDOMText **aResult)
-{
-  *aResult = nsnull;
-
-  GetOwnerDoc()->WarnOnceAbout(nsIDocument::eReplaceWholeText);
-
-  // Handle parent-less nodes
-  nsCOMPtr<nsIContent> parent = GetParent();
-  if (!parent) {
-    if (aContent.IsEmpty()) {
-      return NS_OK;
-    }
-
-    SetNodeValue(aContent);
-    return CallQueryInterface(this, aResult);
-  }
-
-  // We're relying on mozAutoSubtreeModified to keep the doc alive here.
-  nsIDocument* doc = GetOwnerDoc();
-
-  // Batch possible DOMSubtreeModified events.
-  mozAutoSubtreeModified subtree(doc, nsnull);
-
-  PRInt32 index = parent->IndexOf(this);
-  if (index < 0) {
-    NS_WARNING("Trying to use .replaceWholeText with an anonymous text node "
-               "child of a binding parent?");
-    return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
-  }
-
-  // We don't support entity references or read-only nodes, so remove the
-  // logically adjacent text nodes (which therefore must all be siblings of
-  // this) and set this one to the provided text, if that text isn't empty.
-  PRInt32 first =
-    FirstLogicallyAdjacentTextNode(parent, index);
-  PRInt32 last =
-    LastLogicallyAdjacentTextNode(parent, index, parent->GetChildCount());
-
-  // Fire mutation events. Optimize the common case of there being no
-  // listeners
-  if (nsContentUtils::
-        HasMutationListeners(doc, NS_EVENT_BITS_MUTATION_NODEREMOVED)) {
-    for (PRInt32 i = first; i <= last; ++i) {
-      nsCOMPtr<nsIContent> child = parent->GetChildAt((PRUint32)i);
-      if (child &&
-          (i != index || aContent.IsEmpty())) {
-        nsContentUtils::MaybeFireNodeRemoved(child, parent, doc);
-      }
-    }
-  }
-
-  // Remove the needed nodes
-  // Don't want to use 'doc' here since it might no longer be the correct
-  // document.
-  mozAutoDocUpdate updateBatch(parent->GetCurrentDoc(), UPDATE_CONTENT_MODEL,
-                               PR_TRUE);
-
-  do {
-    if (last == index && !aContent.IsEmpty())
-      continue;
-
-    parent->RemoveChildAt(last, PR_TRUE);
-  } while (last-- > first);
-
-  // Empty string means we removed this node too.
-  if (aContent.IsEmpty()) {
-    return NS_OK;
-  }
-
-  SetText(aContent.BeginReading(), aContent.Length(), PR_TRUE);
-  return CallQueryInterface(this, aResult);
-}
-
 //----------------------------------------------------------------------
 
 // Implementation of the nsIContent interface text functions
 
 const nsTextFragment *
 nsGenericDOMDataNode::GetText()
 {
   return &mText;
--- a/content/base/src/nsGenericDOMDataNode.h
+++ b/content/base/src/nsGenericDOMDataNode.h
@@ -325,18 +325,16 @@ protected:
   {
     return static_cast<nsDataSlots*>(GetExistingSlots());
   }
 
   nsresult SplitText(PRUint32 aOffset, nsIDOMText** aReturn);
 
   nsresult GetWholeText(nsAString& aWholeText);
 
-  nsresult ReplaceWholeText(const nsAString& aContent, nsIDOMText **aReturn);
-
   nsresult GetIsElementContentWhitespace(bool *aReturn)
   {
     GetOwnerDoc()->WarnOnceAbout(nsIDocument::eIsElementContentWhitespace);
     *aReturn = TextIsOnlyWhitespace();
     return NS_OK;
   }
 
   static PRInt32 FirstLogicallyAdjacentTextNode(nsIContent* aParent,
--- a/content/base/src/nsInProcessTabChildGlobal.h
+++ b/content/base/src/nsInProcessTabChildGlobal.h
@@ -61,20 +61,25 @@ class nsInProcessTabChildGlobal : public
 public:
   nsInProcessTabChildGlobal(nsIDocShell* aShell, nsIContent* aOwner,
                             nsFrameMessageManager* aChrome);
   virtual ~nsInProcessTabChildGlobal();
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsInProcessTabChildGlobal,
                                            nsDOMEventTargetHelper)
   NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
-  NS_IMETHOD SendSyncMessage()
+  NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
+                             const jsval& aObject,
+                             JSContext* aCx,
+                             PRUint8 aArgc,
+                             jsval* aRetval)
   {
-    return mMessageManager ? mMessageManager->SendSyncMessage()
-                           : NS_ERROR_NULL_POINTER;
+    return mMessageManager
+      ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
+      : NS_ERROR_NULL_POINTER;
   }
   NS_IMETHOD GetContent(nsIDOMWindow** aContent);
   NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
   NS_IMETHOD Dump(const nsAString& aStr)
   {
     return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
   }
   NS_IMETHOD PrivateNoteIntentionalCrash();
--- a/content/base/src/nsObjectLoadingContent.cpp
+++ b/content/base/src/nsObjectLoadingContent.cpp
@@ -633,17 +633,18 @@ nsObjectLoadingContent::OnStartRequest(n
       // final listener.
       if (!mFinalListener) {
         mType = newType;
         return NS_BINDING_ABORTED;
       }
       break;
     case eType_Document: {
       if (!mFrameLoader) {
-        mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
+        mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
+                                             mNetworkCreated);
         if (!mFrameLoader) {
           Fallback(PR_FALSE);
           return NS_ERROR_UNEXPECTED;
         }
       }
 
       rv = mFrameLoader->CheckForRecursiveLoad(uri);
       if (NS_FAILED(rv)) {
@@ -1272,17 +1273,18 @@ nsObjectLoadingContent::LoadObject(nsIUR
     if (newType != mType) {
       LOG(("OBJLC [%p]: (eOverrideServerType) Changing type from %u to %u\n", this, mType, newType));
 
       UnloadContent();
 
       // Must have a frameloader before creating a frame, or the frame will
       // create its own.
       if (!mFrameLoader && newType == eType_Document) {
-        mFrameLoader = nsFrameLoader::Create(thisContent, mNetworkCreated);
+        mFrameLoader = nsFrameLoader::Create(thisContent->AsElement(),
+                                             mNetworkCreated);
         if (!mFrameLoader) {
           mURI = nsnull;
           return NS_OK;
         }
       }
 
       // Must notify here for plugins
       // If aNotify is false, we'll just wait until we get a frame and use the
@@ -1974,18 +1976,18 @@ nsObjectLoadingContent::CreateStaticClon
     nsIObjectFrame* frame =
       const_cast<nsObjectLoadingContent*>(this)->GetExistingFrame(eDontFlush);
     nsIFrame* f = do_QueryFrame(frame);
     aDest->mPrintFrame = f;
   }
 
   if (mFrameLoader) {
     nsCOMPtr<nsIContent> content =
-      do_QueryInterface(static_cast<nsIImageLoadingContent*>((aDest)));
-    nsFrameLoader* fl = nsFrameLoader::Create(content, PR_FALSE);
+      do_QueryInterface(static_cast<nsIImageLoadingContent*>(aDest));
+    nsFrameLoader* fl = nsFrameLoader::Create(content->AsElement(), PR_FALSE);
     if (fl) {
       aDest->mFrameLoader = fl;
       mFrameLoader->CreateStaticClone(fl);
     }
   }
 }
 
 NS_IMETHODIMP
--- a/content/base/src/nsXMLHttpRequest.cpp
+++ b/content/base/src/nsXMLHttpRequest.cpp
@@ -1396,20 +1396,17 @@ nsXMLHttpRequest::DispatchProgressEvent(
     return;
   }
 
   progress->InitProgressEvent(aType, PR_FALSE, PR_FALSE, aLengthComputable,
                               aLoaded, (aTotal == LL_MAXUINT) ? 0 : aTotal);
 
   if (aUseLSEventWrapper) {
     nsCOMPtr<nsIDOMProgressEvent> xhrprogressEvent =
-      new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize);
-    if (!xhrprogressEvent) {
-      return;
-    }
+      new nsXMLHttpProgressEvent(progress, aPosition, aTotalSize, mOwner);
     event = xhrprogressEvent;
   }
   aTarget->DispatchDOMEvent(nsnull, event, nsnull, nsnull);
   
   if (dispatchLoadend) {
     DispatchProgressEvent(aTarget, NS_LITERAL_STRING(LOADEND_STR),
                           aUseLSEventWrapper, aLengthComputable,
                           aLoaded, aTotal, aPosition, aTotalSize);
@@ -3235,17 +3232,19 @@ nsHeaderVisitor::VisitHeader(const nsACS
         mHeaders.Append('\n');
     }
     return NS_OK;
 }
 
 // DOM event class to handle progress notifications
 nsXMLHttpProgressEvent::nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
                                                PRUint64 aCurrentProgress,
-                                               PRUint64 aMaxProgress)
+                                               PRUint64 aMaxProgress,
+                                               nsPIDOMWindow* aWindow)
+  : mWindow(aWindow)
 {
   mInner = static_cast<nsDOMProgressEvent*>(aInner);
   mCurProgress = aCurrentProgress;
   mMaxProgress = aMaxProgress;
 }
 
 nsXMLHttpProgressEvent::~nsXMLHttpProgressEvent()
 {}
@@ -3265,35 +3264,52 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(XMLHttpProgressEvent)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(nsXMLHttpProgressEvent)
 NS_IMPL_CYCLE_COLLECTING_RELEASE(nsXMLHttpProgressEvent)
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsXMLHttpProgressEvent)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mInner);
+  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mWindow);
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(nsXMLHttpProgressEvent)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR_AMBIGUOUS(mInner,
                                                        nsIDOMProgressEvent)
+  NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mWindow);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMETHODIMP nsXMLHttpProgressEvent::GetInput(nsIDOMLSInput * *aInput)
 {
   *aInput = nsnull;
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
+void
+nsXMLHttpProgressEvent::WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations aOperation)
+{
+  if (!mWindow) {
+    return;
+  }
+  nsCOMPtr<nsIDocument> document =
+    do_QueryInterface(mWindow->GetExtantDocument());
+  if (!document) {
+    return;
+  }
+  document->WarnOnceAbout(aOperation);
+}
+
 NS_IMETHODIMP nsXMLHttpProgressEvent::GetPosition(PRUint32 *aPosition)
 {
+  WarnAboutLSProgressEvent(nsIDocument::ePosition);
   // XXX can we change the iface?
   LL_L2UI(*aPosition, mCurProgress);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsXMLHttpProgressEvent::GetTotalSize(PRUint32 *aTotalSize)
 {
+  WarnAboutLSProgressEvent(nsIDocument::eTotalSize);
   // XXX can we change the iface?
   LL_L2UI(*aTotalSize, mMaxProgress);
   return NS_OK;
 }
-
--- a/content/base/src/nsXMLHttpRequest.h
+++ b/content/base/src/nsXMLHttpRequest.h
@@ -375,17 +375,18 @@ protected:
 class nsXMLHttpProgressEvent : public nsIDOMProgressEvent,
                                public nsIDOMLSProgressEvent,
                                public nsIDOMNSEvent,
                                public nsIPrivateDOMEvent
 {
 public:
   nsXMLHttpProgressEvent(nsIDOMProgressEvent* aInner,
                          PRUint64 aCurrentProgress,
-                         PRUint64 aMaxProgress);
+                         PRUint64 aMaxProgress,
+                         nsPIDOMWindow* aWindow);
   virtual ~nsXMLHttpProgressEvent();
 
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsXMLHttpProgressEvent, nsIDOMNSEvent)
   NS_FORWARD_NSIDOMEVENT(mInner->)
   NS_FORWARD_NSIDOMNSEVENT(mInner->)
   NS_FORWARD_NSIDOMPROGRESSEVENT(mInner->)
   NS_DECL_NSIDOMLSPROGRESSEVENT
@@ -416,16 +417,19 @@ public:
     mInner->Serialize(aMsg, aSerializeInterfaceType);
   }
   virtual bool Deserialize(const IPC::Message* aMsg, void** aIter)
   {
     return mInner->Deserialize(aMsg, aIter);
   }
 
 protected:
+  void WarnAboutLSProgressEvent(nsIDocument::DeprecatedOperations);
+
   // Use nsDOMProgressEvent so that we can forward
   // most of the method calls easily.
   nsRefPtr<nsDOMProgressEvent> mInner;
+  nsCOMPtr<nsPIDOMWindow> mWindow;
   PRUint64 mCurProgress;
   PRUint64 mMaxProgress;
 };
 
 #endif
--- a/content/base/test/Makefile.in
+++ b/content/base/test/Makefile.in
@@ -226,17 +226,16 @@ include $(topsrcdir)/config/rules.mk
 		test_bug431701.html \
 		test_bug431833.html \
 		test_bug435425.html \
 		bug435425.sjs \
 		bug435425_redirect.sjs \
 		test_bug438519.html \
 		test_bug444722.html \
 		test_bug451376.html \
-		test_text_replaceWholeText.html \
 		test_text_wholeText.html \
 		test_bug433533.html \
 		wholeTexty-helper.xml \
 		test_bug444030.xhtml \
 		test_NodeIterator_basics_filters.xhtml \
 		test_NodeIterator_mutations_1.xhtml \
 		test_NodeIterator_mutations_2.html \
 		test_NodeIterator_mutations_3.html \
--- a/content/base/test/test_bug352728.html
+++ b/content/base/test/test_bug352728.html
@@ -82,20 +82,42 @@ function testCDATASection(aText, aShould
     is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
   }
 }
 
 function testPI(aTarget, aData, aShouldSucceed, aReason)
 {
   try {
     var pi = document.createProcessingInstruction(aTarget, aData);
-    ok(0, "Invalid processing instruction creation",
-       "Shouldn't create processing instructions in HTML");
+    var types = [ ProcessingInstruction, Node ];
+    checkTypes(pi, "processing instruction", types);
+
+    var interfaces = [ "nsIDOMProcessingInstruction", "nsIDOMNode",
+                       "nsIDOMEventTarget" ];
+    checkInterfaces(pi, "processing instruction", interfaces);
+
+    is(pi.target, aTarget, "Check target");
+    is(pi.data, aData, "Check data");
+    is(pi.nodeName, aTarget, "Check nodeName");
+    is(pi.nodeValue, aData, "Check nodeValue");
+    is(pi.localName, null, "Check localName")
+    is(pi.namespaceURI, null, "Check namespaceURI");
+    
+    is(pi.nodeType, Node.PROCESSING_INSTRUCTION_NODE, "Check nodeType");
+
+    if (!aShouldSucceed) {
+      ok(false, "Invalid processing instruction creation", aReason);
+    }
   } catch (e) {
-    is(e.code, DOMException.NOT_SUPPORTED_ERR, "Check exception code");
+    if (aShouldSucceed) {
+      ok(false, "Correct functioning of processing instruction stuff",
+         "something broke: " + e);
+    } else {
+      is(e.code, DOMException.INVALID_CHARACTER_ERR, "Check exception code");
+    }
   }
 }
 
 testComment("Some text", true);
 testComment("Some text with a '-' in it", true);
 testComment("Some text with a '-' and a '-' and another '-'", true);
 testComment("Some text -- this shouldn't create a node!", false);
 testComment("<!-- This is an HTML comment -->", false);
--- a/content/base/test/test_bug431701.html
+++ b/content/base/test/test_bug431701.html
@@ -54,42 +54,41 @@ function xhrDoc(idx) {
     var xhr = SpecialPowers.createSystemXHR();
     xhr.open("GET", docSources[idx], false);
     xhr.send();
     return xhr.responseXML;
   };
 }
 
 // Each row has the document getter function, then the characterSet,
-// inputEncoding, xmlEncoding expected for that document.
+// inputEncoding expected for that document.
 
 var tests = [
- [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1", null ],
- [ frameDoc("two"), "UTF-8", "UTF-8", null ],
- [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1", null ],
- [ frameDoc("four"), "UTF-8", "UTF-8", null ],
- [ frameDoc("five"), "UTF-8", "UTF-8", null ],
- [ frameDoc("six"), "UTF-8", "UTF-8", "UTF-8"],
- [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
- [ createDoc, "UTF-8", null, null ],
- [ xhrDoc(4), "UTF-8", "UTF-8", null ],
- [ xhrDoc(5), "UTF-8", "UTF-8", "UTF-8" ],
- [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1", "ISO-8859-1" ],
+ [ frameDoc("one"), "ISO-8859-1", "ISO-8859-1" ],
+ [ frameDoc("two"), "UTF-8", "UTF-8" ],
+ [ frameDoc("three"), "ISO-8859-1", "ISO-8859-1" ],
+ [ frameDoc("four"), "UTF-8", "UTF-8" ],
+ [ frameDoc("five"), "UTF-8", "UTF-8" ],
+ [ frameDoc("six"), "UTF-8", "UTF-8" ],
+ [ frameDoc("seven"), "ISO-8859-1", "ISO-8859-1" ],
+ [ createDoc, "UTF-8", null ],
+ [ xhrDoc(4), "UTF-8", "UTF-8" ],
+ [ xhrDoc(5), "UTF-8", "UTF-8" ],
+ [ xhrDoc(6), "ISO-8859-1", "ISO-8859-1" ],
 ];
 
 function doTest(idx) {
   var [docGetter, expectedCharacterSet,
-       expectedInputEncoding, expectedXMLEncoding] = tests[idx];
+       expectedInputEncoding] = tests[idx];
   var doc = docGetter();
 
   // Have to be careful here to catch null vs ""
   is(doc.characterSet, expectedCharacterSet, "Test " + idx + " characterSet");
   is(doc.inputEncoding, expectedInputEncoding,
      "Test " + idx + " inputEncoding");
-  is(doc.xmlEncoding, expectedXMLEncoding, "Test " + idx + " xmlEncoding");
 }
 
 addLoadEvent(function() {
   // sanity check
   isnot("", null, "Shouldn't be equal!");
 
   for (var i = 0; i < tests.length; ++i) {
     doTest(i);
--- a/content/base/test/test_bug444030.xhtml
+++ b/content/base/test/test_bug444030.xhtml
@@ -30,25 +30,16 @@ function doTest() {
   var hadException = false;
   try {
     var wholeText = anonTextNode.wholeText;
   } catch(e) {
     hadException = true;
   }
   ok(hadException,
      "Should have got an exception when using .wholeText with a text node child of the binding parent");
-
-  hadException = false;
-  try {
-    anonTextNode.replaceWholeText("foobar");
-  } catch(e) {
-    hadException = true;
-  }
-  ok(hadException,
-     "Should have got an exception when using .replaceWholeText with a text node child of the binding parent");
   SimpleTest.finish();
 }
 
 SimpleTest.waitForExplicitFinish();
 addLoadEvent(doTest);
 
 ]]>
 </script>
deleted file mode 100644
--- a/content/base/test/test_text_replaceWholeText.html
+++ /dev/null
@@ -1,256 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=421765
--->
-<head>
-  <title>Text.replaceWholeText tests</title>
-  <script type="text/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=421765">Mozilla Bug 421765</a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-
-<iframe id="xmlDocument" src="wholeTexty-helper.xml"></iframe>
-
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-/** Test for Bug 421765 **/
-
-SimpleTest.waitForExplicitFinish();
-
-var xmlDoc;
-
-function text(t) { return document.createTextNode(t); }
-function element() { return document.createElement("div"); }
-function cdata(t)
-{
-  xmlDoc = $("xmlDocument").contentDocument;
-  // document.createCDATASection isn't implemented; clone for the win
-  var node = xmlDoc.documentElement.firstChild.cloneNode(false);
-  is(node.nodeType, Node.CDATA_SECTION_NODE,
-     "er, why isn't this a CDATA section node?");
-  node.data = t;
-  return node;
-}
-
-
-function startTests()
-{
-  var outer = element();
-  var first = text("first");
-  var second = element();
-  second.appendChild(text("element contents"));
-  outer.appendChild(first);
-  outer.appendChild(second);
-
-  is(first.wholeText, "first", "wrong initial wholeText");
-
-  is(first.replaceWholeText("start"), first,
-     "should have gotten first back");
-  is(first.data, "start", "should have modified first's data");
-  is(first.wholeText, "start", "should have gotten new wholeText");
-
-  var cdataNode = cdata("-cdata");
-  outer.insertBefore(cdataNode, second);
-
-  is(first.wholeText, "start-cdata",
-     "should have gotten first+cdataNode as wholeText");
-
-  var outer2 = outer.cloneNode(true); // save
-
-  is(first.replaceWholeText("first"), first,
-     "replaceWholeText on first returned wrong object");
-  is(first.nodeType, Node.TEXT_NODE, "node changed type?");
-  is(first.data, "first", "wrong data in first");
-  is(first.previousSibling, null, "wrong previousSibling for first");
-  is(first.nextSibling, second, "wrong nextSibling for first");
-  is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
-  is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
-
-  ok(first.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(first.data, "first", "wrong data after replacing with empty string");
-
-  is(outer.firstChild, second, "replaceWholeText('') removes the node");
-
-  // switcheroo, with sanity tests
-  outer = outer2;
-  is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
-  first = outer.firstChild;
-  is(first.nodeType, Node.TEXT_NODE, "first not text?");
-  cdataNode = first.nextSibling;
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
-  second = outer.lastChild;
-  is(second.nodeType, Node.ELEMENT_NODE, "second not element?");
-
-  is(cdataNode.replaceWholeText("cdata"), cdataNode,
-     "replaceWholeText on cdataNode returned wrong object");
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
-  is(cdataNode.nodeValue, "cdata", "wrong node value?");
-  is(cdataNode.previousSibling, null, "wrong previousSibling");
-  is(cdataNode.nextSibling, second, "wrong nextSibling");
-
-  ok(cdataNode.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
-  is(outer.firstChild, second, "should be no more text at start");
-}
-
-function middleTests()
-{
-  var outer = element();
-  var first = element();
-  var middle = text("middle");
-  var last = element();
-  first.appendChild(text("first element contents"));
-  last.appendChild(text("last element contents"));
-  outer.appendChild(first);
-  outer.appendChild(middle);
-  outer.appendChild(last);
-
-  is(middle.wholeText, "middle", "wrong initial wholeText");
-
-  is(middle.replaceWholeText("center"), middle,
-     "should have gotten middle back");
-  is(middle.data, "center", "should have modified middle's data");
-  is(middle.wholeText, "center", "should have gotten new wholeText");
-
-  var cdataNode = cdata("-cdata");
-  outer.insertBefore(cdataNode, last);
-
-  is(middle.wholeText, "center-cdata",
-     "should have gotten middle+cdataNode as wholeText");
-
-  var outer2 = outer.cloneNode(true); // save
-
-  is(middle.replaceWholeText("middle"), middle,
-     "replaceWholeText on middle returned wrong object");
-  is(middle.nodeType, Node.TEXT_NODE, "node changed type?");
-  is(middle.data, "middle", "wrong data in middle");
-  is(middle.previousSibling, first, "wrong previousSibling");
-  is(middle.nextSibling, last, "wrong nextSibling");
-
-  ok(middle.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(middle.data, "middle", "wrong data after replacing with empty string");
-
-  // switcheroo, with sanity tests
-  outer = outer2;
-  is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
-  first = outer.firstChild;
-  is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
-  middle = first.nextSibling;
-  is(middle.nodeType, Node.TEXT_NODE, "middle not text?");
-  cdataNode = middle.nextSibling;
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
-  last = outer.lastChild;
-  is(last.nodeType, Node.ELEMENT_NODE, "last not element?");
-
-  is(cdataNode.replaceWholeText("cdata"), cdataNode,
-     "replaceWholeText on cdataNode returned wrong object");
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
-  is(cdataNode.nodeValue, "cdata", "wrong node value?");
-  is(cdataNode.previousSibling, first, "wrong previousSibling");
-  is(cdataNode.nextSibling, last, "wrong nextSibling");
-
-  ok(cdataNode.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
-  is(middle.wholeText, "center", "wrong wholeText after removal");
-  is(first.nextSibling, last, "wrong nextSibling");
-  is(last.previousSibling, first, "wrong previousSibling");
-}
-
-function endTests()
-{
-  var outer = element();
-  var first = element();
-  var second = text("second");
-  first.appendChild(text("element contents"));
-  outer.appendChild(first);
-  outer.appendChild(second);
-
-  is(second.wholeText, "second", "wrong initial wholeText");
-
-  is(second.replaceWholeText("end"), second,
-     "should have gotten second back");
-  is(second.data, "end", "should have modified second's data");
-  is(second.wholeText, "end", "should have gotten new wholeText");
-
-  var cdataNode = cdata("cdata-");
-  outer.insertBefore(cdataNode, second);
-
-  is(second.wholeText, "cdata-end",
-     "should have gotten cdataNode+second as wholeText");
-  is(cdataNode.wholeText, "cdata-end",
-     "should have gotten cdataNode+second as wholeText");
-
-  var outer2 = outer.cloneNode(true); // save
-
-  is(second.replaceWholeText("second"), second,
-     "replaceWholeText on second returned wrong object");
-  is(second.nodeType, Node.TEXT_NODE, "node changed type?");
-  is(second.data, "second", "wrong data in second");
-  is(second.previousSibling, first, "wrong previousSibling for second");
-  is(second.nextSibling, null, "wrong nextSibling for second");
-  is(cdataNode.previousSibling, null, "wrong previousSibling for cdataNode");
-  is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
-
-  ok(second.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(second.data, "second", "wrong data after replacing with empty string");
-
-  is(outer.lastChild, first, "replaceWholeText('') removes the node");
-
-  // switcheroo, with sanity tests
-  outer = outer2;
-  is(outer.nodeType, Node.ELEMENT_NODE, "outer not element?");
-  first = outer.firstChild;
-  is(first.nodeType, Node.ELEMENT_NODE, "first not element?");
-  cdataNode = first.nextSibling;
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "cdataNode not cdata?");
-  second = outer.lastChild;
-  is(second.nodeType, Node.TEXT_NODE, "middle not text?");
-
-  is(cdataNode.replaceWholeText("cdata"), cdataNode,
-     "replaceWholeText on cdataNode returned wrong object");
-  is(cdataNode.nodeType, Node.CDATA_SECTION_NODE, "node changed type?");
-  is(cdataNode.nodeValue, "cdata", "wrong node value?");
-  is(cdataNode.previousSibling, first, "wrong previousSibling for cdataNode");
-  is(cdataNode.nextSibling, null, "wrong nextSibling for cdataNode");
-  is(second.previousSibling, null, "wrong previousSibling for second");
-  is(second.nextSibling, null, "wrong nextSibling for second");
-
-  ok(cdataNode.replaceWholeText("") === null,
-     "empty string should cause a return of null");
-  is(cdataNode.data, "cdata", "wrong data after replacing with empty string");
-  is(outer.lastChild, first, "should be no more text at end");
-}
-
-function test()
-{
-  try
-  {
-    startTests();
-    middleTests();
-    endTests();
-  }
-  catch (e)
-  {
-    ok(false, "exception thrown: " + e);
-  }
-  finally
-  {
-    SimpleTest.finish();
-  }
-}
-
-window.addEventListener("load", test, false);
-</script>
-</pre>
-</body>
-</html>
--- a/content/canvas/test/test_canvas.html
+++ b/content/canvas/test/test_canvas.html
@@ -20185,17 +20185,17 @@ ok(canvas.getAttribute('height') == 60, 
 <canvas id="c637" width="100foo" height="50"><p class="fallback">FAIL (fallback content)</p></canvas>
 <script>
 
 function test_size_attributes_parse_badsuffix() {
 
 var canvas = document.getElementById('c637');
 var ctx = canvas.getContext('2d');
 
-todo(canvas.width == 100, "canvas.width == 100");
+is(canvas.width, 100, "canvas.width == 100");
 
 
 }
 </script>
 
 <!-- [[[ test_size.attributes.parse.floatsuffix.html ]]] -->
 
 <p>Canvas test: size.attributes.parse.floatsuffix</p>
@@ -20395,17 +20395,17 @@ ok(canvas.width == 300, "canvas.width ==
 <script>
 
 function test_size_attributes_setAttribute_badsuffix() {
 
 var canvas = document.getElementById('c648');
 var ctx = canvas.getContext('2d');
 
 canvas.setAttribute('width', '100foo');
-todo(canvas.width == 100, "canvas.width == 100");
+is(canvas.width, 100, "canvas.width == 100");
 
 
 }
 </script>
 
 <!-- [[[ test_size.attributes.setAttribute.floatsuffix.html ]]] -->
 
 <p>Canvas test: size.attributes.setAttribute.floatsuffix</p>
--- a/content/events/test/test_bug650493.html
+++ b/content/events/test/test_bug650493.html
@@ -204,28 +204,12 @@ children.push(document.createElement("sp
 children.push(document.createElement("b"));
 children[2].appendChild(document.createElement("i"));
 children.forEach(function(child) { frag.appendChild(child); });
 root.appendChild(frag);
 check();
 is(children.length, 0, "should have received DOMNodeRemoved for all frag children when appending");
 is(frag.childNodes.length, 0, "fragment should be empty when appending");
 
-testName = "prepare replaceWholeText";
-var textNode;
-root.appendChild(document.createTextNode("hello"));
-root.appendChild(document.createTextNode(""));
-root.appendChild(textNode = document.createTextNode("world"));
-root.appendChild(document.createTextNode("fahrvergnugen"));
-root.appendChild(document.createTextNode(""));
-root.appendChild(document.createElement("div"));
-root.appendChild(document.createTextNode("smorgasbord"));
-root.appendChild(document.createTextNode(""));
-check();
-
-testName = "run replaceWholeText";
-textNode.replaceWholeText("supercalifragilisticexpialidocious");
-check();
-
 </script>
 </body>
 </html>
 
--- a/content/html/content/src/nsHTMLTableElement.cpp
+++ b/content/html/content/src/nsHTMLTableElement.cpp
@@ -63,38 +63,41 @@
  * mParent is NOT ref-counted to avoid circular references
  */
 class TableRowsCollection : public nsIHTMLCollection 
 {
 public:
   TableRowsCollection(nsHTMLTableElement *aParent);
   virtual ~TableRowsCollection();
 
-  nsresult Init();
-
   NS_DECL_CYCLE_COLLECTING_ISUPPORTS
   NS_DECL_NSIDOMHTMLCOLLECTION
 
   virtual nsIContent* GetNodeAt(PRUint32 aIndex);
   virtual nsISupports* GetNamedItem(const nsAString& aName,
                                     nsWrapperCache **aCache);
 
   NS_IMETHOD    ParentDestroyed();
 
   NS_DECL_CYCLE_COLLECTION_CLASS(TableRowsCollection)
 
 protected:
   // Those rows that are not in table sections
+  nsHTMLTableElement* mParent;
   nsRefPtr<nsContentList> mOrphanRows;  
-  nsHTMLTableElement * mParent;
 };
 
 
 TableRowsCollection::TableRowsCollection(nsHTMLTableElement *aParent)
   : mParent(aParent)
+  , mOrphanRows(new nsContentList(mParent,
+                                  mParent->NodeInfo()->NamespaceID(),
+                                  nsGkAtoms::tr,
+                                  nsGkAtoms::tr,
+                                  PR_FALSE))
 {
 }
 
 TableRowsCollection::~TableRowsCollection()
 {
   // we do NOT have a ref-counted reference to mParent, so do NOT
   // release it!  this is to avoid circular references.  The
   // instantiator who provided mParent is responsible for managing our
@@ -113,27 +116,16 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(TableRo
 
 NS_INTERFACE_TABLE_HEAD(TableRowsCollection)
   NS_INTERFACE_TABLE2(TableRowsCollection, nsIHTMLCollection,
                       nsIDOMHTMLCollection)
   NS_INTERFACE_TABLE_TO_MAP_SEGUE_CYCLE_COLLECTION(TableRowsCollection)
   NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(HTMLCollection)
 NS_INTERFACE_MAP_END
 
-nsresult
-TableRowsCollection::Init()
-{
-  mOrphanRows = new nsContentList(mParent,
-                                  mParent->NodeInfo()->NamespaceID(),
-                                  nsGkAtoms::tr,
-                                  nsGkAtoms::tr,
-                                  PR_FALSE);
-  return NS_OK;
-}
-
 // Macro that can be used to avoid copy/pasting code to iterate over the
 // rowgroups.  _code should be the code to execute for each rowgroup.  The
 // rowgroup's rows will be in the nsIDOMHTMLCollection* named "rows".  Note
 // that this may be null at any time.  This macro assumes an nsresult named
 // |rv| is in scope.
 #define DO_FOR_EACH_ROWGROUP(_code)                                  \
   do {                                                               \
     if (mParent) {                                                   \
@@ -494,25 +486,17 @@ nsHTMLTableElement::SetTFoot(nsIDOMHTMLT
 
   return rv;
 }
 
 NS_IMETHODIMP
 nsHTMLTableElement::GetRows(nsIDOMHTMLCollection** aValue)
 {
   if (!mRows) {
-    // XXX why was this here NS_ADDREF(nsGkAtoms::tr);
     mRows = new TableRowsCollection(this);
-    NS_ENSURE_TRUE(mRows, NS_ERROR_OUT_OF_MEMORY);
-
-    nsresult rv = mRows->Init();
-    if (NS_FAILED(rv)) {
-      mRows = nsnull;
-      return rv;
-    }
   }
 
   *aValue = mRows;
   NS_ADDREF(*aValue);
 
   return NS_OK;
 }
 
--- a/content/html/content/test/reflect.js
+++ b/content/html/content/test/reflect.js
@@ -457,21 +457,16 @@ function reflectBoolean(aParameters)
  * @param aParameters   Object    object containing the parameters, which are:
  *  - element           Element   node to test on
  *  - attribute         String    name of the attribute
  *  - nonNegative       Boolean   true if the attribute is limited to 'non-negative numbers', false otherwise
  *  - defaultValue      Integer   [optional] default value, if one exists
  */
 function reflectInt(aParameters)
 {
-  //TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
-  function testExponential(value) {
-    return !!/^[ \t\n\f\r]*[\+\-]?[0-9]+e[0-9]+/.exec(value);
-  }
-
   // Expected value returned by .getAttribute() when |value| has been previously passed to .setAttribute().
   function expectedGetAttributeResult(value) {
     return (value !== null) ? String(value) : "";
   }
 
   function stringToInteger(value, nonNegative, defaultValue) {
     if (nonNegative === false) {
       // Parse: Ignore leading whitespace, find [+/-][numbers]
@@ -551,44 +546,20 @@ function reflectInt(aParameters)
 
     is(element.getAttribute(attr), expectedGetAttributeResult(v), element.localName + ".setAttribute(" +
       attr + ", " + v + "), " + element.localName + ".getAttribute(" + attr + ") ");
 
     if (intValue == -2147483648 && element[attr] == defaultValue) {
       //TBD: Bug 586761: .setAttribute(attr, -2147483648) --> element[attr] == defaultValue instead of -2147483648
       todo_is(element[attr], intValue, "Bug 586761: " + element.localName +
         ".setAttribute(value, " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (testExponential(v)) {
-      //TBD: Bug 673820: .setAttribute(exponential) -> incorrect reflection for element[attr]
-      todo_is(element[attr], intValue, "Bug 673820: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (v == "why 567 what") {
-      //TBD: Bug 679672: .setAttribute() is somehow able to parse "why 567 what" into "567"
-      todo_is(element[attr], intValue, "Bug 679672: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (v === "-0" && nonNegative) {
+    } else if ((v === "-0" || v == "-0xABCDEF") && nonNegative) {
       //TBD: Bug 688093: Non-negative integers should return defaultValue when attempting to reflect "-0"
       todo_is(element[attr], intValue, "Bug 688093: " + element.localName +
         ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (v == "+42foo") {
-      //TBD: Bug: Unable to correctly parse "+" character in front of string
-      todo_is(element[attr], intValue, "Bug: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (v == "0x10FFFF" && defaultValue != 0) {
-      //TBD: Bug: Integer attributes should parse "0x10FFFF" as 0, but instead incorrectly return defaultValue
-      todo_is(element[attr], intValue, "Bug: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if (v == "-0xABCDEF" && !nonNegative && defaultValue != 0) {
-      //TBD: Bug: Signed integer attributes should parse "-0xABCDEF" as -0, but instead incorrectly return defaultValue
-      todo_is(element[attr], intValue, "Bug: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
-    } else if ((v == "++2" || v == "+-2" || v == "--2" || v == "-+2") && element[attr] != defaultValue)  {
-      //TBD: Bug: Should not be able to parse strings with multiple sign characters, should return defaultValue
-      todo_is(element[attr], intValue, "Bug: " + element.localName +
-        ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
     } else {
       is(element[attr], intValue, element.localName +
         ".setAttribute(" + attr + ", " + v + "), " + element.localName + "[" + attr + "] ");
     }
     element.removeAttribute(attr);
 
     if (nonNegative && expectedIdlAttributeResult(v) < 0) {
       try {
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -134,17 +134,16 @@
 #include "nsDOMError.h"
 #include "nsIDOMDOMException.h"
 #include "nsIDOMNode.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNamedNodeMap.h"
 #include "nsIDOMDOMStringList.h"
 #include "nsIDOMDOMTokenList.h"
 #include "nsIDOMDOMSettableTokenList.h"
-#include "nsIDOMNameList.h"
 #include "nsIDOMNSElement.h"
 
 #include "nsDOMStringMap.h"
 
 // HTMLFormElement helper includes
 #include "nsIForm.h"
 #include "nsIFormControl.h"
 #include "nsIDOMHTMLFormElement.h"
@@ -995,19 +994,16 @@ static nsDOMClassInfoData sClassInfoData
 
   NS_DEFINE_CLASSINFO_DATA(XULTreeBuilder, nsDOMGenericSH,
                            DEFAULT_SCRIPTABLE_FLAGS)
 #endif
 
   NS_DEFINE_CLASSINFO_DATA(DOMStringList, nsStringListSH,
                            ARRAY_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(NameList, nsDOMGenericSH,
-                           DOM_DEFAULT_SCRIPTABLE_FLAGS)
-
 #ifdef MOZ_XUL
   NS_DEFINE_CLASSINFO_DATA(TreeColumn, nsDOMGenericSH,
                            DEFAULT_SCRIPTABLE_FLAGS)
 
   NS_DEFINE_CLASSINFO_DATA(TreeColumns, nsTreeColumnsSH,
                            ARRAY_SCRIPTABLE_FLAGS)
 #endif
 
@@ -2991,20 +2987,16 @@ nsDOMClassInfo::Init()
     DOM_CLASSINFO_MAP_ENTRY(nsITreeView)
   DOM_CLASSINFO_MAP_END
 #endif
 
   DOM_CLASSINFO_MAP_BEGIN(DOMStringList, nsIDOMDOMStringList)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMDOMStringList)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(NameList, nsIDOMNameList)
-    DOM_CLASSINFO_MAP_ENTRY(nsIDOMNameList)
-  DOM_CLASSINFO_MAP_END
-
 #ifdef MOZ_XUL
   DOM_CLASSINFO_MAP_BEGIN(TreeColumn, nsITreeColumn)
     DOM_CLASSINFO_MAP_ENTRY(nsITreeColumn)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(TreeColumns, nsITreeColumns)
     DOM_CLASSINFO_MAP_ENTRY(nsITreeColumns)
   DOM_CLASSINFO_MAP_END
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -215,19 +215,16 @@ DOMCI_CLASS(ImageDocument)
 #ifdef MOZ_XUL
 DOMCI_CLASS(XULTemplateBuilder)
 DOMCI_CLASS(XULTreeBuilder)
 #endif
 
 // DOMStringList object
 DOMCI_CLASS(DOMStringList)
 
-// NameList object used by the DOM
-DOMCI_CLASS(NameList)
-
 #ifdef MOZ_XUL
 DOMCI_CLASS(TreeColumn)
 DOMCI_CLASS(TreeColumns)
 #endif
 
 DOMCI_CLASS(CSSMozDocumentRule)
 
 DOMCI_CLASS(BeforeUnloadEvent)
--- a/dom/interfaces/base/domstubs.idl
+++ b/dom/interfaces/base/domstubs.idl
@@ -55,17 +55,16 @@ interface nsIDOMElement;
 interface nsIDOMNSElement;
 interface nsIDOMNamedNodeMap;
 interface nsIDOMNode;
 interface nsIDOMNodeList;
 interface nsIDOMProcessingInstruction;
 interface nsIDOMText;
 interface nsIDOMDOMStringList;
 interface nsIDOMDOMTokenList;
-interface nsIDOMNameList;
 interface nsIDOMClientRect;
 interface nsIDOMClientRectList;
 
 // Needed for raises() in our IDL
 interface DOMException;
 interface RangeException;
 
 // Style Sheets
--- a/dom/interfaces/core/Makefile.in
+++ b/dom/interfaces/core/Makefile.in
@@ -61,17 +61,16 @@ SDK_XPIDLSRCS =                         
 	nsIDOMNamedNodeMap.idl			\
 	nsIDOMNode.idl				\
 	nsIDOMNodeList.idl			\
 	nsIDOMProcessingInstruction.idl		\
 	nsIDOMText.idl				\
 	$(NULL)
 XPIDLSRCS =                                     \
 	nsIDOMDOMStringList.idl			\
-	nsIDOMNameList.idl			\
 	nsIDOMXMLDocument.idl			\
 	nsIDOMUserDataHandler.idl		\
 	nsIDOMNSEditableElement.idl		\
 	nsIDOMNSElement.idl			\
 	nsIDOMNodeSelector.idl			\
 	nsIDOMDOMTokenList.idl			\
 	nsIDOMDOMSettableTokenList.idl	\
 	nsIInlineEventHandlers.idl              \
--- a/dom/interfaces/core/nsIDOMDocument.idl
+++ b/dom/interfaces/core/nsIDOMDocument.idl
@@ -62,17 +62,17 @@ interface nsIDOMCaretPosition;
  * cannot exist outside the context of a Document, the nsIDOMDocument 
  * interface also contains the factory methods needed to create these 
  * objects.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(C54536AF-C238-4D8B-A339-54E2A0649FF5)]
+[scriptable, uuid(489faaa9-c54e-466c-8164-9a5fcc3a7052)]
 interface nsIDOMDocument : nsIDOMNode
 {
   readonly attribute nsIDOMDocumentType         doctype;
   readonly attribute nsIDOMDOMImplementation    implementation;
   readonly attribute nsIDOMElement              documentElement;
   nsIDOMElement                 createElement(in DOMString tagName)
                                   raises(DOMException);
   nsIDOMDocumentFragment        createDocumentFragment();
@@ -102,18 +102,16 @@ interface nsIDOMDocument : nsIDOMNode
   // Introduced in DOM Level 2:
   nsIDOMNodeList                getElementsByTagNameNS(in DOMString namespaceURI,
                                                        in DOMString localName);
   // Introduced in DOM Level 2:
   nsIDOMElement                 getElementById(in DOMString elementId);
   // Introduced in DOM Level 3:
   readonly attribute DOMString       inputEncoding;
   // Introduced in DOM Level 3:
-  readonly attribute DOMString       xmlEncoding;
-  // Introduced in DOM Level 3:
            attribute boolean         xmlStandalone;
                                         // raises(DOMException) on setting
   // Introduced in DOM Level 3:
            attribute DOMString       xmlVersion;
                                         // raises(DOMException) on setting
   // Introduced in DOM Level 3:
            attribute DOMString       documentURI;
   // Introduced in DOM Level 3:
deleted file mode 100644
--- a/dom/interfaces/core/nsIDOMNameList.idl
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* ***** BEGIN LICENSE BLOCK *****
- * Version: MPL 1.1/GPL 2.0/LGPL 2.1
- *
- * The contents of this file are subject to the Mozilla Public License Version
- * 1.1 (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- * http://www.mozilla.org/MPL/
- *
- * Software distributed under the License is distributed on an "AS IS" basis,
- * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
- * for the specific language governing rights and limitations under the
- * License.
- *
- * The Original Code is mozilla.org code.
- *
- * The Initial Developer of the Original Code is
- * Netscape Communications Corporation.
- * Portions created by the Initial Developer are Copyright (C) 2003
- * the Initial Developer. All Rights Reserved.
- *
- * Contributor(s):
- *   Peter Van der Beken <peterv@netscape.com>
- *
- *
- * Alternatively, the contents of this file may be used under the terms of
- * either the GNU General Public License Version 2 or later (the "GPL"), or
- * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
- * in which case the provisions of the GPL or the LGPL are applicable instead
- * of those above. If you wish to allow use of your version of this file only
- * under the terms of either the GPL or the LGPL, and not to allow others to
- * 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 ***** */
-
-/**
- * Corresponds to http://www.w3.org/TR/2004/REC-DOM-Level-3-Core-20040407
- */
-
-#include "domstubs.idl"
-
-[scriptable, uuid(faaf1b80-1ddd-11d9-8c46-000a95dc234c)]
-interface nsIDOMNameList : nsISupports
-{
-  DOMString          getName(in unsigned long index)
-                                      raises(DOMException);
-  DOMString          getNamespaceURI(in unsigned long index)
-                                      raises(DOMException);
-  readonly attribute unsigned long   length;
-  boolean            contains(in DOMString str);
-  boolean            containsNS(in DOMString namespaceURI,
-                                in DOMString name);
-};
--- a/dom/interfaces/core/nsIDOMText.idl
+++ b/dom/interfaces/core/nsIDOMText.idl
@@ -42,17 +42,17 @@
 /**
  * The nsIDOMText interface inherits from nsIDOMCharacterData and represents 
  * the textual content (termed character data in XML) of an Element or Attr.
  *
  * For more information on this interface please see 
  * http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html
  */
 
-[scriptable, uuid(92b0df87-78a1-4e3b-a23c-d0c5bb2b83f9)]
+[scriptable, uuid(8a876308-7891-468c-8f7a-9f2b81160c3c)]
 interface nsIDOMText : nsIDOMCharacterData
 {
   nsIDOMText                      splitText(in unsigned long offset)
                                        raises(DOMException);
 
   /**
    * Indicates whether this text node contains element content whitespace.
    * A text node is element content whitespace if it contains only XML
@@ -63,17 +63,9 @@ interface nsIDOMText : nsIDOMCharacterDa
 
   /**
    * The concatenation of all logically adjacent text nodes with this text
    * node, where "logically adjacent" consists of all text nodes which can be
    * reached by traversing the document tree in either direction without
    * passing an element, comment, or processing-instruction boundary.  
    */
   readonly attribute DOMString wholeText;
-
-  /**
-   * If content is empty, removes all logically adjacent text nodes (including
-   * this node) from the DOM tree, returning null; otherwise, replaces the
-   * contents of this node with aContent and removes all other logically
-   * adjacent text nodes from the DOM tree, returning this node.
-   */
-  nsIDOMText replaceWholeText(in DOMString content) raises(DOMException);
 };
--- a/dom/interfaces/core/nsIDOMXMLDocument.idl
+++ b/dom/interfaces/core/nsIDOMXMLDocument.idl
@@ -33,17 +33,17 @@
  * 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 ***** */
 
 #include "nsIDOMDocument.idl"
 
-[scriptable, uuid(0457526E-1FA5-476C-9314-0F704617B9F4)]
+[scriptable, uuid(8168733e-9cf6-4552-9f03-57de11b87f3f)]
 interface nsIDOMXMLDocument : nsIDOMDocument
 {
   // DOM Level 3 Load & Save, DocumentLS
   // http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS
   /**
    * Whether to load synchronously or asynchronously.
    * The default is async==true.
    */
--- a/dom/interfaces/html/nsIDOMHTMLDocument.idl
+++ b/dom/interfaces/html/nsIDOMHTMLDocument.idl
@@ -42,17 +42,17 @@
 /**
  * The nsIDOMHTMLDocument interface is the interface to a [X]HTML
  * document object.
  *
  * @see <http://www.whatwg.org/html/>
  */
 interface nsISelection;
 
-[scriptable, uuid(DA6A8183-3C50-4F4A-9EFC-0E050B9A856A)]
+[scriptable, uuid(9a23fb3c-1d25-462e-8e85-c78c9dc61755)]
 interface nsIDOMHTMLDocument : nsIDOMDocument
 {
   readonly attribute DOMString            URL;
            attribute DOMString            domain;
            attribute DOMString            cookie;
   // returns "BackCompat" if we're in quirks mode,
   // or "CSS1Compat" if we're in strict mode
   readonly attribute DOMString            compatMode;
--- a/dom/interfaces/svg/nsIDOMSVGDocument.idl
+++ b/dom/interfaces/svg/nsIDOMSVGDocument.idl
@@ -34,15 +34,15 @@
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsIDOMDocument.idl"
 
 interface nsIDOMSVGSVGElement;
 
-[scriptable, uuid(E055EF40-D6BA-443A-B4DB-C1CCFAA6EB31)]
+[scriptable, uuid(1767ad4f-bb2b-474b-b208-9910ed152605)]
 interface nsIDOMSVGDocument : nsIDOMDocument
 {
   readonly attribute DOMString domain;
   readonly attribute DOMString URL;
   readonly attribute nsIDOMSVGSVGElement rootElement;
 };
--- a/dom/ipc/TabChild.h
+++ b/dom/ipc/TabChild.h
@@ -1,9 +1,9 @@
-/* -*- Mode: C++; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 8; -*- */
+/* -*- Mode: C++; c-basic-offset: 2; indent-tabs-mode: nil; tab-width: 2; -*- */
 /* vim: set sw=4 ts=8 et tw=80 : */
 /* ***** BEGIN LICENSE BLOCK *****
  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
  *
  * The contents of this file are subject to the Mozilla Public License Version
  * 1.1 (the "License"); you may not use this file except in compliance with
  * the License. You may obtain a copy of the License at
  * http://www.mozilla.org/MPL/
@@ -93,20 +93,25 @@ class TabChildGlobal : public nsDOMEvent
                        public nsIScriptContextPrincipal
 {
 public:
   TabChildGlobal(TabChild* aTabChild);
   ~TabChildGlobal();
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TabChildGlobal, nsDOMEventTargetHelper)
   NS_FORWARD_SAFE_NSIFRAMEMESSAGEMANAGER(mMessageManager)
-  NS_IMETHOD SendSyncMessage()
+  NS_IMETHOD SendSyncMessage(const nsAString& aMessageName,
+                             const jsval& aObject,
+                             JSContext* aCx,
+                             PRUint8 aArgc,
+                             jsval* aRetval)
   {
-    return mMessageManager ? mMessageManager->SendSyncMessage()
-                           : NS_ERROR_NULL_POINTER;
+    return mMessageManager
+      ? mMessageManager->SendSyncMessage(aMessageName, aObject, aCx, aArgc, aRetval)
+      : NS_ERROR_NULL_POINTER;
   }
   NS_IMETHOD GetContent(nsIDOMWindow** aContent);
   NS_IMETHOD GetDocShell(nsIDocShell** aDocShell);
   NS_IMETHOD Dump(const nsAString& aStr)
   {
     return mMessageManager ? mMessageManager->Dump(aStr) : NS_OK;
   }
   NS_IMETHOD PrivateNoteIntentionalCrash();
--- a/dom/locales/en-US/chrome/dom/dom.properties
+++ b/dom/locales/en-US/chrome/dom/dom.properties
@@ -103,19 +103,19 @@ RemoveChildWarning=Use of attributes' re
 AppendChildWarning=Use of attributes' appendChild() is deprecated. Use value instead.
 CloneNodeWarning=Use of attributes' cloneNode() is deprecated.
 OwnerDocumentWarning=Use of attributes' ownerDocument attribute is deprecated.
 NormalizeWarning=Use of attributes' normalize() is deprecated.
 IsSupportedWarning=Use of attributes' isSupported() is deprecated.
 IsEqualNodeWarning=Use of attributes' isEqualNode() is deprecated.
 TextContentWarning=Use of attributes' textContent attribute is deprecated. Use value instead.
 EnablePrivilegeWarning=Use of enablePrivilege is deprecated.  Please use code that runs with the system principal (e.g. an extension) instead.
+PositionWarning=Use of XMLHttpRequest's progress events' position attribute is deprecated.
+TotalSizeWarning=Use of XMLHttpRequest's progress events' totalSize attribute is deprecated.
 nsIJSONDecodeDeprecatedWarning=nsIJSON.decode is deprecated.  Please use JSON.parse instead.
 nsIJSONEncodeDeprecatedWarning=nsIJSON.encode is deprecated.  Please use JSON.stringify instead.
 nsIDOMWindowInternalWarning=Use of nsIDOMWindowInternal is deprecated. Use nsIDOMWindow instead.
 IsSameNodeWarning=Use of isSameNode is deprecated.  Please use A == B to test for equality instead.
-ReplaceWholeTextWarning=Use of replaceWholeText is deprecated. Please call normalize() on the parent and set the data attribute, or use textContent instead.
-XmlEncodingWarning=Use of xmlEncoding is deprecated.
 XmlVersionWarning=Use of xmlVersion is deprecated.
 InputEncodingWarning=Use of inputEncoding is deprecated.
 XmlStandaloneWarning=Use of xmlStandalone is deprecated.
 IsElementContentWhitespaceWarning=Use of isElementContentWhitespaceWarning is deprecated.
 GlobalStorageWarning=Use of globalStorage is deprecated. Please use localStorage instead.
--- a/dom/tests/mochitest/bugs/test_bug42976.html
+++ b/dom/tests/mochitest/bugs/test_bug42976.html
@@ -34,19 +34,16 @@ function runTest() {
     ok(doc.compatMode == clonefalse.compatMode, "compatMode not preserved correctly; " + iframes[i].id);
   
     // doc.contentType
     ok(doc.contentType == clonefalse.contentType, "contentType not preserved correctly; " + iframes[i].id);
   
     // doc.xmlStandalone
     ok(doc.xmlStandalone == clonefalse.xmlStandalone, "xmlStandalone not preserved correctly; " + iframes[i].id);
   
-    // doc.xmlEncoding
-    ok(doc.xmlEncoding == clonefalse.xmlEncoding, "xmlEncoding not preserved correctly; " + iframes[i].id);
-  
     // doc.characterSet
     ok(doc.characterSet == clonefalse.characterSet, "charset not preserved correctly; " + iframes[i].id);
   
     // innerHTML+tag case test
     var clonetrue = doc.cloneNode(true);
     doc.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
     clonetrue.documentElement.firstChild.innerHTML="<div><dD></dD></div>";
     ok(doc.documentElement.innerHTML == clonetrue.documentElement.innerHTML,
--- a/dom/tests/mochitest/dom-level1-core/exclusions.js
+++ b/dom/tests/mochitest/dom-level1-core/exclusions.js
@@ -83,23 +83,24 @@ var attributeModTests = ["hc_attrappendc
 var modTests = ["hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument", "hc_nodeinsertbeforenewchilddiffdocument",
                 "hc_nodereplacechildnewchilddiffdocument", "hc_elementwrongdocumenterr", "hc_namednodemapwrongdocumenterr", "hc_nodeappendchildnewchilddiffdocument",
                 "hc_nodeinsertbeforenewchilddiffdocument", "hc_nodereplacechildnewchilddiffdocument", "elementwrongdocumenterr", "namednodemapwrongdocumenterr",
                 "nodeappendchildnewchilddiffdocument", "nodeinsertbeforenewchilddiffdocument", "nodereplacechildnewchilddiffdocument"];
 // These tests rely on an implementation of document.createEntityReference.
 var createEntityRef = ["documentinvalidcharacterexceptioncreateentref",
                        "documentinvalidcharacterexceptioncreateentref1",
                        "hc_attrgetvalue2", "hc_nodevalue03"];
-
+var createProcessingInstructionHTML = ["documentinvalidcharacterexceptioncreatepi",
+                                       "documentinvalidcharacterexceptioncreatepi1"];
 
 var todoTests = {};
 function concat(lst/*...*/) {
   var f = [];
   if (arguments !== null) {
     f = arguments[0];
   }
   for (var i = 1; i < arguments.length; i++) {
     f = f.concat(arguments[i]);
   }
   return f;
 }
-var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef);
+var exclusions = concat(dtdTests, indexErrTests, attributeModTests, modTests, createEntityRef, createProcessingInstructionHTML);
 for (var excludedTestName in exclusions) { todoTests[exclusions[excludedTestName]] = true; }
--- a/gfx/thebes/gfxASurface.cpp
+++ b/gfx/thebes/gfxASurface.cpp
@@ -220,29 +220,22 @@ gfxASurface::Wrap (cairo_surface_t *csur
 
     NS_ADDREF(result);
     return result;
 }
 
 void
 gfxASurface::Init(cairo_surface_t* surface, bool existingSurface)
 {
-    if (cairo_surface_status(surface)) {
-        // the surface has an error on it
-        mSurfaceValid = PR_FALSE;
-        cairo_surface_destroy(surface);
-        return;
-    }
-
     SetSurfaceWrapper(surface, this);
 
     mSurface = surface;
-    mSurfaceValid = PR_TRUE;
+    mSurfaceValid = surface && !cairo_surface_status(surface);
 
-    if (existingSurface) {
+    if (existingSurface || !mSurfaceValid) {
         mFloatingRefs = 0;
     } else {
         mFloatingRefs = 1;
 #ifdef MOZ_TREE_CAIRO
         if (cairo_surface_get_content(surface) != CAIRO_CONTENT_COLOR) {
             cairo_surface_set_subpixel_antialiasing(surface, CAIRO_SUBPIXEL_ANTIALIASING_DISABLED);
         }
 #endif
--- a/gfx/thebes/gfxImageSurface.cpp
+++ b/gfx/thebes/gfxImageSurface.cpp
@@ -65,27 +65,35 @@ gfxImageSurface::InitFromSurface(cairo_s
 
 gfxImageSurface::gfxImageSurface(unsigned char *aData, const gfxIntSize& aSize,
                                  long aStride, gfxImageFormat aFormat)
 {
     InitWithData(aData, aSize, aStride, aFormat);
 }
 
 void
+gfxImageSurface::MakeInvalid()
+{
+    mSize = gfxIntSize(-1, -1);
+    mData = NULL;
+    mStride = 0;
+}
+
+void
 gfxImageSurface::InitWithData(unsigned char *aData, const gfxIntSize& aSize,
                               long aStride, gfxImageFormat aFormat)
 {
     mSize = aSize;
     mOwnsData = PR_FALSE;
     mData = aData;
     mFormat = aFormat;
     mStride = aStride;
 
     if (!CheckSurfaceSize(aSize))
-        return;
+        MakeInvalid();
 
     cairo_surface_t *surface =
         cairo_image_surface_create_for_data((unsigned char*)mData,
                                             (cairo_format_t)mFormat,
                                             mSize.width,
                                             mSize.height,
                                             mStride);
 
@@ -116,17 +124,17 @@ TryAllocAlignedBytes(size_t aSize)
 }
 
 gfxImageSurface::gfxImageSurface(const gfxIntSize& size, gfxImageFormat format) :
     mSize(size), mOwnsData(PR_FALSE), mData(nsnull), mFormat(format)
 {
     mStride = ComputeStride();
 
     if (!CheckSurfaceSize(size))
-        return;
+        MakeInvalid();
 
     // if we have a zero-sized surface, just leave mData nsnull
     if (mSize.height * mStride > 0) {
 
         // This can fail to allocate memory aligned as we requested,
         // or it can fail to allocate any memory at all.
         mData = (unsigned char *) TryAllocAlignedBytes(mSize.height * mStride);
         if (!mData)
--- a/gfx/thebes/gfxImageSurface.h
+++ b/gfx/thebes/gfxImageSurface.h
@@ -117,16 +117,18 @@ protected:
     gfxImageSurface();
     void InitWithData(unsigned char *aData, const gfxIntSize& aSize,
                       long aStride, gfxImageFormat aFormat);
     void InitFromSurface(cairo_surface_t *csurf);
     long ComputeStride() const { return ComputeStride(mSize, mFormat); }
 
     static long ComputeStride(const gfxIntSize&, gfxImageFormat);
 
+    void MakeInvalid();
+
     gfxIntSize mSize;
     bool mOwnsData;
     unsigned char *mData;
     gfxImageFormat mFormat;
     long mStride;
 };
 
 class THEBES_API gfxSubimageSurface : public gfxImageSurface {
--- a/gfx/thebes/gfxQuartzImageSurface.cpp
+++ b/gfx/thebes/gfxQuartzImageSurface.cpp
@@ -37,17 +37,17 @@
 
 #include "gfxQuartzImageSurface.h"
 
 #include "cairo-quartz.h"
 #include "cairo-quartz-image.h"
 
 gfxQuartzImageSurface::gfxQuartzImageSurface(gfxImageSurface *imageSurface)
 {
-    if (imageSurface->CairoStatus() || imageSurface->CairoSurface() == NULL)
+    if (imageSurface->CairoSurface() == NULL)
         return;
 
     cairo_surface_t *surf = cairo_quartz_image_surface_create (imageSurface->CairoSurface());
     Init (surf);
 }
 
 gfxQuartzImageSurface::gfxQuartzImageSurface(cairo_surface_t *csurf)
 {
--- a/gfx/thebes/gfxQuartzSurface.cpp
+++ b/gfx/thebes/gfxQuartzSurface.cpp
@@ -35,43 +35,56 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "gfxQuartzSurface.h"
 #include "gfxContext.h"
 
 #include "cairo-quartz.h"
 
-gfxQuartzSurface::gfxQuartzSurface(const gfxSize& size, gfxImageFormat format,
-                                   bool aForPrinting)
-    : mCGContext(NULL), mSize(size), mForPrinting(aForPrinting)
+void
+gfxQuartzSurface::MakeInvalid()
 {
-    unsigned int width = (unsigned int) floor(size.width);
-    unsigned int height = (unsigned int) floor(size.height);
+    mSize = gfxIntSize(-1, -1);    
+}
 
-    if (!CheckSurfaceSize(gfxIntSize(width, height)))
-        return;
+gfxQuartzSurface::gfxQuartzSurface(const gfxSize& desiredSize, gfxImageFormat format,
+                                   bool aForPrinting)
+    : mCGContext(NULL), mSize(desiredSize), mForPrinting(aForPrinting)
+{
+    gfxIntSize size((unsigned int) floor(desiredSize.width),
+                    (unsigned int) floor(desiredSize.height));
+    if (!CheckSurfaceSize(size))
+        MakeInvalid();
+
+    unsigned int width = static_cast<unsigned int>(mSize.width);
+    unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf = cairo_quartz_surface_create
         ((cairo_format_t) format, width, height);
 
     mCGContext = cairo_quartz_surface_get_cg_context (surf);
 
     CGContextRetain(mCGContext);
 
     Init(surf);
 }
 
 gfxQuartzSurface::gfxQuartzSurface(CGContextRef context,
-                                   const gfxSize& size,
+                                   const gfxSize& desiredSize,
                                    bool aForPrinting)
-    : mCGContext(context), mSize(size), mForPrinting(aForPrinting)
+    : mCGContext(context), mSize(desiredSize), mForPrinting(aForPrinting)
 {
-    unsigned int width = (unsigned int) floor(size.width);
-    unsigned int height = (unsigned int) floor(size.height);
+    gfxIntSize size((unsigned int) floor(desiredSize.width),
+                    (unsigned int) floor(desiredSize.height));
+    if (!CheckSurfaceSize(size))
+        MakeInvalid();
+
+    unsigned int width = static_cast<unsigned int>(mSize.width);
+    unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf = 
         cairo_quartz_surface_create_for_cg_context(context,
                                                    width, height);
 
     CGContextRetain(mCGContext);
 
     Init(surf);
@@ -83,27 +96,29 @@ gfxQuartzSurface::gfxQuartzSurface(cairo
 {
     mCGContext = cairo_quartz_surface_get_cg_context (csurf);
     CGContextRetain (mCGContext);
 
     Init(csurf, PR_TRUE);
 }
 
 gfxQuartzSurface::gfxQuartzSurface(unsigned char *data,
-                                   const gfxSize& size,
+                                   const gfxSize& desiredSize,
                                    long stride,
                                    gfxImageFormat format,
                                    bool aForPrinting)
-    : mCGContext(nsnull), mSize(size), mForPrinting(aForPrinting)
+    : mCGContext(nsnull), mSize(desiredSize), mForPrinting(aForPrinting)
 {
-    unsigned int width = (unsigned int) floor(size.width);
-    unsigned int height = (unsigned int) floor(size.height);
+    gfxIntSize size((unsigned int) floor(desiredSize.width),
+                    (unsigned int) floor(desiredSize.height));
+    if (!CheckSurfaceSize(size))
+        MakeInvalid();
 
-    if (!CheckSurfaceSize(gfxIntSize(width, height)))
-        return;
+    unsigned int width = static_cast<unsigned int>(mSize.width);
+    unsigned int height = static_cast<unsigned int>(mSize.height);
 
     cairo_surface_t *surf = cairo_quartz_surface_create_for_data
         (data, (cairo_format_t) format, width, height, stride);
 
     mCGContext = cairo_quartz_surface_get_cg_context (surf);
 
     CGContextRetain(mCGContext);
 
--- a/gfx/thebes/gfxQuartzSurface.h
+++ b/gfx/thebes/gfxQuartzSurface.h
@@ -70,14 +70,16 @@ public:
 
     void MovePixels(const nsIntRect& aSourceRect,
                     const nsIntPoint& aDestTopLeft)
     {
         FastMovePixels(aSourceRect, aDestTopLeft);
     }
 
 protected:
+    void MakeInvalid();
+
     CGContextRef mCGContext;
     gfxSize      mSize;
     bool mForPrinting;
 };
 
 #endif /* GFX_QUARTZSURFACE_H */
--- a/gfx/thebes/gfxWindowsSurface.cpp
+++ b/gfx/thebes/gfxWindowsSurface.cpp
@@ -61,40 +61,48 @@ gfxWindowsSurface::gfxWindowsSurface(HDC
     if (flags & FLAG_FOR_PRINTING) {
         Init(cairo_win32_printing_surface_create(mDC));
         mForPrinting = PR_TRUE;
     } else
 #endif
     InitWithDC(flags);
 }
 
-gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& size, gfxImageFormat imageFormat) :
+void
+gfxWindowsSurface::MakeInvalid(gfxIntSize& size)
+{
+    size = gfxIntSize(-1, -1);
+}
+
+gfxWindowsSurface::gfxWindowsSurface(const gfxIntSize& realSize, gfxImageFormat imageFormat) :
     mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
 {
+    gfxIntSize size(realSize);
     if (!CheckSurfaceSize(size))
-        return;
+        MakeInvalid(size);
 
     cairo_surface_t *surf = cairo_win32_surface_create_with_dib((cairo_format_t)imageFormat,
                                                                 size.width, size.height);
 
     Init(surf);
 
     RecordMemoryUsed(size.width * size.height * 4 + sizeof(gfxWindowsSurface));
 
     if (CairoStatus() == 0)
         mDC = cairo_win32_surface_get_dc(CairoSurface());
     else
         mDC = nsnull;
 }
 
-gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& size, gfxImageFormat imageFormat) :
+gfxWindowsSurface::gfxWindowsSurface(HDC dc, const gfxIntSize& realSize, gfxImageFormat imageFormat) :
     mOwnsDC(PR_FALSE), mForPrinting(PR_FALSE), mWnd(nsnull)
 {
+    gfxIntSize size(realSize);
     if (!CheckSurfaceSize(size))
-        return;
+        MakeInvalid(size);
 
     cairo_surface_t *surf = cairo_win32_surface_create_with_ddb(dc, (cairo_format_t)imageFormat,
                                                                 size.width, size.height);
 
     Init(surf);
 
     // DDBs will generally only use 3 bytes per pixel when RGB24
     int bytesPerPixel = ((imageFormat == gfxASurface::ImageFormatRGB24) ? 3 : 4);
--- a/gfx/thebes/gfxWindowsSurface.h
+++ b/gfx/thebes/gfxWindowsSurface.h
@@ -98,16 +98,18 @@ public:
         FastMovePixels(aSourceRect, aDestTopLeft);
     }
 
     // The memory used by this surface lives in this process's address space,
     // but not in the heap.
     virtual gfxASurface::MemoryLocation GetMemoryLocation() const;
 
 private:
+    void MakeInvalid(gfxIntSize& size);
+
     bool mOwnsDC;
     bool mForPrinting;
 
     HDC mDC;
     HWND mWnd;
 };
 
 #endif /* GFX_WINDOWSSURFACE_H */
--- a/js/src/tests/ecma/Date/jstests.list
+++ b/js/src/tests/ecma/Date/jstests.list
@@ -142,17 +142,17 @@ script 15.9.5.37-3.js
 script 15.9.5.37-4.js
 script 15.9.5.37-5.js
 script 15.9.5.4-1.js
 script 15.9.5.4-2-n.js
 script 15.9.5.5.js
 script 15.9.5.6.js
 script 15.9.5.7.js
 fails-if(Android) script 15.9.5.8.js
-script 15.9.5.9.js
+skip-if(Android) script 15.9.5.9.js # bug 686143, skip temporarily to see what happens to the frequency and location of Android timeouts
 script 15.9.5.js
 slow script dst-offset-caching-1-of-8.js
 slow script dst-offset-caching-2-of-8.js
 slow script dst-offset-caching-3-of-8.js
 slow script dst-offset-caching-4-of-8.js
 slow script dst-offset-caching-5-of-8.js
 slow script dst-offset-caching-6-of-8.js
 slow script dst-offset-caching-7-of-8.js
--- a/js/src/xpconnect/src/dom_quickstubs.qsconf
+++ b/js/src/xpconnect/src/dom_quickstubs.qsconf
@@ -143,21 +143,16 @@ members = [
     'nsIDOMNodeList.*',
     'nsIDOMNodeSelector.querySelector',
     'nsIDOMNodeSelector.querySelectorAll',
     'nsIDOMText.splitText',
     'nsIDOMDOMImplementation.*',
     'nsIDOMDOMStringList.*',
     'nsIDOMDOMTokenList.*',
     'nsIDOMDOMSettableTokenList.*',
-    'nsIDOMNameList.getName',
-    'nsIDOMNameList.contains',
-    'nsIDOMNameList.containsNS',
-    'nsIDOMNameList.length',
-    'nsIDOMNameList.getNamespaceURI',
     'nsIDOMXULDocument.getBoxObjectFor',
     'nsIDOMNSElement.*',
 
     # dom/interfaces/css
     'nsIDOMElementCSSInlineStyle.*',
     'nsIDOMCSS2Properties.*',
     'nsIDOMRect.*',
     'nsIDOMCSSStyleDeclaration.*',
--- a/layout/base/nsDisplayList.cpp
+++ b/layout/base/nsDisplayList.cpp
@@ -2446,23 +2446,16 @@ nsDisplayTransform::GetResultingTransfor
                                                 nsIFrame** aOutAncestor)
 {
   NS_PRECONDITION(aFrame, "Cannot get transform matrix for a null frame!");
 
   if (aOutAncestor) {
       *aOutAncestor = nsLayoutUtils::GetCrossDocParentFrame(aFrame);
   }
 
-  /* Preserve-3d can cause frames without a transform to get an nsDisplayTransform created, we should
-   * use our parent's transform here.
-   */
-  if (!aFrame->GetStyleDisplay()->HasTransform()) {
-    return GetResultingTransformMatrix(aFrame->GetParent(), aOrigin - aFrame->GetPosition(), aFactor, nsnull, aOutAncestor);
-  }
-
   /* Account for the -moz-transform-origin property by translating the
    * coordinate space to the new origin.
    */
   gfxPoint3D toMozOrigin = GetDeltaToMozTransformOrigin(aFrame, aFactor, aBoundsOverride);
   gfxPoint3D toPerspectiveOrigin = GetDeltaToMozPerspectiveOrigin(aFrame, aFactor, aBoundsOverride);
   gfxPoint3D newOrigin = gfxPoint3D(NSAppUnitsToFloatPixels(aOrigin.x, aFactor),
                                     NSAppUnitsToFloatPixels(aOrigin.y, aFactor),
                                     0.0f);
--- a/layout/base/nsDisplayList.h
+++ b/layout/base/nsDisplayList.h
@@ -2074,26 +2074,26 @@ private:
  */ 
 class nsDisplayTransform: public nsDisplayItem
 {
 public:
   /* Constructor accepts a display list, empties it, and wraps it up.  It also
    * ferries the underlying frame to the nsDisplayItem constructor.
    */
   nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame *aFrame,
-                     nsDisplayList *aList) :
-    nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aList)
+                     nsDisplayList *aList, PRUint32 aIndex = 0) :
+    nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aList), mIndex(aIndex)
   {
     MOZ_COUNT_CTOR(nsDisplayTransform);
     NS_ABORT_IF_FALSE(aFrame, "Must have a frame!");
   }
 
   nsDisplayTransform(nsDisplayListBuilder* aBuilder, nsIFrame *aFrame,
-                     nsDisplayItem *aItem) :
-  nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aItem)
+                     nsDisplayItem *aItem, PRUint32 aIndex = 0) :
+  nsDisplayItem(aBuilder, aFrame), mStoredList(aBuilder, aFrame, aItem), mIndex(aIndex)
   {
     MOZ_COUNT_CTOR(nsDisplayTransform);
     NS_ABORT_IF_FALSE(aFrame, "Must have a frame!");
   }
 
 #ifdef NS_BUILD_REFCNT_LOGGING
   virtual ~nsDisplayTransform()
   {
@@ -2122,16 +2122,22 @@ public:
                                    LayerManager* aManager);
   virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
                                              LayerManager* aManager,
                                              const ContainerParameters& aContainerParameters);
   virtual bool ComputeVisibility(nsDisplayListBuilder *aBuilder,
                                    nsRegion *aVisibleRegion,
                                    const nsRect& aAllowVisibleRegionExpansion);
   virtual bool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem);
+  
+  virtual PRUint32 GetPerFrameKey() { return (mIndex << nsDisplayItem::TYPE_BITS) | nsDisplayItem::GetPerFrameKey(); }
+
+  enum {
+    INDEX_MAX = PR_UINT32_MAX >> nsDisplayItem::TYPE_BITS
+  };
 
   const gfx3DMatrix& GetTransform(float aFactor);
 
   /**
    * TransformRect takes in as parameters a rectangle (in aFrame's coordinate
    * space) and returns the smallest rectangle (in aFrame's coordinate space)
    * containing the transformed image of that rectangle.  That is, it takes
    * the four corners of the rectangle, transforms them according to the
@@ -2200,16 +2206,17 @@ public:
                                                  float aFactor,
                                                  const nsRect* aBoundsOverride = nsnull,
                                                  nsIFrame** aOutAncestor = nsnull);
 
 private:
   nsDisplayWrapList mStoredList;
   gfx3DMatrix mTransform;
   float mCachedFactor;
+  PRUint32 mIndex;
 };
 
 /**
  * This class adds basic support for limiting the rendering to the part inside
  * the specified edges.  It's a base class for the display item classes that
  * does the actual work.  The two members, mLeftEdge and mRightEdge, are
  * relative to the edges of the frame's scrollable overflow rectangle and is
  * the amount to suppress on each side.
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -670,24 +670,22 @@ public:
   }
 
   /**
    * Set and get methods for controlling the background drawing
   */
   bool GetBackgroundImageDraw() const { return mDrawImageBackground; }
   void   SetBackgroundImageDraw(bool aCanDraw)
   {
-    NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
     mDrawImageBackground = aCanDraw;
   }
 
   bool GetBackgroundColorDraw() const { return mDrawColorBackground; }
   void   SetBackgroundColorDraw(bool aCanDraw)
   {
-    NS_ASSERTION(!(aCanDraw & ~1), "Value must be true or false");
     mDrawColorBackground = aCanDraw;
   }
 
 #ifdef IBMBIDI
   /**
    *  Check if bidi enabled (set depending on the presence of RTL
    *  characters or when default directionality is RTL).
    *  If enabled, we should apply the Unicode Bidi Algorithm
@@ -720,17 +718,16 @@ public:
    *  direction is determined by the Bidi algorithm according to the
    *  category of the characters and the category of the adjacent
    *  characters, and according to their primary direction.
    *
    *  @lina 05/02/2000
    */
   void SetVisualMode(bool aIsVisual)
   {
-    NS_ASSERTION(!(aIsVisual & ~1), "Value must be true or false");
     mIsVisual = aIsVisual;
   }
 
   /**
    *  Check whether the content should be treated as visual.
    *
    *  @lina 05/02/2000
    */
@@ -752,17 +749,16 @@ public:
   NS_HIDDEN_(PRUint32) GetBidi() const;
 #endif // IBMBIDI
 
   /**
    * Render only Selection
    */
   void SetIsRenderingOnlySelection(bool aResult)
   {
-    NS_ASSERTION(!(aResult & ~1), "Value must be true or false");
     mIsRenderingOnlySelection = aResult;
   }
 
   bool IsRenderingOnlySelection() const { return mIsRenderingOnlySelection; }
 
   NS_HIDDEN_(bool) IsTopLevelWindowInactive();
 
   /*
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -3141,22 +3141,21 @@ PresShell::GoToAnchor(const nsAString& a
       if (fm && win) {
         nsCOMPtr<nsIDOMWindow> focusedWindow;
         fm->GetFocusedWindow(getter_AddRefs(focusedWindow));
         if (SameCOMIdentity(win, focusedWindow))
           fm->ClearFocus(focusedWindow);
       }
     }
   } else {
-    rv = NS_ERROR_FAILURE; //changed to NS_OK in quirks mode if ScrollTo is called
-
-    // Scroll to the top/left if the anchor can not be
-    // found and it is labelled top (quirks mode only). @see bug 80784
-    if ((NS_LossyConvertUTF16toASCII(aAnchorName).LowerCaseEqualsLiteral("top")) &&
-        (mPresContext->CompatibilityMode() == eCompatibility_NavQuirks)) {
+    rv = NS_ERROR_FAILURE;
+    NS_NAMED_LITERAL_STRING(top, "top");
+    if (nsContentUtils::EqualsIgnoreASCIICase(aAnchorName, top)) {
+      // Scroll to the top/left if aAnchorName is "top" and there is no element
+      // with such a name or id.
       rv = NS_OK;
       nsIScrollableFrame* sf = GetRootScrollFrameAsScrollable();
       // Check |aScroll| after setting |rv| so we set |rv| to the same
       // thing whether or not |aScroll| is true.
       if (aScroll && sf) {
         // Scroll to the top of the page
         sf->ScrollTo(nsPoint(0, 0), nsIScrollableFrame::INSTANT);
       }
--- a/layout/base/tests/Makefile.in
+++ b/layout/base/tests/Makefile.in
@@ -63,16 +63,22 @@ DEFINES += -D_IMPL_NS_LAYOUT
 
 _TEST_FILES =	\
 		border_radius_hit_testing_iframe.html \
 		bug369950-subframe.xml \
 		decoration_line_rendering.js \
 		test_after_paint_pref.html \
 		test_border_radius_hit_testing.html \
 		test_bug66619.html \
+		test_bug93077-1.html \
+		test_bug93077-2.html \
+		test_bug93077-3.html \
+		test_bug93077-4.html \
+		test_bug93077-5.html \
+		test_bug93077-6.html \
 		test_bug114649.html \
 		$(warning test_bug369950.html disabled due to random orange; see bug 492575) \
 		test_bug386575.xhtml \
 		test_bug388019.html \
 		test_bug394057.html \
 		test_bug399284.html \
 		test_bug399951.html \
 		test_bug404209.xhtml \
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-1.html
@@ -0,0 +1,32 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#top", "#TOP", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-2.html
@@ -0,0 +1,32 @@
+<!-- Testing quirks mode. -->
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#top", "#TOP", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-3.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<p id=top>Top</p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#TOP", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+location.hash = "#top"
+isnot(window.scrollY, 0)
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-4.html
@@ -0,0 +1,35 @@
+<!-- Testing quirks mode. -->
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<p><a name=top>Top</a></p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#TOP", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+location.hash = "#top"
+isnot(window.scrollY, 0)
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-5.html
@@ -0,0 +1,35 @@
+<!DOCTYPE HTML>
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<p id=TOP>Top</p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#top", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+location.hash = "#TOP"
+isnot(window.scrollY, 0)
+</script>
+</pre>
+</body>
+</html>
new file mode 100644
--- /dev/null
+++ b/layout/base/tests/test_bug93077-6.html
@@ -0,0 +1,35 @@
+<!-- Testing quirks mode. -->
+<html>
+<!--
+https://bugzilla.mozilla.org/show_bug.cgi?id=93077
+-->
+<head>
+  <title>Test for Bug 93077</title>
+  <script type="application/javascript" src="/MochiKit/packed.js"></script>
+  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
+  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
+  <style>
+    #filler { height: 200cm; background: papayawhip; }
+  </style>
+</head>
+<body>
+<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=93077">Mozilla Bug 93077</a>
+<p id="display"></p>
+<div id=filler>...</div>
+<p id=below></p>
+<p><a name=TOP>Top</a></p>
+<pre id="test">
+<script type="application/javascript">
+/** Test for Bug 93077 **/
+["#top", "#Top"].forEach(function(fragid) {
+  document.getElementById("below").scrollIntoView()
+  isnot(window.scrollY, 0)
+  location.hash = fragid
+  is(window.scrollY, 0)
+})
+location.hash = "#TOP"
+isnot(window.scrollY, 0)
+</script>
+</pre>
+</body>
+</html>
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -1513,57 +1513,88 @@ DisplayDebugBorders(nsDisplayListBuilder
     aLists.Outlines()->AppendNewToTop(new (aBuilder)
         nsDisplayGeneric(aBuilder, aFrame, PaintEventTargetBorder, "EventTargetBorder",
                          nsDisplayItem::TYPE_EVENT_TARGET_BORDER));
   }
 }
 #endif
 
 static nsresult
-WrapPreserve3DList(nsIFrame *aFrame, nsDisplayListBuilder *aBuilder, nsDisplayList *aList)
-{
+WrapPreserve3DListInternal(nsIFrame* aFrame, nsDisplayListBuilder *aBuilder, nsDisplayList *aList, PRUint32& aIndex)
+{
+  if (aIndex > nsDisplayTransform::INDEX_MAX) {
+    return NS_OK;
+  }
+
   nsresult rv = NS_OK;
   nsDisplayList newList;
+  nsDisplayList temp;
   while (nsDisplayItem *item = aList->RemoveBottom()) {
     nsIFrame *childFrame = item->GetUnderlyingFrame();
     NS_ASSERTION(childFrame, "All display items to be wrapped must have a frame!");
+
+    // We accumulate sequential items that aren't transforms into the 'temp' list
+    // and then flush this list into newList by wrapping the whole lot with a single
+    // nsDisplayTransform.
+
     if (childFrame->GetParent()->Preserves3DChildren()) {
       switch (item->GetType()) {
         case nsDisplayItem::TYPE_TRANSFORM: {
+          if (!temp.IsEmpty()) {
+            newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
+          }
+          newList.AppendToTop(item);
           break;
         }
         case nsDisplayItem::TYPE_WRAP_LIST: {
+          if (!temp.IsEmpty()) {
+            newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
+          }
           nsDisplayWrapList *list = static_cast<nsDisplayWrapList*>(item);
-          rv = WrapPreserve3DList(aFrame, aBuilder, list->GetList());
+          rv = WrapPreserve3DListInternal(aFrame, aBuilder, list->GetList(), aIndex);
+          newList.AppendToTop(item);
           break;
         }
         case nsDisplayItem::TYPE_OPACITY: {
+          if (!temp.IsEmpty()) {
+            newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
+          }
           nsDisplayOpacity *opacity = static_cast<nsDisplayOpacity*>(item);
-          rv = WrapPreserve3DList(aFrame, aBuilder, opacity->GetList());
+          rv = WrapPreserve3DListInternal(aFrame, aBuilder, opacity->GetList(), aIndex);
+          newList.AppendToTop(item);
           break;
         }
         default: {
-          item = new (aBuilder) nsDisplayTransform(aBuilder, childFrame, item);
+          temp.AppendToTop(item);
           break;
         }
       } 
     } else {
-      item = new (aBuilder) nsDisplayTransform(aBuilder, childFrame, item);
+      temp.AppendToTop(item);
     }
  
-    if (NS_FAILED(rv) || !item)
+    if (NS_FAILED(rv) || !item || aIndex > nsDisplayTransform::INDEX_MAX)
       return rv;
-
-    newList.AppendToTop(item);
+  }
+    
+  if (!temp.IsEmpty()) {
+    newList.AppendToTop(new (aBuilder) nsDisplayTransform(aBuilder, aFrame, &temp, aIndex++));
   }
 
   aList->AppendToTop(&newList);
   return NS_OK;
 }
 
+static nsresult
+WrapPreserve3DList(nsIFrame* aFrame, nsDisplayListBuilder* aBuilder, nsDisplayList *aList)
+{
+  PRUint32 index = 0;
+  return WrapPreserve3DListInternal(aFrame, aBuilder, aList, index);
+}
+
 nsresult
 nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
                                              const nsRect&         aDirtyRect,
                                              nsDisplayList*        aList) {
   if (GetStateBits() & NS_FRAME_TOO_DEEP_IN_FRAME_TREE)
     return NS_OK;
 
   // Replaced elements have their visibility handled here, because
--- a/layout/generic/nsObjectFrame.cpp
+++ b/layout/generic/nsObjectFrame.cpp
@@ -270,28 +270,28 @@ public:
 
   void Destroy() { mFrame = nsnull; }
 
 protected:
   bool AcceptUpdate(PRUint64 aSequenceNumber) {
     if (aSequenceNumber > mLastSequenceNumber && mFrame &&
         mFrame->mInstanceOwner) {
       mLastSequenceNumber = aSequenceNumber;
-      return PR_TRUE;
+      return true;
     }
-    return PR_FALSE;
+    return false;
   }
 
   PRUint64 mLastSequenceNumber;
   nsObjectFrame* mFrame;
 };
 
 nsObjectFrame::nsObjectFrame(nsStyleContext* aContext)
   : nsObjectFrameSuper(aContext)
-  , mReflowCallbackPosted(PR_FALSE)
+  , mReflowCallbackPosted(false)
 {
   PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
          ("Created new nsObjectFrame %p\n", this));
 }
 
 nsObjectFrame::~nsObjectFrame()
 {
   PR_LOG(nsObjectFrameLM, PR_LOG_DEBUG,
@@ -345,17 +345,17 @@ void
 nsObjectFrame::DestroyFrom(nsIFrame* aDestructRoot)
 {
   NS_ASSERTION(!mPreventInstantiation ||
                (mContent && mContent->GetCurrentDoc()->GetDisplayDocument()),
                "about to crash due to bug 136927");
 
   // we need to finish with the plugin before native window is destroyed
   // doing this in the destructor is too late.
-  StopPluginInternal(PR_TRUE);
+  StopPluginInternal(true);
 
   // StopPluginInternal might have disowned the widget; if it has,
   // mWidget will be null.
   if (mWidget) {
     mInnerView->DetachWidgetEventHandler(mWidget);
     mWidget->Destroy();
   }
 
@@ -445,50 +445,50 @@ nsObjectFrame::CreateWidget(nscoord aWid
     if (!parentWidget)
       return NS_ERROR_FAILURE;
 
     mInnerView = viewMan->CreateView(GetContentRectRelativeToSelf(), view);
     if (!mInnerView) {
       NS_ERROR("Could not create inner view");
       return NS_ERROR_OUT_OF_MEMORY;
     }
-    viewMan->InsertChild(view, mInnerView, nsnull, PR_TRUE);
+    viewMan->InsertChild(view, mInnerView, nsnull, true);
 
     nsresult rv;
     mWidget = do_CreateInstance(kWidgetCID, &rv);
     if (NS_FAILED(rv))
       return rv;
 
     nsWidgetInitData initData;
     initData.mWindowType = eWindowType_plugin;
-    initData.mUnicode = PR_FALSE;
-    initData.clipChildren = PR_TRUE;
-    initData.clipSiblings = PR_TRUE;
+    initData.mUnicode = false;
+    initData.clipChildren = true;
+    initData.clipSiblings = true;
     // We want mWidget to be able to deliver events to us, especially on
     // Mac where events to the plugin are routed through Gecko. So we
     // allow the view to attach its event handler to mWidget even though
     // mWidget isn't the view's designated widget.
     EVENT_CALLBACK eventHandler = mInnerView->AttachWidgetEventHandler(mWidget);
     rv = mWidget->Create(parentWidget, nsnull, nsIntRect(0,0,0,0),
                          eventHandler, dx, nsnull, nsnull, &initData);
     if (NS_FAILED(rv)) {
       mWidget->Destroy();
       mWidget = nsnull;
       return rv;
     }
 
-    mWidget->EnableDragDrop(PR_TRUE);
+    mWidget->EnableDragDrop(true);
 
     // If this frame has an ancestor with a widget which is not
     // the root prescontext's widget, then this plugin should not be
     // displayed, so don't show the widget. If we show the widget, the
     // plugin may appear in the main window. In Web content this would
     // only happen with a plugin in a XUL popup.
     if (parentWidget == GetNearestWidget()) {
-      mWidget->Show(PR_TRUE);
+      mWidget->Show(true);
 #ifdef XP_MACOSX
       // On Mac, we need to invalidate ourselves since even windowed
       // plugins are painted through Thebes and we need to ensure
       // the Thebes layer containing the plugin is updated.
       Invalidate(GetContentRectRelativeToSelf());
 #endif
     }
   }
@@ -540,17 +540,17 @@ nsObjectFrame::CreateWidget(nscoord aWid
 #define EMBED_DEF_WIDTH 240
 #define EMBED_DEF_HEIGHT 200
 
 /* virtual */ nscoord
 nsObjectFrame::GetMinWidth(nsRenderingContext *aRenderingContext)
 {
   nscoord result = 0;
 
-  if (!IsHidden(PR_FALSE)) {
+  if (!IsHidden(false)) {
     nsIAtom *atom = mContent->Tag();
     if (atom == nsGkAtoms::applet || atom == nsGkAtoms::embed) {
       result = nsPresContext::CSSPixelsToAppUnits(EMBED_DEF_WIDTH);
     }
   }
 
   DISPLAY_MIN_WIDTH(this, result);
   return result;
@@ -566,17 +566,17 @@ void
 nsObjectFrame::GetDesiredSize(nsPresContext* aPresContext,
                               const nsHTMLReflowState& aReflowState,
                               nsHTMLReflowMetrics& aMetrics)
 {
   // By default, we have no area
   aMetrics.width = 0;
   aMetrics.height = 0;
 
-  if (IsHidden(PR_FALSE)) {
+  if (IsHidden(false)) {
     return;
   }
   
   aMetrics.width = aReflowState.ComputedWidth();
   aMetrics.height = aReflowState.ComputedHeight();
 
   // for EMBED and APPLET, default to 240x200 for compatibility
   nsIAtom *atom = mContent->Tag();
@@ -657,45 +657,45 @@ nsObjectFrame::Reflow(nsPresContext*    
   }
 
   nsRect r(0, 0, aMetrics.width, aMetrics.height);
   r.Deflate(aReflowState.mComputedBorderPadding);
 
   if (mInnerView) {
     nsIViewManager* vm = mInnerView->GetViewManager();
     vm->MoveViewTo(mInnerView, r.x, r.y);
-    vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), PR_TRUE);
+    vm->ResizeView(mInnerView, nsRect(nsPoint(0, 0), r.Size()), true);
   }
 
   FixupWindow(r.Size());
   if (!mReflowCallbackPosted) {
-    mReflowCallbackPosted = PR_TRUE;
+    mReflowCallbackPosted = true;
     aPresContext->PresShell()->PostReflowCallback(this);
   }
 
   aStatus = NS_FRAME_COMPLETE;
 
   NS_FRAME_SET_TRUNCATION(aStatus, aReflowState, aMetrics);
   return NS_OK;
 }
 
 ///////////// nsIReflowCallback ///////////////
 
 bool
 nsObjectFrame::ReflowFinished()
 {
-  mReflowCallbackPosted = PR_FALSE;
+  mReflowCallbackPosted = false;
   CallSetWindow();
-  return PR_TRUE;
+  return true;
 }
 
 void
 nsObjectFrame::ReflowCallbackCanceled()
 {
-  mReflowCallbackPosted = PR_FALSE;
+  mReflowCallbackPosted = false;
 }
 
 nsresult
 nsObjectFrame::InstantiatePlugin(nsPluginHost* aPluginHost, 
                                  const char* aMimeType,
                                  nsIURI* aURI)
 {
   NS_ASSERTION(mPreventInstantiation,
@@ -768,17 +768,17 @@ nsObjectFrame::FixupWindow(const nsSize&
   // us from drawing on screen until the widget is properly positioned, which will not
   // happen until we have finished the reflow process.
 #ifdef XP_MACOSX
   window->clipRect.top = 0;
   window->clipRect.left = 0;
   window->clipRect.bottom = 0;
   window->clipRect.right = 0;
 #else
-  mInstanceOwner->UpdateWindowPositionAndClipRect(PR_FALSE);
+  mInstanceOwner->UpdateWindowPositionAndClipRect(false);
 #endif
 
   NotifyPluginReflowObservers();
 }
 
 nsresult
 nsObjectFrame::CallSetWindow(bool aCheckIsHidden)
 {
@@ -840,17 +840,17 @@ nsObjectFrame::IsFocusable(PRInt32 *aTab
   return nsObjectFrameSuper::IsFocusable(aTabIndex, aWithMouse);
 }
 
 bool
 nsObjectFrame::IsHidden(bool aCheckVisibilityStyle) const
 {
   if (aCheckVisibilityStyle) {
     if (!GetStyleVisibility()->IsVisibleOrCollapsed())
-      return PR_TRUE;    
+      return true;    
   }
 
   // only <embed> tags support the HIDDEN attribute
   if (mContent->Tag() == nsGkAtoms::embed) {
     // Yes, these are really the kooky ways that you could tell 4.x
     // not to hide the <embed> once you'd put the 'hidden' attribute
     // on the tag...
 
@@ -858,21 +858,21 @@ nsObjectFrame::IsHidden(bool aCheckVisib
     // compatibility w/ 4.x and IE so we don't create a non-painting
     // widget in layout. See bug 188959.
     nsAutoString hidden;
     if (mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::hidden, hidden) &&
        (hidden.IsEmpty() ||
         (!hidden.LowerCaseEqualsLiteral("false") &&
          !hidden.LowerCaseEqualsLiteral("no") &&
          !hidden.LowerCaseEqualsLiteral("off")))) {
-      return PR_TRUE;
+      return true;
     }
   }
 
-  return PR_FALSE;
+  return false;
 }
 
 nsIntPoint nsObjectFrame::GetWindowOriginInPixels(bool aWindowless)
 {
   nsIView * parentWithView;
   nsPoint origin(0,0);
 
   GetOffsetFromView(origin, &parentWithView);
@@ -980,25 +980,25 @@ nsDisplayPluginReadback::GetBounds(nsDis
 
 bool
 nsDisplayPluginReadback::ComputeVisibility(nsDisplayListBuilder* aBuilder,
                                            nsRegion* aVisibleRegion,
                                            const nsRect& aAllowVisibleRegionExpansion)
 {
   if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
                                         aAllowVisibleRegionExpansion))
-    return PR_FALSE;
+    return false;
 
   nsRect expand;
   expand.IntersectRect(aAllowVisibleRegionExpansion, GetBounds(aBuilder));
   // *Add* our bounds to the visible region so that stuff underneath us is
   // likely to be made visible, so we can use it for a background! This is
   // a bit crazy since we normally only subtract from the visible region.
   aVisibleRegion->Or(*aVisibleRegion, expand);
-  return PR_TRUE;
+  return true;
 }
 
 nsRect
 nsDisplayPlugin::GetBounds(nsDisplayListBuilder* aBuilder)
 {
   return GetDisplayItemBounds(aBuilder, this, mFrame);
 }
 
@@ -1020,17 +1020,17 @@ nsDisplayPlugin::ComputeVisibility(nsDis
                                           aAllowVisibleRegionExpansion);
 }
 
 nsRegion
 nsDisplayPlugin::GetOpaqueRegion(nsDisplayListBuilder* aBuilder,
                                  bool* aForceTransparentSurface)
 {
   if (aForceTransparentSurface) {
-    *aForceTransparentSurface = PR_FALSE;
+    *aForceTransparentSurface = false;
   }
   nsRegion result;
   nsObjectFrame* f = static_cast<nsObjectFrame*>(mFrame);
   if (!aBuilder->IsForPluginGeometry()) {
     nsIWidget* widget = f->GetWidget();
     if (widget) {
       nsTArray<nsIntRect> clip;
       widget->GetWindowClipRegion(&clip);
@@ -1137,42 +1137,42 @@ nsObjectFrame::DidSetWidgetGeometry()
 #endif
 }
 
 bool
 nsObjectFrame::IsOpaque() const
 {
 #if defined(XP_MACOSX)
   // ???
-  return PR_FALSE;
+  return false;
 #else
   return !IsTransparentMode();
 #endif
 }
 
 bool
 nsObjectFrame::IsTransparentMode() const
 {
 #if defined(XP_MACOSX)
   // ???
-  return PR_FALSE;
+  return false;
 #else
   if (!mInstanceOwner)
-    return PR_FALSE;
+    return false;
 
   NPWindow *window;
   mInstanceOwner->GetWindow(window);
   if (window->type != NPWindowTypeDrawable)
-    return PR_FALSE;
+    return false;
 
   nsresult rv;
   nsRefPtr<nsNPAPIPluginInstance> pi;
   rv = mInstanceOwner->GetInstance(getter_AddRefs(pi));
   if (NS_FAILED(rv) || !pi)
-    return PR_FALSE;
+    return false;
 
   bool transparent = false;
   pi->IsTransparent(&transparent);
   return transparent;
 #endif
 }
 
 NS_IMETHODIMP
@@ -1205,17 +1205,17 @@ nsObjectFrame::BuildDisplayList(nsDispla
   nsDisplayList replacedContent;
 
   if (aBuilder->IsForPainting() && mInstanceOwner && mInstanceOwner->UseAsyncRendering()) {
     NPWindow* window = nsnull;
     mInstanceOwner->GetWindow(window);
     bool isVisible = window && window->width > 0 && window->height > 0;
     if (isVisible && aBuilder->ShouldSyncDecodeImages()) {
   #ifndef XP_MACOSX
-      mInstanceOwner->UpdateWindowVisibility(PR_TRUE);
+      mInstanceOwner->UpdateWindowVisibility(true);
   #endif
     }
 
     nsRefPtr<ImageContainer> container = GetImageContainer();
     nsRefPtr<Image> currentImage = container ? container->GetCurrentImage() : nsnull;
     if (!currentImage || !isVisible ||
         container->GetCurrentSize() != gfxIntSize(window->width, window->height)) {
       mInstanceOwner->NotifyPaintWaiter(aBuilder);
@@ -1783,17 +1783,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
       // (If SetPluginPortAndDetectChange() made any changes itself, this has
       // already been detected in that method, and will likewise result in a
       // call to SetWindow() from FixUpPluginWindow().)
       NP_CGContext* windowContext = static_cast<NP_CGContext*>(window->window);
       if (mInstanceOwner->GetEventModel() == NPEventModelCarbon &&
           windowContext->context != cgContext) {
         windowContext->context = cgContext;
         cgPluginPortCopy->context = cgContext;
-        mInstanceOwner->SetPluginPortChanged(PR_TRUE);
+        mInstanceOwner->SetPluginPortChanged(true);
       }
 #endif
 
       mInstanceOwner->BeginCGPaint();
       if (mInstanceOwner->GetDrawingModel() == NPDrawingModelCoreAnimation ||
           mInstanceOwner->GetDrawingModel() == 
                                    NPDrawingModelInvalidatingCoreAnimation) {
         // CoreAnimation is updated, render the layer and perform a readback.
@@ -1834,17 +1834,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
   if (inst) {
     gfxRect frameGfxRect =
       PresContext()->AppUnitsToGfxUnits(aPluginRect);
     gfxRect dirtyGfxRect =
       PresContext()->AppUnitsToGfxUnits(aDirtyRect);
     gfxContext *ctx = aRenderingContext.ThebesContext();
     gfxMatrix currentMatrix = ctx->CurrentMatrix();
 
-    if (ctx->UserToDevicePixelSnapped(frameGfxRect, PR_FALSE)) {
+    if (ctx->UserToDevicePixelSnapped(frameGfxRect, false)) {
       dirtyGfxRect = ctx->UserToDevice(dirtyGfxRect);
       ctx->IdentityMatrix();
     }
     dirtyGfxRect.RoundOut();
 
     // Look if it's windowless
     NPWindow *window;
     mInstanceOwner->GetWindow(window);
@@ -1896,17 +1896,17 @@ nsObjectFrame::PaintPlugin(nsDisplayList
         // it shouldn't.
         //
         // since the two uses of the rectangle are mutually exclusive in some cases, and
         // since I don't see any incorrect painting (at least with Flash and ViewPoint -
         // the originator of bug 135737), it seems that windowless plugins are not relying
         // on information here for clipping their drawing, and we can safely use this message
         // to tell the plugin exactly where it is in all cases.
 
-        nsIntPoint origin = GetWindowOriginInPixels(PR_TRUE);
+        nsIntPoint origin = GetWindowOriginInPixels(true);
         nsIntRect winlessRect = nsIntRect(origin, nsIntSize(window->width, window->height));
 
         if (!mWindowlessRect.IsEqualEdges(winlessRect)) {
           mWindowlessRect = winlessRect;
 
           WINDOWPOS winpos;
           memset(&winpos, 0, sizeof(winpos));
           winpos.x = mWindowlessRect.x;
@@ -1987,34 +1987,34 @@ nsObjectFrame::PaintPlugin(nsDisplayList
         NS_WARNING("Plugin is being asked to render to a surface that's in error!");
         return;
       }
 
       // check if we need to update the PS
       HPS hps = (HPS)GetPSFromRC(aRenderingContext);
       if (reinterpret_cast<HPS>(window->window) != hps) {
         window->window = reinterpret_cast<void*>(hps);
-        doupdatewindow = PR_TRUE;
+        doupdatewindow = true;
       }
       LONG lPSid = GpiSavePS(hps);
       RECTL rclViewport;
       if (GpiQueryDevice(hps) != NULLHANDLE) { // ensure that we have an associated HDC
         if (GpiQueryPageViewport(hps, &rclViewport)) {
           rclViewport.xLeft += (LONG)xoff;
           rclViewport.xRight += (LONG)xoff;
           rclViewport.yBottom += (LONG)yoff;
           rclViewport.yTop += (LONG)yoff;
           GpiSetPageViewport(hps, &rclViewport);
         }
       }
 
       if ((window->x != origin.x) || (window->y != origin.y)) {
         window->x = origin.x;
         window->y = origin.y;
-        doupdatewindow = PR_TRUE;
+        doupdatewindow = true;
       }
 
       // if our location or visible area has changed, we need to tell the plugin
       if (doupdatewindow) {
         inst->SetWindow(window);        
       }
 
       mInstanceOwner->Paint(aDirtyRect, hps);
@@ -2108,17 +2108,17 @@ nsObjectFrame::GetPluginInstance(nsNPAPI
 }
 
 nsresult
 nsObjectFrame::PrepareInstanceOwner()
 {
   nsWeakFrame weakFrame(this);
 
   // First, have to stop any possibly running plugins.
-  StopPluginInternal(PR_FALSE);
+  StopPluginInternal(false);
 
   if (!weakFrame.IsAlive()) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   NS_ASSERTION(!mInstanceOwner, "Must not have an instance owner here");
 
   mInstanceOwner = new nsPluginInstanceOwner();
@@ -2155,26 +2155,26 @@ nsObjectFrame::Instantiate(nsIChannel* a
   FixupWindow(GetContentRectRelativeToSelf().Size());
 
   // Ensure we redraw when a plugin is instantiated
   Invalidate(GetContentRectRelativeToSelf());
 
   nsWeakFrame weakFrame(this);
 
   NS_ASSERTION(!mPreventInstantiation, "Say what?");
-  mPreventInstantiation = PR_TRUE;
+  mPreventInstantiation = true;
   rv = pluginHost->InstantiatePluginForChannel(aChannel, mInstanceOwner, aStreamListener);
 
   if (!weakFrame.IsAlive()) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   NS_ASSERTION(mPreventInstantiation,
                "Instantiation should still be prevented!");
-  mPreventInstantiation = PR_FALSE;
+  mPreventInstantiation = false;
 
 #ifdef ACCESSIBILITY
   nsAccessibilityService* accService = nsIPresShell::AccService();
   if (accService) {
     accService->RecreateAccessible(PresContext()->PresShell(), mContent);
   }
 #endif
 
@@ -2213,17 +2213,17 @@ nsObjectFrame::Instantiate(const char* a
 
   // get the nsIPluginHost service
   nsCOMPtr<nsIPluginHost> pluginHost(do_GetService(MOZ_PLUGIN_HOST_CONTRACTID, &rv));
   if (NS_FAILED(rv))
     return rv;
   mInstanceOwner->SetPluginHost(pluginHost);
 
   NS_ASSERTION(!mPreventInstantiation, "Say what?");
-  mPreventInstantiation = PR_TRUE;
+  mPreventInstantiation = true;
 
   rv = InstantiatePlugin(static_cast<nsPluginHost*>(pluginHost.get()), aMimeType, aURI);
 
   if (!weakFrame.IsAlive()) {
     return NS_ERROR_NOT_AVAILABLE;
   }
 
   // finish up
@@ -2242,17 +2242,17 @@ nsObjectFrame::Instantiate(const char* a
 
 #ifdef ACCESSIBILITY
   nsAccessibilityService* accService = nsIPresShell::AccService();
   if (accService) {
     accService->RecreateAccessible(PresContext()->PresShell(), mContent);
   }
 #endif
 
-  mPreventInstantiation = PR_FALSE;
+  mPreventInstantiation = false;
 
   return rv;
 }
 
 void
 nsObjectFrame::TryNotifyContentObjectWrapper()
 {
   nsRefPtr<nsNPAPIPluginInstance> inst;
@@ -2304,34 +2304,34 @@ GetMIMEType(nsNPAPIPluginInstance *aPlug
 #endif // XP_WIN
 
 static bool
 DoDelayedStop(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
 {
 #if (MOZ_PLATFORM_MAEMO==5)
   // Don't delay stop on Maemo/Hildon (bug 530739).
   if (aDelayedStop && aInstanceOwner->MatchPluginName("Shockwave Flash"))
-    return PR_FALSE;
+    return false;
 #endif
 
   // Don't delay stopping QuickTime (bug 425157), Flip4Mac (bug 426524),
   // XStandard (bug 430219), CMISS Zinc (bug 429604).
   if (aDelayedStop
 #if !(defined XP_WIN || defined MOZ_X11)
       && !aInstanceOwner->MatchPluginName("QuickTime")
       && !aInstanceOwner->MatchPluginName("Flip4Mac")
       && !aInstanceOwner->MatchPluginName("XStandard plugin")
       && !aInstanceOwner->MatchPluginName("CMISS Zinc Plugin")
 #endif
       ) {
     nsCOMPtr<nsIRunnable> evt = new nsStopPluginRunnable(aInstanceOwner);
     NS_DispatchToCurrentThread(evt);
-    return PR_TRUE;
+    return true;
   }
-  return PR_FALSE;
+  return false;
 }
 
 static void
 DoStopPlugin(nsPluginInstanceOwner *aInstanceOwner, bool aDelayedStop)
 {
   nsRefPtr<nsNPAPIPluginInstance> inst;
   aInstanceOwner->GetInstance(getter_AddRefs(inst));
   if (inst) {
@@ -2394,17 +2394,17 @@ nsStopPluginRunnable::Run()
       }
       NS_ERROR("Failed to setup a timer to stop the plugin later (at a safe "
                "time). Stopping the plugin now, this might crash.");
     }
   }
 
   mTimer = nsnull;
 
-  DoStopPlugin(mInstanceOwner, PR_FALSE);
+  DoStopPlugin(mInstanceOwner, false);
 
   return NS_OK;
 }
 
 void
 nsObjectFrame::StopPlugin()
 {
   bool delayedStop = false;
@@ -2460,17 +2460,17 @@ nsObjectFrame::StopPluginInternal(bool a
   nsRefPtr<nsPluginInstanceOwner> owner;
   owner.swap(mInstanceOwner);
 
   // Make sure that our windowless rect has been zeroed out, so if we
   // get reinstantiated we'll send the right messages to the plug-in.
   mWindowlessRect.SetEmpty();
 
   bool oldVal = mPreventInstantiation;
-  mPreventInstantiation = PR_TRUE;
+  mPreventInstantiation = true;
 
   nsWeakFrame weakFrame(this);
 
 #if defined(XP_WIN) || defined(MOZ_X11)
   if (aDelayedStop && mWidget) {
     // If we're asked to do a delayed stop it means we're stopping the
     // plugin because we're destroying the frame. In that case, disown
     // the widget.
--- a/layout/reftests/bugs/539880-1-ref.html
+++ b/layout/reftests/bugs/539880-1-ref.html
@@ -1,38 +1,38 @@
 <html>
 <body>
 
 <table cellpadding="10">
 	<tr>
 		<th>0</th>
 		<td><table cellpadding="4" border="0"><tr><td>border="0"</td></tr></table></td>
 		<td><table cellpadding="4" border="0"><tr><td>border="0px"</td></tr></table></td>
-		<td><table cellpadding="4" border="1"><tr><td>border="0em"</td></tr></table></td>
+		<td><table cellpadding="4" border="0"><tr><td>border="0em"</td></tr></table></td>
 	</tr>
 	<tr>
 		<th>1</th>
 		<td><table cellpadding="4" border="1"><tr><td>border="1"</td></tr></table></td>
 		<td><table cellpadding="4" border="1"><tr><td>border="1px"</td></tr></table></td>
 		<td><table cellpadding="4" border="1"><tr><td>border="1em"</td></tr></table></td>
 	</tr>
 	<tr>
 		<th>2</th>
 		<td><table cellpadding="4" border="2"><tr><td>border="2"</td></tr></table></td>
 		<td><table cellpadding="4" border="2"><tr><td>border="2px"</td></tr></table></td>
-		<td><table cellpadding="4" border="1"><tr><td>border="2em"</td></tr></table></td>
+		<td><table cellpadding="4" border="2"><tr><td>border="2em"</td></tr></table></td>
 	</tr>
 	<tr>
 		<th>3</th>
 		<td><table cellpadding="4" border="3"><tr><td>border="3"</td></tr></table></td>
 		<td><table cellpadding="4" border="3"><tr><td>border="3px"</td></tr></table></td>
-		<td><table cellpadding="4" border="1"><tr><td>border="3em"</td></tr></table></td>
+		<td><table cellpadding="4" border="3"><tr><td>border="3em"</td></tr></table></td>
 	</tr>
 	<tr>
 		<th>10</th>
 		<td><table cellpadding="4" border="10"><tr><td>border="10"</td></tr></table></td>
 		<td><table cellpadding="4" border="10"><tr><td>border="10px"</td></tr></table></td>
-		<td><table cellpadding="4" border="1"><tr><td>border="10em"</td></tr></table></td>
+		<td><table cellpadding="4" border="10"><tr><td>border="10em"</td></tr></table></td>
 	</tr>
 </table>
 
 </body>
 </html>
--- a/layout/style/nsCSSProps.cpp
+++ b/layout/style/nsCSSProps.cpp
@@ -579,22 +579,24 @@ const PRInt32 nsCSSProps::kAppearanceKTa
   eCSSKeyword__moz_window_button_box,         NS_THEME_WINDOW_BUTTON_BOX,
   eCSSKeyword__moz_window_button_box_maximized, NS_THEME_WINDOW_BUTTON_BOX_MAXIMIZED,
   eCSSKeyword__moz_win_exclude_glass,         NS_THEME_WIN_EXCLUDE_GLASS,
   eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kBackfaceVisibilityKTable[] = {
   eCSSKeyword_visible, NS_STYLE_BACKFACE_VISIBILITY_VISIBLE,
-  eCSSKeyword_hidden, NS_STYLE_BACKFACE_VISIBILITY_HIDDEN
+  eCSSKeyword_hidden, NS_STYLE_BACKFACE_VISIBILITY_HIDDEN,
+  eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kTransformStyleKTable[] = {
   eCSSKeyword_flat, NS_STYLE_TRANSFORM_STYLE_FLAT,
-  eCSSKeyword_preserve_3d, NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D
+  eCSSKeyword_preserve_3d, NS_STYLE_TRANSFORM_STYLE_PRESERVE_3D,
+  eCSSKeyword_UNKNOWN,-1
 };
 
 const PRInt32 nsCSSProps::kBackgroundAttachmentKTable[] = {
   eCSSKeyword_fixed, NS_STYLE_BG_ATTACHMENT_FIXED,
   eCSSKeyword_scroll, NS_STYLE_BG_ATTACHMENT_SCROLL,
   eCSSKeyword_UNKNOWN,-1
 };
 
--- a/layout/tools/reftest/reftest.js
+++ b/layout/tools/reftest/reftest.js
@@ -877,24 +877,23 @@ function ServeFiles(manifestURL, depth, 
 function Focus()
 {
     // FIXME/bug 583976: focus doesn't yet work with out-of-process
     // content.
     if (gBrowserIsRemote) {
         return false;
     }
 
-    // FIXME/bug 623625: determine if the window is focused and/or try
-    // to acquire focus if it's not.
-    //
-    // NB: we can't add anything here that would return false on
-    // tinderbox, otherwise we could lose testing coverage due to
-    // problems on the test machines.  We might want a require-focus
-    // mode, defaulting to false for developers, but that's true on
-    // tinderbox.
+    var fm = CC["@mozilla.org/focus-manager;1"].getService(CI.nsIFocusManager);
+    fm.activeWindow = window;
+    try {
+        var dock = CC["@mozilla.org/widget/macdocksupport;1"].getService(CI.nsIMacDockSupport);
+        dock.activateApplication(true);
+    } catch(ex) {
+    }
     return true;
 }
 
 function StartCurrentTest()
 {
     gTestLog = [];
 
     // make sure we don't run tests that are expected to kill the browser
--- a/mobile/themes/core/honeycomb/platform.css
+++ b/mobile/themes/core/honeycomb/platform.css
@@ -707,16 +707,17 @@ dialog {
 .prompt-button[disabled="true"] {
   border: none !important;
 }
 
 .prompt-button > .button-box {
   -moz-border-end: @border_width_tiny@ solid @color_button_border@;
   -moz-border-right-colors: transparent @color_button_border@;
   -moz-margin-end: -moz-calc(-3 * @border_width_tiny@);
+  padding: @padding_xxxnormal@ 0;
 }
 
 .prompt-button:last-of-type {
   -moz-margin-end: @margin_xtiny@;
 }
 
 .prompt-button:last-of-type > .button-box {
   -moz-border-end: none;
--- a/modules/libpr0n/decoders/nsBMPDecoder.cpp
+++ b/modules/libpr0n/decoders/nsBMPDecoder.cpp
@@ -39,17 +39,17 @@
  * ***** END LICENSE BLOCK ***** */
 /* I got the format description from http://www.daubnet.com/formats/BMP.html */
 
 /* This is a Cross-Platform BMP Decoder, which should work everywhere, including
  * Big-Endian machines like the PowerPC. */
 
 #include <stdlib.h>
 
-#include "Endian.h"
+#include "EndianMacros.h"
 #include "nsBMPDecoder.h"
 
 #include "nsIInputStream.h"
 #include "RasterImage.h"
 #include "imgIContainerObserver.h"
 #include "ImageLogging.h"
 
 namespace mozilla {
--- a/modules/libpr0n/decoders/nsICODecoder.cpp
+++ b/modules/libpr0n/decoders/nsICODecoder.cpp
@@ -39,17 +39,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 /* This is a Cross-Platform ICO Decoder, which should work everywhere, including
  * Big-Endian machines like the PowerPC. */
 
 #include <stdlib.h>
 
-#include "Endian.h"
+#include "EndianMacros.h"
 #include "nsICODecoder.h"
 
 #include "nsIInputStream.h"
 #include "nsIComponentManager.h"
 #include "RasterImage.h"
 #include "imgIContainerObserver.h"
 
 #include "nsIProperties.h"
--- a/modules/libpr0n/encoders/bmp/nsBMPEncoder.cpp
+++ b/modules/libpr0n/encoders/bmp/nsBMPEncoder.cpp
@@ -31,17 +31,17 @@
  * 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 ***** */
 
 #include "nsCRT.h"
-#include "Endian.h"
+#include "EndianMacros.h"
 #include "nsBMPEncoder.h"
 #include "prmem.h"
 #include "prprf.h"
 #include "nsString.h"
 #include "nsStreamUtils.h"
 #include "nsAutoPtr.h"
 
 using namespace mozilla;
--- a/modules/libpr0n/encoders/ico/nsICOEncoder.cpp
+++ b/modules/libpr0n/encoders/ico/nsICOEncoder.cpp
@@ -31,17 +31,17 @@
  * 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 ***** */
 
 #include "nsCRT.h"
-#include "Endian.h"
+#include "EndianMacros.h"
 #include "nsBMPEncoder.h"
 #include "nsPNGEncoder.h"
 #include "nsICOEncoder.h"
 #include "prmem.h"
 #include "prprf.h"
 #include "nsString.h"
 #include "nsStreamUtils.h"
 
rename from modules/libpr0n/src/Endian.h
rename to modules/libpr0n/src/EndianMacros.h
--- a/modules/libpr0n/src/imgLoader.cpp
+++ b/modules/libpr0n/src/imgLoader.cpp
@@ -392,33 +392,23 @@ nsProgressNotificationProxy::GetInterfac
     NS_ADDREF_THIS();
     return NS_OK;
   }
   if (mOriginalCallbacks)
     return mOriginalCallbacks->GetInterface(iid, result);
   return NS_NOINTERFACE;
 }
 
-static bool NewRequestAndEntry(bool forcePrincipalCheckForCacheEntry,
-                                 imgRequest **request, imgCacheEntry **entry)
+static void NewRequestAndEntry(bool aForcePrincipalCheckForCacheEntry,
+                               imgRequest **aRequest, imgCacheEntry **aEntry)
 {
-  *request = new imgRequest();
-  if (!*request)
-    return PR_FALSE;
-
-  *entry = new imgCacheEntry(*request, forcePrincipalCheckForCacheEntry);
-  if (!*entry) {
-    delete *request;
-    return PR_FALSE;
-  }
-
-  NS_ADDREF(*request);
-  NS_ADDREF(*entry);
-
-  return PR_TRUE;
+  nsRefPtr<imgRequest> request = new imgRequest();
+  nsRefPtr<imgCacheEntry> entry = new imgCacheEntry(request, aForcePrincipalCheckForCacheEntry);
+  request.forget(aRequest);
+  entry.forget(aEntry);
 }
 
 static bool ShouldRevalidateEntry(imgCacheEntry *aEntry,
                               nsLoadFlags aFlags,
                               bool aHasExpired)
 {
   bool bValidateEntry = false;
 
@@ -1692,19 +1682,18 @@ NS_IMETHODIMP imgLoader::LoadImage(nsIUR
                          aLoadGroup,
                          mAcceptHeader,
                          requestFlags,
                          aPolicy,
                          aLoadingPrincipal);
     if (NS_FAILED(rv))
       return NS_ERROR_FAILURE;
 
-    if (!NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
-                            getter_AddRefs(entry)))
-      return NS_ERROR_OUT_OF_MEMORY;
+    NewRequestAndEntry(forcePrincipalCheck, getter_AddRefs(request),
+                       getter_AddRefs(entry));
 
     PR_LOG(gImgLog, PR_LOG_DEBUG,
            ("[this=%p] imgLoader::LoadImage -- Created new imgRequest [request=%p]\n", this, request.get()));
 
     // Create a loadgroup for this new channel.  This way if the channel
     // is redirected, we'll have a way to cancel the resulting channel.
     nsCOMPtr<nsILoadGroup> loadGroup =
         do_CreateInstance(NS_LOADGROUP_CONTRACTID);
@@ -1897,19 +1886,17 @@ NS_IMETHODIMP imgLoader::LoadImageWithCh
 
     rv = CreateNewProxyForRequest(request, loadGroup, aObserver,
                                   requestFlags, nsnull, _retval);
     static_cast<imgRequestProxy*>(*_retval)->NotifyListener();
   } else {
     // Default to doing a principal check because we don't know who
     // started that load and whether their principal ended up being
     // inherited on the channel.
-    if (!NewRequestAndEntry(PR_TRUE, getter_AddRefs(request),
-                            getter_AddRefs(entry)))
-      return NS_ERROR_OUT_OF_MEMORY;
+    NewRequestAndEntry(PR_TRUE, getter_AddRefs(request), getter_AddRefs(entry));
 
     // We use originalURI here to fulfil the imgIRequest contract on GetURI.
     nsCOMPtr<nsIURI> originalURI;
     channel->GetOriginalURI(getter_AddRefs(originalURI));
 
     // No principal specified here, because we're not passed one.
     request->Init(originalURI, uri, channel, channel, entry,
                   aCX, nsnull, imgIRequest::CORS_NONE);
--- a/modules/libpr0n/test/crashtests/crashtests.list
+++ b/modules/libpr0n/test/crashtests/crashtests.list
@@ -3,17 +3,17 @@ load 89341-1.gif
 
 # the following tests were inspired by bug 525326
 # they have image sizes of 65535x65535 which is larger than we allow
 load invalid-size.gif
 # this image has a valid size for the first frame, but the second frame is 65535x65535
 load invalid-size-second-frame.gif
 
 # Animated gifs with a very large canvas, but tiny actual content.
-asserts(2) load delaytest.html?523528-1.gif # Bug 564231
+load delaytest.html?523528-1.gif
 load delaytest.html?523528-2.gif
 
 # this would have exposed the leak discovered in bug 642902
 load invalid-icc-profile.jpg
 
 # maximum (256) width and height icons that we currently (due to bug 668068)
 # interpret as 0-width and 0-height.
 load 256-width.ico
--- a/toolkit/components/prompts/content/tabprompts.xml
+++ b/toolkit/components/prompts/content/tabprompts.xml
@@ -208,20 +208,18 @@
                 }
             ]]>
             </body>
         </method>
 
         <method name="onResize">
             <body>
             <![CDATA[
-                // XXX the <notificationbox/>; to be made app-agnostic later
-                let container = this.parentNode.parentNode;
-                let availWidth = container.clientWidth;
-                let availHeight = container.clientHeight;
+                let availWidth = this.clientWidth;
+                let availHeight = this.clientHeight;
                 if (availWidth == this.availWidth && availHeight == this.availHeight)
                     return;
                 this.availWidth = availWidth;
                 this.availHeight = availHeight;
 
                 let self = this;
                 function getElement(anonid) {
                     return document.getAnonymousElementByAttribute(self, "anonid", anonid);
--- a/toolkit/components/telemetry/TelemetryHistograms.h
+++ b/toolkit/components/telemetry/TelemetryHistograms.h
@@ -181,16 +181,17 @@ HISTOGRAM(NETWORK_DISK_CACHE_OPEN, 1, 10
 HISTOGRAM(NETWORK_DISK_CACHE_TRASHRENAME, 1, 10000, 10, EXPONENTIAL, "Time spent renaming bad Cache to Cache.Trash (ms)")
 HISTOGRAM(NETWORK_DISK_CACHE_DELETEDIR, 1, 10000, 10, EXPONENTIAL, "Time spent deleting disk cache (ms)")
 
 /**
  * Url-Classifier telemetry
  */
 #ifdef MOZ_URL_CLASSIFIER
 HISTOGRAM(URLCLASSIFIER_PS_FILELOAD_TIME, 1, 1000, 10, EXPONENTIAL, "Time spent loading PrefixSet from file (ms)")
+HISTOGRAM(URLCLASSIFIER_PS_FALLOCATE_TIME, 1, 1000, 10, EXPONENTIAL, "Time spent fallocating PrefixSet (ms)")
 HISTOGRAM(URLCLASSIFIER_PS_CONSTRUCT_TIME, 1, 5000, 15, EXPONENTIAL, "Time spent constructing PrefixSet from DB (ms)")
 HISTOGRAM(URLCLASSIFIER_PS_LOOKUP_TIME, 1, 500, 10, EXPONENTIAL, "Time spent per PrefixSet lookup (ms)")
 #endif
 
 /**
  * Places telemetry.
  */
 HISTOGRAM(PLACES_PAGES_COUNT, 1000, 150000, 20, EXPONENTIAL, "PLACES: Number of unique pages")
--- a/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
+++ b/toolkit/components/url-classifier/nsUrlClassifierPrefixSet.cpp
@@ -46,16 +46,17 @@
 #include "nsIUrlClassifierPrefixSet.h"
 #include "nsIRandomGenerator.h"
 #include "nsIFile.h"
 #include "nsILocalFile.h"
 #include "nsToolkitCompsCID.h"
 #include "nsTArray.h"
 #include "nsThreadUtils.h"
 #include "mozilla/Mutex.h"
+#include "mozilla/Telemetry.h"
 #include "mozilla/FileUtils.h"
 #include "prlog.h"
 
 using namespace mozilla;
 
 // NSPR_LOG_MODULES=UrlClassifierPrefixSet:5
 #if defined(PR_LOGGING)
 static const PRLogModuleInfo *gUrlClassifierPrefixSetLog = nsnull;
@@ -373,25 +374,34 @@ nsUrlClassifierPrefixSet::LoadFromFd(Aut
 NS_IMETHODIMP
 nsUrlClassifierPrefixSet::LoadFromFile(nsIFile * aFile)
 {
   nsresult rv;
   nsCOMPtr<nsILocalFile> file(do_QueryInterface(aFile, &rv));
   NS_ENSURE_SUCCESS(rv, rv);
 
   AutoFDClose fileFd;
-  rv = file->OpenNSPRFileDesc(PR_RDONLY, 0, &fileFd);
+  rv = file->OpenNSPRFileDesc(PR_RDONLY | nsILocalFile::OS_READAHEAD, 0, &fileFd);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return LoadFromFd(fileFd);
 }
 
 nsresult
 nsUrlClassifierPrefixSet::StoreToFd(AutoFDClose & fileFd)
 {
+  {
+      Telemetry::AutoTimer<Telemetry::URLCLASSIFIER_PS_FALLOCATE_TIME> timer;
+      PRInt64 size = 4 * sizeof(PRUint32);
+      size += 2 * mIndexStarts.Length() * sizeof(PRUint32);
+      size +=     mDeltas.Length() * sizeof(PRUint16);
+
+      mozilla::fallocate(fileFd, size);
+  }
+
   PRInt32 written;
   PRUint32 magic = PREFIXSET_VERSION_MAGIC;
   written = PR_Write(fileFd, &magic, sizeof(PRUint32));
   NS_ENSURE_TRUE(written > 0, NS_ERROR_FAILURE);
 
   written = PR_Write(fileFd, &mRandomKey, sizeof(PRUint32));
   NS_ENSURE_TRUE(written > 0, NS_ERROR_FAILURE);
 
--- a/toolkit/content/xul.css
+++ b/toolkit/content/xul.css
@@ -1187,10 +1187,11 @@ findbar {
 /*********** filefield ************/
 filefield {
   -moz-binding: url("chrome://global/content/bindings/filefield.xml#filefield");
 }
 
 /*********** tabmodalprompt ************/
 tabmodalprompt {
   -moz-binding: url("chrome://global/content/tabprompts.xml#tabmodalprompt");
+  overflow: hidden;
   text-shadow: none;
 }
--- a/toolkit/themes/winstripe/global/findBar.css
+++ b/toolkit/themes/winstripe/global/findBar.css
@@ -12,19 +12,20 @@
   -moz-image-region: rect(0, 32px, 16px, 16px);
 }
 
 .findbar-closebutton:hover:active {
   -moz-image-region: rect(0, 48px, 16px, 32px);
 }
 
 findbar {
-  border-top: 2px solid;
-  -moz-border-top-colors: ThreeDShadow ThreeDHighlight;
-  padding-bottom: 1px;
+  padding-top: 1px;
+  background-image: -moz-linear-gradient(rgba(0,0,0,.15) 1px, rgba(255,255,255,.15) 1px);
+  background-size: 100% 2px;
+  background-repeat: no-repeat;
   min-width: 1px;
 }
 
 /* find-next button */
 
 .findbar-find-next {
   list-style-image: url("chrome://global/skin/icons/find.png");
   -moz-image-region: rect(0px 16px 16px 0px);
--- a/widget/src/gtk2/nsBidiKeyboard.cpp
+++ b/widget/src/gtk2/nsBidiKeyboard.cpp
@@ -88,17 +88,17 @@ nsBidiKeyboard::IsLangRTL(bool *aIsRTL)
     *aIsRTL = (gdk_keymap_get_direction(NULL) == PANGO_DIRECTION_RTL);
 
     return NS_OK;
 }
 
 nsresult
 nsBidiKeyboard::SetHaveBidiKeyboards()
 {
-    mHaveBidiKeyboards = PR_FALSE;
+    mHaveBidiKeyboards = false;
 
     if (!gtklib || !GdkKeymapHaveBidiLayouts)
         return NS_ERROR_FAILURE;
 
     mHaveBidiKeyboards = (*GdkKeymapHaveBidiLayouts)(NULL);
 
     return NS_OK;
 }
--- a/widget/src/gtk2/nsCUPSShim.cpp
+++ b/widget/src/gtk2/nsCUPSShim.cpp
@@ -56,17 +56,17 @@ static const char gSymName[][sizeof("cup
 static const int gSymNameCt = NS_ARRAY_LENGTH(gSymName);
 
 
 bool
 nsCUPSShim::Init()
 {
     mCupsLib = PR_LoadLibrary("libcups.so.2");
     if (!mCupsLib)
-        return PR_FALSE;
+        return false;
 
     // List of symbol pointers. Must match gSymName[] defined above.
     void **symAddr[] = {
         (void **)&mCupsAddOption,
         (void **)&mCupsFreeDests,
         (void **)&mCupsGetDest,
         (void **)&mCupsGetDests,
         (void **)&mCupsPrintFile,
@@ -78,13 +78,13 @@ nsCUPSShim::Init()
         if (! *(symAddr[i])) {
 #ifdef DEBUG
             nsCAutoString msg(gSymName[i]);
             msg.Append(" not found in CUPS library");
             NS_WARNING(msg.get());
 #endif
             PR_UnloadLibrary(mCupsLib);
             mCupsLib = nsnull;
-            return PR_FALSE;
+            return false;
         }
     }
-    return PR_TRUE;
+    return true;
 }
--- a/widget/src/gtk2/nsCUPSShim.h
+++ b/widget/src/gtk2/nsCUPSShim.h
@@ -83,25 +83,25 @@ struct PRLibrary;
 
 /* Note: this class relies on static initialization. */
 class nsCUPSShim {
     public:
         /**
          * Initialize this object. Attempt to load the CUPS shared
          * library and find function pointers for the supported
          * functions (see below).
-         * @return PR_FALSE if the shared library could not be loaded, or if
+         * @return false if the shared library could not be loaded, or if
          *                  any of the functions could not be found.
-         *         PR_TRUE  for successful initialization.
+         *         true  for successful initialization.
          */
         bool Init();
 
         /**
-         * @return PR_TRUE  if the object was initialized successfully.
-         *         PR_FALSE otherwise.
+         * @return true  if the object was initialized successfully.
+         *         false otherwise.
          */
         bool IsInitialized() { return nsnull != mCupsLib; }
 
         /* Function pointers for supported functions. These are only
          * valid after successful initialization.
          */
         CupsAddOptionType   mCupsAddOption;
         CupsFreeDestsType   mCupsFreeDests;
--- a/widget/src/gtk2/nsClipboard.cpp
+++ b/widget/src/gtk2/nsClipboard.cpp
@@ -98,18 +98,18 @@ checkEventProc(Display *display, XEvent 
 
 struct retrieval_context
 {
     bool completed;
     bool timed_out;
     void    *data;
 
     retrieval_context()
-      : completed(PR_FALSE),
-        timed_out(PR_FALSE),
+      : completed(false),
+        timed_out(false),
         data(nsnull)
     { }
 };
 
 static bool
 wait_for_retrieval(GtkClipboard *clipboard, retrieval_context *transferData);
 
 static void
@@ -142,17 +142,17 @@ NS_IMPL_ISUPPORTS1(nsClipboard, nsIClipb
 
 nsresult
 nsClipboard::Init(void)
 {
     nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
     if (!os)
       return NS_ERROR_FAILURE;
 
-    os->AddObserver(this, "quit-application", PR_FALSE);
+    os->AddObserver(this, "quit-application", false);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar *aData)
 {
     if (strcmp(aTopic, "quit-application") == 0) {
@@ -234,17 +234,17 @@ nsClipboard::SetData(nsITransferable *aT
             if (flavorStr.EqualsLiteral(kNativeImageMime) ||
                 flavorStr.EqualsLiteral(kPNGImageMime) ||
                 flavorStr.EqualsLiteral(kJPEGImageMime) ||
                 flavorStr.EqualsLiteral(kGIFImageMime)) {
                 // don't bother adding image targets twice
                 if (!imagesAdded) {
                     // accept any writable image type
                     gtk_target_list_add_image_targets(list, 0, TRUE);
-                    imagesAdded = PR_TRUE;
+                    imagesAdded = true;
                 }
                 continue;
             }
 
             // Add this to our list of valid targets
             GdkAtom atom = gdk_atom_intern(flavorStr, FALSE);
             gtk_target_list_add(list, atom, 0, 0);
         }
@@ -324,17 +324,17 @@ nsClipboard::GetData(nsITransferable *aT
             if (!strcmp(flavorStr, kUnicodeMime)) {
                 gchar* new_text = wait_for_text(clipboard);
                 if (new_text) {
                     // Convert utf-8 into our unicode format.
                     NS_ConvertUTF8toUTF16 ucs2string(new_text);
                     data = (guchar *)ToNewUnicode(ucs2string);
                     length = ucs2string.Length() * 2;
                     g_free(new_text);
-                    foundData = PR_TRUE;
+                    foundData = true;
                     foundFlavor = kUnicodeMime;
                     break;
                 }
                 // If the type was text/unicode and we couldn't get
                 // text off the clipboard, run the next loop
                 // iteration.
                 continue;
             }
@@ -380,17 +380,17 @@ nsClipboard::GetData(nsITransferable *aT
                     data = (guchar *)htmlBody;
                     length = htmlBodyLen * 2;
                 } else {
                     data = (guchar *)nsMemory::Alloc(length);
                     if (!data)
                         break;
                     memcpy(data, selectionData->data, length);
                 }
-                foundData = PR_TRUE;
+                foundData = true;
                 foundFlavor = flavorStr;
                 break;
             }
         }
     }
 
     if (foundData) {
         nsCOMPtr<nsISupports> wrapper;
@@ -430,17 +430,17 @@ nsClipboard::EmptyClipboard(PRInt32 aWhi
 
 NS_IMETHODIMP
 nsClipboard::HasDataMatchingFlavors(const char** aFlavorList, PRUint32 aLength,
                                     PRInt32 aWhichClipboard, bool *_retval)
 {
     if (!aFlavorList || !_retval)
         return NS_ERROR_NULL_POINTER;
 
-    *_retval = PR_FALSE;
+    *_retval = false;
 
     GtkSelectionData *selection_data =
         GetTargets(GetSelectionAtom(aWhichClipboard));
     if (!selection_data)
         return NS_OK;
 
     gint n_targets = 0;
     GdkAtom *targets = NULL;
@@ -451,48 +451,48 @@ nsClipboard::HasDataMatchingFlavors(cons
         return NS_OK;
 
     // Walk through the provided types and try to match it to a
     // provided type.
     for (PRUint32 i = 0; i < aLength && !*_retval; i++) {
         // We special case text/unicode here.
         if (!strcmp(aFlavorList[i], kUnicodeMime) && 
             gtk_selection_data_targets_include_text(selection_data)) {
-            *_retval = PR_TRUE;
+            *_retval = true;
             break;
         }
 
         for (PRInt32 j = 0; j < n_targets; j++) {
             gchar *atom_name = gdk_atom_name(targets[j]);
             if (!atom_name)
                 continue;
 
             if (!strcmp(atom_name, aFlavorList[i]))
-                *_retval = PR_TRUE;
+                *_retval = true;
 
             // X clipboard wants image/jpeg, not image/jpg
             if (!strcmp(aFlavorList[i], kJPEGImageMime) && !strcmp(atom_name, "image/jpeg"))
-                *_retval = PR_TRUE;
+                *_retval = true;
 
             g_free(atom_name);
 
             if (*_retval)
                 break;
         }
     }
     gtk_selection_data_free(selection_data);
     g_free(targets);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsClipboard::SupportsSelectionClipboard(bool *_retval)
 {
-    *_retval = PR_TRUE; // yeah, unix supports the selection clipboard
+    *_retval = true; // yeah, unix supports the selection clipboard
     return NS_OK;
 }
 
 /* static */
 GdkAtom
 nsClipboard::GetSelectionAtom(PRInt32 aWhichClipboard)
 {
     if (aWhichClipboard == kGlobalClipboard)
@@ -892,17 +892,17 @@ checkEventProc(Display *display, XEvent 
 
 // Idle timeout for receiving selection and property notify events (microsec)
 static const int kClipboardTimeout = 500000;
 
 static bool
 wait_for_retrieval(GtkClipboard *clipboard, retrieval_context *r_context)
 {
     if (r_context->completed)  // the request completed synchronously
-        return PR_TRUE;
+        return true;
 
     Display *xDisplay = GDK_DISPLAY();
     checkEventContext context;
     context.cbWidget = NULL;
     context.selAtom = gdk_x11_atom_to_xatom(gdk_atom_intern("GDK_SELECTION",
                                                             FALSE));
 
     // Send X events which are relevant to the ongoing selection retrieval
@@ -925,44 +925,44 @@ wait_for_retrieval(GtkClipboard *clipboa
                              (XPointer) &context)) {
 
             if (xevent.xany.type == SelectionNotify)
                 DispatchSelectionNotifyEvent(context.cbWidget, &xevent);
             else
                 DispatchPropertyNotifyEvent(context.cbWidget, &xevent);
 
             if (r_context->completed)
-                return PR_TRUE;
+                return true;
         }
 
         tv.tv_sec = 0;
         tv.tv_usec = kClipboardTimeout;
         select_result = select(cnumber, &select_set, NULL, NULL, &tv);
 
     } while (select_result == 1);
 
 #ifdef DEBUG_CLIPBOARD
     printf("exceeded clipboard timeout\n");
 #endif
-    r_context->timed_out = PR_TRUE;
-    return PR_FALSE;
+    r_context->timed_out = true;
+    return false;
 }
 
 static void
 clipboard_contents_received(GtkClipboard     *clipboard,
                             GtkSelectionData *selection_data,
                             gpointer          data)
 {
     retrieval_context *context = static_cast<retrieval_context *>(data);
     if (context->timed_out) {
         delete context;
         return;
     }
 
-    context->completed = PR_TRUE;
+    context->completed = true;
 
     if (selection_data->length >= 0)
         context->data = gtk_selection_data_copy(selection_data);
 }
 
 
 static GtkSelectionData *
 wait_for_contents(GtkClipboard *clipboard, GdkAtom target)
@@ -989,17 +989,17 @@ clipboard_text_received(GtkClipboard *cl
                         gpointer      data)
 {
     retrieval_context *context = static_cast<retrieval_context *>(data);
     if (context->timed_out) {
         delete context;
         return;
     }
 
-    context->completed = PR_TRUE;
+    context->completed = true;
     context->data = g_strdup(text);
 }
 
 static gchar *
 wait_for_text(GtkClipboard *clipboard)
 {
     retrieval_context *context = new retrieval_context();
     gtk_clipboard_request_text(clipboard, clipboard_text_received, context);
--- a/widget/src/gtk2/nsDeviceContextSpecG.cpp
+++ b/widget/src/gtk2/nsDeviceContextSpecG.cpp
@@ -72,19 +72,16 @@
 #include "mozilla/Preferences.h"
 
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
 using namespace mozilla;
 
-/* Ensure that the result is always equal to either PR_TRUE or PR_FALSE */
-#define MAKE_PR_BOOL(val) ((val)?(PR_TRUE):(PR_FALSE))
-
 #ifdef PR_LOGGING 
 static PRLogModuleInfo *DeviceContextSpecGTKLM = PR_NewLogModule("DeviceContextSpecGTK");
 #endif /* PR_LOGGING */
 /* Macro to make lines shorter */
 #define DO_PR_DEBUG_LOG(x) PR_LOG(DeviceContextSpecGTKLM, PR_LOG_DEBUG, x)
 
 //----------------------------------------------------------------------------------
 // The printer data is shared between the PrinterEnumerator and the nsDeviceContextSpecGTK
@@ -218,17 +215,17 @@ void nsPrinterFeatures::SetCharValue(  c
   Preferences::SetCString(prefName.get(), value);
 }
 
 nsPrinterFeatures::nsPrinterFeatures( const char *printername )
 {
   DO_PR_DEBUG_LOG(("nsPrinterFeatures::nsPrinterFeatures('%s')\n", printername));
   mPrinterName.Assign(printername);
 
-  SetBoolValue("has_special_printerfeatures", PR_TRUE);
+  SetBoolValue("has_special_printerfeatures", true);
 }
 
 void nsPrinterFeatures::SetCanChangePaperSize( bool aCanSetPaperSize )
 {
   SetBoolValue("can_change_paper_size", aCanSetPaperSize);
 }
 
 void nsPrinterFeatures::SetSupportsPaperSizeChange( bool aSupportsPaperSizeChange )
@@ -435,17 +432,17 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::Ge
   // Spool file. Use Glib's temporary file function since we're
   // already dependent on the gtk software stack.
   gchar *buf;
   gint fd = g_file_open_tmp("XXXXXX.tmp", &buf, nsnull);
   if (-1 == fd)
     return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;
   close(fd);
 
-  rv = NS_NewNativeLocalFile(nsDependentCString(buf), PR_FALSE,
+  rv = NS_NewNativeLocalFile(nsDependentCString(buf), false,
                              getter_AddRefs(mSpoolFile));
   if (NS_FAILED(rv)) {
     unlink(buf);
     return NS_ERROR_GFX_PRINTER_COULD_NOT_OPEN_FILE;
   }
 
   mSpoolName = buf;
   g_free(buf);
@@ -583,17 +580,17 @@ nsresult nsDeviceContextSpecGTK::GetPrin
 {
   aMethod = pmPostScript;
   return NS_OK;
 }
 
 static void
 print_callback(GtkPrintJob *aJob, gpointer aData, GError *aError) {
   g_object_unref(aJob);
-  ((nsILocalFile*) aData)->Remove(PR_FALSE);
+  ((nsILocalFile*) aData)->Remove(false);
 }
 
 static void
 ns_release_macro(gpointer aData) {
   nsILocalFile* spoolFile = (nsILocalFile*) aData;
   NS_RELEASE(spoolFile);
 }
 
@@ -624,17 +621,17 @@ NS_IMETHODIMP nsDeviceContextSpecGTK::En
     gtk_print_job_send(mPrintJob, print_callback, mSpoolFile, ns_release_macro);
   } else {
     // Handle print-to-file ourselves for the benefit of embedders
     nsXPIDLString targetPath;
     nsCOMPtr<nsILocalFile> destFile;
     mPrintSettings->GetToFileName(getter_Copies(targetPath));
 
     nsresult rv = NS_NewNativeLocalFile(NS_ConvertUTF16toUTF8(targetPath),
-                                        PR_FALSE, getter_AddRefs(destFile));
+                                        false, getter_AddRefs(destFile));
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsAutoString destLeafName;
     rv = destFile->GetLeafName(destLeafName);
     NS_ENSURE_SUCCESS(rv, rv);
 
     nsCOMPtr<nsIFile> destDir;
     rv = destFile->GetParent(getter_AddRefs(destDir));
@@ -791,17 +788,17 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::In
       printerName.Cut(0, slash + 1);
   }
 
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
   /* Defaults to FALSE */
   nsPrintfCString  prefName(256,
     PRINTERFEATURES_PREF ".%s.has_special_printerfeatures",
     fullPrinterName.get());
-  Preferences::SetBool(prefName.get(), PR_FALSE);
+  Preferences::SetBool(prefName.get(), false);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
   
   /* Set filename */
   nsCAutoString filename;
   if (NS_FAILED(CopyPrinterCharPref(nsnull, printerName, "filename", filename))) {
     const char *path;
   
@@ -811,33 +808,33 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::In
     if (path)
       filename = nsPrintfCString(PATH_MAX, "%s/mozilla.pdf", path);
     else
       filename.AssignLiteral("mozilla.pdf");
   }  
   DO_PR_DEBUG_LOG(("Setting default filename to '%s'\n", filename.get()));
   aPrintSettings->SetToFileName(NS_ConvertUTF8toUTF16(filename).get());
 
-  aPrintSettings->SetIsInitializedFromPrinter(PR_TRUE);
+  aPrintSettings->SetIsInitializedFromPrinter(true);
 
   if (type == pmPostScript) {
     DO_PR_DEBUG_LOG(("InitPrintSettingsFromPrinter() for PostScript printer\n"));
 
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     nsPrinterFeatures printerFeatures(fullPrinterName);
 
-    printerFeatures.SetSupportsPaperSizeChange(PR_TRUE);
-    printerFeatures.SetSupportsOrientationChange(PR_TRUE);
-    printerFeatures.SetSupportsPlexChange(PR_FALSE);
-    printerFeatures.SetSupportsResolutionNameChange(PR_FALSE);
-    printerFeatures.SetSupportsColorspaceChange(PR_FALSE);
+    printerFeatures.SetSupportsPaperSizeChange(true);
+    printerFeatures.SetSupportsOrientationChange(true);
+    printerFeatures.SetSupportsPlexChange(false);
+    printerFeatures.SetSupportsResolutionNameChange(false);
+    printerFeatures.SetSupportsColorspaceChange(false);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */ 
       
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangeOrientation(PR_TRUE);
+    printerFeatures.SetCanChangeOrientation(true);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     nsCAutoString orientation;
     if (NS_SUCCEEDED(CopyPrinterCharPref("postscript", printerName,
                                          "orientation", orientation))) {
       if (orientation.LowerCaseEqualsLiteral("portrait")) {
         DO_PR_DEBUG_LOG(("setting default orientation to 'portrait'\n"));
         aPrintSettings->SetOrientation(nsIPrintSettings::kPortraitOrientation);
@@ -854,49 +851,49 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::In
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     printerFeatures.SetOrientationRecord(0, "portrait");
     printerFeatures.SetOrientationRecord(1, "landscape");
     printerFeatures.SetNumOrientationRecords(2);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     /* PostScript module does not support changing the plex mode... */
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangePlex(PR_FALSE);
+    printerFeatures.SetCanChangePlex(false);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
     DO_PR_DEBUG_LOG(("setting default plex to '%s'\n", "default"));
     aPrintSettings->SetPlexName(NS_LITERAL_STRING("default").get());
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     printerFeatures.SetPlexRecord(0, "default");
     printerFeatures.SetNumPlexRecords(1);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     /* PostScript module does not support changing the resolution mode... */
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangeResolutionName(PR_FALSE);
+    printerFeatures.SetCanChangeResolutionName(false);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
     DO_PR_DEBUG_LOG(("setting default resolution to '%s'\n", "default"));
     aPrintSettings->SetResolutionName(NS_LITERAL_STRING("default").get());
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     printerFeatures.SetResolutionNameRecord(0, "default");
     printerFeatures.SetNumResolutionNameRecords(1);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     /* PostScript module does not support changing the colorspace... */
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangeColorspace(PR_FALSE);
+    printerFeatures.SetCanChangeColorspace(false);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
     DO_PR_DEBUG_LOG(("setting default colorspace to '%s'\n", "default"));
     aPrintSettings->SetColorspace(NS_LITERAL_STRING("default").get());
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     printerFeatures.SetColorspaceRecord(0, "default");
     printerFeatures.SetNumColorspaceRecords(1);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */   
 
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangePaperSize(PR_TRUE);
+    printerFeatures.SetCanChangePaperSize(true);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
     nsCAutoString papername;
     if (NS_SUCCEEDED(CopyPrinterCharPref("postscript", printerName,
                                          "paper_size", papername))) {
       nsPaperSizePS paper;
 
       if (paper.Find(papername.get())) {
         DO_PR_DEBUG_LOG(("setting default paper size to '%s' (%g mm/%g mm)\n",
@@ -924,39 +921,39 @@ NS_IMETHODIMP nsPrinterEnumeratorGTK::In
 
     bool hasSpoolerCmd = (nsPSPrinterList::kTypePS ==
         nsPSPrinterList::GetPrinterType(fullPrinterName));
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
     printerFeatures.SetSupportsSpoolerCommandChange(hasSpoolerCmd);
     printerFeatures.SetCanChangeSpoolerCommand(hasSpoolerCmd);
 
     /* Postscript module does not pass the job title to lpr */
-    printerFeatures.SetSupportsJobTitleChange(PR_FALSE);
-    printerFeatures.SetCanChangeJobTitle(PR_FALSE);
+    printerFeatures.SetSupportsJobTitleChange(false);
+    printerFeatures.SetCanChangeJobTitle(false);
     /* Postscript module has no control over builtin fonts yet */
-    printerFeatures.SetSupportsDownloadFontsChange(PR_FALSE);
-    printerFeatures.SetCanChangeDownloadFonts(PR_FALSE);
+    printerFeatures.SetSupportsDownloadFontsChange(false);
+    printerFeatures.SetCanChangeDownloadFonts(false);
     /* Postscript module does not support multiple colorspaces
      * so it has to use the old way */
-    printerFeatures.SetSupportsPrintInColorChange(PR_TRUE);
-    printerFeatures.SetCanChangePrintInColor(PR_TRUE);
+    printerFeatures.SetSupportsPrintInColorChange(true);
+    printerFeatures.SetCanChangePrintInColor(true);
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     if (hasSpoolerCmd) {
       nsCAutoString command;
       if (NS_SUCCEEDED(CopyPrinterCharPref("postscript",
             printerName, "print_command", command))) {
         DO_PR_DEBUG_LOG(("setting default print command to '%s'\n",
             command.get()));
         aPrintSettings->SetPrintCommand(NS_ConvertUTF8toUTF16(command).get());
       }
     }
     
 #ifdef SET_PRINTER_FEATURES_VIA_PREFS
-    printerFeatures.SetCanChangeNumCopies(PR_TRUE);   
+    printerFeatures.SetCanChangeNumCopies(true);   
 #endif /* SET_PRINTER_FEATURES_VIA_PREFS */
 
     return NS_OK;    
   }
 
   return NS_ERROR_UNEXPECTED;
 }
 
--- a/widget/src/gtk2/nsDeviceContextSpecG.h
+++ b/widget/src/gtk2/nsDeviceContextSpecG.h
@@ -79,17 +79,17 @@ public:
   NS_IMETHOD GetPrintMethod(PrintMethod &aMethod);
   static nsresult GetPrintMethod(const char *aPrinter, PrintMethod &aMethod);
   virtual ~nsDeviceContextSpecGTK();
   
 protected:
   nsCOMPtr<nsIPrintSettings> mPrintSettings;
   bool mToPrinter : 1;      /* If true, print to printer */
   bool mIsPPreview : 1;     /* If true, is print preview */
-  char   mPath[PATH_MAX];     /* If toPrinter = PR_FALSE, dest file */
+  char   mPath[PATH_MAX];     /* If toPrinter = false, dest file */
   char   mPrinter[256];       /* Printer name */
   GtkPrintJob*      mPrintJob;
   GtkPrinter*       mGtkPrinter;
   GtkPrintSettings* mGtkPrintSettings;
   GtkPageSetup*     mGtkPageSetup;
 
   nsCString              mSpoolName;
   nsCOMPtr<nsILocalFile> mSpoolFile;
--- a/widget/src/gtk2/nsDragService.cpp
+++ b/widget/src/gtk2/nsDragService.cpp
@@ -127,17 +127,17 @@ invisibleSourceDragDataGet(GtkWidget    
                            gpointer          aData);
 
 nsDragService::nsDragService()
 {
     // We have to destroy the hidden widget before the event loop stops
     // running.
     nsCOMPtr<nsIObserverService> obsServ =
         mozilla::services::GetObserverService();
-    obsServ->AddObserver(this, "quit-application", PR_FALSE);
+    obsServ->AddObserver(this, "quit-application", false);
 
     // our hidden source widget
     mHiddenWidget = gtk_invisible_new();
     // make sure that the widget is realized so that
     // we can use it as a drag source.
     gtk_widget_realize(mHiddenWidget);
     // hook up our internal signals so that we can get some feedback
     // from our drag source
@@ -160,18 +160,18 @@ nsDragService::nsDragService()
     // set up our logging module
     if (!sDragLm)
         sDragLm = PR_NewLogModule("nsDragService");
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::nsDragService"));
     mGrabWidget = 0;
     mTargetWidget = 0;
     mTargetDragContext = 0;
     mTargetTime = 0;
-    mCanDrop = PR_FALSE;
-    mTargetDragDataReceived = PR_FALSE;
+    mCanDrop = false;
+    mTargetDragDataReceived = false;
     mTargetDragData = 0;
     mTargetDragDataLen = 0;
 }
 
 nsDragService::~nsDragService()
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::~nsDragService"));
 }
@@ -373,52 +373,52 @@ nsDragService::SetAlphaPixmap(gfxASurfac
                                  PRInt32 aYOffset,
                                  const nsIntRect& dragRect)
 {
     GdkScreen* screen = gtk_widget_get_screen(mHiddenWidget);
 
     // Transparent drag icons need, like a lot of transparency-related things,
     // a compositing X window manager
     if (!gdk_screen_is_composited(screen))
-      return PR_FALSE;
+      return false;
 
     GdkColormap* alphaColormap = gdk_screen_get_rgba_colormap(screen);
     if (!alphaColormap)
-      return PR_FALSE;
+      return false;
 
     GdkPixmap* pixmap = gdk_pixmap_new(NULL, dragRect.width, dragRect.height,
                                        gdk_colormap_get_visual(alphaColormap)->depth);
     if (!pixmap)
-      return PR_FALSE;
+      return false;
 
     gdk_drawable_set_colormap(GDK_DRAWABLE(pixmap), alphaColormap);
 
     // Make a gfxXlibSurface wrapped around the pixmap to render on
     nsRefPtr<gfxASurface> xPixmapSurface =
          nsWindow::GetSurfaceForGdkDrawable(GDK_DRAWABLE(pixmap),
                                             dragRect.Size());
     if (!xPixmapSurface)
-      return PR_FALSE;
+      return false;
 
     nsRefPtr<gfxContext> xPixmapCtx = new gfxContext(xPixmapSurface);
 
     // Clear it...
     xPixmapCtx->SetOperator(gfxContext::OPERATOR_CLEAR);
     xPixmapCtx->Paint();
 
     // ...and paint the drag image with translucency
     xPixmapCtx->SetOperator(gfxContext::OPERATOR_SOURCE);
     xPixmapCtx->SetSource(aSurface);
     xPixmapCtx->Paint(DRAG_IMAGE_ALPHA_LEVEL);
 
     // The drag transaction addrefs the pixmap, so we can just unref it from us here
     gtk_drag_set_icon_pixmap(aContext, alphaColormap, pixmap, NULL,
                              aXOffset, aYOffset);
     g_object_unref(pixmap);
-    return PR_TRUE;
+    return true;
 }
 
 NS_IMETHODIMP
 nsDragService::StartDragSession()
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::StartDragSession"));
     return nsBaseDragService::StartDragSession();
 }
@@ -647,21 +647,21 @@ nsDragService::GetData(nsITransferable *
             PR_LOG(sDragLm, PR_LOG_DEBUG,
                    ("looking for data in type %s, gdk flavor %ld\n",
                    static_cast<const char*>(flavorStr), gdkFlavor));
             bool dataFound = false;
             if (gdkFlavor) {
                 GetTargetDragData(gdkFlavor);
             }
             if (mTargetDragData) {
-                PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_TRUE\n"));
-                dataFound = PR_TRUE;
+                PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = true\n"));
+                dataFound = true;
             }
             else {
-                PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = PR_FALSE\n"));
+                PR_LOG(sDragLm, PR_LOG_DEBUG, ("dataFound = false\n"));
 
                 // Dragging and dropping from the file manager would cause us 
                 // to parse the source text as a nsILocalFile URL.
                 if ( strcmp(flavorStr, kFileMime) == 0 ) {
                     gdkFlavor = gdk_atom_intern(kTextMime, FALSE);
                     GetTargetDragData(gdkFlavor);
                     if (mTargetDragData) {
                         const char* text = static_cast<char*>(mTargetDragData);
@@ -720,17 +720,17 @@ nsDragService::GetData(nsITransferable *
                         if ( convertedText ) {
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("successfully converted plain text \
                                    to unicode.\n"));
                             // out with the old, in with the new
                             g_free(mTargetDragData);
                             mTargetDragData = convertedText;
                             mTargetDragDataLen = ucs2string.Length() * 2;
-                            dataFound = PR_TRUE;
+                            dataFound = true;
                         } // if plain text data on clipboard
                     } else {
                         PR_LOG(sDragLm, PR_LOG_DEBUG,
                                ("we were looking for text/unicode... \
                                trying again with text/plain\n"));
                         gdkFlavor = gdk_atom_intern(kTextMime, FALSE);
                         GetTargetDragData(gdkFlavor);
                         if (mTargetDragData) {
@@ -745,17 +745,17 @@ nsDragService::GetData(nsITransferable *
                             if ( convertedText ) {
                                 PR_LOG(sDragLm, PR_LOG_DEBUG,
                                        ("successfully converted plain text \
                                        to unicode.\n"));
                                 // out with the old, in with the new
                                 g_free(mTargetDragData);
                                 mTargetDragData = convertedText;
                                 mTargetDragDataLen = convertedTextLen * 2;
-                                dataFound = PR_TRUE;
+                                dataFound = true;
                             } // if plain text data on clipboard
                         } // if plain text flavor present
                     } // if plain text charset=utf-8 flavor present
                 } // if looking for text/unicode
 
                 // if we are looking for text/x-moz-url and we failed to find
                 // it on the clipboard, try again with text/uri-list, and then
                 // _NETSCAPE_URL
@@ -779,17 +779,17 @@ nsDragService::GetData(nsITransferable *
                         if ( convertedText ) {
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("successfully converted \
                                    _NETSCAPE_URL to unicode.\n"));
                             // out with the old, in with the new
                             g_free(mTargetDragData);
                             mTargetDragData = convertedText;
                             mTargetDragDataLen = convertedTextLen * 2;
-                            dataFound = PR_TRUE;
+                            dataFound = true;
                         }
                     }
                     else {
                         PR_LOG(sDragLm, PR_LOG_DEBUG,
                                ("failed to get text/uri-list data\n"));
                     }
                     if (!dataFound) {
                         PR_LOG(sDragLm, PR_LOG_DEBUG,
@@ -809,17 +809,17 @@ nsDragService::GetData(nsITransferable *
                                 PR_LOG(sDragLm,
                                        PR_LOG_DEBUG,
                                        ("successfully converted _NETSCAPE_URL \
                                        to unicode.\n"));
                                 // out with the old, in with the new
                                 g_free(mTargetDragData);
                                 mTargetDragData = convertedText;
                                 mTargetDragDataLen = convertedTextLen * 2;
-                                dataFound = PR_TRUE;
+                                dataFound = true;
                             }
                         }
                         else {
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("failed to get _NETSCAPE_URL data\n"));
                         }
                     }
                 }
@@ -858,17 +858,17 @@ nsDragService::IsDataFlavorSupported(con
                                      bool *_retval)
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::IsDataFlavorSupported %s",
                                    aDataFlavor));
     if (!_retval)
         return NS_ERROR_INVALID_ARG;
 
     // set this to no by default
-    *_retval = PR_FALSE;
+    *_retval = false;
 
     // check to make sure that we have a drag object set, here
     if (!mTargetDragContext) {
         PR_LOG(sDragLm, PR_LOG_DEBUG,
                ("*** warning: IsDataFlavorSupported \
                called without a valid drag context!\n"));
         return NS_OK;
     }
@@ -909,17 +909,17 @@ nsDragService::IsDataFlavorSupported(con
                             nsXPIDLCString flavorStr;
                             currentFlavor->ToString(getter_Copies(flavorStr));
                             PR_LOG(sDragLm, PR_LOG_DEBUG,
                                    ("checking %s against %s\n",
                                    (const char *)flavorStr, aDataFlavor));
                             if (strcmp(flavorStr, aDataFlavor) == 0) {
                                 PR_LOG(sDragLm, PR_LOG_DEBUG,
                                        ("boioioioiooioioioing!\n"));
-                                *_retval = PR_TRUE;
+                                *_retval = true;
                             }
                         }
                     }
                 }
             }
         }
         return NS_OK;
     }
@@ -930,48 +930,48 @@ nsDragService::IsDataFlavorSupported(con
         /* Bug 331198 */
         GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
         gchar *name = NULL;
         name = gdk_atom_name(atom);
         PR_LOG(sDragLm, PR_LOG_DEBUG,
                ("checking %s against %s\n", name, aDataFlavor));
         if (name && (strcmp(name, aDataFlavor) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG, ("good!\n"));
-            *_retval = PR_TRUE;
+            *_retval = true;
         }
         // check for automatic text/uri-list -> text/x-moz-url mapping
         if (!*_retval && 
             name &&
             (strcmp(name, gTextUriListType) == 0) &&
             (strcmp(aDataFlavor, kURLMime) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG,
                    ("good! ( it's text/uri-list and \
                    we're checking against text/x-moz-url )\n"));
-            *_retval = PR_TRUE;
+            *_retval = true;
         }
         // check for automatic _NETSCAPE_URL -> text/x-moz-url mapping
         if (!*_retval && 
             name &&
             (strcmp(name, gMozUrlType) == 0) &&
             (strcmp(aDataFlavor, kURLMime) == 0)) {
             PR_LOG(sDragLm, PR_LOG_DEBUG,
                    ("good! ( it's _NETSCAPE_URL and \
                    we're checking against text/x-moz-url )\n"));
-            *_retval = PR_TRUE;
+            *_retval = true;
         }
         // check for auto text/plain -> text/unicode mapping
         if (!*_retval && 
             name &&
             (strcmp(name, kTextMime) == 0) &&
             ((strcmp(aDataFlavor, kUnicodeMime) == 0) ||
              (strcmp(aDataFlavor, kFileMime) == 0))) {
             PR_LOG(sDragLm, PR_LOG_DEBUG,
                    ("good! ( it's text plain and we're checking \
                    against text/unicode or application/x-moz-file)\n"));
-            *_retval = PR_TRUE;
+            *_retval = true;
         }
         g_free(name);
     }
     return NS_OK;
 }
 
 // nsIDragSessionGTK
 
@@ -986,17 +986,17 @@ nsDragService::TargetSetLastContext(GtkW
     mTargetTime = aTime;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDragService::TargetStartDragMotion(void)
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetStartDragMotion"));
-    mCanDrop = PR_FALSE;
+    mCanDrop = false;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsDragService::TargetEndDragMotion(GtkWidget      *aWidget,
                                    GdkDragContext *aContext,
                                    guint           aTime)
 {
@@ -1032,17 +1032,17 @@ nsDragService::TargetDataReceived(GtkWid
                                   gint               aX,
                                   gint               aY,
                                   GtkSelectionData  *aSelectionData,
                                   guint              aInfo,
                                   guint32            aTime)
 {
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("nsDragService::TargetDataReceived"));
     TargetResetData();
-    mTargetDragDataReceived = PR_TRUE;
+    mTargetDragDataReceived = true;
     if (aSelectionData->length > 0) {
         mTargetDragDataLen = aSelectionData->length;
         mTargetDragData = g_malloc(mTargetDragDataLen);
         memcpy(mTargetDragData, aSelectionData->data, mTargetDragDataLen);
     }
     else {
         PR_LOG(sDragLm, PR_LOG_DEBUG,
                ("Failed to get data.  selection data len was %d\n",
@@ -1079,17 +1079,17 @@ nsDragService::IsTargetContextList(void)
     // walk the list of context targets and see if one of them is a list
     // of items.
     for (tmp = mTargetDragContext->targets; tmp; tmp = tmp->next) {
         /* Bug 331198 */
         GdkAtom atom = GDK_POINTER_TO_ATOM(tmp->data);
         gchar *name = NULL;
         name = gdk_atom_name(atom);
         if (name && strcmp(name, gMimeListType) == 0)
-            retval = PR_TRUE;
+            retval = true;
         g_free(name);
         if (retval)
             break;
     }
     return retval;
 }
 
 // Maximum time to wait for a "drag_received" arrived, in microseconds
@@ -1115,17 +1115,17 @@ nsDragService::GetTargetDragData(GdkAtom
         gtk_main_iteration();
     }
     PR_LOG(sDragLm, PR_LOG_DEBUG, ("finished inner iteration\n"));
 }
 
 void
 nsDragService::TargetResetData(void)
 {
-    mTargetDragDataReceived = PR_FALSE;
+    mTargetDragDataReceived = false;
     // make sure to free old data if we have to
     g_free(mTargetDragData);
     mTargetDragData = 0;
     mTargetDragDataLen = 0;
 }
 
 GtkTargetList *
 nsDragService::GetSourceList(void)
@@ -1365,29 +1365,29 @@ nsDragService::SourceEndDragSession(GdkD
         else
             dropEffect = DRAGDROP_ACTION_COPY;
 
     } else {
 
         dropEffect = DRAGDROP_ACTION_NONE;
 
         if (aResult != MOZ_GTK_DRAG_RESULT_NO_TARGET) {
-            mUserCancelled = PR_TRUE;
+            mUserCancelled = true;
         }
     }
 
     nsCOMPtr<nsIDOMNSDataTransfer> dataTransfer =
         do_QueryInterface(mDataTransfer);
 
     if (dataTransfer) {
         dataTransfer->SetDropEffectInt(dropEffect);
     }
 
     // Inform the drag session that we're ending the drag.
-    EndDragSession(PR_TRUE);
+    EndDragSession(true);
 }
 
 static void
 CreateUriList(nsISupportsArray *items, gchar **text, gint *length)
 {
     PRUint32 i, count;
     GString *uriList = g_string_new(NULL);
 
@@ -1484,29 +1484,29 @@ nsDragService::SourceDataGet(GtkWidget  
     if (item) {
         // if someone was asking for text/plain, lookup unicode instead so
         // we can convert it.
         bool needToDoConversionToPlainText = false;
         const char* actualFlavor = mimeFlavor;
         if (strcmp(mimeFlavor, kTextMime) == 0 ||
             strcmp(mimeFlavor, gTextPlainUTF8Type) == 0) {
             actualFlavor = kUnicodeMime;
-            needToDoConversionToPlainText = PR_TRUE;
+            needToDoConversionToPlainText = true;
         }
         // if someone was asking for _NETSCAPE_URL we need to convert to
         // plain text but we also need to look for x-moz-url
         else if (strcmp(mimeFlavor, gMozUrlType) == 0) {
             actualFlavor = kURLMime;
-            needToDoConversionToPlainText = PR_TRUE;
+            needToDoConversionToPlainText = true;
         }
         // if someone was asking for text/uri-list we need to convert to
         // plain text.
         else if (strcmp(mimeFlavor, gTextUriListType) == 0) {
             actualFlavor = gTextUriListType;
-            needToDoConversionToPlainText = PR_TRUE;
+            needToDoConversionToPlainText = true;
         }
         else
             actualFlavor = mimeFlavor;
 
         PRUint32 tmpDataLen = 0;
         void    *tmpData = NULL;
         nsresult rv;
         nsCOMPtr<nsISupports> data;
--- a/widget/src/gtk2/nsFilePicker.cpp
+++ b/widget/src/gtk2/nsFilePicker.cpp
@@ -200,30 +200,30 @@ MakeCaseInsensitiveShellGlob(const char*
   return result;
 }
 
 NS_IMPL_ISUPPORTS1(nsFilePicker, nsIFilePicker)
 
 nsFilePicker::nsFilePicker()
   : mMode(nsIFilePicker::modeOpen),
     mSelectedType(0),
-    mAllowURLs(PR_FALSE)
+    mAllowURLs(false)
 {
 }
 
 nsFilePicker::~nsFilePicker()
 {
 }
 
 void
 ReadMultipleFiles(gpointer filename, gpointer array)
 {
   nsCOMPtr<nsILocalFile> localfile;
   nsresult rv = NS_NewNativeLocalFile(nsDependentCString(static_cast<char*>(filename)),
-                                      PR_FALSE,
+                                      false,
                                       getter_AddRefs(localfile));
   if (NS_SUCCEEDED(rv)) {
     nsCOMArray<nsILocalFile>& files = *static_cast<nsCOMArray<nsILocalFile>*>(array);
     files.AppendObject(localfile);
   }
 
   g_free(filename);
 }
@@ -389,17 +389,17 @@ nsFilePicker::GetFiles(nsISimpleEnumerat
 bool
 confirm_overwrite_file(GtkWidget *parent, nsILocalFile* file)
 {
   nsCOMPtr<nsIStringBundleService> sbs = do_GetService(NS_STRINGBUNDLE_CONTRACTID);
   nsCOMPtr<nsIStringBundle> bundle;
   nsresult rv = sbs->CreateBundle("chrome://global/locale/filepicker.properties",
                                   getter_AddRefs(bundle));
   if (NS_FAILED(rv)) {
-    return PR_FALSE;
+    return false;
   }
 
   nsAutoString leafName;
   file->GetLeafName(leafName);
   const PRUnichar *formatStrings[] =
   {
     leafName.get()
   };
@@ -543,17 +543,17 @@ nsFilePicker::Show(PRInt16 *aReturn)
     gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(file_chooser), filter);
 
     // Set the initially selected filter
     if (mSelectedType == i) {
       gtk_file_chooser_set_filter(GTK_FILE_CHOOSER(file_chooser), filter);
     }
   }
 
-  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_chooser), PR_TRUE);
+  gtk_file_chooser_set_do_overwrite_confirmation(GTK_FILE_CHOOSER(file_chooser), TRUE);
   gint response = gtk_dialog_run(GTK_DIALOG(file_chooser));
 
   switch (response) {
     case GTK_RESPONSE_OK:
     case GTK_RESPONSE_ACCEPT:
     ReadValuesFromFileChooser(file_chooser);
     *aReturn = nsIFilePicker::returnOK;
     if (mMode == nsIFilePicker::modeSave) {
--- a/widget/src/gtk2/nsGtkIMModule.cpp
+++ b/widget/src/gtk2/nsGtkIMModule.cpp
@@ -108,18 +108,18 @@ static bool gIsVirtualKeyboardOpened = f
 nsGtkIMModule::nsGtkIMModule(nsWindow* aOwnerWindow) :
     mOwnerWindow(aOwnerWindow), mLastFocusedWindow(nsnull),
     mContext(nsnull),
 #ifndef NS_IME_ENABLED_ON_PASSWORD_FIELD
     mSimpleContext(nsnull),
 #endif
     mDummyContext(nsnull),
     mCompositionStart(PR_UINT32_MAX), mProcessingKeyEvent(nsnull),
-    mIsComposing(PR_FALSE), mIsIMFocused(PR_FALSE),
-    mIgnoreNativeCompositionEvent(PR_FALSE)
+    mIsComposing(false), mIsIMFocused(false),
+    mIgnoreNativeCompositionEvent(false)
 {
 #ifdef PR_LOGGING
     if (!gGtkIMLog) {
         gGtkIMLog = PR_NewLogModule("nsGtkIMModuleWidgets");
     }
 #endif
     mIMEContext.mStatus = nsIWidget::IME_STATUS_ENABLED;
     Init();
@@ -367,77 +367,77 @@ nsGtkIMModule::OnBlurWindow(nsWindow* aW
 
 bool
 nsGtkIMModule::OnKeyEvent(nsWindow* aCaller, GdkEventKey* aEvent,
                           bool aKeyDownEventWasSent /* = false */)
 {
     NS_PRECONDITION(aEvent, "aEvent must be non-null");
 
     if (!IsEditable() || NS_UNLIKELY(IsDestroyed())) {
-        return PR_FALSE;
+        return false;
     }
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): OnKeyEvent, aCaller=%p, aKeyDownEventWasSent=%s",
          this, aCaller, aKeyDownEventWasSent ? "TRUE" : "FALSE"));
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("    aEvent: type=%s, keyval=%s, unicode=0x%X",
          aEvent->type == GDK_KEY_PRESS ? "GDK_KEY_PRESS" :
          aEvent->type == GDK_KEY_RELEASE ? "GDK_KEY_RELEASE" : "Unknown",
          gdk_keyval_name(aEvent->keyval),
          gdk_keyval_to_unicode(aEvent->keyval)));
 
     if (aCaller != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, the caller isn't focused window, mLastFocusedWindow=%p",
              mLastFocusedWindow));
-        return PR_FALSE;
+        return false;
     }
 
     GtkIMContext* im = GetContext();
     if (NS_UNLIKELY(!im)) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no context"));
-        return PR_FALSE;
+        return false;
     }
 
     mKeyDownEventWasSent = aKeyDownEventWasSent;
-    mFilterKeyEvent = PR_TRUE;
+    mFilterKeyEvent = true;
     mProcessingKeyEvent = aEvent;
     gboolean isFiltered = gtk_im_context_filter_keypress(im, aEvent);
     mProcessingKeyEvent = nsnull;
 
     // We filter the key event if the event was not committed (because
     // it's probably part of a composition) or if the key event was
     // committed _and_ changed.  This way we still let key press
     // events go through as simple key press events instead of
     // composed characters.
     bool filterThisEvent = isFiltered && mFilterKeyEvent;
 
     if (mIsComposing && !isFiltered) {
         if (aEvent->type == GDK_KEY_PRESS) {
             if (!mDispatchedCompositionString.IsEmpty()) {
                 // If there is composition string, we shouldn't dispatch
                 // any keydown events during composition.
-                filterThisEvent = PR_TRUE;
+                filterThisEvent = true;
             } else {
                 // A Hangul input engine for SCIM doesn't emit preedit_end
                 // signal even when composition string becomes empty.  On the
                 // other hand, we should allow to make composition with empty
                 // string for other languages because there *might* be such
                 // IM.  For compromising this issue, we should dispatch
                 // compositionend event, however, we don't need to reset IM
                 // actually.
                 CommitCompositionBy(EmptyString());
-                filterThisEvent = PR_FALSE;
+                filterThisEvent = false;
             }
         } else {
             // Key release event may not be consumed by IM, however, we
             // shouldn't dispatch any keyup event during composition.
-            filterThisEvent = PR_TRUE;
+            filterThisEvent = true;
         }
     }
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("    filterThisEvent=%s (isFiltered=%s, mFilterKeyEvent=%s)",
          filterThisEvent ? "TRUE" : "FALSE", isFiltered ? "YES" : "NO",
          mFilterKeyEvent ? "YES" : "NO"));
 
@@ -450,17 +450,17 @@ nsGtkIMModule::OnFocusChangeInGecko(bool
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): OnFocusChangeInGecko, aFocus=%s mIsComposing=%s, mIsIMFocused=%s, mIgnoreNativeCompositionEvent=%s",
          this, aFocus ? "YES" : "NO", mIsComposing ? "YES" : "NO",
          mIsIMFocused ? "YES" : "NO",
          mIgnoreNativeCompositionEvent ? "YES" : "NO"));
     if (aFocus) {
         // If we failed to commit forcedely in previous focused editor,
         // we should reopen the gate for native signals in new focused editor.
-        mIgnoreNativeCompositionEvent = PR_FALSE;
+        mIgnoreNativeCompositionEvent = false;
     }
 }
 
 void
 nsGtkIMModule::ResetIME()
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): ResetIME, mIsComposing=%s, mIsIMFocused=%s",
@@ -468,17 +468,17 @@ nsGtkIMModule::ResetIME()
 
     GtkIMContext *im = GetContext();
     if (NS_UNLIKELY(!im)) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no context"));
         return;
     }
 
-    mIgnoreNativeCompositionEvent = PR_TRUE;
+    mIgnoreNativeCompositionEvent = true;
     gtk_im_context_reset(im);
 }
 
 nsresult
 nsGtkIMModule::ResetInputState(nsWindow* aCaller)
 {
     if (NS_UNLIKELY(IsDestroyed())) {
         return NS_OK;
@@ -621,20 +621,20 @@ nsGtkIMModule::SetInputMode(nsWindow* aC
             // Turn off auto-capitalization for editboxes
             mode &= ~HILDON_GTK_INPUT_MODE_AUTOCAP;
 
             // Turn off predictive dictionaries for editboxes
             mode &= ~HILDON_GTK_INPUT_MODE_DICTIONARY;
 
             g_object_set(im, "hildon-input-mode",
                          (HildonGtkInputMode)mode, NULL);
-            gIsVirtualKeyboardOpened = PR_TRUE;
+            gIsVirtualKeyboardOpened = true;
             hildon_gtk_im_context_show(im);
         } else {
-            gIsVirtualKeyboardOpened = PR_FALSE;
+            gIsVirtualKeyboardOpened = false;
             hildon_gtk_im_context_hide(im);
         }
     }
 
     nsCOMPtr<nsIObserverService> observerService =
         mozilla::services::GetObserverService();
     if (observerService) {
         nsAutoString rectBuf;
@@ -668,17 +668,17 @@ nsGtkIMModule::GetInputMode(IMEContext* 
 
 /* static */
 bool
 nsGtkIMModule::IsVirtualKeyboardOpened()
 {
 #ifdef MOZ_PLATFORM_MAEMO
     return gIsVirtualKeyboardOpened;
 #else
-    return PR_FALSE;
+    return false;
 #endif
 }
 
 GtkIMContext*
 nsGtkIMModule::GetContext()
 {
     if (IsEnabled()) {
         return mContext;
@@ -733,17 +733,17 @@ nsGtkIMModule::Focus()
 
     if (sLastFocusedModule && sLastFocusedModule != this) {
         sLastFocusedModule->Blur();
     }
 
     sLastFocusedModule = this;
 
     gtk_im_context_focus_in(im);
-    mIsIMFocused = PR_TRUE;
+    mIsIMFocused = true;
 
     if (!IsEnabled()) {
         // We should release IME focus for uim and scim.
         // These IMs are using snooper that is released at losing focus.
         Blur();
     }
 }
 
@@ -761,17 +761,17 @@ nsGtkIMModule::Blur()
     GtkIMContext *im = GetContext();
     if (!im) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no context"));
         return;
     }
 
     gtk_im_context_focus_out(im);
-    mIsIMFocused = PR_FALSE;
+    mIsIMFocused = false;
 }
 
 /* static */
 void
 nsGtkIMModule::OnStartCompositionCallback(GtkIMContext *aContext,
                                           nsGtkIMModule* aModule)
 {
     aModule->OnStartCompositionNative(aContext);
@@ -822,17 +822,17 @@ nsGtkIMModule::OnEndCompositionNative(Gt
     }
 
     bool shouldIgnoreThisEvent = ShouldIgnoreNativeCompositionEvent();
 
     // Finish the cancelling mode here rather than DispatchCompositionEnd()
     // because DispatchCompositionEnd() is called ourselves when we need to
     // commit the composition string *before* the focus moves completely.
     // Note that the native commit can be fired *after* ResetIME().
-    mIgnoreNativeCompositionEvent = PR_FALSE;
+    mIgnoreNativeCompositionEvent = false;
 
     if (!mIsComposing || shouldIgnoreThisEvent) {
         // If we already handled the commit event, we should do nothing here.
         return;
     }
 
     // Be aware, widget can be gone
     DispatchCompositionEnd();
@@ -868,17 +868,17 @@ nsGtkIMModule::OnChangeCompositionNative
     nsAutoString compositionString;
     GetCompositionString(compositionString);
     if (!mIsComposing && compositionString.IsEmpty()) {
         mDispatchedCompositionString.Truncate();
         return; // Don't start the composition with empty string.
     }
 
     // Be aware, widget can be gone
-    DispatchTextEvent(compositionString, PR_TRUE);
+    DispatchTextEvent(compositionString, true);
 }
 
 /* static */
 gboolean
 nsGtkIMModule::OnRetrieveSurroundingCallback(GtkIMContext  *aContext,
                                              nsGtkIMModule *aModule)
 {
     return aModule->OnRetrieveSurroundingNative(aContext);
@@ -1007,17 +1007,17 @@ nsGtkIMModule::OnCommitCompositionNative
         keyval_unicode = gdk_keyval_to_unicode(mProcessingKeyEvent->keyval);
         keyval_utf8_len = g_unichar_to_utf8(keyval_unicode, keyval_utf8);
         keyval_utf8[keyval_utf8_len] = '\0';
 
         if (!strcmp(commitString, keyval_utf8)) {
             PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
                 ("GtkIMModule(%p): OnCommitCompositionNative, we'll send normal key event",
                  this));
-            mFilterKeyEvent = PR_FALSE;
+            mFilterKeyEvent = false;
             return;
         }
     }
 
     NS_ConvertUTF8toUTF16 str(commitString);
     CommitCompositionBy(str); // Be aware, widget can be gone
 }
 
@@ -1025,18 +1025,18 @@ bool
 nsGtkIMModule::CommitCompositionBy(const nsAString& aString)
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): CommitCompositionBy, aString=\"%s\", "
          "mDispatchedCompositionString=\"%s\"",
          this, NS_ConvertUTF16toUTF8(aString).get(),
          NS_ConvertUTF16toUTF8(mDispatchedCompositionString).get()));
 
-    if (!DispatchTextEvent(aString, PR_FALSE)) {
-        return PR_FALSE;
+    if (!DispatchTextEvent(aString, false)) {
+        return false;
     }
     // We should dispatch the compositionend event here because some IMEs
     // might not fire "preedit_end" native event.
     return DispatchCompositionEnd(); // Be aware, widget can be gone
 }
 
 void
 nsGtkIMModule::GetCompositionString(nsAString &aCompositionString)
@@ -1064,35 +1064,35 @@ bool
 nsGtkIMModule::DispatchCompositionStart()
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): DispatchCompositionStart", this));
 
     if (mIsComposing) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    WARNING, we're already in composition"));
-        return PR_TRUE;
+        return true;
     }
 
     if (!mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
-        return PR_FALSE;
+        return false;
     }
 
     nsEventStatus status;
-    nsQueryContentEvent selection(PR_TRUE, NS_QUERY_SELECTED_TEXT,
+    nsQueryContentEvent selection(true, NS_QUERY_SELECTED_TEXT,
                                   mLastFocusedWindow);
     InitEvent(selection);
     mLastFocusedWindow->DispatchEvent(&selection, status);
 
     if (!selection.mSucceeded || selection.mReply.mOffset == PR_UINT32_MAX) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, cannot query the selection offset"));
-        return PR_FALSE;
+        return false;
     }
 
     mCompositionStart = selection.mReply.mOffset;
     mDispatchedCompositionString.Truncate();
 
     if (mProcessingKeyEvent && !mKeyDownEventWasSent &&
         mProcessingKeyEvent->type == GDK_KEY_PRESS) {
         // If this composition is started by a native keydown event, we need to
@@ -1102,127 +1102,127 @@ nsGtkIMModule::DispatchCompositionStart(
         mLastFocusedWindow->DispatchKeyDownEvent(mProcessingKeyEvent,
                                                  &isCancelled);
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    keydown event is dispatched"));
         if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
             kungFuDeathGrip != mLastFocusedWindow) {
             PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
                 ("    NOTE, the focused widget was destroyed/changed by keydown event"));
-            return PR_FALSE;
+            return false;
         }
     }
 
     if (mIgnoreNativeCompositionEvent) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    WARNING, mIgnoreNativeCompositionEvent is already TRUE, but we forcedly reset"));
-        mIgnoreNativeCompositionEvent = PR_FALSE;
+        mIgnoreNativeCompositionEvent = false;
     }
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("    mCompositionStart=%u", mCompositionStart));
-    mIsComposing = PR_TRUE;
-    nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_START,
+    mIsComposing = true;
+    nsCompositionEvent compEvent(true, NS_COMPOSITION_START,
                                  mLastFocusedWindow);
     InitEvent(compEvent);
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
     if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
         kungFuDeathGrip != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    NOTE, the focused widget was destroyed/changed by compositionstart event"));
-        return PR_FALSE;
+        return false;
     }
 
-    return PR_TRUE;
+    return true;
 }
 
 bool
 nsGtkIMModule::DispatchCompositionEnd()
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): DispatchCompositionEnd, "
          "mDispatchedCompositionString=\"%s\"",
          this, NS_ConvertUTF16toUTF8(mDispatchedCompositionString).get()));
 
     if (!mIsComposing) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    WARNING, we have alrady finished the composition"));
-        return PR_FALSE;
+        return false;
     }
 
     if (!mLastFocusedWindow) {
         mDispatchedCompositionString.Truncate();
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
-        return PR_FALSE;
+        return false;
     }
 
-    nsCompositionEvent compEvent(PR_TRUE, NS_COMPOSITION_END,
+    nsCompositionEvent compEvent(true, NS_COMPOSITION_END,
                                  mLastFocusedWindow);
     InitEvent(compEvent);
     compEvent.data = mDispatchedCompositionString;
     nsEventStatus status;
     nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
     mLastFocusedWindow->DispatchEvent(&compEvent, status);
-    mIsComposing = PR_FALSE;
+    mIsComposing = false;
     mCompositionStart = PR_UINT32_MAX;
     mDispatchedCompositionString.Truncate();
     if (static_cast<nsWindow*>(kungFuDeathGrip.get())->IsDestroyed() ||
         kungFuDeathGrip != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    NOTE, the focused widget was destroyed/changed by compositionend event"));
-        return PR_FALSE;
+        return false;
     }
 
-    return PR_TRUE;
+    return true;
 }
 
 bool
 nsGtkIMModule::DispatchTextEvent(const nsAString &aCompositionString,
                                  bool aCheckAttr)
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): DispatchTextEvent, aCheckAttr=%s",
          this, aCheckAttr ? "TRUE" : "FALSE"));
 
     if (!mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
-        return PR_FALSE;
+        return false;
     }
 
     if (!mIsComposing) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    The composition wasn't started, force starting..."));
         nsCOMPtr<nsIWidget> kungFuDeathGrip = mLastFocusedWindow;
         if (!DispatchCompositionStart()) {
-            return PR_FALSE;
+            return false;
         }
     }
 
     nsEventStatus status;
     nsRefPtr<nsWindow> lastFocusedWindow = mLastFocusedWindow;
 
     if (aCompositionString != mDispatchedCompositionString) {
-      nsCompositionEvent compositionUpdate(PR_TRUE, NS_COMPOSITION_UPDATE,
+      nsCompositionEvent compositionUpdate(true, NS_COMPOSITION_UPDATE,
                                            mLastFocusedWindow);
       InitEvent(compositionUpdate);
       compositionUpdate.data = aCompositionString;
       mDispatchedCompositionString = aCompositionString;
       mLastFocusedWindow->DispatchEvent(&compositionUpdate, status);
       if (lastFocusedWindow->IsDestroyed() ||
           lastFocusedWindow != mLastFocusedWindow) {
           PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
               ("    NOTE, the focused widget was destroyed/changed by compositionupdate"));
-          return PR_FALSE;
+          return false;
       }
     }
 
-    nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, mLastFocusedWindow);
+    nsTextEvent textEvent(true, NS_TEXT_TEXT, mLastFocusedWindow);
     InitEvent(textEvent);
 
     PRUint32 targetOffset = mCompositionStart;
 
     nsAutoTArray<nsTextRange, 4> textRanges;
     if (aCheckAttr) {
         // NOTE: SetTextRangeList() assumes that mDispatchedCompositionString
         //       has been updated already.
@@ -1241,22 +1241,22 @@ nsGtkIMModule::DispatchTextEvent(const n
     textEvent.rangeArray = textRanges.Elements();
     textEvent.theText = mDispatchedCompositionString.get();
 
     mLastFocusedWindow->DispatchEvent(&textEvent, status);
     if (lastFocusedWindow->IsDestroyed() ||
         lastFocusedWindow != mLastFocusedWindow) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    NOTE, the focused widget was destroyed/changed by text event"));
-        return PR_FALSE;
+        return false;
     }
 
     SetCursorPosition(targetOffset);
 
-    return PR_TRUE;
+    return true;
 }
 
 void
 nsGtkIMModule::SetTextRangeList(nsTArray<nsTextRange> &aTextRangeList)
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): SetTextRangeList", this));
 
@@ -1399,17 +1399,17 @@ nsGtkIMModule::SetCursorPosition(PRUint3
 
     GtkIMContext *im = GetContext();
     if (!im) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no context"));
         return;
     }
 
-    nsQueryContentEvent charRect(PR_TRUE, NS_QUERY_TEXT_RECT,
+    nsQueryContentEvent charRect(true, NS_QUERY_TEXT_RECT,
                                  mLastFocusedWindow);
     charRect.InitForQueryTextRect(aTargetOffset, 1);
     InitEvent(charRect);
     nsEventStatus status;
     mLastFocusedWindow->DispatchEvent(&charRect, status);
     if (!charRect.mSucceeded) {
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, NS_QUERY_TEXT_RECT was failed"));
@@ -1446,17 +1446,17 @@ nsGtkIMModule::GetCurrentParagraph(nsASt
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
         return NS_ERROR_NULL_POINTER;
     }
 
     nsEventStatus status;
 
     // Query cursor position & selection
-    nsQueryContentEvent querySelectedTextEvent(PR_TRUE,
+    nsQueryContentEvent querySelectedTextEvent(true,
                                                NS_QUERY_SELECTED_TEXT,
                                                mLastFocusedWindow);
     mLastFocusedWindow->DispatchEvent(&querySelectedTextEvent, status);
     NS_ENSURE_TRUE(querySelectedTextEvent.mSucceeded, NS_ERROR_FAILURE);
 
     PRUint32 selOffset = querySelectedTextEvent.mReply.mOffset;
     PRUint32 selLength = querySelectedTextEvent.mReply.mString.Length();
 
@@ -1469,17 +1469,17 @@ nsGtkIMModule::GetCurrentParagraph(nsASt
             ("    FAILED, The selection is out of range"));
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("        selOffset=%u, selLength=%u",
              selOffset, selLength));
         return NS_ERROR_FAILURE;
     }
 
     // Get all text contents of the focused editor
-    nsQueryContentEvent queryTextContentEvent(PR_TRUE,
+    nsQueryContentEvent queryTextContentEvent(true,
                                               NS_QUERY_TEXT_CONTENT,
                                               mLastFocusedWindow);
     queryTextContentEvent.InitForQueryTextContent(0, PR_UINT32_MAX);
     mLastFocusedWindow->DispatchEvent(&queryTextContentEvent, status);
     NS_ENSURE_TRUE(queryTextContentEvent.mSucceeded, NS_ERROR_FAILURE);
 
     nsAutoString textContent(queryTextContentEvent.mReply.mString);
     if (selOffset + selLength > textContent.Length()) {
@@ -1488,18 +1488,18 @@ nsGtkIMModule::GetCurrentParagraph(nsASt
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("        selOffset=%u, selLength=%u, textContent.Length()=%u",
              selOffset, selLength, textContent.Length()));
         return NS_ERROR_FAILURE;
     }
 
     // Get only the focused paragraph, by looking for newlines
     PRInt32 parStart = (selOffset == 0) ? 0 :
-        textContent.RFind("\n", PR_FALSE, selOffset - 1, -1) + 1;
-    PRInt32 parEnd = textContent.Find("\n", PR_FALSE, selOffset + selLength, -1);
+        textContent.RFind("\n", false, selOffset - 1, -1) + 1;
+    PRInt32 parEnd = textContent.Find("\n", false, selOffset + selLength, -1);
     if (parEnd < 0) {
         parEnd = textContent.Length();
     }
     aText = nsDependentSubstring(textContent, parStart, parEnd - parStart);
     aCursorPos = selOffset - PRUint32(parStart);
 
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("    aText.Length()=%u, aCursorPos=%u", aText.Length(), aCursorPos));
@@ -1518,34 +1518,34 @@ nsGtkIMModule::DeleteText(const PRInt32 
         PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
             ("    FAILED, there are no focused window in this module"));
         return NS_ERROR_NULL_POINTER;
     }
 
     nsEventStatus status;
 
     // Query cursor position & selection
-    nsQueryContentEvent querySelectedTextEvent(PR_TRUE,
+    nsQueryContentEvent querySelectedTextEvent(true,
                                                NS_QUERY_SELECTED_TEXT,
                                                mLastFocusedWindow);
     mLastFocusedWindow->DispatchEvent(&querySelectedTextEvent, status);
     NS_ENSURE_TRUE(querySelectedTextEvent.mSucceeded, NS_ERROR_FAILURE);
 
     // Set selection to delete
-    nsSelectionEvent selectionEvent(PR_TRUE, NS_SELECTION_SET,
+    nsSelectionEvent selectionEvent(true, NS_SELECTION_SET,
                                     mLastFocusedWindow);
     selectionEvent.mOffset = querySelectedTextEvent.mReply.mOffset + aOffset;
     selectionEvent.mLength = aNChars;
-    selectionEvent.mReversed = PR_FALSE;
-    selectionEvent.mExpandToClusterBoundary = PR_FALSE;
+    selectionEvent.mReversed = false;
+    selectionEvent.mExpandToClusterBoundary = false;
     mLastFocusedWindow->DispatchEvent(&selectionEvent, status);
     NS_ENSURE_TRUE(selectionEvent.mSucceeded, NS_ERROR_FAILURE);
 
     // Delete the selection
-    nsContentCommandEvent contentCommandEvent(PR_TRUE,
+    nsContentCommandEvent contentCommandEvent(true,
                                               NS_CONTENT_COMMAND_DELETE,
                                               mLastFocusedWindow);
     mLastFocusedWindow->DispatchEvent(&contentCommandEvent, status);
     NS_ENSURE_TRUE(contentCommandEvent.mSucceeded, NS_ERROR_FAILURE);
 
     return NS_OK;
 }
 
@@ -1559,13 +1559,13 @@ bool
 nsGtkIMModule::ShouldIgnoreNativeCompositionEvent()
 {
     PR_LOG(gGtkIMLog, PR_LOG_ALWAYS,
         ("GtkIMModule(%p): ShouldIgnoreNativeCompositionEvent, mLastFocusedWindow=%p, mIgnoreNativeCompositionEvent=%s",
          this, mLastFocusedWindow,
          mIgnoreNativeCompositionEvent ? "YES" : "NO"));
 
     if (!mLastFocusedWindow) {
-        return PR_TRUE; // cannot continue
+        return true; // cannot continue
     }
 
     return mIgnoreNativeCompositionEvent;
 }
--- a/widget/src/gtk2/nsIdleServiceGTK.cpp
+++ b/widget/src/gtk2/nsIdleServiceGTK.cpp
@@ -86,17 +86,17 @@ static void Initialize()
     if (!_XSSQueryExtension)
         PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryExtension!\n"));
     if (!_XSSAllocInfo)
         PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSAllocInfo!\n"));
     if (!_XSSQueryInfo)
         PR_LOG(sIdleLog, PR_LOG_WARNING, ("Failed to get XSSQueryInfo!\n"));
 #endif
 
-    sInitialized = PR_TRUE;
+    sInitialized = true;
 }
 
 nsIdleServiceGTK::nsIdleServiceGTK()
     : mXssInfo(nsnull)
 {
 #ifdef PR_LOGGING
     if (!sIdleLog)
         sIdleLog = PR_NewLogModule("nsIIdleService");
--- a/widget/src/gtk2/nsImageToPixbuf.cpp
+++ b/widget/src/gtk2/nsImageToPixbuf.cpp
@@ -86,17 +86,17 @@ nsImageToPixbuf::ImageToPixbuf(imgIConta
       return nsnull;
 
     return ImgSurfaceToPixbuf(frame, frame->Width(), frame->Height());
 }
 
 GdkPixbuf*
 nsImageToPixbuf::ImgSurfaceToPixbuf(gfxImageSurface* aImgSurface, PRInt32 aWidth, PRInt32 aHeight)
 {
-    GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, PR_TRUE, 8,
+    GdkPixbuf* pixbuf = gdk_pixbuf_new(GDK_COLORSPACE_RGB, TRUE, 8,
                                        aWidth, aHeight);
     if (!pixbuf)
         return nsnull;
 
     PRUint32 rowstride = gdk_pixbuf_get_rowstride (pixbuf);
     guchar* pixels = gdk_pixbuf_get_pixels (pixbuf);
 
     long cairoStride = aImgSurface->Stride();
--- a/widget/src/gtk2/nsLookAndFeel.cpp
+++ b/widget/src/gtk2/nsLookAndFeel.cpp
@@ -81,17 +81,17 @@ bool      nsLookAndFeel::sMenuSupportsDr
 nsLookAndFeel::nsLookAndFeel() : nsXPLookAndFeel()
 {
     mStyle = nsnull;
     InitWidget();
 
     static bool sInitialized = false;
 
     if (!sInitialized) {
-        sInitialized = PR_TRUE;
+        sInitialized = true;
         InitLookAndFeel();
     }
 }
 
 nsLookAndFeel::~nsLookAndFeel()
 {
     g_object_unref(mStyle);
 }
@@ -362,17 +362,17 @@ static void darken_gdk_color(GdkColor *s
     blue *= 0.93;
 
     dest->red = red * 65535.0;
     dest->green = green * 65535.0;
     dest->blue = blue * 65535.0;
 }
 
 static PRInt32 CheckWidgetStyle(GtkWidget* aWidget, const char* aStyle, PRInt32 aResult) {
-    gboolean value = PR_FALSE;
+    gboolean value = FALSE;
     gtk_widget_style_get(aWidget, aStyle, &value, NULL);
     return value ? aResult : 0;
 }
 
 static PRInt32 ConvertGTKStepperStyleToMozillaScrollArrowStyle(GtkWidget* aWidget)
 {
     if (!aWidget)
         return mozilla::LookAndFeel::eScrollArrowStyle_Single;
@@ -808,13 +808,13 @@ nsLookAndFeel::RefreshImpl()
  
     InitWidget();
     InitLookAndFeel();
 }
 
 bool
 nsLookAndFeel::GetEchoPasswordImpl() {
 #ifdef MOZ_PLATFORM_MAEMO
-    return PR_TRUE;
+    return true;
 #else
-    return PR_FALSE;
+    return false;
 #endif
 }
--- a/widget/src/gtk2/nsNativeKeyBindings.cpp
+++ b/widget/src/gtk2/nsNativeKeyBindings.cpp
@@ -51,25 +51,25 @@ static void *gCurrentCallbackData;
 static bool gHandled;
 
 // Common GtkEntry and GtkTextView signals
 static void
 copy_clipboard_cb(GtkWidget *w, gpointer user_data)
 {
   gCurrentCallback("cmd_copy", gCurrentCallbackData);
   g_signal_stop_emission_by_name(w, "copy_clipboard");
-  gHandled = PR_TRUE;
+  gHandled = true;
 }
 
 static void
 cut_clipboard_cb(GtkWidget *w, gpointer user_data)
 {
   gCurrentCallback("cmd_cut", gCurrentCallbackData);
   g_signal_stop_emission_by_name(w, "cut_clipboard");
-  gHandled = PR_TRUE;
+  gHandled = true;
 }
 
 // GTK distinguishes between display lines (wrapped, as they appear on the
 // screen) and paragraphs, which are runs of text terminated by a newline.
 // We don't have this distinction, so we always use editor's notion of
 // lines, which are newline-terminated.
 
 static const char *const sDeleteCommands[][2] = {
@@ -87,17 +87,17 @@ static const char *const sDeleteCommands
   { nsnull, nsnull } // WHITESPACE
 };
 
 static void
 delete_from_cursor_cb(GtkWidget *w, GtkDeleteType del_type,
                       gint count, gpointer user_data)
 {
   g_signal_stop_emission_by_name(w, "delete_from_cursor");
-  gHandled = PR_TRUE;
+  gHandled = true;
 
   bool forward = count > 0;
   if (PRUint32(del_type) >= NS_ARRAY_LENGTH(sDeleteCommands)) {
     // unsupported deletion type
     return;
   }
 
   if (del_type == GTK_DELETE_WORDS) {
@@ -179,17 +179,17 @@ static const char *const sMoveCommands[]
   }
 };
 
 static void
 move_cursor_cb(GtkWidget *w, GtkMovementStep step, gint count,
                gboolean extend_selection, gpointer user_data)
 {
   g_signal_stop_emission_by_name(w, "move_cursor");
-  gHandled = PR_TRUE;
+  gHandled = true;
   bool forward = count > 0;
   if (PRUint32(step) >= NS_ARRAY_LENGTH(sMoveCommands)) {
     // unsupported movement type
     return;
   }
 
   const char *cmd = sMoveCommands[step][extend_selection][forward];
   if (!cmd)
@@ -202,26 +202,26 @@ move_cursor_cb(GtkWidget *w, GtkMovement
   }
 }
 
 static void
 paste_clipboard_cb(GtkWidget *w, gpointer user_data)
 {
   gCurrentCallback("cmd_paste", gCurrentCallbackData);
   g_signal_stop_emission_by_name(w, "paste_clipboard");
-  gHandled = PR_TRUE;
+  gHandled = true;
 }
 
 // GtkTextView-only signals
 static void
 select_all_cb(GtkWidget *w, gboolean select, gpointer user_data)
 {
   gCurrentCallback("cmd_selectAll", gCurrentCallbackData);
   g_signal_stop_emission_by_name(w, "select_all");
-  gHandled = PR_TRUE;
+  gHandled = true;
 }
 
 void
 nsNativeKeyBindings::Init(NativeKeyBindingsType  aType)
 {
   switch (aType) {
   case eKeyBindings_Input:
     mNativeTarget = gtk_entry_new();
@@ -261,63 +261,63 @@ nsNativeKeyBindings::~nsNativeKeyBinding
 }
 
 NS_IMPL_ISUPPORTS1(nsNativeKeyBindings, nsINativeKeyBindings)
 
 bool
 nsNativeKeyBindings::KeyDown(const nsNativeKeyEvent& aEvent,
                              DoCommandCallback aCallback, void *aCallbackData)
 {
-  return PR_FALSE;
+  return false;
 }
 
 bool
 nsNativeKeyBindings::KeyPress(const nsNativeKeyEvent& aEvent,
                               DoCommandCallback aCallback, void *aCallbackData)
 {
   PRUint32 keyCode;
 
   if (aEvent.charCode != 0)
     keyCode = gdk_unicode_to_keyval(aEvent.charCode);
   else
     keyCode = DOMKeyCodeToGdkKeyCode(aEvent.keyCode);
 
   if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
-    return PR_TRUE;
+    return true;
 
   nsKeyEvent *nativeKeyEvent = static_cast<nsKeyEvent*>(aEvent.nativeEvent);
   if (!nativeKeyEvent || nativeKeyEvent->eventStructType != NS_KEY_EVENT &&
       nativeKeyEvent->message != NS_KEY_PRESS)
-    return PR_FALSE;
+    return false;
 
   for (PRUint32 i = 0; i < nativeKeyEvent->alternativeCharCodes.Length(); ++i) {
     PRUint32 ch = nativeKeyEvent->isShift ?
         nativeKeyEvent->alternativeCharCodes[i].mShiftedCharCode :
         nativeKeyEvent->alternativeCharCodes[i].mUnshiftedCharCode;
     if (ch && ch != aEvent.charCode) {
       keyCode = gdk_unicode_to_keyval(ch);
       if (KeyPressInternal(aEvent, aCallback, aCallbackData, keyCode))
-        return PR_TRUE;
+        return true;
     }
   }
 
 /* gtk_bindings_activate_event is preferable, but it has unresolved bug: http://bugzilla.gnome.org/show_bug.cgi?id=162726
 Also gtk_bindings_activate may work with some non-shortcuts operations (todo: check it)
 See bugs 411005 406407
 
   Code, which should be used after fixing http://bugzilla.gnome.org/show_bug.cgi?id=162726:
   const nsGUIEvent *guiEvent = static_cast<nsGUIEvent*>(aEvent.nativeEvent);
   if (guiEvent &&
      (guiEvent->message == NS_KEY_PRESS || guiEvent->message == NS_KEY_UP || guiEvent->message == NS_KEY_DOWN) &&
       guiEvent->pluginEvent)
         gtk_bindings_activate_event(GTK_OBJECT(mNativeTarget),
                                     static_cast<GdkEventKey*>(guiEvent->pluginEvent));
 */
 
-  return PR_FALSE;
+  return false;
 }
 
 bool
 nsNativeKeyBindings::KeyPressInternal(const nsNativeKeyEvent& aEvent,
                                       DoCommandCallback aCallback,
                                       void *aCallbackData,
                                       PRUint32 aKeyCode)
 {
@@ -328,25 +328,25 @@ nsNativeKeyBindings::KeyPressInternal(co
     modifiers |= GDK_CONTROL_MASK;
   if (aEvent.shiftKey)
     modifiers |= GDK_SHIFT_MASK;
   // we don't support meta
 
   gCurrentCallback = aCallback;
   gCurrentCallbackData = aCallbackData;
 
-  gHandled = PR_FALSE;
+  gHandled = false;
 
   gtk_bindings_activate(GTK_OBJECT(mNativeTarget),
                         aKeyCode, GdkModifierType(modifiers));
 
   gCurrentCallback = nsnull;
   gCurrentCallbackData = nsnull;
 
   return gHandled;
 }
 
 bool
 nsNativeKeyBindings::KeyUp(const nsNativeKeyEvent& aEvent,
                            DoCommandCallback aCallback, void *aCallbackData)
 {
-  return PR_FALSE;
+  return false;
 }
--- a/widget/src/gtk2/nsNativeThemeGTK.cpp
+++ b/widget/src/gtk2/nsNativeThemeGTK.cpp
@@ -77,17 +77,17 @@ nsNativeThemeGTK::nsNativeThemeGTK()
   if (moz_gtk_init() != MOZ_GTK_SUCCESS) {
     memset(mDisabledWidgetTypes, 0xff, sizeof(mDisabledWidgetTypes));
     return;
   }
 
   // We have to call moz_gtk_shutdown before the event loop stops running.
   nsCOMPtr<nsIObserverService> obsServ =
     mozilla::services::GetObserverService();
-  obsServ->AddObserver(this, "xpcom-shutdown", PR_FALSE);
+  obsServ->AddObserver(this, "xpcom-shutdown", false);
 
   memset(mDisabledWidgetTypes, 0, sizeof(mDisabledWidgetTypes));
   memset(mSafeWidgetStates, 0, sizeof(mSafeWidgetStates));
 }
 
 nsNativeThemeGTK::~nsNativeThemeGTK() {
 }
 
@@ -299,24 +299,24 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
           // the beginning or the end, depending on the button type.
           PRInt32 curpos = CheckIntAttr(aFrame, nsWidgetAtoms::curpos, 0);
           PRInt32 maxpos = CheckIntAttr(aFrame, nsWidgetAtoms::maxpos, 100);
           if ((curpos == 0 && (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP ||
                 aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT)) ||
               (curpos == maxpos &&
                (aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
                 aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT)))
-            aState->disabled = PR_TRUE;
+            aState->disabled = true;
 
           // In order to simulate native GTK scrollbar click behavior,
           // we set the active attribute on the element to true if it's
           // pressed with any mouse button.
           // This allows us to show that it's active without setting :active
           else if (CheckBooleanAttr(aFrame, nsWidgetAtoms::active))
-            aState->active = PR_TRUE;
+            aState->active = true;
 
           if (aWidgetFlags) {
             *aWidgetFlags = GetScrollbarButtonType(aFrame);
             if (aWidgetType - NS_THEME_SCROLLBAR_BUTTON_UP < 2)
               *aWidgetFlags |= MOZ_GTK_STEPPER_VERTICAL;
           }
         }
 
@@ -461,19 +461,19 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
   case NS_THEME_LISTBOX:
   case NS_THEME_TREEVIEW:
     aGtkWidgetType = MOZ_GTK_TREEVIEW;
     break;
   case NS_THEME_TREEVIEW_HEADER_CELL:
     if (aWidgetFlags) {
       // In this case, the flag denotes whether the header is the sorted one or not
       if (GetTreeSortDirection(aFrame) == eTreeSortDirection_Natural)
-        *aWidgetFlags = PR_FALSE;
+        *aWidgetFlags = false;
       else
-        *aWidgetFlags = PR_TRUE;
+        *aWidgetFlags = true;
     }
     aGtkWidgetType = MOZ_GTK_TREE_HEADER_CELL;
     break;
   case NS_THEME_TREEVIEW_HEADER_SORTARROW:
     if (aWidgetFlags) {
       switch (GetTreeSortDirection(aFrame)) {
         case eTreeSortDirection_Ascending:
           *aWidgetFlags = GTK_ARROW_DOWN;
@@ -485,17 +485,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
         default:
           /* GTK_ARROW_NONE is implemented since GTK 2.10
            * This prevents the treecolums from getting smaller
            * and wider when switching sort direction off and on
            * */
 #if GTK_CHECK_VERSION(2,10,0)
           *aWidgetFlags = GTK_ARROW_NONE;
 #else
-          return PR_FALSE; // Don't draw when we shouldn't
+          return false; // Don't draw when we shouldn't
 #endif // GTK_CHECK_VERSION(2,10,0)
           break;
       }
     }
     aGtkWidgetType = MOZ_GTK_TREE_HEADER_SORTARROW;
     break;
   case NS_THEME_TREEVIEW_TWISTY:
     aGtkWidgetType = MOZ_GTK_TREEVIEW_EXPANDER;
@@ -508,17 +508,17 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
       *aWidgetFlags = GTK_EXPANDER_EXPANDED;
     break;
   case NS_THEME_DROPDOWN:
     aGtkWidgetType = MOZ_GTK_DROPDOWN;
     if (aWidgetFlags)
         *aWidgetFlags = IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML);
     break;
   case NS_THEME_DROPDOWN_TEXT:
-    return PR_FALSE; // nothing to do, but prevents the bg from being drawn
+    return false; // nothing to do, but prevents the bg from being drawn
   case NS_THEME_DROPDOWN_TEXTFIELD:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ENTRY;
     break;
   case NS_THEME_DROPDOWN_BUTTON:
     aGtkWidgetType = MOZ_GTK_DROPDOWN_ARROW;
     break;
   case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
   case NS_THEME_BUTTON_ARROW_DOWN:
@@ -637,20 +637,20 @@ nsNativeThemeGTK::GetGtkWidgetAndState(P
   case NS_THEME_RADIOMENUITEM:
     aGtkWidgetType = MOZ_GTK_RADIOMENUITEM;
     break;
   case NS_THEME_WINDOW:
   case NS_THEME_DIALOG:
     aGtkWidgetType = MOZ_GTK_WINDOW;
     break;
   default:
-    return PR_FALSE;
+    return false;
   }
 
-  return PR_TRUE;
+  return true;
 }
 
 class ThemeRenderer : public gfxGdkNativeRenderer {
 public:
   ThemeRenderer(GtkWidgetState aState, GtkThemeWidgetType aGTKWidgetType,
                 gint aFlags, GtkTextDirection aDirection,
                 const GdkRectangle& aGDKRect, const GdkRectangle& aGDKClip)
     : mState(aState), mGTKWidgetType(aGTKWidgetType), mFlags(aFlags),
@@ -698,20 +698,20 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
 {
   *aExtra = nsIntMargin(0,0,0,0);
   // Allow an extra one pixel above and below the thumb for certain
   // GTK2 themes (Ximian Industrial, Bluecurve, Misty, at least);
   // We modify the frame's overflow area.  See bug 297508.
   switch (aWidgetType) {
   case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
     aExtra->top = aExtra->bottom = 1;
-    return PR_TRUE;
+    return true;
   case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
     aExtra->left = aExtra->right = 1;
-    return PR_TRUE;
+    return true;
 
   // Include the indicator spacing (the padding around the control).
   case NS_THEME_CHECKBOX:
   case NS_THEME_RADIO:
     {
       gint indicator_size, indicator_spacing;
 
       if (aWidgetType == NS_THEME_CHECKBOX) {
@@ -719,51 +719,51 @@ nsNativeThemeGTK::GetExtraSizeForWidget(
       } else {
         moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
       }
 
       aExtra->top = indicator_spacing;
       aExtra->right = indicator_spacing;
       aExtra->bottom = indicator_spacing;
       aExtra->left = indicator_spacing;
-      return PR_TRUE;
+      return true;
     }
   case NS_THEME_BUTTON :
     {
       if (IsDefaultButton(aFrame)) {
         // Some themes draw a default indicator outside the widget,
         // include that in overflow
         gint top, left, bottom, right;
         moz_gtk_button_get_default_overflow(&top, &left, &bottom, &right);
         aExtra->top = top;
         aExtra->right = right;
         aExtra->bottom = bottom;
         aExtra->left = left;
-        return PR_TRUE;
+        return true;
       }
     }
   case NS_THEME_TAB :
     {
       if (!IsSelectedTab(aFrame))
-        return PR_FALSE;
+        return false;
 
       gint gap_height = moz_gtk_get_tab_thickness();
 
       PRInt32 extra = gap_height - GetTabMarginPixels(aFrame);
       if (extra <= 0)
-        return PR_FALSE;
+        return false;
 
       if (IsBottomTab(aFrame)) {
         aExtra->top = extra;
       } else {
         aExtra->bottom = extra;
       }
     }
   default:
-    return PR_FALSE;
+    return false;
   }
 }
 
 NS_IMETHODIMP
 nsNativeThemeGTK::DrawWidgetBackground(nsRenderingContext* aContext,
                                        nsIFrame* aFrame,
                                        PRUint8 aWidgetType,
                                        const nsRect& aRect,
@@ -970,24 +970,24 @@ nsNativeThemeGTK::GetWidgetPadding(nsDev
     case NS_THEME_BUTTON_ARROW_NEXT:
     case NS_THEME_BUTTON_ARROW_PREVIOUS:
     // Radios and checkboxes return a fixed size in GetMinimumWidgetSize
     // and have a meaningful baseline, so they can't have
     // author-specified padding.
     case NS_THEME_CHECKBOX:
     case NS_THEME_RADIO:
       aResult->SizeTo(0, 0, 0, 0);
-      return PR_TRUE;
+      return true;
     case NS_THEME_MENUITEM:
     case NS_THEME_CHECKMENUITEM:
     case NS_THEME_RADIOMENUITEM:
       {
         // Menubar and menulist have their padding specified in CSS.
         if (!IsRegularMenuItem(aFrame))
-          return PR_FALSE;
+          return false;
 
         aResult->SizeTo(0, 0, 0, 0);
         GtkThemeWidgetType gtkWidgetType;
         if (GetGtkWidgetAndState(aWidgetType, aFrame, gtkWidgetType, nsnull,
                                  nsnull)) {
           moz_gtk_get_widget_border(gtkWidgetType, &aResult->left, &aResult->top,
                                     &aResult->right, &aResult->bottom, GetTextDirection(aFrame),
                                     IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XHTML));
@@ -998,88 +998,88 @@ nsNativeThemeGTK::GetWidgetPadding(nsDev
         if (aWidgetType == NS_THEME_MENUITEM)
           moz_gtk_menuitem_get_horizontal_padding(&horizontal_padding);
         else
           moz_gtk_checkmenuitem_get_horizontal_padding(&horizontal_padding);
 
         aResult->left += horizontal_padding;
         aResult->right += horizontal_padding;
 
-        return PR_TRUE;
+        return true;
       }
   }
 
-  return PR_FALSE;
+  return false;
 }
 
 bool
 nsNativeThemeGTK::GetWidgetOverflow(nsDeviceContext* aContext,
                                     nsIFrame* aFrame, PRUint8 aWidgetType,
                                     nsRect* aOverflowRect)
 {
   nsMargin m;
   PRInt32 p2a;
   nsIntMargin extraSize;
   if (!GetExtraSizeForWidget(aFrame, aWidgetType, &extraSize))
-    return PR_FALSE;
+    return false;
 
   p2a = aContext->AppUnitsPerDevPixel();
   m = nsMargin(NSIntPixelsToAppUnits(extraSize.left, p2a),
                NSIntPixelsToAppUnits(extraSize.top, p2a),
                NSIntPixelsToAppUnits(extraSize.right, p2a),
                NSIntPixelsToAppUnits(extraSize.bottom, p2a));
 
   aOverflowRect->Inflate(m);
-  return PR_TRUE;
+  return true;
 }
 
 NS_IMETHODIMP
 nsNativeThemeGTK::GetMinimumWidgetSize(nsRenderingContext* aContext,
                                        nsIFrame* aFrame, PRUint8 aWidgetType,
                                        nsIntSize* aResult, bool* aIsOverridable)
 {
   aResult->width = aResult->height = 0;
-  *aIsOverridable = PR_TRUE;
+  *aIsOverridable = true;
 
   switch (aWidgetType) {
     case NS_THEME_SCROLLBAR_BUTTON_UP:
     case NS_THEME_SCROLLBAR_BUTTON_DOWN:
       {
         MozGtkScrollbarMetrics metrics;
         moz_gtk_get_scrollbar_metrics(&metrics);
 
         aResult->width = metrics.slider_width;
         aResult->height = metrics.stepper_size;
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
       }
       break;
     case NS_THEME_SCROLLBAR_BUTTON_LEFT:
     case NS_THEME_SCROLLBAR_BUTTON_RIGHT:
       {
         MozGtkScrollbarMetrics metrics;
         moz_gtk_get_scrollbar_metrics(&metrics);
 
         aResult->width = metrics.stepper_size;
         aResult->height = metrics.slider_width;
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
       }
       break;
     case NS_THEME_SPLITTER:
     {
       gint metrics;
       if (IsHorizontal(aFrame)) {
         moz_gtk_splitter_get_metrics(GTK_ORIENTATION_HORIZONTAL, &metrics);
         aResult->width = metrics;
         aResult->height = 0;
       } else {
         moz_gtk_splitter_get_metrics(GTK_ORIENTATION_VERTICAL, &metrics);
         aResult->width = 0;
         aResult->height = metrics;
       }
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
     case NS_THEME_SCROLLBAR_TRACK_HORIZONTAL:
     case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
     {
       /* While we enforce a minimum size for the thumb, this is ignored
        * for the some scrollbars if buttons are hidden (bug 513006) because
        * the thumb isn't a direct child of the scrollbar, unlike the buttons
@@ -1088,49 +1088,49 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
       MozGtkScrollbarMetrics metrics;
       moz_gtk_get_scrollbar_metrics(&metrics);
 
       if (aWidgetType == NS_THEME_SCROLLBAR_TRACK_VERTICAL)
         aResult->width = metrics.slider_width;
       else
         aResult->height = metrics.slider_width;
 
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
     case NS_THEME_SCROLLBAR_THUMB_VERTICAL:
     case NS_THEME_SCROLLBAR_THUMB_HORIZONTAL:
       {
         MozGtkScrollbarMetrics metrics;
         moz_gtk_get_scrollbar_metrics(&metrics);
 
         nsRect rect = aFrame->GetParent()->GetRect();
         PRInt32 p2a = aFrame->PresContext()->DeviceContext()->
                         AppUnitsPerDevPixel();
         nsMargin margin;
 
         /* Get the available space, if that is smaller then the minimum size,
          * adjust the mininum size to fit into it.
-         * Setting aIsOverridable to PR_TRUE has no effect for thumbs. */
+         * Setting aIsOverridable to true has no effect for thumbs. */
         aFrame->GetMargin(margin);
         rect.Deflate(margin);
         aFrame->GetParent()->GetBorderAndPadding(margin);
         rect.Deflate(margin);
 
         if (aWidgetType == NS_THEME_SCROLLBAR_THUMB_VERTICAL) {
           aResult->width = metrics.slider_width;
           aResult->height = NS_MIN(NSAppUnitsToIntPixels(rect.height, p2a),
                                    metrics.min_slider_size);
         } else {
           aResult->height = metrics.slider_width;
           aResult->width = NS_MIN(NSAppUnitsToIntPixels(rect.width, p2a),
                                   metrics.min_slider_size);
         }
 
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
       }
       break;
     case NS_THEME_SCALE_THUMB_HORIZONTAL:
     case NS_THEME_SCALE_THUMB_VERTICAL:
       {
         gint thumb_length, thumb_height;
 
         if (aWidgetType == NS_THEME_SCALE_THUMB_VERTICAL) {
@@ -1138,68 +1138,68 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
           aResult->width = thumb_height;
           aResult->height = thumb_length;
         } else {
           moz_gtk_get_scalethumb_metrics(GTK_ORIENTATION_HORIZONTAL, &thumb_length, &thumb_height);
           aResult->width = thumb_length;
           aResult->height = thumb_height;
         }
 
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
       }
       break;
     case NS_THEME_TAB_SCROLLARROW_BACK:
     case NS_THEME_TAB_SCROLLARROW_FORWARD:
       {
         moz_gtk_get_tab_scroll_arrow_size(&aResult->width, &aResult->height);
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
       }
       break;
   case NS_THEME_DROPDOWN_BUTTON:
     {
       moz_gtk_get_combo_box_entry_button_size(&aResult->width,
                                               &aResult->height);
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
   case NS_THEME_MENUSEPARATOR:
     {
       gint separator_height;
 
       moz_gtk_get_menu_separator_height(&separator_height);
       aResult->height = separator_height;
     
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
   case NS_THEME_CHECKBOX:
   case NS_THEME_RADIO:
     {
       gint indicator_size, indicator_spacing;
 
       if (aWidgetType == NS_THEME_CHECKBOX) {
         moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing);
       } else {
         moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing);
       }
 
       // Include space for the indicator and the padding around it.
       aResult->width = indicator_size;
       aResult->height = indicator_size;
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
   case NS_THEME_TOOLBAR_BUTTON_DROPDOWN:
   case NS_THEME_BUTTON_ARROW_UP:
   case NS_THEME_BUTTON_ARROW_DOWN:
   case NS_THEME_BUTTON_ARROW_NEXT:
   case NS_THEME_BUTTON_ARROW_PREVIOUS:
     {
         moz_gtk_get_arrow_size(&aResult->width, &aResult->height);
-        *aIsOverridable = PR_FALSE;
+        *aIsOverridable = false;
     }
     break;
   case NS_THEME_CHECKBOX_CONTAINER:
   case NS_THEME_RADIO_CONTAINER:
   case NS_THEME_CHECKBOX_LABEL:
   case NS_THEME_RADIO_LABEL:
   case NS_THEME_BUTTON:
   case NS_THEME_DROPDOWN:
@@ -1233,26 +1233,26 @@ nsNativeThemeGTK::GetMinimumWidgetSize(n
   case NS_THEME_SPINNER_DOWN_BUTTON:
     // hard code these sizes
     aResult->width = 14;
     aResult->height = 13;
     break;
   case NS_THEME_RESIZER:
     // same as Windows to make our lives easier
     aResult->width = aResult->height = 15;
-    *aIsOverridable = PR_FALSE;
+    *aIsOverridable = false;
     break;
   case NS_THEME_TREEVIEW_TWISTY:
   case NS_THEME_TREEVIEW_TWISTY_OPEN:
     {
       gint expander_size;
 
       moz_gtk_get_treeview_expander_size(&expander_size);
       aResult->width = aResult->height = expander_size;
-      *aIsOverridable = PR_FALSE;
+      *aIsOverridable = false;
     }
     break;
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNativeThemeGTK::WidgetStateChanged(nsIFrame* aFrame, PRUint8 aWidgetType, 
@@ -1269,51 +1269,51 @@ nsNativeThemeGTK::WidgetStateChanged(nsI
       aWidgetType == NS_THEME_PROGRESSBAR ||
       aWidgetType == NS_THEME_PROGRESSBAR_VERTICAL ||
       aWidgetType == NS_THEME_MENUBAR ||
       aWidgetType == NS_THEME_MENUPOPUP ||
       aWidgetType == NS_THEME_TOOLTIP ||
       aWidgetType == NS_THEME_MENUSEPARATOR ||
       aWidgetType == NS_THEME_WINDOW ||
       aWidgetType == NS_THEME_DIALOG) {
-    *aShouldRepaint = PR_FALSE;
+    *aShouldRepaint = false;
     return NS_OK;
   }
 
   if ((aWidgetType == NS_THEME_SCROLLBAR_BUTTON_UP ||
        aWidgetType == NS_THEME_SCROLLBAR_BUTTON_DOWN ||
        aWidgetType == NS_THEME_SCROLLBAR_BUTTON_LEFT ||
        aWidgetType == NS_THEME_SCROLLBAR_BUTTON_RIGHT) &&
       (aAttribute == nsWidgetAtoms::curpos ||
        aAttribute == nsWidgetAtoms::maxpos)) {
-    *aShouldRepaint = PR_TRUE;
+    *aShouldRepaint = true;
     return NS_OK;
   }
 
   // XXXdwh Not sure what can really be done here.  Can at least guess for
   // specific widgets that they're highly unlikely to have certain states.
   // For example, a toolbar doesn't care about any states.
   if (!aAttribute) {
     // Hover/focus/active changed.  Always repaint.
-    *aShouldRepaint = PR_TRUE;
+    *aShouldRepaint = true;
   }
   else {
     // Check the attribute to see if it's relevant.  
     // disabled, checked, dlgtype, default, etc.
-    *aShouldRepaint = PR_FALSE;
+    *aShouldRepaint = false;
     if (aAttribute == nsWidgetAtoms::disabled ||
         aAttribute == nsWidgetAtoms::checked ||
         aAttribute == nsWidgetAtoms::selected ||
         aAttribute == nsWidgetAtoms::focused ||
         aAttribute == nsWidgetAtoms::readonly ||
         aAttribute == nsWidgetAtoms::_default ||
         aAttribute == nsWidgetAtoms::mozmenuactive ||
         aAttribute == nsWidgetAtoms::open ||
         aAttribute == nsWidgetAtoms::parentfocused)
-      *aShouldRepaint = PR_TRUE;
+      *aShouldRepaint = true;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsNativeThemeGTK::ThemeChanged()
 {
@@ -1324,17 +1324,17 @@ nsNativeThemeGTK::ThemeChanged()
 }
 
 NS_IMETHODIMP_(bool)
 nsNativeThemeGTK::ThemeSupportsWidget(nsPresContext* aPresContext,
                                       nsIFrame* aFrame,
                                       PRUint8 aWidgetType)
 {
   if (IsWidgetTypeDisabled(mDisabledWidgetTypes, aWidgetType))
-    return PR_FALSE;
+    return false;
 
   switch (aWidgetType) {
   case NS_THEME_BUTTON:
   case NS_THEME_BUTTON_FOCUS:
   case NS_THEME_RADIO:
   case NS_THEME_CHECKBOX:
   case NS_THEME_TOOLBOX: // N/A
   case NS_THEME_TOOLBAR:
@@ -1417,51 +1417,51 @@ nsNativeThemeGTK::ThemeSupportsWidget(ns
   case NS_THEME_DROPDOWN_BUTTON:
     // "Native" dropdown buttons cause padding and margin problems, but only
     // in HTML so allow them in XUL.
     return (!aFrame || IsFrameContentNodeInNamespace(aFrame, kNameSpaceID_XUL)) &&
            !IsWidgetStyled(aPresContext, aFrame, aWidgetType);
 
   }
 
-  return PR_FALSE;
+  return false;
 }
 
 NS_IMETHODIMP_(bool)
 nsNativeThemeGTK::WidgetIsContainer(PRUint8 aWidgetType)
 {
   // XXXdwh At some point flesh all of this out.
   if (aWidgetType == NS_THEME_DROPDOWN_BUTTON ||
       aWidgetType == NS_THEME_RADIO ||
       aWidgetType == NS_THEME_CHECKBOX ||
       aWidgetType == NS_THEME_TAB_SCROLLARROW_BACK ||
       aWidgetType == NS_THEME_TAB_SCROLLARROW_FORWARD ||
       aWidgetType == NS_THEME_BUTTON_ARROW_UP ||
       aWidgetType == NS_THEME_BUTTON_ARROW_DOWN ||
       aWidgetType == NS_THEME_BUTTON_ARROW_NEXT ||
       aWidgetType == NS_THEME_BUTTON_ARROW_PREVIOUS)
-    return PR_FALSE;
-  return PR_TRUE;
+    return false;
+  return true;
 }
 
 bool
 nsNativeThemeGTK::ThemeDrawsFocusForWidget(nsPresContext* aPresContext, nsIFrame* aFrame, PRUint8 aWidgetType)
 {
    if (aWidgetType == NS_THEME_DROPDOWN ||
       aWidgetType == NS_THEME_BUTTON || 
       aWidgetType == NS_THEME_TREEVIEW_HEADER_CELL)
-    return PR_TRUE;
+    return true;
   
-  return PR_FALSE;
+  return false;
 }
 
 bool
 nsNativeThemeGTK::ThemeNeedsComboboxDropmarker()
 {
-  return PR_FALSE;
+  return false;
 }
 
 nsITheme::Transparency
 nsNativeThemeGTK::GetWidgetTransparency(nsIFrame* aFrame, PRUint8 aWidgetType)
 {
   switch (aWidgetType) {
   // These widgets always draw a default background.
   case NS_THEME_SCROLLBAR_TRACK_VERTICAL:
--- a/widget/src/gtk2/nsPSPrinters.cpp
+++ b/widget/src/gtk2/nsPSPrinters.cpp
@@ -69,17 +69,17 @@ nsPSPrinterList::nsPSPrinterList()
 
 
 /* Check whether the PostScript module has been disabled at runtime */
 bool
 nsPSPrinterList::Enabled()
 {
     const char *val = PR_GetEnv("MOZILLA_POSTSCRIPT_ENABLED");
     if (val && (val[0] == '0' || !PL_strcasecmp(val, "false")))
-        return PR_FALSE;
+        return false;
 
     // is the PS module enabled?
     return Preferences::GetBool("print.postscript.enabled", true);
 }
 
 
 /* Fetch a list of printers handled by the PostsScript module */
 void
--- a/widget/src/gtk2/nsPSPrinters.h
+++ b/widget/src/gtk2/nsPSPrinters.h
@@ -46,18 +46,18 @@
 class nsCUPSShim;
 
 class nsPSPrinterList {
     public:
         nsPSPrinterList();
 
         /**
          * Is the PostScript module enabled or disabled?
-         * @return PR_TRUE if enabled,
-         *         PR_FALSE if not.
+         * @return true if enabled,
+         *         false if not.
          */
         bool Enabled();
 
         /**
          * Obtain a list of printers (print destinations) supported by the
          * PostScript module, Each entry will be in the form <type>/<name>,
          * where <type> is a printer type string, and <name> is the actual
          * printer name.
--- a/widget/src/gtk2/nsPaperPS.cpp
+++ b/widget/src/gtk2/nsPaperPS.cpp
@@ -42,32 +42,32 @@
 #include "plstr.h"
 #include "nsCoord.h"
 #include "nsMemory.h"
 
 const nsPaperSizePS_ nsPaperSizePS::mList[] =
 {
 #define SIZE_MM(x)      (x)
 #define SIZE_INCH(x)    ((x) * MM_PER_INCH_FLOAT)
-    { "A5",             SIZE_MM(148),   SIZE_MM(210),   PR_TRUE },
-    { "A4",             SIZE_MM(210),   SIZE_MM(297),   PR_TRUE },
-    { "A3",             SIZE_MM(297),   SIZE_MM(420),   PR_TRUE },
-    { "Letter",         SIZE_INCH(8.5), SIZE_INCH(11),  PR_FALSE },
-    { "Legal",          SIZE_INCH(8.5), SIZE_INCH(14),  PR_FALSE },
-    { "Tabloid",        SIZE_INCH(11),  SIZE_INCH(17),  PR_FALSE },
-    { "Executive",      SIZE_INCH(7.5), SIZE_INCH(10),  PR_FALSE },
+    { "A5",             SIZE_MM(148),   SIZE_MM(210),   true },
+    { "A4",             SIZE_MM(210),   SIZE_MM(297),   true },
+    { "A3",             SIZE_MM(297),   SIZE_MM(420),   true },
+    { "Letter",         SIZE_INCH(8.5), SIZE_INCH(11),  false },
+    { "Legal",          SIZE_INCH(8.5), SIZE_INCH(14),  false },
+    { "Tabloid",        SIZE_INCH(11),  SIZE_INCH(17),  false },
+    { "Executive",      SIZE_INCH(7.5), SIZE_INCH(10),  false },
 #undef SIZE_INCH
 #undef SIZE_MM
 };
 
 const unsigned int nsPaperSizePS::mCount = NS_ARRAY_LENGTH(mList);
 
 bool
 nsPaperSizePS::Find(const char *aName)
 {
     for (int i = mCount; i--; ) {
         if (!PL_strcasecmp(aName, mList[i].name)) {
             mCurrent = i;
-            return PR_TRUE;
+            return true;
         }
     }
-    return PR_FALSE;
+    return false;
 }
--- a/widget/src/gtk2/nsPaperPS.h
+++ b/widget/src/gtk2/nsPaperPS.h
@@ -53,17 +53,17 @@ struct nsPaperSizePS_ {
 class nsPaperSizePS {
     public:
         /** ---------------------------------------------------
          * Constructor
          */
         nsPaperSizePS() { mCurrent = 0; }
 
         /** ---------------------------------------------------
-         * @return PR_TRUE if the cursor points past the last item.
+         * @return true if the cursor points past the last item.
          */
         bool AtEnd() { return mCurrent >= mCount; }
 
         /** ---------------------------------------------------
          * Position the cursor at the beginning of the paper size list.
          * @return VOID
          */
         void First() { mCurrent = 0; }
@@ -74,17 +74,17 @@ class nsPaperSizePS {
          */
         void Next() {
             NS_ASSERTION(!AtEnd(), "Invalid current item");
             mCurrent++;
         }
 
         /** ---------------------------------------------------
          * Point the cursor to the entry with the given paper name.
-         * @return PR_TRUE if pointing to a valid entry.
+         * @return true if pointing to a valid entry.
          */
         bool Find(const char *aName);
 
         /** ---------------------------------------------------
          * @return a pointer to the name of the current paper size
          */
         const char *Name() {
             NS_PRECONDITION(!AtEnd(), "Invalid current item");
@@ -103,17 +103,17 @@ class nsPaperSizePS {
          * @return the height of the page in millimeters
          */
         float Height_mm() {
             NS_PRECONDITION(!AtEnd(), "Invalid current item");
             return mList[mCurrent].height_mm;
         }
 
         /** ---------------------------------------------------
-         * @return PR_TRUE if the paper should be presented to
+         * @return true if the paper should be presented to
          *                 the user in metric units.
          */
         bool IsMetric() {
             NS_PRECONDITION(!AtEnd(), "Invalid current item");
             return mList[mCurrent].isMetric;
         }
 
     private:
--- a/widget/src/gtk2/nsPrintDialogGTK.cpp
+++ b/widget/src/gtk2/nsPrintDialogGTK.cpp
@@ -265,24 +265,24 @@ nsPrintDialogWidgetGTK::nsPrintDialogWid
   gtk_box_pack_start(GTK_BOX(check_buttons_container), shrink_to_fit_toggle, FALSE, FALSE, 0);
 
   // GTK+2.18 and above allow us to add a "Selection" option to the main settings screen,
   // rather than adding an option on a custom tab like we must do on older versions.
   bool canSelectText;
   aSettings->GetPrintOptions(nsIPrintSettings::kEnableSelectionRB, &canSelectText);
   if (gtk_major_version > 2 ||
       (gtk_major_version == 2 && gtk_minor_version >= 18)) {
-    useNativeSelection = PR_TRUE;
+    useNativeSelection = true;
     g_object_set(dialog,
                  "support-selection", TRUE,
                  "has-selection", canSelectText,
                  "embed-page-setup", TRUE,
                  NULL);
   } else {
-    useNativeSelection = PR_FALSE;
+    useNativeSelection = false;
     selection_only_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("selectionOnly").get());
     gtk_widget_set_sensitive(selection_only_toggle, canSelectText);
     gtk_box_pack_start(GTK_BOX(check_buttons_container), selection_only_toggle, FALSE, FALSE, 0);
   }
 
   // Check buttons for printing background
   GtkWidget* appearance_buttons_container = gtk_vbox_new(TRUE, 2);
   print_bg_colors_toggle = gtk_check_button_new_with_mnemonic(GetUTF8FromBundle("printBGColors").get());
@@ -474,17 +474,17 @@ nsPrintDialogWidgetGTK::ExportSettings(n
     ExportFramePrinting(aNSSettings, settings);
     ExportHeaderFooter(aNSSettings);
 
     aNSSettings->SetOutputFormat(nsIPrintSettings::kOutputFormatNative);
 
     // Print-to-file is true by default. This must be turned off or else printing won't occur!
     // (We manually copy the spool file when this flag is set, because we love our embedders)
     // Even if it is print-to-file in GTK's case, GTK does The Right Thing when we send the job.
-    aNSSettings->SetPrintToFile(PR_FALSE);
+    aNSSettings->SetPrintToFile(false);
 
     aNSSettings->SetShrinkToFit(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(shrink_to_fit_toggle)));
 
     aNSSettings->SetPrintBGColors(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(print_bg_colors_toggle)));
     aNSSettings->SetPrintBGImages(gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(print_bg_images_toggle)));
 
     // Try to save native settings in the session object
     nsCOMPtr<nsPrintSettingsGTK> aNSSettingsGTK(do_QueryInterface(aNSSettings));
@@ -523,17 +523,17 @@ nsPrintDialogWidgetGTK::ConstructHeaderF
 
   bool shouldBeCustom = true;
   NS_ConvertUTF16toUTF8 currentStringUTF8(currentString);
 
   for (unsigned int i = 0; i < NS_ARRAY_LENGTH(header_footer_tags); i++) {
     if (!strcmp(currentStringUTF8.get(), header_footer_tags[i])) {
       gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown), i);
       g_object_set_data(G_OBJECT(dropdown), "previous-active", GINT_TO_POINTER(i));
-      shouldBeCustom = PR_FALSE;
+      shouldBeCustom = false;
       break;
     }
   }
 
   if (shouldBeCustom) {
     gtk_combo_box_set_active(GTK_COMBO_BOX(dropdown), CUSTOM_VALUE_INDEX);
     g_object_set_data(G_OBJECT(dropdown), "previous-active", GINT_TO_POINTER(CUSTOM_VALUE_INDEX));
     char* custom_string = strdup(currentStringUTF8.get());
@@ -616,27 +616,27 @@ nsPrintDialogServiceGTK::ShowPageSetup(n
   nsCOMPtr<nsIPrintSettingsService> psService = do_GetService("@mozilla.org/gfx/printsettings-service;1");
   if (psService) {
     nsXPIDLString printName;
     aNSSettings->GetPrinterName(getter_Copies(printName));
     if (!printName) {
       psService->GetDefaultPrinterName(getter_Copies(printName));
       aNSSettings->SetPrinterName(printName.get());
     }
-    psService->InitPrintSettingsFromPrefs(aNSSettings, PR_TRUE, nsIPrintSettings::kInitSaveAll);
+    psService->InitPrintSettingsFromPrefs(aNSSettings, true, nsIPrintSettings::kInitSaveAll);
   }
 
   GtkPrintSettings* gtkSettings = aNSSettingsGTK->GetGtkPrintSettings();
   GtkPageSetup* oldPageSetup = aNSSettingsGTK->GetGtkPageSetup();
 
   GtkPageSetup* newPageSetup = gtk_print_run_page_setup_dialog(gtkParent, oldPageSetup, gtkSettings);
 
   aNSSettingsGTK->SetGtkPageSetup(newPageSetup);
 
   // Now newPageSetup has a refcount of 2 (SetGtkPageSetup will addref), put it to 1 so if
   // this gets replaced we don't leak.
   g_object_unref(newPageSetup);
 
   if (psService)
-    psService->SavePrintSettingsToPrefs(aNSSettings, PR_TRUE, nsIPrintSettings::kInitSaveAll);
+    psService->SavePrintSettingsToPrefs(aNSSettings, true, nsIPrintSettings::kInitSaveAll);
 
   return NS_OK;
 }
--- a/widget/src/gtk2/nsPrintSettingsGTK.cpp
+++ b/widget/src/gtk2/nsPrintSettingsGTK.cpp
@@ -72,17 +72,17 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsPrintSett
                              nsPrintSettingsGTK)
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK::nsPrintSettingsGTK() :
   mPageSetup(NULL),
   mPrintSettings(NULL),
   mGTKPrinter(NULL),
-  mPrintSelectionOnly(PR_FALSE)
+  mPrintSelectionOnly(false)
 {
   // The aim here is to set up the objects enough that silent printing works well.
   // These will be replaced anyway if the print dialog is used.
   mPrintSettings = gtk_print_settings_new();
   mPageSetup = gtk_page_setup_new();
   InitUnwriteableMargin();
 
   SetOutputFormat(nsIPrintSettings::kOutputFormatNative);
@@ -113,17 +113,17 @@ nsPrintSettingsGTK::~nsPrintSettingsGTK(
 }
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK::nsPrintSettingsGTK(const nsPrintSettingsGTK& aPS) :
   mPageSetup(NULL),
   mPrintSettings(NULL),
   mGTKPrinter(NULL),
-  mPrintSelectionOnly(PR_FALSE)
+  mPrintSelectionOnly(false)
 {
   *this = aPS;
 }
 
 /** ---------------------------------------------------
  */
 nsPrintSettingsGTK& nsPrintSettingsGTK::operator=(const nsPrintSettingsGTK& rhs)
 {
@@ -253,21 +253,21 @@ NS_IMETHODIMP nsPrintSettingsGTK::GetPri
   else
     *aPrintRange = kRangeAllPages;
 
   return NS_OK;
 }
 NS_IMETHODIMP nsPrintSettingsGTK::SetPrintRange(PRInt16 aPrintRange)
 {
   if (aPrintRange == kRangeSelection) {
-    mPrintSelectionOnly = PR_TRUE;
+    mPrintSelectionOnly = true;
     return NS_OK;
   }
 
-  mPrintSelectionOnly = PR_FALSE;
+  mPrintSelectionOnly = false;
   if (aPrintRange == kRangeSpecifiedPageRange)
     gtk_print_settings_set_print_pages(mPrintSettings, GTK_PRINT_PAGES_RANGES);
   else
     gtk_print_settings_set_print_pages(mPrintSettings, GTK_PRINT_PAGES_ALL);
   return NS_OK;
 }
 
 /* attribute long startPageRange; */
@@ -443,17 +443,17 @@ nsPrintSettingsGTK::SetToFileName(const 
 
   if (StringEndsWith(nsDependentString(aToFileName), NS_LITERAL_STRING(".ps"))) {
     gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "ps");
   } else {
     gtk_print_settings_set(mPrintSettings, GTK_PRINT_SETTINGS_OUTPUT_FILE_FORMAT, "pdf");
   }
 
   nsCOMPtr<nsILocalFile> file;
-  nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), PR_TRUE,
+  nsresult rv = NS_NewLocalFile(nsDependentString(aToFileName), true,
                                 getter_AddRefs(file));
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Convert the nsIFile to a URL
   nsCAutoString url;
   rv = NS_GetURLSpecFromFile(file, url);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -492,18 +492,18 @@ nsPrintSettingsGTK::SetPrinterName(const
   }
 
   // Give mPrintSettings the passed-in printer name if either...
   // - it has no printer name stored yet
   // - it has an existing printer name that's different from
   //   the name passed to this function.
   const char* oldPrinterName = gtk_print_settings_get_printer(mPrintSettings);
   if (!oldPrinterName || !gtkPrinter.Equals(oldPrinterName)) {
-    mIsInitedFromPrinter = PR_FALSE;
-    mIsInitedFromPrefs = PR_FALSE;
+    mIsInitedFromPrinter = false;
+    mIsInitedFromPrefs = false;
     gtk_print_settings_set_printer(mPrintSettings, gtkPrinter.get());
   }
 
   return NS_OK;
 }
 
 /* attribute long numCopies; */
 NS_IMETHODIMP
--- a/widget/src/gtk2/nsSound.cpp
+++ b/widget/src/gtk2/nsSound.cpp
@@ -116,32 +116,32 @@ quiet_error_handler(const char* file,
 {
 }
 
 NS_IMPL_ISUPPORTS2(nsSound, nsISound, nsIStreamLoaderObserver)
 
 ////////////////////////////////////////////////////////////////////////
 nsSound::nsSound()
 {
-    mInited = PR_FALSE;
+    mInited = false;
 }
 
 nsSound::~nsSound()
 {
 }
 
 NS_IMETHODIMP
 nsSound::Init()
 {
     // This function is designed so that no library is compulsory, and
     // one library missing doesn't cause the other(s) to not be used.
     if (mInited) 
         return NS_OK;
 
-    mInited = PR_TRUE;
+    mInited = true;
 
     if (!elib) {
         elib = PR_LoadLibrary("libesd.so.0");
     }
 
     if (!libasound) {
         PRFuncPtr func = PR_FindFunctionSymbolAndLibrary("snd_lib_error_set_handler",
                                                          &libasound);
@@ -499,17 +499,17 @@ NS_IMETHODIMP nsSound::PlaySystemSound(c
         return PlayEventSound(eventId);
     }
 
     nsresult rv;
     nsCOMPtr <nsIURI> fileURI;
 
     // create a nsILocalFile and then a nsIFileURL from that
     nsCOMPtr <nsILocalFile> soundFile;
-    rv = NS_NewLocalFile(aSoundAlias, PR_TRUE, 
+    rv = NS_NewLocalFile(aSoundAlias, true, 
                          getter_AddRefs(soundFile));
     NS_ENSURE_SUCCESS(rv,rv);
 
     rv = NS_NewFileURI(getter_AddRefs(fileURI), soundFile);
     NS_ENSURE_SUCCESS(rv,rv);
 
     nsCOMPtr<nsIFileURL> fileURL = do_QueryInterface(fileURI,&rv);
     NS_ENSURE_SUCCESS(rv,rv);
--- a/widget/src/gtk2/nsWindow.cpp
+++ b/widget/src/gtk2/nsWindow.cpp
@@ -395,57 +395,57 @@ GetBitmapStride(PRInt32 width)
   return (width+7)/8;
 #else
   return cairo_format_stride_for_width(CAIRO_FORMAT_A1, width);
 #endif
 }
 
 nsWindow::nsWindow()
 {
-    mIsTopLevel       = PR_FALSE;
-    mIsDestroyed      = PR_FALSE;
-    mNeedsResize      = PR_FALSE;
-    mNeedsMove        = PR_FALSE;
-    mListenForResizes = PR_FALSE;
-    mIsShown          = PR_FALSE;
-    mNeedsShow        = PR_FALSE;
-    mEnabled          = PR_TRUE;
-    mCreated          = PR_FALSE;
+    mIsTopLevel       = false;
+    mIsDestroyed      = false;
+    mNeedsResize      = false;
+    mNeedsMove        = false;
+    mListenForResizes = false;
+    mIsShown          = false;
+    mNeedsShow        = false;
+    mEnabled          = true;
+    mCreated          = false;
 
     mContainer           = nsnull;
     mGdkWindow           = nsnull;
     mShell               = nsnull;
     mWindowGroup         = nsnull;
-    mHasMappedToplevel   = PR_FALSE;
-    mIsFullyObscured     = PR_FALSE;
-    mRetryPointerGrab    = PR_FALSE;
+    mHasMappedToplevel   = false;
+    mIsFullyObscured     = false;
+    mRetryPointerGrab    = false;
     mTransientParent     = nsnull;
     mWindowType          = eWindowType_child;
     mSizeState           = nsSizeMode_Normal;
     mLastSizeMode        = nsSizeMode_Normal;
 
 #ifdef MOZ_X11
     mOldFocusWindow      = 0;
 #endif /* MOZ_X11 */
     mPluginType          = PluginType_NONE;
 
     if (!gGlobalsInitialized) {
-        gGlobalsInitialized = PR_TRUE;
+        gGlobalsInitialized = true;
 
         // It's OK if either of these fail, but it may not be one day.
         initialize_prefs();
     }
 
     mLastMotionPressure = 0;
 
 #ifdef ACCESSIBILITY
     mRootAccessible  = nsnull;
 #endif
 
-    mIsTransparent = PR_FALSE;
+    mIsTransparent = false;
     mTransparencyBitmap = nsnull;
 
     mTransparencyBitmapWidth  = 0;
     mTransparencyBitmapHeight = 0;
 
 #ifdef MOZ_DFB
     mDFBCursorX     = 0;
     mDFBCursorY     = 0;
@@ -492,17 +492,17 @@ nsWindow::ReleaseGlobals()
 NS_IMPL_ISUPPORTS_INHERITED1(nsWindow, nsBaseWidget,
                              nsISupportsWeakReference)
 
 void
 nsWindow::CommonCreate(nsIWidget *aParent, bool aListenForResizes)
 {
     mParent = aParent;
     mListenForResizes = aListenForResizes;
-    mCreated = PR_TRUE;
+    mCreated = true;
 }
 
 void
 nsWindow::InitKeyEvent(nsKeyEvent &aEvent, GdkEventKey *aGdkEvent)
 {
     aEvent.keyCode   = GdkKeyCodeToDOMKeyCode(aGdkEvent->keyval);
     // NOTE: The state of given key event indicates adjacent state of
     // modifier keys.  E.g., even if the event is Shift key press event,
@@ -551,17 +551,17 @@ nsWindow::InitKeyEvent(nsKeyEvent &aEven
     aEvent.pluginEvent = (void *)aGdkEvent;
 
     aEvent.time      = aGdkEvent->time;
 }
 
 void
 nsWindow::DispatchResizeEvent(nsIntRect &aRect, nsEventStatus &aStatus)
 {
-    nsSizeEvent event(PR_TRUE, NS_SIZE, this);
+    nsSizeEvent event(true, NS_SIZE, this);
 
     event.windowSize = &aRect;
     event.refPoint.x = aRect.x;
     event.refPoint.y = aRect.y;
     event.mWinWidth = aRect.width;
     event.mWinHeight = aRect.height;
 
     nsEventStatus status;
@@ -572,25 +572,25 @@ void
 nsWindow::DispatchActivateEvent(void)
 {
     NS_ASSERTION(mContainer || mIsDestroyed,
                  "DispatchActivateEvent only intended for container windows");
 
 #ifdef ACCESSIBILITY
     DispatchActivateEventAccessible();
 #endif //ACCESSIBILITY
-    nsGUIEvent event(PR_TRUE, NS_ACTIVATE, this);
+    nsGUIEvent event(true, NS_ACTIVATE, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
 void
 nsWindow::DispatchDeactivateEvent(void)
 {
-    nsGUIEvent event(PR_TRUE, NS_DEACTIVATE, this);
+    nsGUIEvent event(true, NS_DEACTIVATE, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 
 #ifdef ACCESSIBILITY
     DispatchDeactivateEventAccessible();
 #endif //ACCESSIBILITY
 }
 
@@ -614,40 +614,40 @@ nsWindow::DispatchEvent(nsGUIEvent *aEve
 }
 
 void
 nsWindow::OnDestroy(void)
 {
     if (mOnDestroyCalled)
         return;
 
-    mOnDestroyCalled = PR_TRUE;
+    mOnDestroyCalled = true;
     
     // Prevent deletion.
     nsCOMPtr<nsIWidget> kungFuDeathGrip = this;
 
     // release references to children, device context, toolkit + app shell
     nsBaseWidget::OnDestroy(); 
     
     // Remove association between this object and its parent and siblings.
     nsBaseWidget::Destroy();
     mParent = nsnull;
 
-    nsGUIEvent event(PR_TRUE, NS_DESTROY, this);
+    nsGUIEvent event(true, NS_DESTROY, this);
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
 bool
 nsWindow::AreBoundsSane(void)
 {
     if (mBounds.width > 0 && mBounds.height > 0)
-        return PR_TRUE;
-
-    return PR_FALSE;
+        return true;
+
+    return false;
 }
 
 static GtkWidget*
 EnsureInvisibleContainer()
 {
     if (!gInvisibleContainer) {
         // GtkWidgets need to be anchored to a GtkWindow to be realized (to
         // have a window).  Using GTK_WINDOW_POPUP rather than
@@ -736,18 +736,18 @@ nsWindow::DestroyChildWindows()
 
 NS_IMETHODIMP
 nsWindow::Destroy(void)
 {
     if (mIsDestroyed || !mCreated)
         return NS_OK;
 
     LOG(("nsWindow::Destroy [%p]\n", (void *)this));
-    mIsDestroyed = PR_TRUE;
-    mCreated = PR_FALSE;
+    mIsDestroyed = true;
+    mCreated = false;
 
     /** Need to clean our LayerManager up while still alive */
     if (mLayerManager) {
         nsRefPtr<GLContext> gl = nsnull;
         if (mLayerManager->GetBackendType() == LayerManager::LAYERS_OPENGL) {
             LayerManagerOGL *ogllm = static_cast<LayerManagerOGL*>(mLayerManager.get());
             gl = ogllm->gl();
         }
@@ -771,17 +771,17 @@ nsWindow::Destroy(void)
     if (static_cast<nsIWidget *>(this) == rollupWidget.get()) {
         if (gRollupListener)
             gRollupListener->Rollup(nsnull, nsnull);
         NS_IF_RELEASE(gMenuRollup);
         gRollupWindow = nsnull;
         gRollupListener = nsnull;
     }
 
-    NativeShow(PR_FALSE);
+    NativeShow(false);
 
     if (mIMModule) {
         mIMModule->OnDestroyWindow(this);
     }
 
     // make sure that we remove ourself as the focus window
     if (gFocusWindow == this) {
         LOGFOCUS(("automatically losing focus...\n"));
@@ -1089,32 +1089,32 @@ nsWindow::Show(bool aState)
         SetHasMappedToplevel(mHasMappedToplevel);
     }
 
     // Ok, someone called show on a window that isn't sized to a sane
     // value.  Mark this window as needing to have Show() called on it
     // and return.
     if ((aState && !AreBoundsSane()) || !mCreated) {
         LOG(("\tbounds are insane or window hasn't been created yet\n"));
-        mNeedsShow = PR_TRUE;
+        mNeedsShow = true;
         return NS_OK;
     }
 
     // If someone is hiding this widget, clear any needing show flag.
     if (!aState)
-        mNeedsShow = PR_FALSE;
+        mNeedsShow = false;
 
     // If someone is showing this window and it needs a resize then
     // resize the widget.
     if (aState) {
         if (mNeedsMove) {
             NativeResize(mBounds.x, mBounds.y, mBounds.width, mBounds.height,
-                         PR_FALSE);
+                         false);
         } else if (mNeedsResize) {
-            NativeResize(mBounds.width, mBounds.height, PR_FALSE);
+            NativeResize(mBounds.width, mBounds.height, false);
         }
     }
 
 #ifdef ACCESSIBILITY
     if (aState && sAccessibilityEnabled) {
         CreateRootAccessible();
     }
 #endif
@@ -1154,42 +1154,42 @@ nsWindow::Resize(PRInt32 aWidth, PRInt32
             if (mNeedsMove)
                 NativeResize(mBounds.x, mBounds.y,
                              mBounds.width, mBounds.height, aRepaint);
             else
                 NativeResize(mBounds.width, mBounds.height, aRepaint);
 
             // Does it need to be shown because it was previously insane?
             if (mNeedsShow)
-                NativeShow(PR_TRUE);
+                NativeShow(true);
         }
         else {
             // If someone has set this so that the needs show flag is false
             // and it needs to be hidden, update the flag and hide the
             // window.  This flag will be cleared the next time someone
             // hides the window or shows it.  It also prevents us from
-            // calling NativeShow(PR_FALSE) excessively on the window which
+            // calling NativeShow(false) excessively on the window which
             // causes unneeded X traffic.
             if (!mNeedsShow) {
-                mNeedsShow = PR_TRUE;
-                NativeShow(PR_FALSE);
+                mNeedsShow = true;
+                NativeShow(false);
             }
         }
     }
     // If the widget hasn't been shown, mark the widget as needing to be
     // resized before it is shown.
     else {
         if (AreBoundsSane() && mListenForResizes) {
             // For widgets that we listen for resizes for (widgets created
             // with native parents) we apparently _always_ have to resize.  I
             // dunno why, but apparently we're lame like that.
             NativeResize(aWidth, aHeight, aRepaint);
         }
         else {
-            mNeedsResize = PR_TRUE;
+            mNeedsResize = true;
         }
     }
 
     // synthesize a resize event if this isn't a toplevel
     if (mIsTopLevel || mListenForResizes) {
         nsIntRect rect(mBounds.x, mBounds.y, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
@@ -1201,59 +1201,59 @@ nsWindow::Resize(PRInt32 aWidth, PRInt32
 NS_IMETHODIMP
 nsWindow::Resize(PRInt32 aX, PRInt32 aY, PRInt32 aWidth, PRInt32 aHeight,
                        bool aRepaint)
 {
     mBounds.x = aX;
     mBounds.y = aY;
     mBounds.SizeTo(GetSafeWindowSize(nsIntSize(aWidth, aHeight)));
 
-    mNeedsMove = PR_TRUE;
+    mNeedsMove = true;
 
     if (!mCreated)
         return NS_OK;
 
     // There are several cases here that we need to handle, based on a
     // matrix of the visibility of the widget, the sanity of this resize
     // and whether or not the widget was previously sane.
 
     // Has this widget been set to visible?
     if (mIsShown) {
         // Are the bounds sane?
         if (AreBoundsSane()) {
             // Yep?  Resize the window
             NativeResize(aX, aY, aWidth, aHeight, aRepaint);
             // Does it need to be shown because it was previously insane?
             if (mNeedsShow)
-                NativeShow(PR_TRUE);
+                NativeShow(true);
         }
         else {
             // If someone has set this so that the needs show flag is false
             // and it needs to be hidden, update the flag and hide the
             // window.  This flag will be cleared the next time someone
             // hides the window or shows it.  It also prevents us from
-            // calling NativeShow(PR_FALSE) excessively on the window which
+            // calling NativeShow(false) excessively on the window which
             // causes unneeded X traffic.
             if (!mNeedsShow) {
-                mNeedsShow = PR_TRUE;
-                NativeShow(PR_FALSE);
+                mNeedsShow = true;
+                NativeShow(false);
             }
         }
     }
     // If the widget hasn't been shown, mark the widget as needing to be
     // resized before it is shown
     else {
         if (AreBoundsSane() && mListenForResizes){
             // For widgets that we listen for resizes for (widgets created
             // with native parents) we apparently _always_ have to resize.  I
             // dunno why, but apparently we're lame like that.
             NativeResize(aX, aY, aWidth, aHeight, aRepaint);
         }
         else {
-            mNeedsResize = PR_TRUE;
+            mNeedsResize = true;
         }
     }
 
     if (mIsTopLevel || mListenForResizes) {
         // synthesize a resize event
         nsIntRect rect(aX, aY, aWidth, aHeight);
         nsEventStatus status;
         DispatchResizeEvent(rect, status);
@@ -1301,17 +1301,17 @@ nsWindow::Move(PRInt32 aX, PRInt32 aY)
     // XXX Should we do some AreBoundsSane check here?
 
     mBounds.x = aX;
     mBounds.y = aY;
 
     if (!mCreated)
         return NS_OK;
 
-    mNeedsMove = PR_FALSE;
+    mNeedsMove = false;
 
     if (mIsTopLevel) {
         gtk_window_move(GTK_WINDOW(mShell), aX, aY);
     }
     else if (mGdkWindow) {
         gdk_window_move(mGdkWindow, aX, aY);
     }
 
@@ -1376,17 +1376,17 @@ nsWindow::SetSizeMode(PRInt32 aMode)
     switch (aMode) {
     case nsSizeMode_Maximized:
         gtk_window_maximize(GTK_WINDOW(mShell));
         break;
     case nsSizeMode_Minimized:
         gtk_window_iconify(GTK_WINDOW(mShell));
         break;
     case nsSizeMode_Fullscreen:
-        MakeFullScreen(PR_TRUE);
+        MakeFullScreen(true);
         break;
 
     default:
         // nsSizeMode_Normal, really.
         if (mSizeState == nsSizeMode_Minimized)
             gtk_window_deiconify(GTK_WINDOW(mShell));
         else if (mSizeState == nsSizeMode_Maximized)
             gtk_window_unmaximize(GTK_WINDOW(mShell));
@@ -1471,39 +1471,39 @@ nsWindow::SetFocus(bool aRaise)
     // grab it.  Note that we don't set our focus flag in this case.
 
     LOGFOCUS(("  SetFocus %d [%p]\n", aRaise, (void *)this));
 
     GtkWidget *owningWidget = GetMozContainerWidget();
     if (!owningWidget)
         return NS_ERROR_FAILURE;
 
-    // Raise the window if someone passed in PR_TRUE and the prefs are
+    // Raise the window if someone passed in true and the prefs are
     // set properly.
     GtkWidget *toplevelWidget = gtk_widget_get_toplevel(owningWidget);
 
     if (gRaiseWindows && aRaise && toplevelWidget &&
         !gtk_widget_has_focus(owningWidget) &&
         !gtk_widget_has_focus(toplevelWidget)) {
         GtkWidget* top_window = nsnull;
         GetToplevelWidget(&top_window);
         if (top_window && (gtk_widget_get_visible(top_window)))
         {
             gdk_window_show_unraised(gtk_widget_get_window(top_window));
             // Unset the urgency hint if possible.
-            SetUrgencyHint(top_window, PR_FALSE);
+            SetUrgencyHint(top_window, false);
         }
     }
 
     nsRefPtr<nsWindow> owningWindow = get_window_for_gtk_widget(owningWidget);
     if (!owningWindow)
         return NS_ERROR_FAILURE;
 
     if (aRaise) {
-        // aRaise == PR_TRUE means request toplevel activation.
+        // aRaise == true means request toplevel activation.
 
         // This is asynchronous.
         // If and when the window manager accepts the request, then the focus
         // widget will get a focus-in-event signal.
         if (gRaiseWindows && owningWindow->mIsShown && owningWindow->mShell &&
             !gtk_window_is_active(GTK_WINDOW(owningWindow->mShell))) {
 
             LOGFOCUS(("  requesting toplevel activation [%p]\n", (void *)this));
@@ -1511,31 +1511,31 @@ nsWindow::SetFocus(bool aRaise)
                          || mParent,
                          "Presenting an override-redirect window");
             gtk_window_present(GTK_WINDOW(owningWindow->mShell));
         }
 
         return NS_OK;
     }
 
-    // aRaise == PR_FALSE means that keyboard events should be dispatched
+    // aRaise == false means that keyboard events should be dispatched
     // from this widget.
 
     // Ensure owningWidget is the focused GtkWidget within its toplevel window.
     //
     // For eWindowType_popup, this GtkWidget may not actually be the one that
     // receives the key events as it may be the parent window that is active.
     if (!gtk_widget_is_focus(owningWidget)) {
         // This is synchronous.  It takes focus from a plugin or from a widget
         // in an embedder.  The focus manager already knows that this window
         // is active so gBlockActivateEvent avoids another (unnecessary)
         // NS_ACTIVATE event.
-        gBlockActivateEvent = PR_TRUE;
+        gBlockActivateEvent = true;
         gtk_widget_grab_focus(owningWidget);
-        gBlockActivateEvent = PR_FALSE;
+        gBlockActivateEvent = false;
     }
 
     // If this is the widget that already has focus, return.
     if (gFocusWindow == this) {
         LOGFOCUS(("  already have focus [%p]\n", (void *)this));
         return NS_OK;
     }
 
@@ -1919,17 +1919,17 @@ nsWindow::GetAttention(PRInt32 aCycleCou
     GtkWidget* top_focused_window = nsnull;
     GetToplevelWidget(&top_window);
     if (gFocusWindow)
         gFocusWindow->GetToplevelWidget(&top_focused_window);
 
     // Don't get attention if the window is focused anyway.
     if (top_window && (gtk_widget_get_visible(top_window)) &&
         top_window != top_focused_window) {
-        SetUrgencyHint(top_window, PR_TRUE);
+        SetUrgencyHint(top_window, true);
     }
 
     return NS_OK;
 }
 
 bool
 nsWindow::HasPendingInputEvent()
 {
@@ -1954,17 +1954,17 @@ nsWindow::HasPendingInputEvent()
                         ResizeRedirectMask | SubstructureNotifyMask |
                         SubstructureRedirectMask | FocusChangeMask |
                         PropertyChangeMask | ColormapChangeMask |
                         OwnerGrabButtonMask, &ev);
     if (haveEvent) {
         XPutBackEvent(display, &ev);
     }
 #else
-    haveEvent = PR_FALSE;
+    haveEvent = false;
 #endif
     return haveEvent;
 }
 
 #if 0
 #ifdef DEBUG
 // Paint flashing code (disabled for cairo - see below)
 
@@ -2036,17 +2036,17 @@ gdk_window_flash(GdkWindow *    aGdkWind
 #endif /* MOZ_X11 */
 #endif // DEBUG
 #endif
 
 static void
 DispatchDidPaint(nsIWidget* aWidget)
 {
     nsEventStatus status;
-    nsPaintEvent didPaintEvent(PR_TRUE, NS_DID_PAINT, aWidget);
+    nsPaintEvent didPaintEvent(true, NS_DID_PAINT, aWidget);
     aWidget->DispatchEvent(&didPaintEvent, status);
 }
 
 #if defined(MOZ_WIDGET_GTK2)
 gboolean
 nsWindow::OnExposeEvent(GdkEventExpose *aEvent)
 #else
 gboolean
@@ -2060,28 +2060,28 @@ nsWindow::OnExposeEvent(cairo_t *cr)
     // Windows that are not visible will be painted after they become visible.
     if (!mGdkWindow || mIsFullyObscured || !mHasMappedToplevel)
         return FALSE;
 
     // Dispatch WILL_PAINT to allow scripts etc. to run before we
     // dispatch PAINT
     {
         nsEventStatus status;
-        nsPaintEvent willPaintEvent(PR_TRUE, NS_WILL_PAINT, this);
-        willPaintEvent.willSendDidPaint = PR_TRUE;
+        nsPaintEvent willPaintEvent(true, NS_WILL_PAINT, this);
+        willPaintEvent.willSendDidPaint = true;
         DispatchEvent(&willPaintEvent, status);
 
         // If the window has been destroyed during WILL_PAINT, there is
         // nothing left to do.
         if (!mGdkWindow)
             return TRUE;
     }
 
-    nsPaintEvent event(PR_TRUE, NS_PAINT, this);
-    event.willSendDidPaint = PR_TRUE;
+    nsPaintEvent event(true, NS_PAINT, this);
+    event.willSendDidPaint = true;
 
 #if defined(MOZ_WIDGET_GTK2)
     GdkRectangle *rects;
     gint nrects;
     gdk_region_get_rectangles(aEvent->region, &rects, &nrects);
     if (NS_UNLIKELY(!rects)) // OOM
         return FALSE;
 #else
@@ -2297,23 +2297,23 @@ nsWindow::OnExposeEvent(cairo_t *cr)
     // Synchronously flush any new dirty areas
 #if defined(MOZ_WIDGET_GTK2)
     GdkRegion* dirtyArea = gdk_window_get_update_area(mGdkWindow);
 #else
     cairo_region_t* dirtyArea = gdk_window_get_update_area(mGdkWindow);
 #endif
 
     if (dirtyArea) {
-        gdk_window_invalidate_region(mGdkWindow, dirtyArea, PR_FALSE);
+        gdk_window_invalidate_region(mGdkWindow, dirtyArea, false);
 #if defined(MOZ_WIDGET_GTK2)
         gdk_region_destroy(dirtyArea);
 #else
         cairo_region_destroy(dirtyArea);
 #endif
-        gdk_window_process_updates(mGdkWindow, PR_FALSE);
+        gdk_window_process_updates(mGdkWindow, false);
     }
 
     // check the return value!
     return TRUE;
 }
 
 gboolean
 nsWindow::OnConfigureEvent(GtkWidget *aWidget, GdkEventConfigure *aEvent)
@@ -2343,17 +2343,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
     // top-left is weird.  However, mBounds.x/y are set to client window
     // position below, so this check avoids unwanted rollup on spurious
     // configure events from Cygwin/X (bug 672103).
     if (mBounds.x == aEvent->x &&
         mBounds.y == aEvent->y)
         return FALSE;
 
     if (mWindowType == eWindowType_toplevel || mWindowType == eWindowType_dialog) {
-        check_for_rollup(aEvent->window, 0, 0, PR_FALSE, PR_TRUE);
+        check_for_rollup(aEvent->window, 0, 0, false, true);
     }
 
     // This event indicates that the window position may have changed.
     // mBounds.Size() is updated in OnSizeAllocate().
 
     // (The gtk_window_get_window_type() function is only available from
     // version 2.20.)
     NS_ASSERTION(GTK_IS_WINDOW(aWidget),
@@ -2377,17 +2377,17 @@ nsWindow::OnConfigureEvent(GtkWidget *aW
     }
 
     // This is wrong, but noautohide titlebar panels currently depend on it
     // (bug 601545#c13).  mBounds.TopLeft() should refer to the
     // window-manager frame top-left, but WidgetToScreenOffset() gives the
     // client window origin.
     mBounds.MoveTo(WidgetToScreenOffset());
 
-    nsGUIEvent event(PR_TRUE, NS_MOVE, this);
+    nsGUIEvent event(true, NS_MOVE, this);
 
     event.refPoint = mBounds.TopLeft();
 
     // XXX mozilla will invalidate the entire window after this move
     // complete.  wtf?
     nsEventStatus status;
     DispatchEvent(&event, status);
 
@@ -2436,17 +2436,17 @@ nsWindow::OnSizeAllocate(GtkWidget *aWid
 
     nsEventStatus status;
     DispatchResizeEvent (rect, status);
 }
 
 void
 nsWindow::OnDeleteEvent(GtkWidget *aWidget, GdkEventAny *aEvent)
 {
-    nsGUIEvent event(PR_TRUE, NS_XUL_CLOSE, this);
+    nsGUIEvent event(true, NS_XUL_CLOSE, this);
 
     event.refPoint.x = 0;
     event.refPoint.y = 0;
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
@@ -2463,17 +2463,17 @@ nsWindow::OnEnterNotifyEvent(GtkWidget *
 
     // Check before is_parent_ungrab_enter() as the button state may have
     // changed while a non-Gecko ancestor window had a pointer grab.
     DispatchMissedButtonReleases(aEvent);
 
     if (is_parent_ungrab_enter(aEvent))
         return;
 
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
+    nsMouseEvent event(true, NS_MOUSE_ENTER, this, nsMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->x);
     event.refPoint.y = nscoord(aEvent->y);
 
     event.time = aEvent->time;
 
     LOG(("OnEnterNotify: %p\n", (void *)this));
 
@@ -2485,17 +2485,17 @@ nsWindow::OnEnterNotifyEvent(GtkWidget *
 static bool
 is_top_level_mouse_exit(GdkWindow* aWindow, GdkEventCrossing *aEvent)
 {
     gint x = gint(aEvent->x_root);
     gint y = gint(aEvent->y_root);
     GdkDisplay* display = gdk_window_get_display(aWindow);
     GdkWindow* winAtPt = gdk_display_get_window_at_pointer(display, &x, &y);
     if (!winAtPt)
-        return PR_TRUE;
+        return true;
     GdkWindow* topLevelAtPt = gdk_window_get_toplevel(winAtPt);
     GdkWindow* topLevelWidget = gdk_window_get_toplevel(aWindow);
     return topLevelAtPt != topLevelWidget;
 }
 
 void
 nsWindow::OnLeaveNotifyEvent(GtkWidget *aWidget, GdkEventCrossing *aEvent)
 {
@@ -2505,17 +2505,17 @@ nsWindow::OnLeaveNotifyEvent(GtkWidget *
     // that window.
     //
     // XXXkt However, we will miss toplevel exits when the pointer directly
     // leaves a foreign (plugin) child window without passing over a visible
     // portion of a Gecko window.
     if (aEvent->subwindow != NULL)
         return;
 
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
+    nsMouseEvent event(true, NS_MOUSE_EXIT, this, nsMouseEvent::eReal);
 
     event.refPoint.x = nscoord(aEvent->x);
     event.refPoint.y = nscoord(aEvent->y);
 
     event.time = aEvent->time;
 
     event.exit = is_top_level_mouse_exit(mGdkWindow, aEvent)
         ? nsMouseEvent::eTopLevel : nsMouseEvent::eChild;
@@ -2555,130 +2555,130 @@ nsWindow::OnMotionNotifyEvent(GtkWidget 
     }
 
     mDFBCursorX = cursorX;
     mDFBCursorY = cursorY;
 
 
     // when we receive this, it must be that the gtk dragging is over,
     // it is dropped either in or out of mozilla, clear the flag
-    sIsDraggingOutOf = PR_FALSE;
-
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
+    sIsDraggingOutOf = false;
+
+    nsMouseEvent event(true, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
 
     // should we move this into !synthEvent?
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     // Sometime gdk generate 0 pressure value between normal values
     // We have to ignore that and use last valid value
     if (pressure)
       mLastMotionPressure = pressure;
     event.pressure = mLastMotionPressure;
 
     event.refPoint = nsIntPoint(cursorX, cursorY) - WidgetToScreenOffset();
 
     event.isShift   = (aEvent->state & GDK_SHIFT_MASK)
-        ? PR_TRUE : PR_FALSE;
+        ? true : false;
     event.isControl = (aEvent->state & GDK_CONTROL_MASK)
-        ? PR_TRUE : PR_FALSE;
+        ? true : false;
     event.isAlt     = (aEvent->state & GDK_MOD1_MASK)
-        ? PR_TRUE : PR_FALSE;
+        ? true : false;
 
     event.time = aEvent->time;
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 #else
 void
 nsWindow::OnMotionNotifyEvent(GtkWidget *aWidget, GdkEventMotion *aEvent)
 {
     // when we receive this, it must be that the gtk dragging is over,
     // it is dropped either in or out of mozilla, clear the flag
-    sIsDraggingOutOf = PR_FALSE;
+    sIsDraggingOutOf = false;
 
     // see if we can compress this event
     // XXXldb Why skip every other motion event when we have multiple,
     // but not more than that?
     bool synthEvent = false;
 #ifdef MOZ_X11
     XEvent xevent;
 
     while (XPending (GDK_WINDOW_XDISPLAY(aEvent->window))) {
         XEvent peeked;
         XPeekEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &peeked);
         if (peeked.xany.window != gdk_x11_window_get_xid(aEvent->window)
             || peeked.type != MotionNotify)
             break;
 
-        synthEvent = PR_TRUE;
+        synthEvent = true;
         XNextEvent (GDK_WINDOW_XDISPLAY(aEvent->window), &xevent);
     }
 #if defined(MOZ_WIDGET_GTK2)
     // if plugins still keeps the focus, get it back
     if (gPluginFocusWindow && gPluginFocusWindow != this) {
         nsRefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
     }
 #endif /* MOZ_WIDGET_GTK2 */
 #endif /* MOZ_X11 */
 
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
+    nsMouseEvent event(true, NS_MOUSE_MOVE, this, nsMouseEvent::eReal);
 
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     // Sometime gdk generate 0 pressure value between normal values
     // We have to ignore that and use last valid value
     if (pressure)
       mLastMotionPressure = pressure;
     event.pressure = mLastMotionPressure;
 
     if (synthEvent) {
 #ifdef MOZ_X11
         event.refPoint.x = nscoord(xevent.xmotion.x);
         event.refPoint.y = nscoord(xevent.xmotion.y);
 
         event.isShift   = (xevent.xmotion.state & GDK_SHIFT_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isControl = (xevent.xmotion.state & GDK_CONTROL_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isAlt     = (xevent.xmotion.state & GDK_MOD1_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
 
         event.time = xevent.xmotion.time;
 #else
         event.refPoint.x = nscoord(aEvent->x);
         event.refPoint.y = nscoord(aEvent->y);
 
         event.isShift   = (aEvent->state & GDK_SHIFT_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isControl = (aEvent->state & GDK_CONTROL_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isAlt     = (aEvent->state & GDK_MOD1_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
 
         event.time = aEvent->time;
 #endif /* MOZ_X11 */
     }
     else {
         // XXX see OnScrollEvent()
         if (aEvent->window == mGdkWindow) {
             event.refPoint.x = nscoord(aEvent->x);
             event.refPoint.y = nscoord(aEvent->y);
         } else {
             nsIntPoint point(NSToIntFloor(aEvent->x_root), NSToIntFloor(aEvent->y_root));
             event.refPoint = point - WidgetToScreenOffset();
         }
 
         event.isShift   = (aEvent->state & GDK_SHIFT_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isControl = (aEvent->state & GDK_CONTROL_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
         event.isAlt     = (aEvent->state & GDK_MOD1_MASK)
-            ? PR_TRUE : PR_FALSE;
+            ? true : false;
 
         event.time = aEvent->time;
     }
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 #endif
@@ -2722,17 +2722,17 @@ nsWindow::DispatchMissedButtonReleases(G
 
             LOG(("Synthesized button %u release on %p\n",
                  guint(buttonType + 1), (void *)this));
 
             // Dispatch a synthesized button up event to tell Gecko about the
             // change in state.  This event is marked as synthesized so that
             // it is not dispatched as a DOM event, because we don't know the
             // position, widget, modifiers, or time/order.
-            nsMouseEvent synthEvent(PR_TRUE, NS_MOUSE_BUTTON_UP, this,
+            nsMouseEvent synthEvent(true, NS_MOUSE_BUTTON_UP, this,
                                     nsMouseEvent::eSynthesized);
             synthEvent.button = buttonType;
             nsEventStatus status;
             DispatchEvent(&synthEvent, status);
 
             sLastButtonReleaseTime = aGdkEvent->time;
         }
     }
@@ -2803,17 +2803,17 @@ nsWindow::OnButtonPressEvent(GtkWidget *
 
     nsWindow *containerWindow = GetContainerWindow();
     if (!gFocusWindow && containerWindow) {
         containerWindow->DispatchActivateEvent();
     }
 
     // check to see if we should rollup
     bool rolledUp = check_for_rollup(aEvent->window, aEvent->x_root,
-                                       aEvent->y_root, PR_FALSE, PR_FALSE);
+                                       aEvent->y_root, false, false);
     if (gConsumeRollupEvent && rolledUp)
         return;
 
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     mLastMotionPressure = pressure;
 
     PRUint16 domButton;
@@ -2826,17 +2826,17 @@ nsWindow::OnButtonPressEvent(GtkWidget *
         break;
     case 3:
         domButton = nsMouseEvent::eRightButton;
         break;
     // These are mapped to horizontal scroll
     case 6:
     case 7:
         {
-            nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
+            nsMouseScrollEvent event(true, NS_MOUSE_SCROLL, this);
             event.pressure = mLastMotionPressure;
             event.scrollFlags = nsMouseScrollEvent::kIsHorizontal;
             event.refPoint.x = nscoord(aEvent->x);
             event.refPoint.y = nscoord(aEvent->y);
             // XXX Why is this delta value different from the scroll event?
             event.delta = (aEvent->button == 6) ? -2 : 2;
 
             event.isShift   = (aEvent->state & GDK_SHIFT_MASK) != 0;
@@ -2858,27 +2858,27 @@ nsWindow::OnButtonPressEvent(GtkWidget *
         DispatchCommandEvent(nsWidgetAtoms::Forward);
         return;
     default:
         return;
     }
 
     gButtonState |= ButtonMaskFromGDKButton(aEvent->button);
 
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
+    nsMouseEvent event(true, NS_MOUSE_BUTTON_DOWN, this, nsMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     event.pressure = mLastMotionPressure;
 
     DispatchEvent(&event, status);
 
     // right menu click on linux should also pop up a context menu
     if (domButton == nsMouseEvent::eRightButton &&
         NS_LIKELY(!mIsDestroyed)) {
-        nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
+        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
                                       nsMouseEvent::eReal);
         InitButtonEvent(contextMenuEvent, aEvent);
         contextMenuEvent.pressure = mLastMotionPressure;
         DispatchEvent(&contextMenuEvent, status);
     }
 }
 
 void
@@ -2900,17 +2900,17 @@ nsWindow::OnButtonReleaseEvent(GtkWidget
         domButton = nsMouseEvent::eRightButton;
         break;
     default:
         return;
     }
 
     gButtonState &= ~ButtonMaskFromGDKButton(aEvent->button);
 
-    nsMouseEvent event(PR_TRUE, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
+    nsMouseEvent event(true, NS_MOUSE_BUTTON_UP, this, nsMouseEvent::eReal);
     event.button = domButton;
     InitButtonEvent(event, aEvent);
     gdouble pressure = 0;
     gdk_event_get_axis ((GdkEvent*)aEvent, GDK_AXIS_PRESSURE, &pressure);
     event.pressure = pressure ? pressure : mLastMotionPressure;
 
     nsEventStatus status;
     DispatchEvent(&event, status);
@@ -2924,17 +2924,17 @@ nsWindow::OnContainerFocusInEvent(GtkWid
                  "Unexpected focus on a popup window");
 
     LOGFOCUS(("OnContainerFocusInEvent [%p]\n", (void *)this));
 
     // Unset the urgency hint, if possible
     GtkWidget* top_window = nsnull;
     GetToplevelWidget(&top_window);
     if (top_window && (gtk_widget_get_visible(top_window)))
-        SetUrgencyHint(top_window, PR_FALSE);
+        SetUrgencyHint(top_window, false);
 
     // Return if being called within SetFocus because the focus manager
     // already knows that the window is active.
     if (gBlockActivateEvent) {
         LOGFOCUS(("NS_ACTIVATE event is blocked [%p]\n", (void *)this));
         return;
     }
 
@@ -2967,17 +2967,17 @@ nsWindow::OnContainerFocusOutEvent(GtkWi
         if (!shouldRollup) {
             // we also roll up when a drag is from a different application
             nsCOMPtr<nsIDOMNode> sourceNode;
             dragSession->GetSourceNode(getter_AddRefs(sourceNode));
             shouldRollup = (sourceNode == nsnull);
         }
 
         if (shouldRollup) {
-            check_for_rollup(aEvent->window, 0, 0, PR_FALSE, PR_TRUE);
+            check_for_rollup(aEvent->window, 0, 0, false, true);
         }
     }
 
 #if defined(MOZ_WIDGET_GTK2) && defined(MOZ_X11)
     // plugin lose focus
     if (gPluginFocusWindow) {
         nsRefPtr<nsWindow> kungFuDeathGrip = gPluginFocusWindow;
         gPluginFocusWindow->LoseNonXEmbedPluginFocus();
@@ -2996,26 +2996,26 @@ nsWindow::OnContainerFocusOutEvent(GtkWi
 
     LOGFOCUS(("Done with container focus out [%p]\n", (void *)this));
 }
 
 bool
 nsWindow::DispatchCommandEvent(nsIAtom* aCommand)
 {
     nsEventStatus status;
-    nsCommandEvent event(PR_TRUE, nsWidgetAtoms::onAppCommand, aCommand, this);
+    nsCommandEvent event(true, nsWidgetAtoms::onAppCommand, aCommand, this);
     DispatchEvent(&event, status);
     return TRUE;
 }
 
 bool
 nsWindow::DispatchContentCommandEvent(PRInt32 aMsg)
 {
   nsEventStatus status;
-  nsContentCommandEvent event(PR_TRUE, aMsg, this);
+  nsContentCommandEvent event(true, aMsg, this);
   DispatchEvent(&event, status);
   return TRUE;
 }
 
 static PRUint32
 GetCharCodeFor(const GdkEventKey *aEvent, guint aShiftState,
                gint aGroup)
 {
@@ -3065,29 +3065,29 @@ IsCtrlAltTab(GdkEventKey *aEvent)
         aEvent->state & GDK_CONTROL_MASK && aEvent->state & GDK_MOD1_MASK;
 }
 
 bool
 nsWindow::DispatchKeyDownEvent(GdkEventKey *aEvent, bool *aCancelled)
 {
     NS_PRECONDITION(aCancelled, "aCancelled must not be null");
 
-    *aCancelled = PR_FALSE;
+    *aCancelled = false;
 
     if (IsCtrlAltTab(aEvent)) {
-        return PR_FALSE;
+        return false;
     }
 
     // send the key down event
     nsEventStatus status;
-    nsKeyEvent downEvent(PR_TRUE, NS_KEY_DOWN, this);
+    nsKeyEvent downEvent(true, NS_KEY_DOWN, this);
     InitKeyEvent(downEvent, aEvent);
     DispatchEvent(&downEvent, status);
     *aCancelled = (status == nsEventStatus_eConsumeNoDefault);
-    return PR_TRUE;
+    return true;
 }
 
 gboolean
 nsWindow::OnKeyPressEvent(GtkWidget *aWidget, GdkEventKey *aEvent)
 {
     LOGFOCUS(("OnKeyPressEvent [%p]\n", (void *)this));
 
     // if we are in the middle of composing text, XIM gets to see it
@@ -3122,17 +3122,17 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWi
     }
 
     // If a keydown event handler causes to enable IME, i.e., it moves
     // focus from IME unusable content to IME usable editor, we should
     // send the native key event to IME for the first input on the editor.
     if (!IMEWasEnabled && mIMModule && mIMModule->IsEnabled()) {
         // Notice our keydown event was already dispatched.  This prevents
         // unnecessary DOM keydown event in the editor.
-        if (mIMModule->OnKeyEvent(this, aEvent, PR_TRUE)) {
+        if (mIMModule->OnKeyEvent(this, aEvent, true)) {
             return TRUE;
         }
     }
 
     // Don't pass modifiers as NS_KEY_PRESS events.
     // TODO: Instead of selectively excluding some keys from NS_KEY_PRESS events,
     //       we should instead selectively include (as per MSDN spec; no official
     //       spec covers KeyPress events).
@@ -3178,17 +3178,17 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWi
             return DispatchContentCommandEvent(NS_CONTENT_COMMAND_REDO);
         case GDK_Undo:
         case GDK_F14:
             return DispatchContentCommandEvent(NS_CONTENT_COMMAND_UNDO);
     }
 #endif /* ! AIX */
 #endif /* MOZ_X11 */
 
-    nsKeyEvent event(PR_TRUE, NS_KEY_PRESS, this);
+    nsKeyEvent event(true, NS_KEY_PRESS, this);
     InitKeyEvent(event, aEvent);
     if (isKeyDownCancelled) {
       // If prevent default set for onkeydown, do the same for onkeypress
       event.flags |= NS_EVENT_FLAG_NO_DEFAULT;
     }
     event.charCode = nsConvertCharCodeToUnicode(aEvent);
     if (event.charCode) {
         event.keyCode = 0;
@@ -3266,30 +3266,30 @@ nsWindow::OnKeyPressEvent(GtkWidget *aWi
                 }
             }
         }
     }
 
     // before we dispatch a key, check if it's the context menu key.
     // If so, send a context menu key event instead.
     if (is_context_menu_key(event)) {
-        nsMouseEvent contextMenuEvent(PR_TRUE, NS_CONTEXTMENU, this,
+        nsMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
                                       nsMouseEvent::eReal,
                                       nsMouseEvent::eContextMenuKey);
         key_event_to_context_menu_event(contextMenuEvent, aEvent);
         DispatchEvent(&contextMenuEvent, status);
     }
     else {
         // If the character code is in the BMP, send the key press event.
         // Otherwise, send a text event with the equivalent UTF-16 string.
         if (IS_IN_BMP(event.charCode)) {
             DispatchEvent(&event, status);
         }
         else {
-            nsTextEvent textEvent(PR_TRUE, NS_TEXT_TEXT, this);
+            nsTextEvent textEvent(true, NS_TEXT_TEXT, this);
             PRUnichar textString[3];
             textString[0] = H_SURROGATE(event.charCode);
             textString[1] = L_SURROGATE(event.charCode);
             textString[2] = 0;
             textEvent.theText = textString;
             textEvent.time = event.time;
             DispatchEvent(&textEvent, status);
         }
@@ -3308,17 +3308,17 @@ nsWindow::OnKeyReleaseEvent(GtkWidget *a
 {
     LOGFOCUS(("OnKeyReleaseEvent [%p]\n", (void *)this));
 
     if (mIMModule && mIMModule->OnKeyEvent(this, aEvent)) {
         return TRUE;
     }
 
     // send the key event as a key up event
-    nsKeyEvent event(PR_TRUE, NS_KEY_UP, this);
+    nsKeyEvent event(true, NS_KEY_UP, this);
     InitKeyEvent(event, aEvent);
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 
     // If the event was consumed, return.
     if (status == nsEventStatus_eConsumeNoDefault) {
         return TRUE;
@@ -3327,21 +3327,21 @@ nsWindow::OnKeyReleaseEvent(GtkWidget *a
     return FALSE;
 }
 
 void
 nsWindow::OnScrollEvent(GtkWidget *aWidget, GdkEventScroll *aEvent)
 {
     // check to see if we should rollup
     bool rolledUp =  check_for_rollup(aEvent->window, aEvent->x_root,
-                                        aEvent->y_root, PR_TRUE, PR_FALSE);
+                                        aEvent->y_root, true, false);
     if (gConsumeRollupEvent && rolledUp)
         return;
 
-    nsMouseScrollEvent event(PR_TRUE, NS_MOUSE_SCROLL, this);
+    nsMouseScrollEvent event(true, NS_MOUSE_SCROLL, this);
     switch (aEvent->direction) {
     case GDK_SCROLL_UP:
         event.scrollFlags = nsMouseScrollEvent::kIsVertical;
         event.delta = -3;
         break;
     case GDK_SCROLL_DOWN:
         event.scrollFlags = nsMouseScrollEvent::kIsVertical;
         event.delta = 3;
@@ -3393,31 +3393,31 @@ nsWindow::OnVisibilityNotifyEvent(GtkWid
     case GDK_VISIBILITY_UNOBSCURED:
     case GDK_VISIBILITY_PARTIAL:
         if (mIsFullyObscured && mHasMappedToplevel) {
             // GDK_EXPOSE events have been ignored, so make sure GDK
             // doesn't think that the window has already been painted.
             gdk_window_invalidate_rect(mGdkWindow, NULL, FALSE);
         }
 
-        mIsFullyObscured = PR_FALSE;
+        mIsFullyObscured = false;
 
         // In Hildon/Maemo, a browser window will get into 'patially visible' state wheneven an
         // autocomplete feature is dropped down (from urlbar or from an entry form completion),
         // and there are no much further ways for that to happen in the plaftorm. In such cases, if hildon
         // virtual keyboard is up, we can not grab focus to any dropdown list. Reason: nsWindow::EnsureGrabs()
         // calls gdk_pointer_grab() which grabs the pointer (usually a mouse) so that all events are passed
         // to this it until the pointer is ungrabbed.
         if (!nsGtkIMModule::IsVirtualKeyboardOpened()) {
             // if we have to retry the grab, retry it.
             EnsureGrabs();
         }
         break;
     default: // includes GDK_VISIBILITY_FULLY_OBSCURED
-        mIsFullyObscured = PR_TRUE;
+        mIsFullyObscured = true;
         break;
     }
 }
 
 void
 nsWindow::OnWindowStateEvent(GtkWidget *aWidget, GdkEventWindowState *aEvent)
 {
     LOG(("nsWindow::OnWindowStateEvent [%p] changed %d new_window_state %d\n",
@@ -3439,17 +3439,17 @@ nsWindow::OnWindowStateEvent(GtkWidget *
               (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_WITHDRAWN));
         if (mHasMappedToplevel != mapped) {
             SetHasMappedToplevel(mapped);
         }
         return;
     }
     // else the widget is a shell widget.
 
-    nsSizeModeEvent event(PR_TRUE, NS_SIZEMODE, this);
+    nsSizeModeEvent event(true, NS_SIZEMODE, this);
 
     // We don't care about anything but changes in the maximized/icon
     // states
     if ((aEvent->changed_mask
          & (GDK_WINDOW_STATE_ICONIFIED|GDK_WINDOW_STATE_MAXIMIZED)) == 0) {
         return;
     }
 
@@ -3485,17 +3485,17 @@ nsWindow::OnWindowStateEvent(GtkWidget *
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
 void
 nsWindow::ThemeChanged()
 {
-    nsGUIEvent event(PR_TRUE, NS_THEMECHANGED, this);
+    nsGUIEvent event(true, NS_THEMECHANGED, this);
     nsEventStatus status = nsEventStatus_eIgnore;
     DispatchEvent(&event, status);
 
     if (!mGdkWindow || NS_UNLIKELY(mIsDestroyed))
         return;
 
     // Dispatch NS_THEMECHANGED to all child windows
     GList *children =
@@ -3567,17 +3567,17 @@ nsWindow::OnDragMotionEvent(GtkWidget *a
       event.button.button = 1;
       sLastButtonReleaseTime = 0;
       if (widget) {
         g_signal_emit_by_name(widget, "button_release_event", &event, &retval);
         return TRUE;
       }
     }
 
-    sIsDraggingOutOf = PR_FALSE;
+    sIsDraggingOutOf = false;
 
     // get our drag context
     nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
     nsCOMPtr<nsIDragSessionGTK> dragSessionGTK = do_QueryInterface(dragService);
 
     // first, figure out which internal widget this drag motion actually
     // happened on
     nscoord retx = 0;
@@ -3602,17 +3602,17 @@ nsWindow::OnDragMotionEvent(GtkWidget *a
 
     CheckNeedDragLeaveEnter(innerMostWidget, dragService, aDragContext, retx, rety);
 
     // notify the drag service that we are starting a drag motion.
     dragSessionGTK->TargetStartDragMotion();
 
     dragService->FireDragEventAtSource(NS_DRAGDROP_DRAG);
 
-    nsDragEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
+    nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
 
     InitDragEvent(event);
 
     event.refPoint.x = retx;
     event.refPoint.y = rety;
     event.time = aTime;
 
     nsEventStatus status;
@@ -3632,17 +3632,17 @@ nsWindow::OnDragLeaveEvent(GtkWidget *aW
                            GdkDragContext *aDragContext,
                            guint aTime,
                            gpointer aData)
 {
     // XXX Do we want to pass this on only if the event's subwindow is null?
 
     LOGDRAG(("nsWindow::OnDragLeaveSignal(%p)\n", (void*)this));
 
-    sIsDraggingOutOf = PR_TRUE;
+    sIsDraggingOutOf = true;
 
     if (mDragLeaveTimer) {
         return;
     }
 
     // create a fast timer - we're delaying the drag leave until the
     // next mainloop in hopes that we might be able to get a drag drop
     // signal
@@ -3690,32 +3690,32 @@ nsWindow::OnDragDropEvent(GtkWidget *aWi
     }
 
     CheckNeedDragLeaveEnter(innerMostWidget, dragService, aDragContext, retx, rety);
 
     // What we do here is dispatch a new drag motion event to
     // re-validate the drag target and then we do the drop.  The events
     // look the same except for the type.
 
-    nsDragEvent event(PR_TRUE, NS_DRAGDROP_OVER, innerMostWidget);
+    nsDragEvent event(true, NS_DRAGDROP_OVER, innerMostWidget);
 
     InitDragEvent(event);
 
     event.refPoint.x = retx;
     event.refPoint.y = rety;
     event.time = aTime;
 
     nsEventStatus status;
     innerMostWidget->DispatchEvent(&event, status);
 
     // We need to check innerMostWidget->mIsDestroyed here because the nsRefPtr
     // only protects innerMostWidget from being deleted, it does NOT protect
     // against nsView::~nsView() calling Destroy() on it, bug 378670.
     if (!innerMostWidget->mIsDestroyed) {
-        nsDragEvent event(PR_TRUE, NS_DRAGDROP_DROP, innerMostWidget);
+        nsDragEvent event(true, NS_DRAGDROP_DROP, innerMostWidget);
         event.refPoint.x = retx;
         event.refPoint.y = rety;
 
         nsEventStatus status = nsEventStatus_eIgnore;
         innerMostWidget->DispatchEvent(&event, status);
     }
 
     // before we unset the context we need to do a drop_finish
@@ -3735,17 +3735,17 @@ nsWindow::OnDragDropEvent(GtkWidget *aWi
     // different app, we won't get a drag_end signal to end it from.
     gint x, y;
     GdkDisplay* display = gdk_display_get_default();
     if (display) {
       // get the current cursor position
       gdk_display_get_pointer(display, NULL, &x, &y, NULL);
       ((nsDragService *)dragService.get())->SetDragEndPoint(nsIntPoint(x, y));
     }
-    dragService->EndDragSession(PR_TRUE);
+    dragService->EndDragSession(true);
 
     return TRUE;
 }
 
 void
 nsWindow::OnDragDataReceivedEvent(GtkWidget *aWidget,
                                   GdkDragContext *aDragContext,
                                   gint aX,
@@ -3765,17 +3765,17 @@ nsWindow::OnDragDataReceivedEvent(GtkWid
                                        aSelectionData, aInfo, aTime);
 }
 
 void
 nsWindow::OnDragLeave(void)
 {
     LOGDRAG(("nsWindow::OnDragLeave(%p)\n", (void*)this));
 
-    nsDragEvent event(PR_TRUE, NS_DRAGDROP_EXIT, this);
+    nsDragEvent event(true, NS_DRAGDROP_EXIT, this);
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 
     nsCOMPtr<nsIDragService> dragService = do_GetService(kCDragServiceCID);
 
     if (dragService) {
         nsCOMPtr<nsIDragSession> currentDragSession;
@@ -3785,30 +3785,30 @@ nsWindow::OnDragLeave(void)
             nsCOMPtr<nsIDOMNode> sourceNode;
             currentDragSession->GetSourceNode(getter_AddRefs(sourceNode));
 
             if (!sourceNode) {
                 // We're leaving a window while doing a drag that was
                 // initiated in a different app. End the drag session,
                 // since we're done with it for now (until the user
                 // drags back into mozilla).
-                dragService->EndDragSession(PR_FALSE);
+                dragService->EndDragSession(false);
             }
         }
     }
 }
 
 void
 nsWindow::OnDragEnter(nscoord aX, nscoord aY)
 {
     // XXX Do we want to pass this on only if the event's subwindow is null?
 
     LOGDRAG(("nsWindow::OnDragEnter(%p)\n", (void*)this));
 
-    nsDragEvent event(PR_TRUE, NS_DRAGDROP_ENTER, this);
+    nsDragEvent event(true, NS_DRAGDROP_ENTER, this);
 
     event.refPoint.x = aX;
     event.refPoint.y = aY;
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 }
 
@@ -3894,17 +3894,17 @@ nsWindow::Create(nsIWidget        *aPare
 
     // initialize all the common bits of this class
     BaseCreate(baseParent, aRect, aHandleEventFunction, aContext,
                aAppShell, aToolkit, aInitData);
 
     // Do we need to listen for resizes?
     bool listenForResizes = false;;
     if (aNativeParent || (aInitData && aInitData->mListenForResizes))
-        listenForResizes = PR_TRUE;
+        listenForResizes = true;
 
     // and do our common creation
     CommonCreate(aParent, listenForResizes);
 
     // save our bounds
     mBounds = aRect;
 
     // figure out our parent window
@@ -3934,25 +3934,25 @@ nsWindow::Create(nsIWidget        *aPare
     }
 
     // ok, create our windows
     switch (mWindowType) {
     case eWindowType_dialog:
     case eWindowType_popup:
     case eWindowType_toplevel:
     case eWindowType_invisible: {
-        mIsTopLevel = PR_TRUE;
+        mIsTopLevel = true;
 
         // We only move a general managed toplevel window if someone has
         // actually placed the window somewhere.  If no placement has taken
         // place, we just let the window manager Do The Right Thing.
         //
         // Indicate that if we're shown, we at least need to have our size set.
         // If we get explicitly moved, the position will also be set.
-        mNeedsResize = PR_TRUE;
+        mNeedsResize = true;
 
         nsXPIDLString brandName;
         GetBrandName(brandName);
         NS_ConvertUTF16toUTF8 cBrand(brandName);
 
         if (mWindowType == eWindowType_dialog) {
             mShell = gtk_window_new(GTK_WINDOW_TOPLEVEL);
             SetDefaultIcon();
@@ -3983,17 +3983,17 @@ nsWindow::Create(nsIWidget        *aPare
                          (void *)mShell, (void *)mWindowGroup));
                 }
             }
         }
         else if (mWindowType == eWindowType_popup) {
             // With popup windows, we want to control their position, so don't
             // wait for the window manager to place them (which wouldn't
             // happen with override-redirect windows anyway).
-            mNeedsMove = PR_TRUE;
+            mNeedsMove = true;
 
             // Popups that are not noautohide are only temporary. The are used
             // for menus and the like and disappear when another window is used.
             if (!aInitData->mNoAutoHide) {
                 // For most popups, use the standard GtkWindowType
                 // GTK_WINDOW_POPUP, which will use a Window with the
                 // override-redirect attribute (for temporary windows).
                 mShell = gtk_window_new(GTK_WINDOW_POPUP);
@@ -4276,22 +4276,22 @@ nsWindow::Create(nsIWidget        *aPare
     }
     else if (mGdkWindow) {
         LOG(("\tmGdkWindow %p %lx\n", (void *)mGdkWindow,
              gdk_x11_window_get_xid(mGdkWindow)));
     }
 
     // resize so that everything is set to the right dimensions
     if (!mIsTopLevel)
-        Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, PR_FALSE);
+        Resize(mBounds.x, mBounds.y, mBounds.width, mBounds.height, false);
 
 #ifdef ACCESSIBILITY
     nsresult rv;
     if (!sAccessibilityChecked) {
-        sAccessibilityChecked = PR_TRUE;
+        sAccessibilityChecked = true;
 
         //check if accessibility enabled/disabled by environment variable
         const char *envValue = PR_GetEnv(sAccEnv);
         if (envValue) {
             sAccessibilityEnabled = atoi(envValue) != 0;
             LOG(("Accessibility Env %s=%s\n", sAccEnv, envValue));
         }
         //check gconf-2 setting
@@ -4420,17 +4420,17 @@ void
 nsWindow::NativeResize(PRInt32 aWidth, PRInt32 aHeight, bool    aRepaint)
 {
     LOG(("nsWindow::NativeResize [%p] %d %d\n", (void *)this,
          aWidth, aHeight));
 
     ResizeTransparencyBitmap(aWidth, aHeight);
 
     // clear our resize flag
-    mNeedsResize = PR_FALSE;
+    mNeedsResize = false;
 
     if (mIsTopLevel) {
         gtk_window_resize(GTK_WINDOW(mShell), aWidth, aHeight);
     }
     else if (mContainer) {
         GtkWidget *widget = GTK_WIDGET(mContainer);
         GtkAllocation allocation, prev_allocation;
         gtk_widget_get_allocation(widget, &prev_allocation);
@@ -4445,18 +4445,18 @@ nsWindow::NativeResize(PRInt32 aWidth, P
     }
 }
 
 void
 nsWindow::NativeResize(PRInt32 aX, PRInt32 aY,
                        PRInt32 aWidth, PRInt32 aHeight,
                        bool    aRepaint)
 {
-    mNeedsResize = PR_FALSE;
-    mNeedsMove = PR_FALSE;
+    mNeedsResize = false;
+    mNeedsMove = false;
 
     LOG(("nsWindow::NativeResize [%p] %d %d %d %d\n", (void *)this,
          aX, aY, aWidth, aHeight));
 
     ResizeTransparencyBitmap(aWidth, aHeight);
 
     if (mIsTopLevel) {
         // aX and aY give the position of the window manager frame top-left.
@@ -4489,17 +4489,17 @@ nsWindow::NativeShow (bool    aAction)
         // So, we delay setting the mask until the last moment: when the window
         // is shown.
         // XXX that may or may not be true for GTK+ 2.x
         if (mTransparencyBitmap) {
             ApplyTransparencyBitmap();
         }
 
         // unset our flag now that our window has been shown
-        mNeedsShow = PR_FALSE;
+        mNeedsShow = false;
 
         if (mIsTopLevel) {
             // Set up usertime/startupID metadata for the created window.
             if (mWindowType != eWindowType_invisible) {
                 SetUserTimeAndStartupIDForActivatedWindow(mShell);
             }
 
             gtk_widget_show(GTK_WIDGET(mContainer));
@@ -4656,25 +4656,25 @@ nsWindow::GetTransparencyMode()
 nsresult
 nsWindow::ConfigureChildren(const nsTArray<Configuration>& aConfigurations)
 {
     for (PRUint32 i = 0; i < aConfigurations.Length(); ++i) {
         const Configuration& configuration = aConfigurations[i];
         nsWindow* w = static_cast<nsWindow*>(configuration.mChild);
         NS_ASSERTION(w->GetParent() == this,
                      "Configured widget is not a child");
-        w->SetWindowClipRegion(configuration.mClipRegion, PR_TRUE);
+        w->SetWindowClipRegion(configuration.mClipRegion, true);
         if (w->mBounds.Size() != configuration.mBounds.Size()) {
             w->Resize(configuration.mBounds.x, configuration.mBounds.y,
                       configuration.mBounds.width, configuration.mBounds.height,
-                      PR_TRUE);
+                      true);
         } else if (w->mBounds.TopLeft() != configuration.mBounds.TopLeft()) {
             w->Move(configuration.mBounds.x, configuration.mBounds.y);
         } 
-        w->SetWindowClipRegion(configuration.mClipRegion, PR_FALSE);
+        w->SetWindowClipRegion(configuration.mClipRegion, false);
     }
     return NS_OK;
 }
 
 static pixman_box32
 ToPixmanBox(const nsIntRect& aRect)
 {
     pixman_box32_t result;
@@ -4843,23 +4843,23 @@ ChangedMaskBits(gchar* aMaskBits, PRInt3
         for (x = aRect.x; x < xMax; x++) {
             bool newBit = *alphas > 0;
             alphas++;
 
             gchar maskByte = maskBytes[x >> 3];
             bool maskBit = (maskByte & (1 << (x & 7))) != 0;
 
             if (maskBit != newBit) {
-                return PR_TRUE;
+                return true;
             }
         }
         aAlphas += aStride;
     }
 
-    return PR_FALSE;
+    return false;
 }
 
 static
 void UpdateMaskBits(gchar* aMaskBits, PRInt32 aMaskWidth, PRInt32 aMaskHeight,
         const nsIntRect& aRect, PRUint8* aAlphas, PRInt32 aStride)
 {
     PRInt32 x, y, xMax = aRect.XMost(), yMax = aRect.YMost();
     PRInt32 maskBytesPerRow = GetBitmapStride(aMaskWidth);
@@ -4976,24 +4976,24 @@ nsWindow::UpdateTranslucentWindowAlphaIn
     return NS_OK;
 }
 
 void
 nsWindow::GrabPointer(void)
 {
     LOG(("GrabPointer %d\n", mRetryPointerGrab));
 
-    mRetryPointerGrab = PR_FALSE;
+    mRetryPointerGrab = false;
 
     // If the window isn't visible, just set the flag to retry the
     // grab.  When this window becomes visible, the grab will be
     // retried.
     if (!mHasMappedToplevel || mIsFullyObscured) {
         LOG(("GrabPointer: window not visible\n"));
-        mRetryPointerGrab = PR_TRUE;
+        mRetryPointerGrab = true;
         return;
     }
 
     if (!mGdkWindow)
         return;
 
     gint retval;
     retval = gdk_pointer_grab(mGdkWindow, TRUE,
@@ -5004,26 +5004,26 @@ nsWindow::GrabPointer(void)
 #ifdef HAVE_GTK_MOTION_HINTS
                                              GDK_POINTER_MOTION_HINT_MASK |
 #endif
                                              GDK_POINTER_MOTION_MASK),
                               (GdkWindow *)NULL, NULL, GDK_CURRENT_TIME);
 
     if (retval != GDK_GRAB_SUCCESS) {
         LOG(("GrabPointer: pointer grab failed\n"));
-        mRetryPointerGrab = PR_TRUE;
+        mRetryPointerGrab = true;
     }
 }
 
 void
 nsWindow::ReleaseGrabs(void)
 {
     LOG(("ReleaseGrabs\n"));
 
-    mRetryPointerGrab = PR_FALSE;
+    mRetryPointerGrab = false;
     gdk_pointer_ungrab(GDK_CURRENT_TIME);
 }
 
 void
 nsWindow::GetToplevelWidget(GtkWidget **aWidget)
 {
     *aWidget = nsnull;
 
@@ -5310,17 +5310,17 @@ nsWindow::HideWindowChrome(bool aShouldH
 
     // Sawfish, metacity, and presumably other window managers get
     // confused if we change the window decorations while the window
     // is visible.
     bool wasVisible = false;
     GdkWindow *shellWindow = gtk_widget_get_window(mShell);
     if (gdk_window_is_visible(shellWindow)) {
         gdk_window_hide(shellWindow);
-        wasVisible = PR_TRUE;
+        wasVisible = true;
     }
 
     gint wmd;
     if (aShouldHide)
         wmd = 0;
     else
         wmd = ConvertBorderStyles(mBorderStyle);
 
@@ -5353,17 +5353,17 @@ check_for_rollup(GdkWindow *aWindow, gdo
 
     if (rollupWidget && gRollupListener) {
         GdkWindow *currentPopup =
             (GdkWindow *)rollupWidget->GetNativeData(NS_NATIVE_WINDOW);
         if (aAlwaysRollup || !is_mouse_in_window(currentPopup, aMouseX, aMouseY)) {
             bool rollup = true;
             if (aIsWheel) {
                 gRollupListener->ShouldRollupOnMouseWheelEvent(&rollup);
-                retVal = PR_TRUE;
+                retVal = true;
             }
             // if we're dealing with menus, we probably have submenus and
             // we don't want to rollup if the click is in a parent menu of
             // the current submenu
             PRUint32 popupsToRollup = PR_UINT32_MAX;
             if (gMenuRollup && !aAlwaysRollup) {
                 nsAutoTArray<nsIWidget*, 5> widgetChain;
                 PRUint32 sameTypeCount = gMenuRollup->GetSubmenuWidgetChain(&widgetChain);
@@ -5373,31 +5373,31 @@ check_for_rollup(GdkWindow *aWindow, gdo
                         (GdkWindow*) widget->GetNativeData(NS_NATIVE_WINDOW);
                     if (is_mouse_in_window(currWindow, aMouseX, aMouseY)) {
                       // don't roll up if the mouse event occurred within a
                       // menu of the same type. If the mouse event occurred
                       // in a menu higher than that, roll up, but pass the
                       // number of popups to Rollup so that only those of the
                       // same type close up.
                       if (i < sameTypeCount) {
-                        rollup = PR_FALSE;
+                        rollup = false;
                       }
                       else {
                         popupsToRollup = sameTypeCount;
                       }
                       break;
                     }
                 } // foreach parent menu widget
             } // if rollup listener knows about menus
 
             // if we've determined that we should still rollup, do it.
             if (rollup) {
                 gRollupListener->Rollup(popupsToRollup, nsnull);
                 if (popupsToRollup == PR_UINT32_MAX) {
-                    retVal = PR_TRUE;
+                    retVal = true;
                 }
             }
         }
     } else {
         gRollupWindow = nsnull;
         gRollupListener = nsnull;
         NS_IF_RELEASE(gMenuRollup);
     }
@@ -5451,19 +5451,19 @@ is_mouse_in_window (GdkWindow* aWindow, 
     gdk_drawable_get_size(aWindow, &w, &h);
 #else
     w = gdk_window_get_width(aWindow);
     h = gdk_window_get_height(aWindow);
 #endif
 
     if (aMouseX > x && aMouseX < x + w &&
         aMouseY > y && aMouseY < y + h)
-        return PR_TRUE;
-
-    return PR_FALSE;
+        return true;
+
+    return false;
 }
 
 static nsWindow *
 get_window_for_gtk_widget(GtkWidget *widget)
 {
     gpointer user_data = g_object_get_data(G_OBJECT(widget), "nsWindow");
 
     return static_cast<nsWindow *>(user_data);
@@ -6189,20 +6189,20 @@ theme_changed_cb (GtkSettings *settings,
 // These are all of our drag and drop operations
 
 void
 nsWindow::InitDragEvent(nsDragEvent &aEvent)
 {
     // set the keyboard modifiers
     GdkModifierType state = (GdkModifierType)0;
     gdk_display_get_pointer(gdk_display_get_default(), NULL, NULL, NULL, &state);
-    aEvent.isShift = (state & GDK_SHIFT_MASK) ? PR_TRUE : PR_FALSE;
-    aEvent.isControl = (state & GDK_CONTROL_MASK) ? PR_TRUE : PR_FALSE;
-    aEvent.isAlt = (state & GDK_MOD1_MASK) ? PR_TRUE : PR_FALSE;
-    aEvent.isMeta = PR_FALSE; // GTK+ doesn't support the meta key
+    aEvent.isShift = (state & GDK_SHIFT_MASK) ? true : false;
+    aEvent.isControl = (state & GDK_CONTROL_MASK) ? true : false;
+    aEvent.isAlt = (state & GDK_MOD1_MASK) ? true : false;
+    aEvent.isMeta = false; // GTK+ doesn't support the meta key
 }
 
 // This will update the drag action based on the information in the
 // drag context.  Gtk gets this from a combination of the key settings
 // and what the source is offering.
 
 void
 nsWindow::UpdateDragStatus(GdkDragContext *aDragContext,
@@ -6381,20 +6381,20 @@ is_context_menu_key(const nsKeyEvent& aK
              !aKeyEvent.isControl && !aKeyEvent.isMeta && !aKeyEvent.isAlt));
 }
 
 static void
 key_event_to_context_menu_event(nsMouseEvent &aEvent,
                                 GdkEventKey *aGdkEvent)
 {
     aEvent.refPoint = nsIntPoint(0, 0);
-    aEvent.isShift = PR_FALSE;
-    aEvent.isControl = PR_FALSE;
-    aEvent.isAlt = PR_FALSE;
-    aEvent.isMeta = PR_FALSE;
+    aEvent.isShift = false;
+    aEvent.isControl = false;
+    aEvent.isAlt = false;
+    aEvent.isMeta = false;
     aEvent.time = aGdkEvent->time;
     aEvent.clickCount = 1;
 }
 
 static int
 is_parent_ungrab_enter(GdkEventCrossing *aEvent)
 {
     return (GDK_CROSSING_UNGRAB == aEvent->mode) &&
@@ -6418,17 +6418,17 @@ gdk_keyboard_get_modifiers()
 
     gdk_window_get_pointer(NULL, NULL, NULL, &m);
 
     return m;
 }
 
 #ifdef MOZ_X11
 // Get the modifier masks for GDK_Caps_Lock, GDK_Num_Lock and GDK_Scroll_Lock.
-// Return PR_TRUE on success, PR_FALSE on error.
+// Return true on success, false on error.
 static bool
 gdk_keyboard_get_modmap_masks(Display*  aDisplay,
                               PRUint32* aCapsLockMask,
                               PRUint32* aNumLockMask,
                               PRUint32* aScrollLockMask)
 {
     *aCapsLockMask = 0;
     *aNumLockMask = 0;
@@ -6438,23 +6438,23 @@ gdk_keyboard_get_modmap_masks(Display*  
     int max_keycode = 0;
     XDisplayKeycodes(aDisplay, &min_keycode, &max_keycode);
 
     int keysyms_per_keycode = 0;
     KeySym* xkeymap = XGetKeyboardMapping(aDisplay, min_keycode,
                                           max_keycode - min_keycode + 1,
                                           &keysyms_per_keycode);
     if (!xkeymap) {
-        return PR_FALSE;
+        return false;
     }
 
     XModifierKeymap* xmodmap = XGetModifierMapping(aDisplay);
     if (!xmodmap) {
         XFree(xkeymap);
-        return PR_FALSE;
+        return false;
     }
 
     /*
       The modifiermap member of the XModifierKeymap structure contains 8 sets
       of max_keypermod KeyCodes, one for each modifier in the order Shift,
       Lock, Control, Mod1, Mod2, Mod3, Mod4, and Mod5.
       Only nonzero KeyCodes have meaning in each set, and zero KeyCodes are ignored.
     */
@@ -6472,17 +6472,17 @@ gdk_keyboard_get_modmap_masks(Display*  
                 case GDK_Num_Lock:    *aNumLockMask |= mask;    break;
                 case GDK_Scroll_Lock: *aScrollLockMask |= mask; break;
             }
         }
     }
 
     XFreeModifiermap(xmodmap);
     XFree(xkeymap);
-    return PR_TRUE;
+    return true;
 }
 #endif /* MOZ_X11 */
 
 #ifdef ACCESSIBILITY
 void
 nsWindow::CreateRootAccessible()
 {
     if (mIsTopLevel && !mRootAccessible) {
@@ -6493,17 +6493,17 @@ nsWindow::CreateRootAccessible()
             mRootAccessible = acc;
         }
     }
 }
 
 nsAccessible*
 nsWindow::DispatchAccessibleEvent()
 {
-    nsAccessibleEvent event(PR_TRUE, NS_GETACCESSIBLE, this);
+    nsAccessibleEvent event(true, NS_GETACCESSIBLE, this);
 
     nsEventStatus status;
     DispatchEvent(&event, status);
 
     return event.mAccessible;
 }
 
 void
@@ -6764,47 +6764,47 @@ nsWindow::GetThebesSurface(cairo_t *cr)
 // Code shared begin BeginMoveDrag and BeginResizeDrag
 bool
 nsWindow::GetDragInfo(nsMouseEvent* aMouseEvent,
                       GdkWindow** aWindow, gint* aButton,
                       gint* aRootX, gint* aRootY)
 {
     if (aMouseEvent->button != nsMouseEvent::eLeftButton) {
         // we can only begin a move drag with the left mouse button
-        return PR_FALSE;
+        return false;
     }
     *aButton = 1;
 
     // get the gdk window for this widget
     GdkWindow* gdk_window = mGdkWindow;
     if (!gdk_window) {
-        return PR_FALSE;
+        return false;
     }
     NS_ABORT_IF_FALSE(GDK_IS_WINDOW(gdk_window), "must really be window");
 
     // find the top-level window
     gdk_window = gdk_window_get_toplevel(gdk_window);
     NS_ABORT_IF_FALSE(gdk_window,
                       "gdk_window_get_toplevel should not return null");
     *aWindow = gdk_window;
 
     if (!aMouseEvent->widget) {
-        return PR_FALSE;
+        return false;
     }
 
     // FIXME: It would be nice to have the widget position at the time
     // of the event, but it's relatively unlikely that the widget has
     // moved since the mousedown.  (On the other hand, it's quite likely
     // that the mouse has moved, which is why we use the mouse position
     // from the event.)
     nsIntPoint offset = aMouseEvent->widget->WidgetToScreenOffset();
     *aRootX = aMouseEvent->refPoint.x + offset.x;
     *aRootY = aMouseEvent->refPoint.y + offset.y;
 
-    return PR_TRUE;
+    return true;
 }
 
 NS_IMETHODIMP
 nsWindow::BeginMoveDrag(nsMouseEvent* aEvent)
 {
     NS_ABORT_IF_FALSE(aEvent, "must have event");
     NS_ABORT_IF_FALSE(aEvent->eventStructType == NS_MOUSE_EVENT,
                       "event must have correct struct type");
--- a/widget/src/qt/nsDeviceContextSpecQt.cpp
+++ b/widget/src/qt/nsDeviceContextSpecQt.cpp
@@ -66,19 +66,16 @@
 #include "nsILocalFile.h"
 #include "nsTArray.h"
 
 #include <unistd.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 
 #include "gfxPDFSurface.h"
- 
-/* Ensure that the result is always equal to either PR_TRUE or PR_FALSE */
-#define MAKE_PR_BOOL(val) ((val)?(PR_TRUE):(PR_FALSE))
 
 #ifdef PR_LOGGING
 static PRLogModuleInfo* DeviceContextSpecQtLM =
     PR_NewLogModule("DeviceContextSpecQt");
 #endif /* PR_LOGGING */
 /* Macro to make lines shorter */
 #define DO_PR_DEBUG_LOG(x) PR_LOG(DeviceContextSpecQtLM, PR_LOG_DEBUG, x)
 
--- a/widget/src/windows/GfxInfo.cpp
+++ b/widget/src/windows/GfxInfo.cpp
@@ -75,18 +75,18 @@ static const PRUint32 vendorATI = 0x1002
 
 
 GfxInfo::GfxInfo()
   : mAdapterVendorID(0),
     mAdapterDeviceID(0),
     mAdapterVendorID2(0),
     mAdapterDeviceID2(0),
     mWindowsVersion(0),
-    mHasDualGPU(PR_FALSE),
-    mIsGPU2Active(PR_FALSE)
+    mHasDualGPU(false),
+    mIsGPU2Active(false)
 {
 }
 
 /* GetD2DEnabled and GetDwriteEnabled shouldn't be called until after gfxPlatform initialization
  * has occurred because they depend on it for information. (See bug 591561) */
 nsresult
 GfxInfo::GetD2DEnabled(bool *aEnabled)
 {
@@ -99,27 +99,27 @@ GfxInfo::GetDWriteEnabled(bool *aEnabled
 {
   *aEnabled = gfxWindowsPlatform::GetPlatform()->DWriteEnabled();
   return NS_OK;
 }
 
 nsresult
 GfxInfo::GetAzureEnabled(bool *aEnabled)
 {
-  *aEnabled = PR_FALSE;
+  *aEnabled = false;
 
   bool d2dEnabled = 
     gfxWindowsPlatform::GetPlatform()->GetRenderMode() == gfxWindowsPlatform::RENDER_DIRECT2D;
 
   if (d2dEnabled) {
     bool azure = false;
     nsresult rv = mozilla::Preferences::GetBool("gfx.canvas.azure.enabled", &azure);
 
     if (NS_SUCCEEDED(rv) && azure) {
-      *aEnabled = PR_TRUE;
+      *aEnabled = true;
     }
   }
 
   return NS_OK;
 }
 
 /* readonly attribute DOMString DWriteVersion; */
 NS_IMETHODIMP
@@ -434,17 +434,17 @@ GfxInfo::Init()
               // We know driverKey.Length() > 0 since driverKeyPre is a prefix of driverKey.
               if (driverKey[driverKey.Length()-1] == '0') {
                 driverKey.SetCharAt('1', driverKey.Length()-1);
               } else {
                 driverKey.SetCharAt('0', driverKey.Length()-1);
               }
               result = RegOpenKeyExW(HKEY_LOCAL_MACHINE, driverKey.BeginReading(), 0, KEY_QUERY_VALUE, &key);
               if (result == ERROR_SUCCESS) {
-                mHasDualGPU = PR_TRUE;
+                mHasDualGPU = true;
                 mDeviceKey2 = driverKey;
                 dwcbData = sizeof(value);
                 result = RegQueryValueExW(key, L"DriverVersion", NULL, NULL, (LPBYTE)value, &dwcbData);
                 if (result == ERROR_SUCCESS)
                   mDriverVersion2 = value;
                 dwcbData = sizeof(value);
                 result = RegQueryValueExW(key, L"DriverDate", NULL, NULL, (LPBYTE)value, &dwcbData);
                 if (result == ERROR_SUCCESS)
@@ -483,17 +483,17 @@ GfxInfo::Init()
     mDriverVersion.AssignASCII(spoofedDriverVersionString);
   }
 
   const char *spoofedVendor = PR_GetEnv("MOZ_GFX_SPOOF_VENDOR_ID");
   if (spoofedVendor) {
      PR_sscanf(spoofedVendor, "%x", &mAdapterVendorID);
   }
 
-  mHasDriverVersionMismatch = PR_FALSE;
+  mHasDriverVersionMismatch = false;
   if (mAdapterVendorID == vendorIntel) {
     // we've had big crashers (bugs 590373 and 595364) apparently correlated
     // with bad Intel driver installations where the DriverVersion reported
     // by the registry was not the version of the DLL.
     bool is64bitApp = sizeof(void*) == 8;
     const PRUnichar *dllFileName = is64bitApp
                                  ? L"igd10umd64.dll"
                                  : L"igd10umd32.dll";
@@ -503,17 +503,17 @@ GfxInfo::Init()
     PRUint64 dllNumericVersion = 0, driverNumericVersion = 0;
     ParseDriverVersion(dllVersion, &dllNumericVersion);
     ParseDriverVersion(mDriverVersion, &driverNumericVersion);
 
     // if GetDLLVersion fails, it gives "0.0.0.0"
     // so if GetDLLVersion failed, we get dllNumericVersion = 0
     // so this test implicitly handles the case where GetDLLVersion failed
     if (dllNumericVersion != driverNumericVersion)
-      mHasDriverVersionMismatch = PR_TRUE;
+      mHasDriverVersionMismatch = true;
   }
 
   const char *spoofedDevice = PR_GetEnv("MOZ_GFX_SPOOF_DEVICE_ID");
   if (spoofedDevice) {
     PR_sscanf(spoofedDevice, "%x", &mAdapterDeviceID);
   }
 
   const char *spoofedWindowsVersion = PR_GetEnv("MOZ_GFX_SPOOF_WINDOWS_VERSION");
@@ -967,17 +967,17 @@ WindowsVersionToOperatingSystem(PRInt32 
       return DRIVER_OS_UNKNOWN;
     };
 }
 
 nsresult
 GfxInfo::GetFeatureStatusImpl(PRInt32 aFeature, PRInt32 *aStatus, nsAString & aSuggestedDriverVersion, GfxDriverInfo* aDriverInfo /* = nsnull */)
 {
   *aStatus = nsIGfxInfo::FEATURE_NO_INFO;
-  aSuggestedDriverVersion.SetIsVoid(PR_TRUE);
+  aSuggestedDriverVersion.SetIsVoid(true);
 
   PRInt32 status = nsIGfxInfo::FEATURE_NO_INFO;
 
   PRUint32 adapterVendor = 0;
   PRUint32 adapterDeviceID = 0;
   nsAutoString adapterDriverVersionString;
   if (NS_FAILED(GetAdapterVendorID(&adapterVendor)) ||
       NS_FAILED(GetAdapterDeviceID(&adapterDeviceID)) ||
--- a/widget/src/windows/JumpListBuilder.cpp
+++ b/widget/src/windows/JumpListBuilder.cpp
@@ -75,17 +75,17 @@ const char kPrefTaskbarEnabled[] = "brow
 NS_IMPL_ISUPPORTS2(JumpListBuilder, nsIJumpListBuilder, nsIObserver)
 NS_IMPL_ISUPPORTS1(AsyncFaviconDataReady, nsIFaviconDataCallback)
 NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncWriteIconToDisk, nsIRunnable)
 NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteIconFromDisk, nsIRunnable)
 NS_IMPL_THREADSAFE_ISUPPORTS1(AsyncDeleteAllFaviconsFromDisk, nsIRunnable)
 
 JumpListBuilder::JumpListBuilder() :
   mMaxItems(0),
-  mHasCommit(PR_FALSE)
+  mHasCommit(false)
 {
   ::CoInitialize(NULL);
   
   CoCreateInstance(CLSID_DestinationList, NULL, CLSCTX_INPROC_SERVER,
                    IID_ICustomDestinationList, getter_AddRefs(mJumpListMgr));
 
   NS_NewThread(getter_AddRefs(mIOThread));
   Preferences::AddStrongObserver(this, kPrefTaskbarEnabled);
@@ -97,20 +97,20 @@ JumpListBuilder::~JumpListBuilder()
   Preferences::RemoveObserver(this, kPrefTaskbarEnabled);
   mJumpListMgr = nsnull;
   ::CoUninitialize();
 }
 
 /* readonly attribute short available; */
 NS_IMETHODIMP JumpListBuilder::GetAvailable(PRInt16 *aAvailable)
 {
-  *aAvailable = PR_FALSE;
+  *aAvailable = false;
 
   if (mJumpListMgr)
-    *aAvailable = PR_TRUE;
+    *aAvailable = true;
 
   return NS_OK;
 }
 
 /* readonly attribute boolean isListCommitted; */
 NS_IMETHODIMP JumpListBuilder::GetIsListCommitted(bool *aCommit)
 {
   *aCommit = mHasCommit;
@@ -144,17 +144,17 @@ NS_IMETHODIMP JumpListBuilder::GetMaxLis
   return NS_OK;
 }
 
 /* boolean initListBuild(in nsIMutableArray removedItems); */
 NS_IMETHODIMP JumpListBuilder::InitListBuild(nsIMutableArray *removedItems, bool *_retval)
 {
   NS_ENSURE_ARG_POINTER(removedItems);
 
-  *_retval = PR_FALSE;
+  *_retval = false;
 
   if (!mJumpListMgr)
     return NS_ERROR_NOT_AVAILABLE;
 
   if(sBuildingList)
     AbortListBuild();
 
   IObjectArray *objArray;
@@ -162,18 +162,18 @@ NS_IMETHODIMP JumpListBuilder::InitListB
   if (SUCCEEDED(mJumpListMgr->BeginList(&mMaxItems, IID_PPV_ARGS(&objArray)))) {
     if (objArray) {
       TransferIObjectArrayToIMutableArray(objArray, removedItems);
       objArray->Release();
     }
 
     RemoveIconCacheForItems(removedItems);
 
-    sBuildingList = PR_TRUE;
-    *_retval = PR_TRUE;
+    sBuildingList = true;
+    *_retval = true;
     return NS_OK;
   }
 
   return NS_OK;
 }
 
 // Ensures that we don't have old ICO files that aren't in our jump lists 
 // anymore left over in the cache.
@@ -260,29 +260,29 @@ nsresult JumpListBuilder::RemoveIconCach
     PRInt32 len = path.Length();
     if (StringTail(path, 4).LowerCaseEqualsASCII(".ico")) {
       // Check if the cached ICO file exists
       bool exists;
       if (NS_FAILED(currFile->Exists(&exists)) || !exists)
         continue;
 
       // We found an ICO file that exists, so we should remove it
-      currFile->Remove(PR_FALSE);
+      currFile->Remove(false);
     }
   } while(true);
 
   return NS_OK;
 }
 
 /* boolean addListToBuild(in short aCatType, [optional] in nsIArray items, [optional] in AString catName); */
 NS_IMETHODIMP JumpListBuilder::AddListToBuild(PRInt16 aCatType, nsIArray *items, const nsAString &catName, bool *_retval)
 {
   nsresult rv;
 
-  *_retval = PR_FALSE;
+  *_retval = false;
 
   if (!mJumpListMgr)
     return NS_ERROR_NOT_AVAILABLE;
 
   switch(aCatType) {
     case nsIJumpListBuilder::JUMPLIST_CATEGORY_TASKS:
     {
       NS_ENSURE_ARG_POINTER(items);
@@ -322,31 +322,31 @@ NS_IMETHODIMP JumpListBuilder::AddListTo
       nsRefPtr<IObjectArray> pArray;
       hr = collection->QueryInterface(IID_IObjectArray, getter_AddRefs(pArray));
       if (FAILED(hr))
         return NS_ERROR_UNEXPECTED;
 
       // Add the tasks
       hr = mJumpListMgr->AddUserTasks(pArray);
       if (SUCCEEDED(hr))
-        *_retval = PR_TRUE;
+        *_retval = true;
       return NS_OK;
     }
     break;
     case nsIJumpListBuilder::JUMPLIST_CATEGORY_RECENT:
     {
       if (SUCCEEDED(mJumpListMgr->AppendKnownCategory(KDC_RECENT)))
-        *_retval = PR_TRUE;
+        *_retval = true;
       return NS_OK;
     }
     break;
     case nsIJumpListBuilder::JUMPLIST_CATEGORY_FREQUENT:
     {
       if (SUCCEEDED(mJumpListMgr->AppendKnownCategory(KDC_FREQUENT)))
-        *_retval = PR_TRUE;
+        *_retval = true;
       return NS_OK;
     }
     break;
     case nsIJumpListBuilder::JUMPLIST_CATEGORY_CUSTOMLIST:
     {
       NS_ENSURE_ARG_POINTER(items);
 
       if (catName.IsEmpty())
@@ -403,89 +403,89 @@ NS_IMETHODIMP JumpListBuilder::AddListTo
       nsRefPtr<IObjectArray> pArray;
       hr = collection->QueryInterface(IID_IObjectArray, (LPVOID*)&pArray);
       if (FAILED(hr))
         return NS_ERROR_UNEXPECTED;
 
       // Add the tasks
       hr = mJumpListMgr->AppendCategory(catName.BeginReading(), pArray);
       if (SUCCEEDED(hr))
-        *_retval = PR_TRUE;
+        *_retval = true;
       return NS_OK;
     }
     break;
   }
   return NS_OK;
 }
 
 /* void abortListBuild(); */
 NS_IMETHODIMP JumpListBuilder::AbortListBuild()
 {
   if (!mJumpListMgr)
     return NS_ERROR_NOT_AVAILABLE;
 
   mJumpListMgr->AbortList();
-  sBuildingList = PR_FALSE;
+  sBuildingList = false;
 
   return NS_OK;
 }
 
 /* boolean commitListBuild(); */
 NS_IMETHODIMP JumpListBuilder::CommitListBuild(bool *_retval)
 {
-  *_retval = PR_FALSE;
+  *_retval = false;
 
   if (!mJumpListMgr)
     return NS_ERROR_NOT_AVAILABLE;
 
   HRESULT hr = mJumpListMgr->CommitList();
-  sBuildingList = PR_FALSE;
+  sBuildingList = false;
 
   // XXX We might want some specific error data here.
   if (SUCCEEDED(hr)) {
-    *_retval = PR_TRUE;
-    mHasCommit = PR_TRUE;
+    *_retval = true;
+    mHasCommit = true;
   }
 
   return NS_OK;
 }
 
 /* boolean deleteActiveList(); */
 NS_IMETHODIMP JumpListBuilder::DeleteActiveList(bool *_retval)
 {
-  *_retval = PR_FALSE;
+  *_retval = false;
 
   if (!mJumpListMgr)
     return NS_ERROR_NOT_AVAILABLE;
 
   if(sBuildingList)
     AbortListBuild();
 
   nsAutoString uid;
   if (!WinTaskbar::GetAppUserModelID(uid))
     return NS_OK;
 
   if (SUCCEEDED(mJumpListMgr->DeleteList(uid.get())))
-    *_retval = PR_TRUE;
+    *_retval = true;
 
   return NS_OK;
 }
 
 /* internal */
 
 bool JumpListBuilder::IsSeparator(nsCOMPtr<nsIJumpListItem>& item)
 {
   PRInt16 type;
   item->GetType(&type);
   if (NS_FAILED(item->GetType(&type)))
-    return PR_FALSE;
+    return false;
     
   if (type == nsIJumpListItem::JUMPLIST_ITEM_SEPARATOR)
-    return PR_TRUE;
-  return PR_FALSE;
+    return true;
+  return false;
 }
 
 // TransferIObjectArrayToIMutableArray - used in converting removed items
 // to our objects.
 nsresult JumpListBuilder::TransferIObjectArrayToIMutableArray(IObjectArray *objArray, nsIMutableArray *removedItems)
 {
   NS_ENSURE_ARG_POINTER(objArray);
   NS_ENSURE_ARG_POINTER(removedItems);
@@ -519,17 +519,17 @@ nsresult JumpListBuilder::TransferIObjec
     }
 
     if (pLink)
       pLink->Release();
     if (pItem)
       pItem->Release();
 
     if (NS_SUCCEEDED(rv)) {
-      removedItems->AppendElement(item, PR_FALSE);
+      removedItems->AppendElement(item, false);
     }
   }
   return NS_OK;
 }
 
 NS_IMETHODIMP JumpListBuilder::Observe(nsISupports* aSubject,
                                         const char* aTopic,
                                         const PRUnichar* aData)
@@ -698,17 +698,17 @@ NS_IMETHODIMP AsyncDeleteIconFromDisk::R
   // Check that we aren't deleting some arbitrary file that is not an icon
   if (StringTail(mIconPath, 4).LowerCaseEqualsASCII(".ico")) {
     // Check if the cached ICO file exists
     bool exists;
     if (NS_FAILED(icoFile->Exists(&exists)) || !exists)
       return NS_ERROR_FAILURE;
 
     // We found an ICO file that exists, so we should remove it
-    icoFile->Remove(PR_FALSE);
+    icoFile->Remove(false);
   }
 
   return NS_OK;
 }
 
 AsyncDeleteIconFromDisk::~AsyncDeleteIconFromDisk()
 {
 }
@@ -748,17 +748,17 @@ NS_IMETHODIMP AsyncDeleteAllFaviconsFrom
     PRInt32 len = path.Length();
     if (StringTail(path, 4).LowerCaseEqualsASCII(".ico")) {
       // Check if the cached ICO file exists
       bool exists;
       if (NS_FAILED(currFile->Exists(&exists)) || !exists)
         continue;
 
       // We found an ICO file that exists, so we should remove it
-      currFile->Remove(PR_FALSE);
+      currFile->Remove(false);
     }
   } while(true);
 
   return NS_OK;
 }
 
 AsyncDeleteAllFaviconsFromDisk::~AsyncDeleteAllFaviconsFromDisk()
 {
--- a/widget/src/windows/JumpListItem.cpp
+++ b/widget/src/windows/JumpListItem.cpp
@@ -105,27 +105,27 @@ NS_IMETHODIMP JumpListItem::GetType(PRIn
   return NS_OK;
 }
 
 /* boolean equals(nsIJumpListItem item); */
 NS_IMETHODIMP JumpListItem::Equals(nsIJumpListItem *aItem, bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aItem);
 
-  *aResult = PR_FALSE;
+  *aResult = false;
 
   PRInt16 theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
   if (NS_FAILED(aItem->GetType(&theType)))
     return NS_OK;
 
   // Make sure the types match.
   if (Type() != theType)
     return NS_OK;
 
-  *aResult = PR_TRUE;
+  *aResult = true;
 
   return NS_OK;
 }
 
 /* link impl. */
 
 /* attribute nsIURI uri; */
 NS_IMETHODIMP JumpListLink::GetUri(nsIURI **aURI)
@@ -192,17 +192,17 @@ NS_IMETHODIMP JumpListLink::CompareHash(
 
 /* boolean equals(nsIJumpListItem item); */
 NS_IMETHODIMP JumpListLink::Equals(nsIJumpListItem *aItem, bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aItem);
 
   nsresult rv;
 
-  *aResult = PR_FALSE;
+  *aResult = false;
 
   PRInt16 theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
   if (NS_FAILED(aItem->GetType(&theType)))
     return NS_OK;
 
   // Make sure the types match.
   if (Type() != theType)
     return NS_OK;
@@ -218,21 +218,21 @@ NS_IMETHODIMP JumpListLink::Equals(nsIJu
     return NS_OK;
 
   // Call the internal object's equals() method to check.
   nsCOMPtr<nsIURI> theUri;
   bool equals = false;
   if (NS_SUCCEEDED(link->GetUri(getter_AddRefs(theUri)))) {
     if (!theUri) {
       if (!mURI)
-        *aResult = PR_TRUE;
+        *aResult = true;
       return NS_OK;
     }
     if (NS_SUCCEEDED(theUri->Equals(mURI, &equals)) && equals) {
-      *aResult = PR_TRUE;
+      *aResult = true;
     }
   }
 
   return NS_OK;
 }
 
 /* shortcut impl. */
 
@@ -286,17 +286,17 @@ NS_IMETHODIMP JumpListShortcut::SetFavic
 
 /* boolean equals(nsIJumpListItem item); */
 NS_IMETHODIMP JumpListShortcut::Equals(nsIJumpListItem *aItem, bool *aResult)
 {
   NS_ENSURE_ARG_POINTER(aItem);
 
   nsresult rv;
 
-  *aResult = PR_FALSE;
+  *aResult = false;
 
   PRInt16 theType = nsIJumpListItem::JUMPLIST_ITEM_EMPTY;
   if (NS_FAILED(aItem->GetType(&theType)))
     return NS_OK;
 
   // Make sure the types match.
   if (Type() != theType)
     return NS_OK;
@@ -313,21 +313,21 @@ NS_IMETHODIMP JumpListShortcut::Equals(n
   // No need to check the icon page URI either
 
   // Call the internal object's equals() method to check.
   nsCOMPtr<nsILocalHandlerApp> theApp;
   bool equals = false;
   if (NS_SUCCEEDED(shortcut->GetApp(getter_AddRefs(theApp)))) {
     if (!theApp) {
       if (!mHandlerApp)
-        *aResult = PR_TRUE;
+        *aResult = true;
       return NS_OK;
     }
     if (NS_SUCCEEDED(theApp->Equals(mHandlerApp, &equals)) && equals) {
-      *aResult = PR_TRUE;
+      *aResult = true;
     }
   }
 
   return NS_OK;
 }
 
 /* internal helpers */
 
@@ -376,17 +376,17 @@ static PRInt32 GetICOCacheSecondsTimeout
   if (alreadyObtained) {
     return icoReCacheSecondsTimeout;
   }
 
   // Obtain the pref
   const char PREF_ICOTIMEOUT[]  = "browser.taskbar.lists.icoTimeoutInSeconds";
   icoReCacheSecondsTimeout = Preferences::GetInt(PREF_ICOTIMEOUT, 
                                                  kSecondsPerDay);
-  alreadyObtained = PR_TRUE;
+  alreadyObtained = true;
   return icoReCacheSecondsTimeout;
 }
 
 // (static) If the data is available, will return the path on disk where 
 // the favicon for page aFaviconPageURI is stored.  If the favicon does not
 // exist, or its cache is expired, this method will kick off an async request
 // for the icon so that next time the method is called it will be available. 
 nsresult JumpListShortcut::ObtainCachedIconFile(nsCOMPtr<nsIURI> aFaviconPageURI,
@@ -555,17 +555,17 @@ nsresult JumpListShortcut::GetShellLink(
 
   bool useUriIcon = false; // if we want to use the URI icon
   bool usedUriIcon = false; // if we did use the URI icon
   shortcut->GetIconIndex(&appIconIndex);
   
   nsCOMPtr<nsIURI> iconUri;
   rv = shortcut->GetFaviconPageUri(getter_AddRefs(iconUri));
   if (NS_SUCCEEDED(rv) && iconUri) {
-    useUriIcon = PR_TRUE;
+    useUriIcon = true;
   }
 
   // Store the title of the app
   if (appTitle.Length() > 0) {
     IPropertyStore* pPropStore = nsnull;
     hr = psl->QueryInterface(IID_IPropertyStore, (LPVOID*)&pPropStore);
     if (FAILED(hr))
       return NS_ERROR_UNEXPECTED;
@@ -587,17 +587,17 @@ nsresult JumpListShortcut::GetShellLink(
 
   if (useUriIcon) {
     nsString icoFilePath;
     rv = ObtainCachedIconFile(iconUri, icoFilePath, aIOThread);
     if (NS_SUCCEEDED(rv)) {
       // Always use the first icon in the ICO file
       // our encoded icon only has 1 resource
       psl->SetIconLocation(icoFilePath.get(), 0);
-      usedUriIcon = PR_TRUE;
+      usedUriIcon = true;
     }
   }
 
   // We didn't use an ICO via URI so fall back to the app icon
   if (!usedUriIcon) {
     psl->SetIconLocation(appPath.get(), appIconIndex);
   }
 
@@ -609,17 +609,17 @@ nsresult JumpListShortcut::GetShellLink(
 // If successful fills in the aSame parameter
 // aSame will be true if the path is in our icon cache
 static nsresult IsPathInOurIconCache(nsCOMPtr<nsIJumpListShortcut>& aShortcut, 
                                      PRUnichar *aPath, bool *aSame)
 {
   NS_ENSURE_ARG_POINTER(aPath);
   NS_ENSURE_ARG_POINTER(aSame);
  
-  *aSame = PR_FALSE;
+  *aSame = false;
 
   // Construct the path of our jump list cache
   nsCOMPtr<nsIFile> jumpListCache;
   nsresult rv = NS_GetSpecialDirectory("ProfLDS", getter_AddRefs(jumpListCache));
   NS_ENSURE_SUCCESS(rv, rv);
   rv = jumpListCache->AppendNative(nsDependentCString(JumpListItem::kJumpListCacheDir));
   NS_ENSURE_SUCCESS(rv, rv);
   nsAutoString jumpListCachePath;
@@ -657,17 +657,17 @@ nsresult JumpListShortcut::GetJumpListSh
 
   // Path
   hres = pLink->GetPath((LPWSTR)&buf, MAX_PATH, NULL, SLGP_UNCPRIORITY);
   if (FAILED(hres))
     return NS_ERROR_INVALID_ARG;
 
   nsCOMPtr<nsILocalFile> file;
   nsDependentString filepath(buf);
-  rv = NS_NewLocalFile(filepath, PR_FALSE, getter_AddRefs(file));
+  rv = NS_NewLocalFile(filepath, false, getter_AddRefs(file));
   NS_ENSURE_SUCCESS(rv, rv);
 
   rv = handlerApp->SetExecutable(file);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Parameters
   hres = pLink->GetArguments((LPWSTR)&buf, MAX_PATH);
   if (SUCCEEDED(hres)) {
@@ -808,26 +808,26 @@ nsresult JumpListLink::GetJumpListLink(I
 }
 
 // Confirm the app is on the system
 bool JumpListShortcut::ExecutableExists(nsCOMPtr<nsILocalHandlerApp>& handlerApp)
 {
   nsresult rv;
 
   if (!handlerApp)
-    return PR_FALSE;
+    return false;
 
   nsCOMPtr<nsIFile> executable;
   rv = handlerApp->GetExecutable(getter_AddRefs(executable));
   if (NS_SUCCEEDED(rv) && executable) {
     bool exists;
     executable->Exists(&exists);
     return exists;
   }
-  return PR_FALSE;
+  return false;
 }
 
 // (static) Helper method which will hash a URI
 nsresult JumpListItem::HashURI(nsCOMPtr<nsICryptoHash> &aCryptoHash, 
                                nsIURI *aUri, nsACString& aUriHash)
 {
   if (!aUri)
     return NS_ERROR_INVALID_ARG;
@@ -841,17 +841,17 @@ nsresult JumpListItem::HashURI(nsCOMPtr<
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   rv = aCryptoHash->Init(nsICryptoHash::MD5);
   NS_ENSURE_SUCCESS(rv, rv);
   rv = aCryptoHash->Update(reinterpret_cast<const PRUint8*>(spec.BeginReading()), 
                                                             spec.Length());
   NS_ENSURE_SUCCESS(rv, rv);
-  rv = aCryptoHash->Finish(PR_TRUE, aUriHash);
+  rv = aCryptoHash->Finish(true, aUriHash);
   NS_ENSURE_SUCCESS(rv, rv);
 
   return NS_OK;
 }
 
 } // namespace widget
 } // namespace mozilla
 
--- a/widget/src/windows/KeyboardLayout.cpp
+++ b/widget/src/windows/KeyboardLayout.cpp
@@ -125,17 +125,17 @@ VirtualKey::MatchingDeadKeyTable(const D
 
 void
 VirtualKey::SetNormalChars(PRUint8 aShiftState,
                            const PRUnichar* aChars,
                            PRUint32 aNumOfChars)
 {
   NS_ASSERTION(aShiftState < NS_ARRAY_LENGTH(mShiftStates), "invalid index");
 
-  SetDeadKey(aShiftState, PR_FALSE);
+  SetDeadKey(aShiftState, false);
 
   for (PRUint32 index = 0; index < aNumOfChars; index++) {
     // Ignore legacy non-printable control characters
     mShiftStates[aShiftState].Normal.Chars[index] =
       (aChars[index] >= 0x20) ? aChars[index] : 0;
   }
 
   PRUint32 len = NS_ARRAY_LENGTH(mShiftStates[aShiftState].Normal.Chars);
@@ -144,17 +144,17 @@ VirtualKey::SetNormalChars(PRUint8 aShif
   }
 }
 
 void
 VirtualKey::SetDeadChar(PRUint8 aShiftState, PRUnichar aDeadChar)
 {
   NS_ASSERTION(aShiftState < NS_ARRAY_LENGTH(mShiftStates), "invalid index");
 
-  SetDeadKey(aShiftState, PR_TRUE);
+  SetDeadKey(aShiftState, true);
 
   mShiftStates[aShiftState].DeadKey.DeadChar = aDeadChar;
   mShiftStates[aShiftState].DeadKey.Table = nsnull;
 }
 
 PRUint32
 VirtualKey::GetUniChars(PRUint8 aShiftState,
                         PRUnichar* aUniChars,
@@ -619,36 +619,36 @@ KeyboardLayout::DeactivateDeadKeyState()
     return;
   }
 
   BYTE kbdState[256];
   memset(kbdState, 0, sizeof(kbdState));
 
   SetShiftState(kbdState, mDeadKeyShiftState);
 
-  EnsureDeadKeyActive(PR_FALSE, mActiveDeadKey, kbdState);
+  EnsureDeadKeyActive(false, mActiveDeadKey, kbdState);
   mActiveDeadKey = -1;
 }
 
 bool
 KeyboardLayout::AddDeadKeyEntry(PRUnichar aBaseChar,
                                 PRUnichar aCompositeChar,
                                 DeadKeyEntry* aDeadKeyArray,
                                 PRUint32 aEntries)
 {
   for (PRUint32 index = 0; index < aEntries; index++) {
     if (aDeadKeyArray[index].BaseChar == aBaseChar) {
-      return PR_FALSE;
+      return false;
     }
   }
 
   aDeadKeyArray[aEntries].BaseChar = aBaseChar;
   aDeadKeyArray[aEntries].CompositeChar = aCompositeChar;
 
-  return PR_TRUE;
+  return true;
 }
 
 PRUint32
 KeyboardLayout::GetDeadKeyCombinations(PRUint8 aDeadKey,
                                        const PBYTE aDeadKeyKbdState,
                                        PRUint16 aShiftStatesWithBaseChars,
                                        DeadKeyEntry* aDeadKeyArray,
                                        PRUint32 aMaxEntries)
@@ -668,17 +668,17 @@ KeyboardLayout::GetDeadKeyCombinations(P
     for (PRUint32 virtualKey = 0; virtualKey < 256; virtualKey++) {
       PRInt32 vki = GetKeyIndex(virtualKey);
       // Dead-key can pair only with such key that produces exactly one base
       // character.
       if (vki >= 0 && mVirtualKeys[vki].GetNativeUniChars(shiftState) == 1) {
         // Ensure dead-key is in active state, when it swallows entered
         // character and waits for the next pressed key.
         if (!deadKeyActive) {
-          deadKeyActive = EnsureDeadKeyActive(PR_TRUE, aDeadKey,
+          deadKeyActive = EnsureDeadKeyActive(true, aDeadKey,
                                               aDeadKeyKbdState);
         }
 
         // Depending on the character the followed the dead-key, the keyboard
         // driver can produce one composite character, or a dead-key character
         // followed by a second character.
         PRUnichar compositeChars[5];
         PRInt32 ret =
@@ -697,32 +697,32 @@ KeyboardLayout::GetDeadKeyCombinations(P
             ret = ::ToUnicodeEx(virtualKey, 0, kbdState, (LPWSTR)baseChars,
                                 NS_ARRAY_LENGTH(baseChars), 0, mKeyboardLayout);
             NS_ASSERTION(ret == 1, "One base character expected");
             if (ret == 1 && entries < aMaxEntries &&
                 AddDeadKeyEntry(baseChars[0], compositeChars[0],
                                 aDeadKeyArray, entries)) {
               entries++;
             }
-            deadKeyActive = PR_FALSE;
+            deadKeyActive = false;
             break;
           }
           default:
             // 1. Unexpected dead-key. Dead-key chaining is not supported.
             // 2. More than one character generated. This is not a valid
             //    dead-key and base character combination.
-            deadKeyActive = PR_FALSE;
+            deadKeyActive = false;
             break;
         }
       }
     }
   }
 
   if (deadKeyActive) {
-    deadKeyActive = EnsureDeadKeyActive(PR_FALSE, aDeadKey, aDeadKeyKbdState);
+    deadKeyActive = EnsureDeadKeyActive(false, aDeadKey, aDeadKeyKbdState);
   }
 
   NS_QuickSort(aDeadKeyArray, entries, sizeof(DeadKeyEntry),
                CompareDeadKeyEntries, nsnull);
   return entries;
 }
 
 
--- a/widget/src/windows/KeyboardLayout.h
+++ b/widget/src/windows/KeyboardLayout.h
@@ -176,17 +176,17 @@ public:
   ~KeyboardLayout();
 
   static bool IsPrintableCharKey(PRUint8 aVirtualKey);
   static bool IsNumpadKey(PRUint8 aVirtualKey);
 
   bool IsDeadKey() const
   {
     return (mLastVirtualKeyIndex >= 0) ?
-      mVirtualKeys[mLastVirtualKeyIndex].IsDeadKey(mLastShiftState) : PR_FALSE;
+      mVirtualKeys[mLastVirtualKeyIndex].IsDeadKey(mLastShiftState) : false;
   }
 
   void LoadLayout(HKL aLayout);
   void OnKeyDown(PRUint8 aVirtualKey);
   PRUint32 GetUniChars(PRUnichar* aUniChars, PRUint8* aShiftStates,
                        PRUint32 aMaxChars) const;
   PRUint32 GetUniCharsWithShiftState(PRUint8 aVirtualKey, PRUint8 aShiftStates,
                                      PRUnichar* aUniChars,
--- a/widget/src/windows/TaskbarPreview.cpp
+++ b/widget/src/windows/TaskbarPreview.cpp
@@ -131,17 +131,17 @@ ResetRenderingContext() {
 }
 
 }
 
 TaskbarPreview::TaskbarPreview(ITaskbarList4 *aTaskbar, nsITaskbarPreviewController *aController, HWND aHWND, nsIDocShell *aShell)
   : mTaskbar(aTaskbar),
     mController(aController),
     mWnd(aHWND),
-    mVisible(PR_FALSE),
+    mVisible(false),
     mDocShell(do_GetWeakReference(aShell))
 {
   // TaskbarPreview may outlive the WinTaskbar that created it
   ::CoInitialize(NULL);
 
   gInstCount++;
 
   WindowHook &hook = GetWindowHook();
@@ -247,17 +247,17 @@ nsresult
 TaskbarPreview::UpdateTaskbarProperties() {
   nsresult rv = UpdateTooltip();
 
   // If we are the active preview and our window is the active window, restore
   // our active state - otherwise some other non-preview window is now active
   // and should be displayed as so.
   if (sActivePreview == this) {
     if (mWnd == ::GetActiveWindow()) {
-      nsresult rvActive = ShowActive(PR_TRUE);
+      nsresult rvActive = ShowActive(true);
       if (NS_FAILED(rvActive))
         rv = rvActive;
     } else {
       sActivePreview = nsnull;
     }
   }
   return rv;
 }
@@ -282,20 +282,20 @@ TaskbarPreview::Disable() {
   return NS_OK;
 }
 
 bool
 TaskbarPreview::IsWindowAvailable() const {
   if (mWnd) {
     nsWindow* win = nsWindow::GetNSWindowPtr(mWnd);
     if(win && !win->HasDestroyStarted()) {
-      return PR_TRUE;
+      return true;
     }
   }
-  return PR_FALSE;
+  return false;
 }
 
 void
 TaskbarPreview::DetachFromNSWindow() {
   WindowHook &hook = GetWindowHook();
   hook.RemoveMonitor(WM_DESTROY, MainWindowHook, this);
   mWnd = NULL;
 }
@@ -319,53 +319,53 @@ TaskbarPreview::WndProc(UINT nMsg, WPARA
         PRUint32 thumbnailHeight = height;
 
         if (aspectRatio > preferredAspectRatio) {
           thumbnailWidth = PRUint32(thumbnailHeight * preferredAspectRatio);
         } else {
           thumbnailHeight = PRUint32(thumbnailWidth / preferredAspectRatio);
         }
 
-        DrawBitmap(thumbnailWidth, thumbnailHeight, PR_FALSE);
+        DrawBitmap(thumbnailWidth, thumbnailHeight, false);
       }
       break;
     case WM_DWMSENDICONICLIVEPREVIEWBITMAP:
       {
         PRUint32 width, height;
         nsresult rv;
         rv = mController->GetWidth(&width);
         if (NS_FAILED(rv))
           break;
         rv = mController->GetHeight(&height);
         if (NS_FAILED(rv))
           break;
 
-        DrawBitmap(width, height, PR_TRUE);
+        DrawBitmap(width, height, true);
       }
       break;
   }
   return ::DefWindowProcW(PreviewWindow(), nMsg, wParam, lParam);
 }
 
 bool
 TaskbarPreview::CanMakeTaskbarCalls() {
   // If the nsWindow has already been destroyed and we know it but our caller
   // clearly doesn't so we can't make any calls.
   if (!mWnd)
-    return PR_FALSE;
+    return false;
   // Certain functions like SetTabOrder seem to require a visible window. During
   // window close, the window seems to be hidden before being destroyed.
   if (!::IsWindowVisible(mWnd))
-    return PR_FALSE;
+    return false;
   if (mVisible) {
     nsWindow *window = nsWindow::GetNSWindowPtr(mWnd);
     NS_ASSERTION(window, "Could not get nsWindow from HWND");
     return window->HasTaskbarIconBeenCreated();
   }
-  return PR_FALSE;
+  return false;
 }
 
 WindowHook&
 TaskbarPreview::GetWindowHook() {
   nsWindow *window = nsWindow::GetNSWindowPtr(mWnd);
   NS_ASSERTION(window, "Cannot use taskbar previews in an embedded context!");
 
   return window->GetWindowHook();
@@ -452,17 +452,17 @@ TaskbarPreview::MainWindowHook(void *aCo
     nsWindow *window = nsWindow::GetNSWindowPtr(preview->mWnd);
     NS_ASSERTION(window, "Cannot use taskbar previews in an embedded context!");
 
     window->SetHasTaskbarIconBeenCreated();
 
     if (preview->mVisible)
       preview->UpdateTaskbarProperties();
   }
-  return PR_FALSE;
+  return false;
 }
 
 TaskbarPreview *
 TaskbarPreview::sActivePreview = nsnull;
 
 } // namespace widget
 } // namespace mozilla
 
--- a/widget/src/windows/TaskbarPreviewButton.cpp
+++ b/widget/src/windows/TaskbarPreviewButton.cpp
@@ -54,17 +54,17 @@ namespace widget {
 NS_IMPL_ISUPPORTS2(TaskbarPreviewButton, nsITaskbarPreviewButton, nsISupportsWeakReference)
 
 TaskbarPreviewButton::TaskbarPreviewButton(TaskbarWindowPreview* preview, PRUint32 index)
   : mPreview(preview), mIndex(index)
 {
 }
 
 TaskbarPreviewButton::~TaskbarPreviewButton() {
-  SetVisible(PR_FALSE);
+  SetVisible(false);
 }
 
 NS_IMETHODIMP
 TaskbarPreviewButton::GetTooltip(nsAString &aTooltip) {
   aTooltip = mTooltip;
   return NS_OK;
 }
 
@@ -135,17 +135,17 @@ TaskbarPreviewButton::GetImage(imgIConta
 }
 
 NS_IMETHODIMP
 TaskbarPreviewButton::SetImage(imgIContainer *img) {
   if (Button().hIcon)
     ::DestroyIcon(Button().hIcon);
   if (img) {
     nsresult rv;
-    rv = nsWindowGfx::CreateIcon(img, PR_FALSE, 0, 0,
+    rv = nsWindowGfx::CreateIcon(img, false, 0, 0,
                                  nsWindowGfx::GetIconMetrics(nsWindowGfx::kRegularIcon),
                                  &Button().hIcon);
     NS_ENSURE_SUCCESS(rv, rv);
   } else {
     Button().hIcon = NULL;
   }
   return Update();
 }
--- a/widget/src/windows/TaskbarTabPreview.cpp
+++ b/widget/src/windows/TaskbarTabPreview.cpp
@@ -53,17 +53,17 @@ namespace widget {
 NS_IMPL_ISUPPORTS1(TaskbarTabPreview, nsITaskbarTabPreview)
 
 const PRUnichar *const kWindowClass = L"MozillaTaskbarPreviewClass";
 
 TaskbarTabPreview::TaskbarTabPreview(ITaskbarList4 *aTaskbar, nsITaskbarPreviewController *aController, HWND aHWND, nsIDocShell *aShell)
   : TaskbarPreview(aTaskbar, aController, aHWND, aShell),
     mProxyWindow(NULL),
     mIcon(NULL),
-    mRegistered(PR_FALSE)
+    mRegistered(false)
 {
   WindowHook &hook = GetWindowHook();
   hook.AddMonitor(WM_WINDOWPOSCHANGED, MainWindowHook, this);
 }
 
 TaskbarTabPreview::~TaskbarTabPreview() {
   if (mIcon) {
     ::DestroyIcon(mIcon);
@@ -120,17 +120,17 @@ TaskbarTabPreview::SetTitle(const nsAStr
   return mVisible ? UpdateTitle() : NS_OK;
 }
 
 NS_IMETHODIMP
 TaskbarTabPreview::SetIcon(imgIContainer *icon) {
   HICON hIcon = NULL;
   if (icon) {
     nsresult rv;
-    rv = nsWindowGfx::CreateIcon(icon, PR_FALSE, 0, 0,
+    rv = nsWindowGfx::CreateIcon(icon, false, 0, 0,
                                  nsWindowGfx::GetIconMetrics(nsWindowGfx::kSmallIcon),
                                  &hIcon);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   if (mIcon)
     ::DestroyIcon(mIcon);
   mIcon = hIcon;
@@ -158,26 +158,26 @@ TaskbarTabPreview::UpdateTaskbarProperti
     return NS_OK;
 
   if (FAILED(mTaskbar->RegisterTab(mProxyWindow, mWnd)))
     return NS_ERROR_FAILURE;
 
   nsresult rv = UpdateNext();
   NS_ENSURE_SUCCESS(rv, rv);
   rv = TaskbarPreview::UpdateTaskbarProperties();
-  mRegistered = PR_TRUE;
+  mRegistered = true;
   return rv;
 }
 
 LRESULT
 TaskbarTabPreview::WndProc(UINT nMsg, WPARAM wParam, LPARAM lParam) {
   nsRefPtr<TaskbarTabPreview> kungFuDeathGrip(this);
   switch (nMsg) {
     case WM_CREATE:
-      TaskbarPreview::EnableCustomDrawing(mProxyWindow, PR_TRUE);
+      TaskbarPreview::EnableCustomDrawing(mProxyWindow, true);
       return 0;
     case WM_CLOSE:
       mController->OnClose();
       return 0;
     case WM_ACTIVATE:
       if (LOWORD(wParam) == WA_ACTIVE) {
         // Activate the tab the user selected then restore the main window,
         // keeping normal/max window state intact.
@@ -286,28 +286,28 @@ TaskbarTabPreview::Disable() {
   // TaskbarPreview::Disable assumes that mWnd is valid but this method can be
   // called when it is null iff the nsWindow has already been destroyed and we
   // are still visible for some reason during object destruction.
   if (mWnd)
     TaskbarPreview::Disable();
 
   if (FAILED(mTaskbar->UnregisterTab(mProxyWindow)))
     return NS_ERROR_FAILURE;
-  mRegistered = PR_FALSE;
+  mRegistered = false;
 
   // TaskbarPreview::WndProc will set mProxyWindow to null
   if (!DestroyWindow(mProxyWindow))
     return NS_ERROR_FAILURE;
   mProxyWindow = NULL;
   return NS_OK;
 }
 
 void
 TaskbarTabPreview::DetachFromNSWindow() {
-  (void) SetVisible(PR_FALSE);
+  (void) SetVisible(false);
   WindowHook &hook = GetWindowHook();
   hook.RemoveMonitor(WM_WINDOWPOSCHANGED, MainWindowHook, this);
 
   TaskbarPreview::DetachFromNSWindow();
 }
 
 /* static */
 bool
@@ -318,17 +318,17 @@ TaskbarTabPreview::MainWindowHook(void *
   if (nMsg == WM_WINDOWPOSCHANGED) {
     TaskbarTabPreview *preview = reinterpret_cast<TaskbarTabPreview*>(aContext);
     WINDOWPOS *pos = reinterpret_cast<WINDOWPOS*>(lParam);
     if (SWP_FRAMECHANGED == (pos->flags & SWP_FRAMECHANGED))
       preview->UpdateProxyWindowStyle();
   } else {
     NS_NOTREACHED("Style changed hook fired on non-style changed message");
   }
-  return PR_FALSE;
+  return false;
 }
 
 void
 TaskbarTabPreview::UpdateProxyWindowStyle() {
   if (!mProxyWindow)
     return;
 
   DWORD minMaxMask = WS_MINIMIZE | WS_MAXIMIZE;
--- a/widget/src/windows/TaskbarWindowPreview.cpp
+++ b/widget/src/windows/TaskbarWindowPreview.cpp
@@ -52,17 +52,17 @@
 namespace mozilla {
 namespace widget {
 
 namespace {
 bool WindowHookProc(void *aContext, HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LRESULT *aResult)
 {
   TaskbarWindowPreview *preview = reinterpret_cast<TaskbarWindowPreview*>(aContext);
   *aResult = preview->WndProc(nMsg, wParam, lParam);
-  return PR_TRUE;
+  return true;