Backout all of the bugs in the 7e12e3e16e6c pushlog because of the orange.
authorEhsan Akhgari <ehsan@mozilla.com>
Fri, 04 Feb 2011 16:34:02 -0500
changeset 61964 afdc0c8b967492ccc1d1e120d8235856dbdcfe4f
parent 61960 7e12e3e16e6c053affbd82b3bfde196f405af6eb
child 61965 cf5069883c1da0b55ad3e8b3c184b0214bf4dfbd
push idunknown
push userunknown
push dateunknown
milestone2.0b12pre
Backout all of the bugs in the 7e12e3e16e6c pushlog because of the orange. It is not clear which one of these bugs is at fault.
content/base/public/nsISyncLoadDOMService.idl
content/base/public/nsIXMLHttpRequest.idl
content/base/src/nsAttrValue.cpp
content/base/src/nsAttrValue.h
content/base/src/nsContentSink.cpp
content/base/src/nsImageLoadingContent.cpp
content/html/content/src/nsGenericHTMLElement.cpp
content/html/content/src/nsHTMLDivElement.cpp
content/html/content/src/nsHTMLFrameElement.cpp
content/html/content/src/nsHTMLHRElement.cpp
content/html/content/src/nsHTMLIFrameElement.cpp
content/html/content/src/nsHTMLInputElement.cpp
content/html/content/src/nsHTMLTableCellElement.cpp
content/html/content/src/nsHTMLTableColElement.cpp
content/html/content/src/nsHTMLTableElement.cpp
content/html/content/src/nsHTMLTableRowElement.cpp
content/html/content/src/nsHTMLTableSectionElement.cpp
content/html/content/src/nsHTMLVideoElement.cpp
content/html/content/test/Makefile.in
content/html/content/test/test_bug599975.html
content/xslt/public/nsIXSLTProcessorObsolete.idl
dom/base/nsDOMClassInfoID.h
dom/plugins/PluginInstanceChild.cpp
gfx/layers/opengl/ContainerLayerOGL.cpp
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/layers/opengl/LayerManagerOGL.h
gfx/thebes/gfxMatrix.h
js/src/xpconnect/src/nsDOMQS.h
layout/base/tests/test_bug629838.html
modules/libjar/nsJAR.cpp
modules/libjar/nsJARChannel.cpp
modules/libjar/nsZipArchive.cpp
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/test/unit/test_gzipped_206.js
netwerk/test/unit/test_range_requests.js
netwerk/test/unit/test_resumable_truncate.js
toolkit/mozapps/extensions/content/extensions.js
toolkit/mozapps/extensions/test/browser/browser_sorting.js
widget/src/windows/nsWindow.cpp
--- a/content/base/public/nsISyncLoadDOMService.idl
+++ b/content/base/public/nsISyncLoadDOMService.idl
@@ -59,21 +59,19 @@ interface nsIChannel;
  *    Don't make me come over there!!                                    *
  *                                                                       *
  *                                                                       *
  ************************************************************************/
 
 /**
  * The nsISyncDOMLoadService interface can be used to synchronously load
  * a document.
- *
- * @deprecated use XMLHttpRequest instead
  */
 
-[deprecated, scriptable, uuid(8095998d-ae1c-4cfa-9b43-0973e5d77eb0)]
+[scriptable, uuid(8095998d-ae1c-4cfa-9b43-0973e5d77eb0)]
 interface nsISyncLoadDOMService : nsISupports
 {
     /**
      * Synchronously load the document from the specified channel.
      *
      * @param aChannel   The channel to load the document from.
      * @param aLoaderPrincipal Principal of loading document. For security
      *                         checks null if no securitychecks should be done
--- a/content/base/public/nsIXMLHttpRequest.idl
+++ b/content/base/public/nsIXMLHttpRequest.idl
@@ -386,19 +386,19 @@ interface nsIXMLHttpRequest : nsISupport
 [scriptable, uuid(840d0d00-e83e-4a29-b3c7-67e96e90a499)]
 interface nsIXHRSendable : nsISupports {
   void getSendInfo(out nsIInputStream body,
                    out ACString contentType,
                    out ACString charset);
 };
 
 /**
- * @deprecated
+ * DEPRECATED.
  */
-[deprecated, scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
+[scriptable, uuid(423fdd3d-41c9-4149-8fe5-b14a1d3912a0)]
 interface nsIJSXMLHttpRequest : nsISupports {
   /**
    * Meant to be a script-only mechanism for setting an upload progress event
    * listener.
    * This attribute should not be used from native code!!
    * This event listener may be called multiple times during the upload..
    *
    * After the initial response, all event listeners will be cleared.
--- a/content/base/src/nsAttrValue.cpp
+++ b/content/base/src/nsAttrValue.cpp
@@ -1049,34 +1049,35 @@ nsAttrValue::ParseEnumValue(const nsAStr
     }
     tableEntry++;
   }
 
   return PR_FALSE;
 }
 
 PRBool
-nsAttrValue::ParseSpecialIntValue(const nsAString& aString)
+nsAttrValue::ParseSpecialIntValue(const nsAString& aString,
+                                  PRBool aCanBePercent)
 {
   ResetIfSet();
 
   PRInt32 ec;
   PRBool strict;
   PRBool isPercent = PR_FALSE;
   nsAutoString tmp(aString);
-  PRInt32 originalVal = StringToInteger(aString, &strict, &ec, PR_TRUE, &isPercent);
+  PRInt32 originalVal = StringToInteger(aString, &strict, &ec, aCanBePercent, &isPercent);
 
   if (NS_FAILED(ec)) {
     return PR_FALSE;
   }
 
   PRInt32 val = NS_MAX(originalVal, 0);
 
   // % (percent)
-  if (isPercent || tmp.RFindChar('%') >= 0) {
+  if (aCanBePercent && (isPercent || tmp.RFindChar('%') >= 0)) {
     isPercent = PR_TRUE;
   }
 
   strict = strict && (originalVal == val);
 
   SetIntValueAndType(val,
                      isPercent ? ePercent : eInteger,
                      strict ? nsnull : &aString);
--- a/content/base/src/nsAttrValue.h
+++ b/content/base/src/nsAttrValue.h
@@ -224,21 +224,23 @@ public:
                         PRBool aCaseSensitive);
 
   /**
    * Parse a string into an integer. Can optionally parse percent (n%).
    * This method explicitly sets a lower bound of zero on the element,
    * whether it be percent or raw integer.
    *
    * @param aString the string to parse
+   * @param aCanBePercent PR_TRUE if it can be a percent value (%)
    * @return whether the value could be parsed
    *
    * @see http://www.whatwg.org/html/#rules-for-parsing-dimension-values
    */
-  PRBool ParseSpecialIntValue(const nsAString& aString);
+  PRBool ParseSpecialIntValue(const nsAString& aString,
+                              PRBool aCanBePercent);
 
 
   /**
    * Parse a string value into an integer.
    *
    * @param aString the string to parse
    * @return whether the value could be parsed
    */
--- a/content/base/src/nsContentSink.cpp
+++ b/content/base/src/nsContentSink.cpp
@@ -519,16 +519,19 @@ nsContentSink::ProcessHeaderData(nsIAtom
     rv = cookieServ->SetCookieString(codebaseURI,
                                      prompt,
                                      NS_ConvertUTF16toUTF8(aValue).get(),
                                      channel);
     if (NS_FAILED(rv)) {
       return rv;
     }
   }
+  else if (aHeader == nsGkAtoms::link) {
+    rv = ProcessLinkHeader(aContent, aValue);
+  }
   else if (aHeader == nsGkAtoms::msthemecompatible) {
     // Disable theming for the presshell if the value is no.
     // XXXbz don't we want to support this as an HTTP header too?
     nsAutoString value(aValue);
     if (value.LowerCaseEqualsLiteral("no")) {
       nsIPresShell* shell = mDocument->GetShell();
       if (shell) {
         shell->DisableThemeSupport();
--- a/content/base/src/nsImageLoadingContent.cpp
+++ b/content/base/src/nsImageLoadingContent.cpp
@@ -636,25 +636,25 @@ nsImageLoadingContent::LoadImage(const n
   // XXXbiesi fire onerror if that failed?
 
   PRBool equal;
 
   if (aNewURI.IsEmpty() &&
       doc->GetDocumentURI() &&
       NS_SUCCEEDED(doc->GetDocumentURI()->Equals(imageURI, &equal)) && 
       equal)  {
+
     // Loading an embedded img from the same URI as the document URI will not work
     // as a resource cannot recursively embed itself. Attempting to do so generally
     // results in having to pre-emptively close down an in-flight HTTP transaction 
     // and then incurring the significant cost of establishing a new TCP channel.
     // This is generally triggered from <img src=""> 
     // In light of that, just skip loading it..
     // Do make sure to drop our existing image, if any
     CancelImageRequests(aNotify);
-    FireEvent(NS_LITERAL_STRING("error"));
     return NS_OK;
   }
 
   NS_TryToSetImmutable(imageURI);
 
   return LoadImage(imageURI, aForce, aNotify, doc);
 }
 
--- a/content/html/content/src/nsGenericHTMLElement.cpp
+++ b/content/html/content/src/nsGenericHTMLElement.cpp
@@ -1611,17 +1611,17 @@ nsGenericHTMLElement::ParseDivAlignValue
 
 PRBool
 nsGenericHTMLElement::ParseImageAttribute(nsIAtom* aAttribute,
                                           const nsAString& aString,
                                           nsAttrValue& aResult)
 {
   if ((aAttribute == nsGkAtoms::width) ||
       (aAttribute == nsGkAtoms::height)) {
-    return aResult.ParseSpecialIntValue(aString);
+    return aResult.ParseSpecialIntValue(aString, PR_TRUE);
   }
   else if ((aAttribute == nsGkAtoms::hspace) ||
            (aAttribute == nsGkAtoms::vspace) ||
            (aAttribute == nsGkAtoms::border)) {
     return aResult.ParseIntWithBounds(aString, 0);
   }
   return PR_FALSE;
 }
--- a/content/html/content/src/nsHTMLDivElement.cpp
+++ b/content/html/content/src/nsHTMLDivElement.cpp
@@ -111,17 +111,17 @@ nsHTMLDivElement::ParseAttribute(PRInt32
                                  nsIAtom* aAttribute,
                                  const nsAString& aValue,
                                  nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (mNodeInfo->Equals(nsGkAtoms::marquee)) {
       if ((aAttribute == nsGkAtoms::width) ||
           (aAttribute == nsGkAtoms::height)) {
-        return aResult.ParseSpecialIntValue(aValue);
+        return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
       }
       if (aAttribute == nsGkAtoms::bgcolor) {
         return aResult.ParseColor(aValue);
       }
       if ((aAttribute == nsGkAtoms::hspace) ||
           (aAttribute == nsGkAtoms::vspace)) {
         return aResult.ParseIntWithBounds(aValue, 0);
       }
--- a/content/html/content/src/nsHTMLFrameElement.cpp
+++ b/content/html/content/src/nsHTMLFrameElement.cpp
@@ -134,20 +134,20 @@ nsHTMLFrameElement::ParseAttribute(PRInt
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::bordercolor) {
       return aResult.ParseColor(aValue);
     }
     if (aAttribute == nsGkAtoms::frameborder) {
       return ParseFrameborderValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::marginwidth) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::marginheight) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::scrolling) {
       return ParseScrollingValue(aValue, aResult);
     }
   }
 
   return nsGenericHTMLFrameElement::ParseAttribute(aNamespaceID, aAttribute,
                                                    aValue, aResult);
--- a/content/html/content/src/nsHTMLHRElement.cpp
+++ b/content/html/content/src/nsHTMLHRElement.cpp
@@ -129,17 +129,17 @@ static const nsAttrValue::EnumTable kAli
 PRBool
 nsHTMLHRElement::ParseAttribute(PRInt32 aNamespaceID,
                                 nsIAtom* aAttribute,
                                 const nsAString& aValue,
                                 nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::size) {
       return aResult.ParseIntWithBounds(aValue, 1, 1000);
     }
     if (aAttribute == nsGkAtoms::align) {
       return aResult.ParseEnumValue(aValue, kAlignTable, PR_FALSE);
     }
     if (aAttribute == nsGkAtoms::color) {
--- a/content/html/content/src/nsHTMLIFrameElement.cpp
+++ b/content/html/content/src/nsHTMLIFrameElement.cpp
@@ -157,26 +157,26 @@ nsHTMLIFrameElement::GetSVGDocument(nsID
 PRBool
 nsHTMLIFrameElement::ParseAttribute(PRInt32 aNamespaceID,
                                     nsIAtom* aAttribute,
                                     const nsAString& aValue,
                                     nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::marginwidth) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::marginheight) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::frameborder) {
       return ParseFrameborderValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::scrolling) {
       return ParseScrollingValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::align) {
--- a/content/html/content/src/nsHTMLInputElement.cpp
+++ b/content/html/content/src/nsHTMLInputElement.cpp
@@ -2693,20 +2693,20 @@ nsHTMLInputElement::ParseAttribute(PRInt
         }
 
         HandleTypeChange(newType);
       }
 
       return success;
     }
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::maxlength) {
       return aResult.ParseNonNegativeIntValue(aValue);
     }
     if (aAttribute == nsGkAtoms::size) {
       return aResult.ParsePositiveIntValue(aValue);
     }
     if (aAttribute == nsGkAtoms::border) {
--- a/content/html/content/src/nsHTMLTableCellElement.cpp
+++ b/content/html/content/src/nsHTMLTableCellElement.cpp
@@ -300,20 +300,20 @@ nsHTMLTableCellElement::ParseAttribute(P
         // quirks mode does not honor the special html 4 value of 0
         if (val < 0 || (0 == val && InNavQuirksMode(GetOwnerDoc()))) {
           aResult.SetTo(1);
         }
       }
       return res;
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::align) {
       return ParseTableCellHAlignValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::bgcolor) {
       return aResult.ParseColor(aValue);
     }
     if (aAttribute == nsGkAtoms::scope) {
--- a/content/html/content/src/nsHTMLTableColElement.cpp
+++ b/content/html/content/src/nsHTMLTableColElement.cpp
@@ -123,24 +123,24 @@ PRBool
 nsHTMLTableColElement::ParseAttribute(PRInt32 aNamespaceID,
                                       nsIAtom* aAttribute,
                                       const nsAString& aValue,
                                       nsAttrValue& aResult)
 {
   if (aNamespaceID == kNameSpaceID_None) {
     /* ignore these attributes, stored simply as strings ch */
     if (aAttribute == nsGkAtoms::charoff) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::span) {
       /* protection from unrealistic large colspan values */
       return aResult.ParseIntWithBounds(aValue, 1, MAX_COLSPAN);
     }
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::align) {
       return ParseTableCellHAlignValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::valign) {
       return ParseTableVAlignValue(aValue, aResult);
     }
   }
--- a/content/html/content/src/nsHTMLTableElement.cpp
+++ b/content/html/content/src/nsHTMLTableElement.cpp
@@ -978,34 +978,34 @@ nsHTMLTableElement::ParseAttribute(PRInt
                                    nsIAtom* aAttribute,
                                    const nsAString& aValue,
                                    nsAttrValue& aResult)
 {
   /* ignore summary, just a string */
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::cellspacing ||
         aAttribute == nsGkAtoms::cellpadding) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::cols) {
       return aResult.ParseIntWithBounds(aValue, 0);
     }
     if (aAttribute == nsGkAtoms::border) {
       if (!aResult.ParseIntWithBounds(aValue, 0)) {
         // XXX this should really be NavQuirks only to allow non numeric value
         aResult.SetTo(1);
       }
 
       return PR_TRUE;
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::width) {
-      if (aResult.ParseSpecialIntValue(aValue)) {
+      if (aResult.ParseSpecialIntValue(aValue, PR_TRUE)) {
         // treat 0 width as auto
         nsAttrValue::ValueType type = aResult.Type();
         if ((type == nsAttrValue::eInteger &&
              aResult.GetIntegerValue() == 0) ||
             (type == nsAttrValue::ePercent &&
              aResult.GetPercentValue() == 0.0f)) {
           return PR_FALSE;
         }
--- a/content/html/content/src/nsHTMLTableRowElement.cpp
+++ b/content/html/content/src/nsHTMLTableRowElement.cpp
@@ -378,20 +378,20 @@ nsHTMLTableRowElement::ParseAttribute(PR
    * ch
    */
 
   if (aNamespaceID == kNameSpaceID_None) {
     if (aAttribute == nsGkAtoms::charoff) {
       return aResult.ParseIntWithBounds(aValue, 0);
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::width) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::align) {
       return ParseTableCellHAlignValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::bgcolor) {
       return aResult.ParseColor(aValue);
     }
     if (aAttribute == nsGkAtoms::valign) {
--- a/content/html/content/src/nsHTMLTableSectionElement.cpp
+++ b/content/html/content/src/nsHTMLTableSectionElement.cpp
@@ -247,17 +247,17 @@ nsHTMLTableSectionElement::ParseAttribut
   if (aNamespaceID == kNameSpaceID_None) {
     /* ignore these attributes, stored simply as strings
        ch
     */
     if (aAttribute == nsGkAtoms::charoff) {
       return aResult.ParseIntWithBounds(aValue, 0);
     }
     if (aAttribute == nsGkAtoms::height) {
-      return aResult.ParseSpecialIntValue(aValue);
+      return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
     }
     if (aAttribute == nsGkAtoms::align) {
       return ParseTableCellHAlignValue(aValue, aResult);
     }
     if (aAttribute == nsGkAtoms::bgcolor) {
       return aResult.ParseColor(aValue);
     }
     if (aAttribute == nsGkAtoms::valign) {
--- a/content/html/content/src/nsHTMLVideoElement.cpp
+++ b/content/html/content/src/nsHTMLVideoElement.cpp
@@ -119,17 +119,17 @@ nsIntSize nsHTMLVideoElement::GetVideoSi
 
 PRBool
 nsHTMLVideoElement::ParseAttribute(PRInt32 aNamespaceID,
                                    nsIAtom* aAttribute,
                                    const nsAString& aValue,
                                    nsAttrValue& aResult)
 {
    if (aAttribute == nsGkAtoms::width || aAttribute == nsGkAtoms::height) {
-     return aResult.ParseSpecialIntValue(aValue);
+     return aResult.ParseSpecialIntValue(aValue, PR_TRUE);
    }
 
    return nsHTMLMediaElement::ParseAttribute(aNamespaceID, aAttribute, aValue,
                                              aResult);
 }
 
 static void
 MapAttributesIntoRule(const nsMappedAttributes* aAttributes,
--- a/content/html/content/test/Makefile.in
+++ b/content/html/content/test/Makefile.in
@@ -231,17 +231,16 @@ include $(topsrcdir)/config/rules.mk
 		test_bug600155.html \
 		test_bug556007.html \
 		test_bug606817.html \
 		test_bug297761.html \
 		file_bug297761.html \
 		test_bug607145.html \
 		test_bug601061.html \
 		test_bug596511.html \
-		test_bug599975.html \
 		reflect.js \
 		test_bug611189.html \
 		test_bug613113.html \
 		test_bug605124-1.html \
 		test_bug605124-2.html \
 		test_bug605125-1.html \
 		test_bug605125-2.html \
 		test_bug612730.html \
deleted file mode 100644
--- a/content/html/content/test/test_bug599975.html
+++ /dev/null
@@ -1,35 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=599975
--->
-<head>
-  <title>Test for Bug 599975</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"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=599975">Mozilla Bug 599975</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-<img id=image>
-</div>
-<pre id="test">
-<script type="application/javascript">
-/** Test for Bug 599975 **/
-SimpleTest.waitForExplicitFinish();
-var img = document.getElementById("image");
-img.onerror = function() {
-  ok(true, "onerror fired");
-  SimpleTest.finish();
-}
-img.onload = function() {
-  ok(false, "onload fired");
-  SimpleTest.finish();
-}
-img.src = "";
-</script>
-</pre>
-</body>
-</html>
--- a/content/xslt/public/nsIXSLTProcessorObsolete.idl
+++ b/content/xslt/public/nsIXSLTProcessorObsolete.idl
@@ -39,19 +39,19 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsISupports.idl"
 
 interface nsIDOMNode;
 interface nsIDOMDocument;
 
 /**
- * @deprecated Use nsIXSLTProcessor instead!!
+ * DEPRECATED! Don't use this interface! Use nsIXSLTProcessor instead!!
  */
 
-[deprecated, scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)]
+[scriptable, uuid(3fbff728-2d20-11d3-aef3-00108300ff91)]
 interface nsIXSLTProcessorObsolete : nsISupports
 {
     void transformDocument(in nsIDOMNode aSourceDOM,
                            in nsIDOMNode aStyleDOM,
                            in nsIDOMDocument aOutputDOC,
                            in nsISupports aObserver);
 };
--- a/dom/base/nsDOMClassInfoID.h
+++ b/dom/base/nsDOMClassInfoID.h
@@ -68,17 +68,16 @@ enum nsDOMClassInfoID {
  * DOMCI_CASTABLE_INTERFACES(extra). For every interface there will be one
  * call to DOMCI_CASTABLE_INTERFACE with the bit that it corresponds to and
  * the extra argument that was passed in to DOMCI_CASTABLE_INTERFACES.
  *
  * WARNING: Be very careful when adding interfaces to this list. Every object
  *          that implements one of these interfaces must be directly castable
  *          to that interface from the *canonical* nsISupports!
  */
-#undef DOMCI_CASTABLE_INTERFACE
 #define DOMCI_CASTABLE_INTERFACES(_extra)                                     \
 DOMCI_CASTABLE_INTERFACE(nsINode, nsINode, 0, _extra)                         \
 DOMCI_CASTABLE_INTERFACE(nsIContent, nsIContent, 1, _extra)                   \
 DOMCI_CASTABLE_INTERFACE(nsIDocument, nsIDocument, 2, _extra)                 \
 DOMCI_CASTABLE_INTERFACE(nsINodeList, nsINodeList, 3, _extra)                 \
 DOMCI_CASTABLE_INTERFACE(nsICSSDeclaration, nsICSSDeclaration, 4, _extra)     \
 DOMCI_CASTABLE_INTERFACE(nsGenericTextNode, nsGenericTextNode, 5, _extra)     \
 DOMCI_CASTABLE_INTERFACE(nsDocument, nsIDocument, 6, _extra)                  \
--- a/dom/plugins/PluginInstanceChild.cpp
+++ b/dom/plugins/PluginInstanceChild.cpp
@@ -1388,23 +1388,19 @@ PluginInstanceChild::SetWindowLongAHook(
     // Set flash's new subclass to get the result. 
     LONG_PTR proc = sUser32SetWindowLongAHookStub(hWnd, nIndex, newLong);
 
     // We already checked this in SetWindowLongHookCheck
     PluginInstanceChild* self = reinterpret_cast<PluginInstanceChild*>(
         GetProp(hWnd, kPluginInstanceChildProperty));
 
     // Hook our subclass back up, just like we do on setwindow.   
-    WNDPROC currentProc =
-        reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_WNDPROC));
-    if (currentProc != PluginWindowProc) {
-        self->mPluginWndProc =
-            reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
-                reinterpret_cast<LONG_PTR>(PluginWindowProc)));
-    }
+    self->mPluginWndProc =
+        reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
+            reinterpret_cast<LONG_PTR>(PluginWindowProc)));
     return proc;
 }
 
 #ifdef _WIN64
 LONG_PTR WINAPI
 PluginInstanceChild::SetWindowLongPtrWHook(HWND hWnd,
                                            int nIndex,
                                            LONG_PTR newLong)
@@ -1421,23 +1417,19 @@ PluginInstanceChild::SetWindowLongWHook(
     // Set flash's new subclass to get the result. 
     LONG_PTR proc = sUser32SetWindowLongWHookStub(hWnd, nIndex, newLong);
 
     // We already checked this in SetWindowLongHookCheck
     PluginInstanceChild* self = reinterpret_cast<PluginInstanceChild*>(
         GetProp(hWnd, kPluginInstanceChildProperty));
 
     // Hook our subclass back up, just like we do on setwindow.   
-    WNDPROC currentProc =
-        reinterpret_cast<WNDPROC>(GetWindowLongPtr(hWnd, GWLP_WNDPROC));
-    if (currentProc != PluginWindowProc) {
-        self->mPluginWndProc =
-            reinterpret_cast<WNDPROC>(sUser32SetWindowLongAHookStub(hWnd, nIndex,
-                reinterpret_cast<LONG_PTR>(PluginWindowProc)));
-    }
+    self->mPluginWndProc =
+        reinterpret_cast<WNDPROC>(sUser32SetWindowLongWHookStub(hWnd, nIndex,
+            reinterpret_cast<LONG_PTR>(PluginWindowProc)));
     return proc;
 }
 
 void
 PluginInstanceChild::HookSetWindowLongPtr()
 {
 #ifdef _WIN64
     // XXX WindowsDllInterceptor doesn't support hooks
--- a/gfx/layers/opengl/ContainerLayerOGL.cpp
+++ b/gfx/layers/opengl/ContainerLayerOGL.cpp
@@ -206,18 +206,17 @@ ContainerRender(Container* aContainer,
     aManager->CreateFBOWithTexture(framebufferRect,
                                    mode,
                                    &frameBuffer,
                                    &containerSurface);
     childOffset.x = visibleRect.x;
     childOffset.y = visibleRect.y;
 
     aContainer->gl()->PushViewportRect();
-    aManager->SetupPipeline(visibleRect.width, visibleRect.height,
-                            LayerManagerOGL::DontApplyWorldTransform);
+    aManager->SetupPipeline(visibleRect.width, visibleRect.height);
 
   } else {
     frameBuffer = aPreviousFrameBuffer;
     aContainer->mSupportsComponentAlphaChildren = (aContainer->GetContentFlags() & Layer::CONTENT_OPAQUE) ||
       (aContainer->GetParent() && aContainer->GetParent()->SupportsComponentAlphaChildren());
 #ifdef DEBUG
     PRBool is2d =
 #endif
@@ -252,21 +251,16 @@ ContainerRender(Container* aContainer,
           scissorRect = visibleRect;
         }
       }
     }
 
     if (needsFramebuffer) {
       scissorRect.MoveBy(- visibleRect.TopLeft());
     } else {
-      if (!frameBuffer) {
-        // Transform scissorRect here
-        aManager->WorldTransformRect(scissorRect);
-      }
-
       if (!aPreviousFrameBuffer) {
         /**
          * glScissor coordinates are oriented with 0,0 being at the bottom left,
          * the opposite to layout (0,0 at the top left).
          * All rendering to an FBO is upside-down, making the coordinate systems
          * match.
          * When rendering directly to a window (No current or previous FBO),
          * we need to flip the scissor rect.
@@ -299,18 +293,17 @@ ContainerRender(Container* aContainer,
   aContainer->gl()->PopScissorRect();
 
   if (needsFramebuffer) {
     // Unbind the current framebuffer and rebind the previous one.
     
     // Restore the viewport
     aContainer->gl()->PopViewportRect();
     nsIntRect viewport = aContainer->gl()->ViewportRect();
-    aManager->SetupPipeline(viewport.width, viewport.height,
-                            LayerManagerOGL::ApplyWorldTransform);
+    aManager->SetupPipeline(viewport.width, viewport.height);
 
     aContainer->gl()->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, aPreviousFrameBuffer);
     aContainer->gl()->fDeleteFramebuffers(1, &frameBuffer);
 
     aContainer->gl()->fActiveTexture(LOCAL_GL_TEXTURE0);
 
     aContainer->gl()->fBindTexture(aManager->FBOTextureTarget(), containerSurface);
 
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -545,17 +545,16 @@ LayerManagerOGL::Render()
 {
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return;
   }
 
   nsIntRect rect;
   mWidget->GetClientBounds(rect);
-  WorldTransformRect(rect);
 
   GLint width = rect.width;
   GLint height = rect.height;
 
   // We can't draw anything to something with no area
   // so just return
   if (width == 0 || height == 0)
     return;
@@ -571,30 +570,29 @@ LayerManagerOGL::Render()
     mWidgetSize.height = height;
   } else {
     MakeCurrent();
   }
 
   DEBUG_GL_ERROR_CHECK(mGLContext);
 
   SetupBackBuffer(width, height);
-  SetupPipeline(width, height, ApplyWorldTransform);
+  SetupPipeline(width, height);
 
   // Default blend function implements "OVER"
   mGLContext->fBlendFuncSeparate(LOCAL_GL_ONE, LOCAL_GL_ONE_MINUS_SRC_ALPHA,
                                  LOCAL_GL_ONE, LOCAL_GL_ONE);
   mGLContext->fEnable(LOCAL_GL_BLEND);
 
   DEBUG_GL_ERROR_CHECK(mGLContext);
 
   const nsIntRect *clipRect = mRoot->GetClipRect();
 
   if (clipRect) {
     nsIntRect r = *clipRect;
-    WorldTransformRect(r);
     if (!mGLContext->IsDoubleBuffered() && !mTarget)
       mGLContext->FixWindowCoordinateRect(r, mWidgetSize.height);
     mGLContext->fScissor(r.x, r.y, r.width, r.height);
   } else {
     mGLContext->fScissor(0, 0, width, height);
   }
 
   mGLContext->fEnable(LOCAL_GL_SCISSOR_TEST);
@@ -659,18 +657,16 @@ LayerManagerOGL::Render()
 
   mGLContext->fEnableVertexAttribArray(vcattr);
   mGLContext->fEnableVertexAttribArray(tcattr);
 
   const nsIntRect *r;
   nsIntRegionRectIterator iter(mClippingRegion);
 
   while ((r = iter.Next()) != nsnull) {
-    nsIntRect cRect = *r; r = &cRect;
-    WorldTransformRect(cRect);
     float left = (GLfloat)r->x / width;
     float right = (GLfloat)r->XMost() / width;
     float top = (GLfloat)r->y / height;
     float bottom = (GLfloat)r->YMost() / height;
 
     float vertices[] = { left * 2.0f - 1.0f,
                          -(top * 2.0f - 1.0f),
                          right * 2.0f - 1.0f,
@@ -705,42 +701,17 @@ LayerManagerOGL::Render()
   DEBUG_GL_ERROR_CHECK(mGLContext);
 
   mGLContext->fFlush();
 
   DEBUG_GL_ERROR_CHECK(mGLContext);
 }
 
 void
-LayerManagerOGL::SetWorldTransform(const gfxMatrix& aMatrix)
-{
-  NS_ASSERTION(aMatrix.PreservesAxisAlignedRectangles(),
-               "SetWorldTransform only accepts matrices that satisfy PreservesAxisAlignedRectangles");
-  NS_ASSERTION(!aMatrix.HasNonIntegerScale(),
-               "SetWorldTransform only accepts matrices with integer scale");
-
-  mWorldMatrix = aMatrix;
-}
-
-gfxMatrix&
-LayerManagerOGL::GetWorldTransform(void)
-{
-  return mWorldMatrix;
-}
-
-void
-LayerManagerOGL::WorldTransformRect(nsIntRect& aRect)
-{
-  gfxRect grect(aRect.x, aRect.y, aRect.width, aRect.height);
-  grect = mWorldMatrix.TransformBounds(grect);
-  aRect.SetRect(grect.pos.x, grect.pos.y, grect.size.width, grect.size.height);
-}
-
-void
-LayerManagerOGL::SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy)
+LayerManagerOGL::SetupPipeline(int aWidth, int aHeight)
 {
   // Set the viewport correctly. 
   //
   // When we're not double buffering, we use a FBO as our backbuffer.
   // We use a normal view transform in that case, meaning that our FBO
   // and all other FBOs look upside down.  We then do a Y-flip when
   // we draw it into the window.
   mGLContext->fViewport(0, 0, aWidth, aHeight);
@@ -768,20 +739,16 @@ LayerManagerOGL::SetupPipeline(int aWidt
     viewMatrix._42 = 1.0f;
   } else {
     viewMatrix._11 = 2.0f / float(aWidth);
     viewMatrix._22 = 2.0f / float(aHeight);
     viewMatrix._41 = -1.0f;
     viewMatrix._42 = -1.0f;
   }
 
-  if (aTransformPolicy == ApplyWorldTransform) {
-    viewMatrix = gfx3DMatrix::From2D(mWorldMatrix) * viewMatrix;
-  }
-
   SetLayerProgramProjectionMatrix(viewMatrix);
 }
 
 void
 LayerManagerOGL::SetupBackBuffer(int aWidth, int aHeight)
 {
   if (mGLContext->IsDoubleBuffered() && !mTarget) {
     mGLContext->fBindFramebuffer(LOCAL_GL_FRAMEBUFFER, 0);
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -367,35 +367,21 @@ public:
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "OGL"; }
 #endif // MOZ_LAYERS_HAVE_LOG
 
   const nsIntSize& GetWigetSize() {
     return mWidgetSize;
   }
 
-  enum WorldTransforPolicy {
-    ApplyWorldTransform,
-    DontApplyWorldTransform
-  };
-
   /**
    * Setup the viewport and projection matrix for rendering
    * to a window of the given dimensions.
    */
-  void SetupPipeline(int aWidth, int aHeight, WorldTransforPolicy aTransformPolicy);
-
-  /**
-   * Setup World transform matrix.
-   * Transform will be ignored if it is not PreservesAxisAlignedRectangles
-   * or has non integer scale
-   */
-  void SetWorldTransform(const gfxMatrix& aMatrix);
-  gfxMatrix& GetWorldTransform(void);
-  void WorldTransformRect(nsIntRect& aRect);
+  void SetupPipeline(int aWidth, int aHeight);
 
 private:
   /** Widget associated with this layer manager */
   nsIWidget *mWidget;
   nsIntSize mWidgetSize;
 
   /** 
    * Context target, NULL when drawing directly to our swap chain.
@@ -464,17 +450,16 @@ private:
    * If we have any more similar updates, then we should delay.
    */
   void SetLayerProgramProjectionMatrix(const gfx3DMatrix& aMatrix);
 
   /* Thebes layer callbacks; valid at the end of a transaciton,
    * while rendering */
   DrawThebesLayerCallback mThebesLayerCallback;
   void *mThebesLayerCallbackData;
-  gfxMatrix mWorldMatrix;
 };
 
 /**
  * General information and tree management for OGL layers.
  */
 class LayerOGL
 {
 public:
--- a/gfx/thebes/gfxMatrix.h
+++ b/gfx/thebes/gfxMatrix.h
@@ -276,23 +276,15 @@ public:
      * Returns true if matrix is multiple of 90 degrees rotation with flipping,
      * scaling and translation.
      */
     PRBool PreservesAxisAlignedRectangles() const {
         return ((FuzzyEqual(xx, 0.0) && FuzzyEqual(yy, 0.0))
             || (FuzzyEqual(xy, 0.0) && FuzzyEqual(yx, 0.0)));
     }
 
-    /**
-     * Returns true if the matrix has non-integer scale
-     */
-    PRBool HasNonIntegerScale() const {
-        return !FuzzyEqual(xx, NS_floor(xx + 0.5)) ||
-               !FuzzyEqual(yy, NS_floor(yy + 0.5));
-    }
-
 private:
     static PRBool FuzzyEqual(gfxFloat aV1, gfxFloat aV2) {
         return fabs(aV2 - aV1) < 1e-6;
     }
 };
 
 #endif /* GFX_MATRIX_H */
--- a/js/src/xpconnect/src/nsDOMQS.h
+++ b/js/src/xpconnect/src/nsDOMQS.h
@@ -73,17 +73,16 @@ xpc_qsUnwrapArg<_interface>(JSContext *c
                                                    &rv);                      \
     if(NS_SUCCEEDED(rv))                                                      \
         *ppArg = static_cast<_interface*>(static_cast<_base*>(native));       \
     return rv;                                                                \
 }
 
 #undef DOMCI_CASTABLE_INTERFACE
 
-#undef DOMCI_CASTABLE_INTERFACE
 #define DOMCI_CASTABLE_INTERFACE(_interface, _base, _bit, _extra)             \
   DEFINE_UNWRAP_CAST(_interface, _base, _bit)
 
 DOMCI_CASTABLE_INTERFACES(unused)
 
 #undef DOMCI_CASTABLE_INTERFACE
 
 // Ideally we'd just add nsGenericElement to the castable interfaces, but for
--- a/layout/base/tests/test_bug629838.html
+++ b/layout/base/tests/test_bug629838.html
@@ -18,49 +18,38 @@
 <script class="testbody" type="text/javascript">
 
 SimpleTest.waitForExplicitFinish();
 
 var initialPaintCount, afterPaintCount;
 var color = 0;
 
 function onAfterPaint () {
+  ok(true, "OnAfterPaint");
   afterPaintCount += 1;
 }
 
 function startTest() {
   setTimeout(function () {
     afterPaintCount = 0;
     initialPaintCount = window.mozPaintCount;
     window.addEventListener("MozAfterPaint", onAfterPaint, true);
     doBackgroundFlicker();
-  }, 500);
+  }, 1000);
 }
 
 document.addEventListener("DOMContentLoaded", startTest, true);
 
-// Unfortunately we cannot reliably assert that mozPaintCount and afterPaintCount increment perfectly
-// in sync, because they can diverge in the presence of OS-triggered paints or system load.
-// Instead, we wait for mozPaintCount to increase by a set amount, and then assert that we got a
-// minimum number of MozAfterPaint events. This number needs to be high enough to ensure that this test
-// will fail if empty transactions are not triggering MozAfterPaint, but low enough to allow the test to
-// pass even if the operating system triggers extra repaints or the browser is running slowly.
-// If this test still fails occasionally, examine the output to see whether minimumAfterPaints needs to be
-// adjusted down or whether you are dealing with a different issue.
-const mozPaintsToWait = 50;
-const minimumAfterPaintsToPass = 37;
-
 function doPluginFlicker() {
   ok(true, "Plugin color iteration " + color + 
      ", afterpaint count: " + afterPaintCount +
      ", mozpaint count: " + window.mozPaintCount);
-  var mozPaints = (window.mozPaintCount - initialPaintCount);
-  if (mozPaints >= mozPaintsToWait) { 
-    ok(true, "mozPaintCount incremented enough from plugin color changes.");
-    ok(afterPaintCount >= minimumAfterPaintsToPass, "Got MozAfterPaint event " + afterPaintCount + " time(s).");
+  if ((afterPaintCount >= window.mozPaintCount - initialPaintCount) && 
+      (afterPaintCount > 20)) {
+    ok(true, "Got enough paints from plugin color changes");
     SimpleTest.finish();
     return;
   }
 
   color = (color + 1) % 256;
   var str = color.toString(16);
   if (str.length < 2) {
     str = "0" + str;
@@ -69,20 +58,19 @@ function doPluginFlicker() {
   document.getElementById("p").setColor(str);
   setTimeout(doPluginFlicker, 0);
 }
 
 function doBackgroundFlicker() {
   ok(true, "Background color iteration " + color + 
      ", afterpaint count: " + afterPaintCount +
      ", mozpaint count: " + window.mozPaintCount);
-  var mozPaints = (window.mozPaintCount - initialPaintCount);
-  if (mozPaints >= mozPaintsToWait) {
-    ok(true, "mozPaintCount incremented enough from background color changes.");
-    ok(afterPaintCount >= minimumAfterPaintsToPass, "Got MozAfterPaint event " + afterPaintCount + " time(s).");
+  if ((afterPaintCount >= window.mozPaintCount - initialPaintCount) && 
+      (afterPaintCount > 20)) {
+    ok(true, "Got enough paints from background color changes");
     afterPaintCount = 0;
     initialPaintCount = window.mozPaintCount;
     doPluginFlicker();
     return;
   }
 
   color = (color + 1) % 256;
   document.body.style.backgroundColor = "rgb(" + color + "," + color + "," + color + ")";
--- a/modules/libjar/nsJAR.cpp
+++ b/modules/libjar/nsJAR.cpp
@@ -146,20 +146,17 @@ nsrefcnt nsJAR::Release(void)
   if (0 == count) {
     mRefCnt = 1; /* stabilize */ 
     /* enable this to find non-threadsafe destructors: */ 
     /* NS_ASSERT_OWNINGTHREAD(nsJAR); */ 
     delete this;
     return 0; 
   }
   else if (1 == count && mCache) {
-#ifdef DEBUG
-    nsresult rv =
-#endif
-      mCache->ReleaseZip(this);
+    nsresult rv = mCache->ReleaseZip(this);
     NS_ASSERTION(NS_SUCCEEDED(rv), "failed to release zip file");
   }
   return count; 
 } 
 
 //----------------------------------------------
 // nsIZipReader implementation
 //----------------------------------------------
@@ -1148,20 +1145,17 @@ nsZipReaderCache::GetZip(nsIFile* zipFil
     zip->SetZipReaderCache(this);
 
     rv = zip->Open(zipFile);
     if (NS_FAILED(rv)) {
       NS_RELEASE(zip);
       return rv;
     }
 
-#ifdef DEBUG
-    PRBool collision =
-#endif
-      mZips.Put(&key, static_cast<nsIZipReader*>(zip)); // AddRefs to 2
+    PRBool collision = mZips.Put(&key, static_cast<nsIZipReader*>(zip)); // AddRefs to 2
     NS_ASSERTION(!collision, "horked");
   }
   *result = zip;
   return rv;
 }
 
 NS_IMETHODIMP
 nsZipReaderCache::GetInnerZip(nsIFile* zipFile, const char *entry,
@@ -1305,20 +1299,18 @@ nsZipReaderCache::ReleaseZip(nsJAR* zip)
     uri.Insert(NS_LITERAL_CSTRING("file:"), 0);
   } else {
     uri.Insert(NS_LITERAL_CSTRING("jar:"), 0);
     uri.AppendLiteral("!/");
     uri.Append(zip->mOuterZipEntry);
   }
 
   nsCStringKey key(uri);
-#ifdef DEBUG
-  PRBool removed =
-#endif
-    mZips.Remove(&key);   // Releases
+  PRBool removed;
+  removed = mZips.Remove(&key);  // Releases
   NS_ASSERTION(removed, "botched");
 
   return NS_OK;
 }
 
 static PRBool
 FindFlushableZip(nsHashKey *aKey, void *aData, void* closure)
 {
@@ -1340,20 +1332,17 @@ nsZipReaderCache::Observe(nsISupports *a
 {
   if (strcmp(aTopic, "memory-pressure") == 0) {
     nsAutoLock lock(mLock);
     while (PR_TRUE) {
       nsHashKey* flushable = nsnull;
       mZips.Enumerate(FindFlushableZip, &flushable); 
       if ( ! flushable )
         break;
-#ifdef DEBUG
-      PRBool removed =
-#endif
-        mZips.Remove(flushable);   // Releases
+      PRBool removed = mZips.Remove(flushable);  // Releases
       NS_ASSERTION(removed, "botched");
 
 #ifdef xDEBUG_jband
       printf("flushed something from the jar cache\n");
 #endif
     }
   }
   else if (strcmp(aTopic, "chrome-flush-caches") == 0) {
--- a/modules/libjar/nsJARChannel.cpp
+++ b/modules/libjar/nsJARChannel.cpp
@@ -89,20 +89,17 @@ public:
                     const nsACString &jarEntry,
                     nsIZipReaderCache *jarCache)
         : mJarCache(jarCache)
         , mJarReader(zipReader)
         , mJarEntry(jarEntry)
         , mContentLength(-1)
     {
         if (fullJarURI) {
-#ifdef DEBUG
-            nsresult rv =
-#endif
-                fullJarURI->GetAsciiSpec(mJarDirSpec);
+            nsresult rv = fullJarURI->GetAsciiSpec(mJarDirSpec);
             NS_ASSERTION(NS_SUCCEEDED(rv), "this shouldn't fail");
         }
     }
 
     virtual ~nsJARInputThunk()
     {
         if (!mJarCache && mJarReader)
             mJarReader->Close();
--- a/modules/libjar/nsZipArchive.cpp
+++ b/modules/libjar/nsZipArchive.cpp
@@ -997,20 +997,17 @@ bool nsZipItem::IsSymlink()
 
 nsZipCursor::nsZipCursor(nsZipItem *item, nsZipArchive *aZip, PRUint8* aBuf, PRUint32 aBufSize, bool doCRC) :
   mItem(item),
   mBuf(aBuf),
   mBufSize(aBufSize),
   mDoCRC(doCRC)
 {
   if (mItem->Compression() == DEFLATED) {
-#ifdef DEBUG
-    nsresult status =
-#endif
-      gZlibInit(&mZs);
+    nsresult status = gZlibInit(&mZs);
     NS_ASSERTION(status == NS_OK, "Zlib failed to initialize");
     NS_ASSERTION(aBuf, "Must pass in a buffer for DEFLATED nsZipItem");
   }
   
   mZs.avail_in = item->Size();
   mZs.next_in = (Bytef*)aZip->GetData(item);
   
   if (doCRC)
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -2481,60 +2481,51 @@ nsHttpChannel::CheckCache()
           !(mLoadFlags & INHIBIT_CACHING)) ||
          mFallbackChannel)) {
         mCachedContentIsValid = PR_TRUE;
         return NS_OK;
     }
 
     PRUint16 isCachedRedirect = mCachedResponseHead->Status()/100 == 3;
 
-    mCustomConditionalRequest =
-        mRequestHead.PeekHeader(nsHttp::If_Modified_Since) ||
-        mRequestHead.PeekHeader(nsHttp::If_None_Match) ||
-        mRequestHead.PeekHeader(nsHttp::If_Unmodified_Since) ||
-        mRequestHead.PeekHeader(nsHttp::If_Match) ||
-        mRequestHead.PeekHeader(nsHttp::If_Range);
-
     if (method != nsHttp::Head && !isCachedRedirect) {
         // If the cached content-length is set and it does not match the data
         // size of the cached content, then the cached response is partial...
         // either we need to issue a byte range request or we need to refetch
         // the entire document.
         nsInt64 contentLength = mCachedResponseHead->ContentLength();
         if (contentLength != nsInt64(-1)) {
             PRUint32 size;
             rv = mCacheEntry->GetDataSize(&size);
             NS_ENSURE_SUCCESS(rv, rv);
 
             if (nsInt64(size) != contentLength) {
                 LOG(("Cached data size does not match the Content-Length header "
                      "[content-length=%lld size=%u]\n", PRInt64(contentLength), size));
-
-                PRBool hasContentEncoding =
-                    mCachedResponseHead->PeekHeader(nsHttp::Content_Encoding)
-                    != nsnull;
-                if ((nsInt64(size) < contentLength) &&
-                     size > 0 &&
-                     !hasContentEncoding &&
-                     mCachedResponseHead->IsResumable() &&
-                     !mCustomConditionalRequest &&
-                     !mCachedResponseHead->NoStore()) {
-                    // looks like a partial entry we can reuse
+                if ((nsInt64(size) < contentLength) && mCachedResponseHead->IsResumable()) {
+                    // looks like a partial entry.
                     rv = SetupByteRangeRequest(size);
                     NS_ENSURE_SUCCESS(rv, rv);
                     mCachedContentIsPartial = PR_TRUE;
                 }
                 return NS_OK;
             }
         }
     }
 
     PRBool doValidation = PR_FALSE;
     PRBool canAddImsHeader = PR_TRUE;
 
+    mCustomConditionalRequest = 
+        mRequestHead.PeekHeader(nsHttp::If_Modified_Since) ||
+        mRequestHead.PeekHeader(nsHttp::If_None_Match) ||
+        mRequestHead.PeekHeader(nsHttp::If_Unmodified_Since) ||
+        mRequestHead.PeekHeader(nsHttp::If_Match) ||
+        mRequestHead.PeekHeader(nsHttp::If_Range);
+
     // If the LOAD_FROM_CACHE flag is set, any cached data can simply be used.
     if (mLoadFlags & LOAD_FROM_CACHE) {
         LOG(("NOT validating based on LOAD_FROM_CACHE load flag\n"));
         doValidation = PR_FALSE;
     }
     // If the VALIDATE_ALWAYS flag is set, any cached data won't be used until
     // it's revalidated with the server.
     else if (mLoadFlags & VALIDATE_ALWAYS) {
--- a/netwerk/test/unit/test_gzipped_206.js
+++ b/netwerk/test/unit/test_gzipped_206.js
@@ -1,39 +1,28 @@
 do_load_httpd_js();
 
 var httpserver = null;
 
-// testString = "This is a slightly longer test\n";
-const responseBody = [0x1f, 0x8b, 0x08, 0x08, 0xef, 0x70, 0xe6, 0x4c, 0x00, 0x03, 0x74, 0x65, 0x78, 0x74, 0x66, 0x69,
-                     0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x0b, 0xc9, 0xc8, 0x2c, 0x56, 0x00, 0xa2, 0x44, 0x85,
-                     0xe2, 0x9c, 0xcc, 0xf4, 0x8c, 0x92, 0x9c, 0x4a, 0x85, 0x9c, 0xfc, 0xbc, 0xf4, 0xd4, 0x22, 0x85,
-                     0x92, 0xd4, 0xe2, 0x12, 0x2e, 0x2e, 0x00, 0x00, 0xe5, 0xe6, 0xf0, 0x20, 0x00, 0x00, 0x00];
-
-function getCacheService()
-{
-    var nsCacheService = Components.classes["@mozilla.org/network/cache-service;1"];
-    var service = nsCacheService.getService(Components.interfaces.nsICacheService);
-    return service;
-}
+const responseBody = [0x1f, 0x8b, 0x08, 0x00, 0x16, 0x5a, 0x8a, 0x48, 0x02,
+		      0x03, 0x2b, 0x49, 0x2d, 0x2e, 0xe1, 0x02, 0x00, 0xc6,
+		      0x35, 0xb9, 0x3b, 0x05, 0x00, 0x00, 0x00];
 
 function make_channel(url, callback, ctx) {
   var ios = Cc["@mozilla.org/network/io-service;1"].
             getService(Ci.nsIIOService);
   return ios.newChannel(url, "", null);
 }
 
 var doRangeResponse = false;
 
 function cachedHandler(metadata, response) {
   response.setHeader("Content-Type", "application/x-gzip", false);
   response.setHeader("Content-Encoding", "gzip", false);
   response.setHeader("ETag", "Just testing");
-  response.setHeader("Cache-Control", "max-age=3600000"); // avoid validation
-  response.setHeader("Content-Length", "" + responseBody.length);
 
   var body = responseBody;
 
   if (doRangeResponse) {
     do_check_true(metadata.hasHeader("Range"));
     var matches = metadata.getHeader("Range").match(/^\s*bytes=(\d+)?-(\d+)?\s*$/);
     var from = (matches[1] === undefined) ? 0 : matches[1];
     var to = (matches[2] === undefined) ? responseBody.length - 1 : matches[2];
@@ -43,48 +32,69 @@ function cachedHandler(metadata, respons
       return;
     }
     body = body.slice(from, to + 1);
     // always respond to successful range requests with 206
     response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
     response.setHeader("Content-Range", from + "-" + to + "/" + responseBody.length, false);
   } else {
     response.setHeader("Accept-Ranges", "bytes");
-    body = body.slice(0, 17); // slice off a piece to send first
     doRangeResponse = true;
   }
 
   var bos = Cc["@mozilla.org/binaryoutputstream;1"]
       .createInstance(Ci.nsIBinaryOutputStream);
   bos.setOutputStream(response.bodyOutputStream);
 
-  response.processAsync();
   bos.writeByteArray(body, body.length);
-  response.finish();
+}
+
+function Canceler() {
 }
 
-function continue_test(request, data) {
-  do_check_true(17 == data.length);
+Canceler.prototype = {
+  QueryInterface: function(iid) {
+    if (iid.equals(Ci.nsIStreamListener) ||
+        iid.equals(Ci.nsIRequestObserver) ||
+        iid.equals(Ci.nsISupports))
+      return this;
+    throw Components.results.NS_ERROR_NO_INTERFACE;
+  },
+
+  onStartRequest: function(request, context) {
+  },
+
+  onDataAvailable: function(request, context, stream, offset, count) {
+    request.QueryInterface(Ci.nsIChannel)
+           .cancel(Components.results.NS_BINDING_ABORTED);
+  },
+
+  onStopRequest: function(request, context, status) {
+    do_check_eq(status, Components.results.NS_BINDING_ABORTED);
+    continue_test();
+  }
+};
+
+function continue_test() {
   var chan = make_channel("http://localhost:4444/cached/test.gz");
-  chan.asyncOpen(new ChannelListener(finish_test, null, CL_EXPECT_GZIP), null);
+  chan.asyncOpen(new ChannelListener(finish_test, null), null);
 }
 
 function finish_test(request, data, ctx) {
+  do_test_pending();
+  httpserver.stop(do_test_finished);
   do_check_eq(request.status, 0);
   do_check_eq(data.length, responseBody.length);
   for (var i = 0; i < data.length; ++i) {
     do_check_eq(data.charCodeAt(i), responseBody[i]);
   }
-  httpserver.stop(do_test_finished);
+  do_test_finished();
 }
 
 function run_test() {
   httpserver = new nsHttpServer();
   httpserver.registerPathHandler("/cached/test.gz", cachedHandler);
   httpserver.start(4444);
 
-  // wipe out cached content
-  getCacheService().evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
-
   var chan = make_channel("http://localhost:4444/cached/test.gz");
-  chan.asyncOpen(new ChannelListener(continue_test, null, CL_EXPECT_GZIP), null);
+  chan.asyncOpen(new Canceler(), null);
   do_test_pending();
 }
deleted file mode 100644
--- a/netwerk/test/unit/test_range_requests.js
+++ /dev/null
@@ -1,275 +0,0 @@
-//
-// This test makes sure range-requests are sent and treated the way we want
-// See bug #612135 for a thorough discussion on the subject
-//
-// Necko does a range-request for a partial cache-entry iff
-//
-//   1) size of the cached entry < value of the cached Content-Length header
-//      (not tested here - see bug #612135 comments 108-110)
-//   2) the size of the cached entry is > 0  (see bug #628607)
-//   3) the cached entry does not have a "no-store" Cache-Control header
-//   4) the cached entry does not have a Content-Encoding (see bug #613159)
-//   5) the request does not have a conditional-request header set by client
-//   6) nsHttpResponseHead::IsResumable() is true for the cached entry 
-//
-//  The test has one handler for each case and run_tests() fires one request
-//  for each. None of the handlers should see a Range-header.
-
-do_load_httpd_js();
-
-var httpserver = null;
-
-const clearTextBody = "This is a slightly longer test\n";
-const encodedBody = [0x1f, 0x8b, 0x08, 0x08, 0xef, 0x70, 0xe6, 0x4c, 0x00, 0x03, 0x74, 0x65, 0x78, 0x74, 0x66, 0x69,
-                     0x6c, 0x65, 0x2e, 0x74, 0x78, 0x74, 0x00, 0x0b, 0xc9, 0xc8, 0x2c, 0x56, 0x00, 0xa2, 0x44, 0x85,
-                     0xe2, 0x9c, 0xcc, 0xf4, 0x8c, 0x92, 0x9c, 0x4a, 0x85, 0x9c, 0xfc, 0xbc, 0xf4, 0xd4, 0x22, 0x85,
-                     0x92, 0xd4, 0xe2, 0x12, 0x2e, 0x2e, 0x00, 0x00, 0xe5, 0xe6, 0xf0, 0x20, 0x00, 0x00, 0x00];
-const decodedBody = [0x54, 0x68, 0x69, 0x73, 0x20, 0x69, 0x73, 0x20, 0x61, 0x20, 0x73, 0x6c, 0x69, 0x67, 0x68, 0x74,
-                     0x6c, 0x79, 0x20, 0x6c, 0x6f, 0x6e, 0x67, 0x65, 0x72, 0x20, 0x74, 0x65, 0x73, 0x74, 0x0a, 0x0a];
-
-const partial_data_length = 4;
-
-function getCacheService()
-{
-    var nsCacheService = Components.classes["@mozilla.org/network/cache-service;1"];
-    var service = nsCacheService.getService(Components.interfaces.nsICacheService);
-    return service;
-}
-
-function make_channel(url, callback, ctx) {
-  var ios = Cc["@mozilla.org/network/io-service;1"].
-            getService(Ci.nsIIOService);
-  var chan = ios.newChannel(url, "", null);
-  return chan.QueryInterface(Ci.nsIHttpChannel);
-}
-
-// StreamListener which cancels its request on first data available
-function Canceler(continueFn) {
-  this.continueFn = continueFn;
-}
-Canceler.prototype = {
-  QueryInterface: function(iid) {
-    if (iid.equals(Ci.nsIStreamListener) ||
-        iid.equals(Ci.nsIRequestObserver) ||
-        iid.equals(Ci.nsISupports))
-      return this;
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-  onStartRequest: function(request, context) { },
-
-  onDataAvailable: function(request, context, stream, offset, count) {
-    request.QueryInterface(Ci.nsIChannel)
-           .cancel(Components.results.NS_BINDING_ABORTED);
-  },
-  onStopRequest: function(request, context, status) {
-    do_check_eq(status, Components.results.NS_BINDING_ABORTED);
-    this.continueFn(request, null);
-  }
-};
-// Simple StreamListener which performs no validations
-function MyListener(continueFn) {
-  this.continueFn = continueFn;
-  this._buffer = null;
-}
-MyListener.prototype = {
-  QueryInterface: function(iid) {
-    if (iid.equals(Ci.nsIStreamListener) ||
-        iid.equals(Ci.nsIRequestObserver) ||
-        iid.equals(Ci.nsISupports))
-      return this;
-    throw Components.results.NS_ERROR_NO_INTERFACE;
-  },
-  onStartRequest: function(request, context) { this._buffer = ""; },
-
-  onDataAvailable: function(request, context, stream, offset, count) {
-    this._buffer = this._buffer.concat(read_stream(stream, count));
-  },
-  onStopRequest: function(request, context, status) {
-    this.continueFn(request, this._buffer);
-  }
-};
-
-function received_cleartext(request, data) {
-  do_check_eq(clearTextBody, data);
-  testFinished();
-}
-
-function setStdHeaders(response, length) {
-  response.setHeader("Content-Type", "text/plain", false);
-  response.setHeader("ETag", "Just testing");
-  response.setHeader("Cache-Control", "max-age: 360000");
-  response.setHeader("Accept-Ranges", "bytes");
-  response.setHeader("Content-Length", "" + length);
-}
-
-function handler_2(metadata, response) {
-  setStdHeaders(response, clearTextBody.length);
-  do_check_false(metadata.hasHeader("Range"));
-  response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
-}
-function received_partial_2(request, data) {
-  do_check_eq(data, undefined);
-  var chan = make_channel("http://localhost:4444/test_2");
-  chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
-}
-
-var case_3_request_no = 0;
-function handler_3(metadata, response) {
-  var body = clearTextBody;
-  setStdHeaders(response, body.length);
-  response.setHeader("Cache-Control", "no-store", false);
-  switch (case_3_request_no) {
-    case 0:
-      do_check_false(metadata.hasHeader("Range"));
-      body = body.slice(0, partial_data_length);
-      response.processAsync();
-      response.bodyOutputStream.write(body, body.length);
-      response.finish();
-      break;
-    case 1:
-      do_check_false(metadata.hasHeader("Range"));
-      response.bodyOutputStream.write(body, body.length);
-      break;
-    default:
-      response.setStatusLine(metadata.httpVersion, 404, "Not Found");
-  }
-  case_3_request_no++;
-}
-function received_partial_3(request, data) {
-  do_check_eq(partial_data_length, data.length);
-  var chan = make_channel("http://localhost:4444/test_3");
-  chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
-}
-
-var case_4_request_no = 0;
-function handler_4(metadata, response) {
-  switch (case_4_request_no) {
-    case 0:
-      do_check_false(metadata.hasHeader("Range"));
-      var body = encodedBody;
-      setStdHeaders(response, body.length);
-      response.setHeader("Content-Encoding", "gzip", false);
-      body = body.slice(0, partial_data_length);
-	  var bos = Cc["@mozilla.org/binaryoutputstream;1"]
-	              .createInstance(Ci.nsIBinaryOutputStream);
-	  bos.setOutputStream(response.bodyOutputStream);
-      response.processAsync();
-      bos.writeByteArray(body, body.length);
-      response.finish();
-      break;
-    case 1:
-      do_check_false(metadata.hasHeader("Range"));
-      setStdHeaders(response, clearTextBody.length);
-      response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
-      break;
-    default:
-      response.setStatusLine(metadata.httpVersion, 404, "Not Found");
-  }
-  case_4_request_no++;
-}
-function received_partial_4(request, data) {
-// checking length does not work with encoded data
-//  do_check_eq(partial_data_length, data.length);
-  var chan = make_channel("http://localhost:4444/test_4");
-  chan.asyncOpen(new MyListener(received_cleartext), null);
-}
-
-var case_5_request_no = 0;
-function handler_5(metadata, response) {
-  var body = clearTextBody;
-  setStdHeaders(response, body.length);
-  switch (case_5_request_no) {
-    case 0:
-      do_check_false(metadata.hasHeader("Range"));
-      body = body.slice(0, partial_data_length);
-      response.processAsync();
-      response.bodyOutputStream.write(body, body.length);
-      response.finish();
-      break;
-    case 1:
-      do_check_false(metadata.hasHeader("Range"));
-      response.bodyOutputStream.write(body, body.length);
-      break;
-    default:
-      response.setStatusLine(metadata.httpVersion, 404, "Not Found");
-  }
-  case_5_request_no++;
-}
-function received_partial_5(request, data) {
-  do_check_eq(partial_data_length, data.length);
-  var chan = make_channel("http://localhost:4444/test_5");
-  chan.setRequestHeader("If-Match", "Some eTag", false);
-  chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
-}
-
-var case_6_request_no = 0;
-function handler_6(metadata, response) {
-  switch (case_6_request_no) {
-    case 0:
-      do_check_false(metadata.hasHeader("Range"));
-      var body = clearTextBody;
-      setStdHeaders(response, body.length);
-      response.setHeader("Accept-Ranges", "", false);
-      body = body.slice(0, partial_data_length);
-      response.processAsync();
-      response.bodyOutputStream.write(body, body.length);
-      response.finish();
-      break;
-    case 1:
-      do_check_false(metadata.hasHeader("Range"));
-      setStdHeaders(response, clearTextBody.length);
-      response.bodyOutputStream.write(clearTextBody, clearTextBody.length);
-      break;
-    default:
-      response.setStatusLine(metadata.httpVersion, 404, "Not Found");
-  }
-  case_6_request_no++;
-}
-function received_partial_6(request, data) {
-// would like to verify that the response does not have Accept-Ranges
-  do_check_eq(partial_data_length, data.length);
-  var chan = make_channel("http://localhost:4444/test_6");
-  chan.asyncOpen(new ChannelListener(received_cleartext, null), null);
-}
-
-// Simple mechanism to keep track of tests and stop the server 
-var numTestsFinished = 0;
-function testFinished() {
-  if (++numTestsFinished == 5)
-    httpserver.stop(do_test_finished);
-}
-
-function run_test() {
-  httpserver = new nsHttpServer();
-  httpserver.registerPathHandler("/test_2", handler_2);
-  httpserver.registerPathHandler("/test_3", handler_3);
-  httpserver.registerPathHandler("/test_4", handler_4);
-  httpserver.registerPathHandler("/test_5", handler_5);
-  httpserver.registerPathHandler("/test_6", handler_6);
-  httpserver.start(4444);
-
-  // wipe out cached content
-  getCacheService().evictEntries(Components.interfaces.nsICache.STORE_ANYWHERE);
-
-  // Case 2: zero-length partial entry must not trigger range-request
-  var chan = make_channel("http://localhost:4444/test_2");
-  chan.asyncOpen(new Canceler(received_partial_2), null);
-
-  // Case 3: no-store response must not trigger range-request
-  var chan = make_channel("http://localhost:4444/test_3");
-  chan.asyncOpen(new MyListener(received_partial_3), null);
-
-  // Case 4: response with content-encoding must not trigger range-request
-  var chan = make_channel("http://localhost:4444/test_4");
-  chan.asyncOpen(new MyListener(received_partial_4), null);
-
-  // Case 5: conditional request-header set by client
-  var chan = make_channel("http://localhost:4444/test_5");
-  chan.asyncOpen(new MyListener(received_partial_5), null);
-
-  // Case 6: response is not resumable (drop the Accept-Ranges header)
-  var chan = make_channel("http://localhost:4444/test_6");
-  chan.asyncOpen(new MyListener(received_partial_6), null);
-
-  do_test_pending();
-}
--- a/netwerk/test/unit/test_resumable_truncate.js
+++ b/netwerk/test/unit/test_resumable_truncate.js
@@ -3,16 +3,18 @@ do_load_httpd_js();
 var httpserver = null;
 
 function make_channel(url, callback, ctx) {
   var ios = Cc["@mozilla.org/network/io-service;1"].
             getService(Ci.nsIIOService);
   return ios.newChannel(url, "", null);
 }
 
+var do304 = false;
+
 const responseBody = "response body";
 
 function cachedHandler(metadata, response) {
   var body = responseBody;
   if (metadata.hasHeader("Range")) {
     var matches = metadata.getHeader("Range").match(/^\s*bytes=(\d+)?-(\d+)?\s*$/);
     var from = (matches[1] === undefined) ? 0 : matches[1];
     var to = (matches[2] === undefined) ? responseBody.length - 1 : matches[2];
@@ -20,16 +22,19 @@ function cachedHandler(metadata, respons
       response.setStatusLine(metadata.httpVersion, 416, "Start pos too high");
       response.setHeader("Content-Range", "*/" + responseBody.length, false);
       return;
     }
     body = responseBody.slice(from, to + 1);
     // always respond to successful range requests with 206
     response.setStatusLine(metadata.httpVersion, 206, "Partial Content");
     response.setHeader("Content-Range", from + "-" + to + "/" + responseBody.length, false);
+  } else if (do304) {
+    response.setStatusLine(metadata.httpVersion, 304, "Not Modified");
+    return;
   }
 
   response.setHeader("Content-Type", "text/plain", false);
   response.setHeader("ETag", "Just testing");
   response.setHeader("Accept-Ranges", "bytes");
 
   response.bodyOutputStream.write(body, body.length);
 }
@@ -61,26 +66,29 @@ Canceler.prototype = {
   }
 };
 
 function finish_test() {
   httpserver.stop(do_test_finished);
 }
 
 function start_cache_read() {
+  do304 = true;
   var chan = make_channel("http://localhost:4444/cached/test.gz");
   chan.asyncOpen(new ChannelListener(finish_test, null), null);
 }
 
 function start_canceler() {
+  do304 = false;
   var chan = make_channel("http://localhost:4444/cached/test.gz");
   chan.asyncOpen(new Canceler(start_cache_read), null);
 }
 
 function run_test() {
   httpserver = new nsHttpServer();
   httpserver.registerPathHandler("/cached/test.gz", cachedHandler);
   httpserver.start(4444);
 
+  do304 = false;
   var chan = make_channel("http://localhost:4444/cached/test.gz");
   chan.asyncOpen(new ChannelListener(start_canceler, null), null);
   do_test_pending();
 }
--- a/toolkit/mozapps/extensions/content/extensions.js
+++ b/toolkit/mozapps/extensions/content/extensions.js
@@ -1201,38 +1201,17 @@ function createItem(aObj, aIsInstall, aI
 }
 
 function sortElements(aElements, aSortBy, aAscending) {
   // aSortBy is an Array of attributes to sort by, in decending
   // order of priority.
 
   const DATE_FIELDS = ["updateDate"];
   const NUMERIC_FIELDS = ["size", "relevancescore", "purchaseAmount"];
-
-  // We're going to group add-ons into the following buckets:
-  //
-  //  enabledInstalled
-  //    * Enabled
-  //    * Incompatible but enabled because compatibility checking is off
-  //    * Waiting to be installed
-  //    * Waiting to be enabled
-  //
-  //  pendingDisable
-  //    * Waiting to be disabled
-  //
-  //  pendingUninstall
-  //    * Waiting to be removed
-  //
-  //  disabledIncompatibleBlocked
-  //    * Disabled
-  //    * Incompatible
-  //    * Blocklisted
-
-  const UISTATE_ORDER = ["enabled", "pendingDisable", "pendingUninstall",
-                         "disabled"];
+  const UISTATE_ORDER = ["enabled", "incompatible", "disabled", "blocked"]
 
   function dateCompare(a, b) {
     var aTime = a.getTime();
     var bTime = b.getTime();
     if (aTime < bTime)
       return -1;
     if (aTime > bTime)
       return 1;
@@ -1261,30 +1240,29 @@ function sortElements(aElements, aSortBy
       return null;
 
     if (aObj.hasAttribute(aKey))
       return aObj.getAttribute(aKey);
 
     addon = aObj.mAddon || aObj.mInstall;
     if (!addon)
       return null;
-
     if (aKey == "uiState") {
-      if (addon.pendingOperations == AddonManager.PENDING_DISABLE)
-        return "pendingDisable";
-      if (addon.pendingOperations == AddonManager.PENDING_UNINSTALL)
-        return "pendingUninstall";
-      if (!addon.isActive &&
-          (addon.pendingOperations != AddonManager.PENDING_ENABLE &&
-           addon.pendingOperations != AddonManager.PENDING_INSTALL))
+      if (addon.isActive)
+        return "enabled";
+      else if (!addon.isCompatible)
+        return "incompatible";
+      else if (addon.blocklistState == Ci.nsIBlocklistService.STATE_NOT_BLOCKED)
         return "disabled";
-      else
-        return "enabled";
+      else if (addon.isCompatible &&
+               addon.blocklistState != Ci.nsIBlocklistService.STATE_NOT_BLOCKED)
+        return "blocked";
     }
 
+
     return addon[aKey];
   }
 
   // aSortFuncs will hold the sorting functions that we'll
   // use per element, in the correct order.
   var aSortFuncs = [];
 
   for (let i = 0; i < aSortBy.length; i++) {
--- a/toolkit/mozapps/extensions/test/browser/browser_sorting.js
+++ b/toolkit/mozapps/extensions/test/browser/browser_sorting.js
@@ -8,194 +8,162 @@
 var gManagerWindow;
 var gProvider;
 
 function test() {
   waitForExplicitFinish();
 
   gProvider = new MockProvider();
   gProvider.createAddons([{
-    //  enabledInstalled group
-    //    * Enabled
-    //    * Incompatible but enabled because compatibility checking is off
-    //    * Waiting to be installed
-    //    * Waiting to be enabled
+    // Enabled extensions
     id: "test1@tests.mozilla.org",
     name: "Test add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 02, 00, 00, 00),
-    size: 1,
-    pendingOperations: AddonManager.PENDING_NONE,
+    size: 1
   }, {
     id: "test2@tests.mozilla.org",
     name: "a first add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 01, 23, 59, 59),
-    size: 0265,
-    pendingOperations: AddonManager.PENDING_UPGRADE,
-    isActive: true,
-    isCompatible: false,
+    size: 0265
   }, {
     id: "test3@tests.mozilla.org",
     name: "\u010Cesk\u00FD slovn\u00EDk", // Český slovník
     description: "foo",
     updateDate: new Date(2010, 04, 02, 00, 00, 01),
-    size: 12,
-    pendingOperations: AddonManager.PENDING_INSTALL,
-    isActive: false,
+    size: 12
   }, {
     id: "test4@tests.mozilla.org",
     name: "canadian dictionary",
     updateDate: new Date(1970, 0, 01, 00, 00, 00),
     description: "foo",
-    isActive: true,
   }, {
     id: "test5@tests.mozilla.org",
     name: "croatian dictionary",
     description: "foo",
     updateDate: new Date(2012, 12, 12, 00, 00, 00),
-    size: 5,
-    pendingOperations: AddonManager.PENDING_ENABLE,
-    isActive: false,
+    size: 5
   }, {
-    //  pendingDisable group
-    //    * Waiting to be disabled
+    // Incompatible, disabled extensions
     id: "test6@tests.mozilla.org",
     name: "orange Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 02, 00, 00, 00),
     size: 142,
     isCompatible: false,
-    isActive: true,
-    pendingOperations: AddonManager.PENDING_DISABLE,
+    isActive: false,
   }, {
     id: "test7@tests.mozilla.org",
     name: "Blue Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 01, 23, 59, 59),
     size: 65,
-    isActive: true,
-    pendingOperations: AddonManager.PENDING_DISABLE,
+    isCompatible: false,
+    isActive: false,
   }, {
     id: "test8@tests.mozilla.org",
     name: "Green Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 03, 00, 00, 01),
     size: 125,
-    pendingOperations: AddonManager.PENDING_DISABLE,
+    isCompatible: false,
+    isActive: false,
   }, {
     id: "test9@tests.mozilla.org",
     name: "red Add-on",
     updateDate: new Date(2011, 04, 01, 00, 00, 00),
     description: "foo",
     isCompatible: false,
-    pendingOperations: AddonManager.PENDING_DISABLE,
+    isActive: false,
   }, {
     id: "test10@tests.mozilla.org",
     name: "Purple Add-on",
     description: "foo",
     updateDate: new Date(2012, 12, 12, 00, 00, 00),
     size: 56,
     isCompatible: false,
-    pendingOperations: AddonManager.PENDING_DISABLE,
+    isActive: false,
   }, {
-    //  pendingUninstall group
-    //    * Waiting to be removed
+    // Disabled, compatible extensions
     id: "test11@tests.mozilla.org",
     name: "amber Add-on",
     description: "foo",
     updateDate: new Date(1978, 04, 02, 00, 00, 00),
     size: 142,
     isActive: false,
-    appDisabled: true,
-    pendingOperations: AddonManager.PENDING_UNINSTALL,
   }, {
     id: "test12@tests.mozilla.org",
-    name: "Salmon Add-on - pending disable",
+    name: "Salmon Add-on",
     description: "foo",
     updateDate: new Date(2054, 04, 01, 23, 59, 59),
     size: 65,
-    isActive: true,
-    pendingOperations: AddonManager.PENDING_UNINSTALL,
+    isActive: false,
   }, {
     id: "test13@tests.mozilla.org",
     name: "rose Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 02, 00, 00, 01),
     size: 125,
     isActive: false,
-    userDisabled: true,
-    pendingOperations: AddonManager.PENDING_UNINSTALL,
   }, {
     id: "test14@tests.mozilla.org",
     name: "Violet Add-on",
     updateDate: new Date(2010, 05, 01, 00, 00, 00),
     description: "foo",
     isActive: false,
-    appDisabled: true,
-    pendingOperations: AddonManager.PENDING_UNINSTALL,
   }, {
     id: "test15@tests.mozilla.org",
     name: "white Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 12, 00, 00, 00),
     size: 56,
     isActive: false,
-    userDisabled: true,
-    pendingOperations: AddonManager.PENDING_UNINSTALL,
   }, {
-    //  disabledIncompatibleBlocked group
-    //    * Disabled
-    //    * Incompatible
-    //    * Blocklisted
+    // Blocked extensions
     id: "test16@tests.mozilla.org",
     name: "grimsby Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 01, 00, 00, 00),
     size: 142,
     isActive: false,
-    appDisabled: true,
+    blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
   }, {
     id: "test17@tests.mozilla.org",
     name: "beamsville Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 8, 23, 59, 59),
     size: 65,
     isActive: false,
-    userDisabled: true,
+    blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
   }, {
     id: "test18@tests.mozilla.org",
     name: "smithville Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 03, 00, 00, 01),
     size: 125,
     isActive: false,
-    userDisabled: true,
     blocklistState: Ci.nsIBlocklistService.STATE_OUTDATED,
   }, {
     id: "test19@tests.mozilla.org",
     name: "dunnville Add-on",
     updateDate: new Date(2010, 04, 02, 00, 00, 00),
     description: "foo",
     isActive: false,
-    appDisabled: true,
-    isCompatible: false,
-    blocklistState: Ci.nsIBlocklistService.STATE_NOT_BLOCKED,
+    blocklistState: Ci.nsIBlocklistService.STATE_SOFTBLOCKED,
   }, {
     id: "test20@tests.mozilla.org",
     name: "silverdale Add-on",
     description: "foo",
     updateDate: new Date(2010, 04, 12, 00, 00, 00),
     size: 56,
     isActive: false,
-    appDisabled: true,
     blocklistState: Ci.nsIBlocklistService.STATE_BLOCKED,
   }]);
 
-
   open_manager("addons://list/extension", function(aWindow) {
     gManagerWindow = aWindow;
     run_next_test();
   });
 }
 
 function end_test() {
   close_manager(gManagerWindow, function() {
@@ -251,16 +219,17 @@ add_test(function() {
     "test14@tests.mozilla.org",
     "test15@tests.mozilla.org",
     "test17@tests.mozilla.org",
     "test19@tests.mozilla.org",
     "test16@tests.mozilla.org",
     "test20@tests.mozilla.org",
     "test18@tests.mozilla.org",
   ]);
+
   run_next_test();
 });
 
 // Tests that switching to date ordering works
 add_test(function() {
   set_order("updateDate", false);
 
   // When we're ascending with updateDate, it's from newest
--- a/widget/src/windows/nsWindow.cpp
+++ b/widget/src/windows/nsWindow.cpp
@@ -2650,22 +2650,28 @@ void nsWindow::UpdateGlass()
 
   // DWMNCRP_USEWINDOWSTYLE - The non-client rendering area is
   //                          rendered based on the window style.
   // DWMNCRP_ENABLED        - The non-client area rendering is
   //                          enabled; the window style is ignored.
   DWMNCRENDERINGPOLICY policy = DWMNCRP_USEWINDOWSTYLE;
   switch (mTransparencyMode) {
   case eTransparencyBorderlessGlass:
-    // Only adjust if there is some opaque rectangle
+    // Margins must be 2px (kGlassMarginAdjustment) or larger to cover the 2px
+    // border Windows adds. A value of -1 in cxLeftWidth indicates a sheet of
+    // glass which we ignore here.
     if (margins.cxLeftWidth >= 0) {
-      margins.cxLeftWidth += kGlassMarginAdjustment;
-      margins.cyTopHeight += kGlassMarginAdjustment;
-      margins.cxRightWidth += kGlassMarginAdjustment;
-      margins.cyBottomHeight += kGlassMarginAdjustment;
+      if (margins.cxLeftWidth >= 0 && margins.cxLeftWidth < kGlassMarginAdjustment)
+        margins.cxLeftWidth = kGlassMarginAdjustment;
+      if (margins.cyTopHeight >= 0 && margins.cyTopHeight < kGlassMarginAdjustment)
+        margins.cyTopHeight = kGlassMarginAdjustment;
+      if (margins.cxRightWidth >= 0 && margins.cxRightWidth < kGlassMarginAdjustment)
+        margins.cxRightWidth = kGlassMarginAdjustment;
+      if (margins.cyBottomHeight >= 0 && margins.cyBottomHeight < kGlassMarginAdjustment)
+        margins.cyBottomHeight = kGlassMarginAdjustment;
     }
     // Fall through
   case eTransparencyGlass:
     policy = DWMNCRP_ENABLED;
     break;
   }
 
   PR_LOG(gWindowsLog, PR_LOG_ALWAYS,