Merge mozilla-central to Places
authorShawn Wilsher <me@shawnwilsher.com>
Tue, 14 Dec 2010 15:56:41 -0800
changeset 59388 ca55136bdf2c3558d4289fbb5028217327d5de0f
parent 59387 23c8f19e51f1b92ad7c1ccd0e73ab99d110afa6d (current diff)
parent 59183 a272338eb57a623106e8032905009813d91e8e28 (diff)
child 59389 ef51960b24ddd0b79fec1555e7d84764bac1f8af
push id1
push usershaver@mozilla.com
push dateTue, 04 Jan 2011 17:58:04 +0000
milestone2.0b8pre
Merge mozilla-central to Places
browser/themes/gnomestripe/browser/effects.svg
browser/themes/pinstripe/browser/effects.svg
browser/themes/winstripe/browser/effects.svg
build/bloaturls.txt
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -350,16 +350,19 @@ nsRootAccessible::FireAccessibleFocusEve
   }
 
   // Fire focus only if it changes, but always fire focus events when
   // aForceEvent == PR_TRUE
   nsINode* focusNode = focusAccessible->GetNode();
   if (gLastFocusedNode == focusNode && !aForceEvent)
     return;
 
+  nsDocAccessible* focusDocument = focusAccessible->GetDocAccessible();
+  NS_ASSERTION(focusDocument, "No document while accessible is in document?!");
+
   gLastFocusedAccessiblesState = nsAccUtils::State(focusAccessible);
 
   // Fire menu start/end events for ARIA menus.
   if (focusAccessible->ARIARole() == nsIAccessibleRole::ROLE_MENUITEM) {
     // The focus is inside a menu.
     if (!mCurrentARIAMenubar) {
       // Entering ARIA menu. Fire menu start event.
       nsAccessible* menuBarAccessible =
@@ -368,41 +371,42 @@ nsRootAccessible::FireAccessibleFocusEve
       if (menuBarAccessible) {
         mCurrentARIAMenubar = menuBarAccessible->GetNode();
         if (mCurrentARIAMenubar) {
           nsRefPtr<AccEvent> menuStartEvent =
             new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
                          menuBarAccessible, aIsFromUserInput,
                          AccEvent::eAllowDupes);
           if (menuStartEvent)
-            FireDelayedAccessibleEvent(menuStartEvent);
+            focusDocument->FireDelayedAccessibleEvent(menuStartEvent);
         }
       }
     }
   }
   else if (mCurrentARIAMenubar) {
     // Focus left a menu. Fire menu end event.
     nsRefPtr<AccEvent> menuEndEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mCurrentARIAMenubar,
                    aIsFromUserInput, AccEvent::eAllowDupes);
     if (menuEndEvent) {
-      FireDelayedAccessibleEvent(menuEndEvent);
+      focusDocument->FireDelayedAccessibleEvent(menuEndEvent);
     }
     mCurrentARIAMenubar = nsnull;
   }
 
   NS_IF_RELEASE(gLastFocusedNode);
   gLastFocusedNode = focusNode;
   NS_IF_ADDREF(gLastFocusedNode);
 
   // Coalesce focus events from the same document, because DOM focus event might
   // be fired for the document node and then for the focused DOM element.
-  FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
-                             focusNode, AccEvent::eCoalesceFromSameDocument,
-                             aIsFromUserInput);
+  focusDocument->FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_FOCUS,
+                                            focusNode,
+                                            AccEvent::eCoalesceFromSameDocument,
+                                            aIsFromUserInput);
 }
 
 void
 nsRootAccessible::FireCurrentFocusEvent()
 {
   if (IsDefunct())
     return;
 
@@ -454,16 +458,19 @@ nsRootAccessible::HandleEvent(nsIDOMEven
     GetAccService()->GetAccessibleOrContainer(origTarget, weakShell);
 
   if (eventType.EqualsLiteral("popuphiding"))
     return HandlePopupHidingEvent(origTarget, accessible);
 
   if (!accessible)
     return NS_OK;
 
+  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;
 #ifdef MOZ_XUL
   PRBool isTree = targetContent ?
     targetContent->NodeInfo()->Equals(nsAccessibilityAtoms::tree,
                                       kNameSpaceID_XUL) : PR_FALSE;
 
@@ -687,18 +694,19 @@ nsRootAccessible::HandleEvent(nsIDOMEven
                             accessible, eFromUserInput);
   }
   else if (eventType.EqualsLiteral("DOMMenuBarInactive")) {  // Always from user input
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENU_END,
                             accessible, eFromUserInput);
     FireCurrentFocusEvent();
   }
   else if (eventType.EqualsLiteral("ValueChange")) {
-    FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
-                               targetNode, AccEvent::eRemoveDupes);
+    targetDocument->
+      FireDelayedAccessibleEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE,
+                                 targetNode, AccEvent::eRemoveDupes);
   }
 #ifdef DEBUG_DRAGDROPSTART
   else if (eventType.EqualsLiteral("mouseover")) {
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_DRAGDROP_START,
                             accessible);
   }
 #endif
   return NS_OK;
--- a/accessible/tests/mochitest/events/test_focus.html
+++ b/accessible/tests/mochitest/events/test_focus.html
@@ -62,22 +62,21 @@
     {
       this.ID = "alertdialog";
       this.DOMNode = getNode(this.ID);
 
       this.invoke = function showNFocusAlertDialog_invoke()
       {
         document.getElementById(this.ID).style.display = 'block';
         document.getElementById(this.ID).focus();
-        todo(false, "Enable show event handling when bug 422744 is fixed.");
       }
 
       this.eventSeq = [
-        new invokerChecker(EVENT_FOCUS, this.DOMNode),
-        // new invokerChecker(EVENT_SHOW, this.DOMNode)
+        new invokerChecker(EVENT_SHOW, this.DOMNode),
+        new invokerChecker(EVENT_FOCUS, this.DOMNode)
       ];
 
       this.getID = function showNFocusAlertDialog_getID()
       {
         return "Show and focus alert dialog " + prettyName(this.ID);
       }
     }
 
--- a/accessible/tests/mochitest/test_text_caret.html
+++ b/accessible/tests/mochitest/test_text_caret.html
@@ -38,26 +38,25 @@
      */
     function setCaretOffsetInvoker(aID, aOffset)
     {
       this.target = getAccessible(aID, [nsIAccessibleText]);
 
       this.invoke = function setCaretOffsetInvoker_invoke()
       {
         this.target.caretOffset = aOffset;
-        todo(false, "Enable focus event handling when bug 422744 is fixed.");
       }
 
       this.getID = function setCaretOffsetInvoker_getID()
       {
         return "nsIAccessibleText::caretOffset test";
       }
 
       this.eventSeq = [
-        // new invokerChecker(EVENT_FOCUS, this.target),
+        new invokerChecker(EVENT_FOCUS, this.target),
         new caretMovedChecker(this.target, aOffset)
       ];
     }
 
     /**
      * Do tests.
      */
     var gQueue = null;
--- a/browser/base/content/browser-syncui.js
+++ b/browser/base/content/browser-syncui.js
@@ -273,17 +273,17 @@ let gSyncUI = {
   },
 
   doLogout: function SUI_doLogout() {
     Weave.Service.logout();
   },
 
   doSync: function SUI_doSync() {
     if (Weave.Service.isLoggedIn || Weave.Service.login())
-      Weave.Service.sync();
+      setTimeout(function() Weave.Service.sync(), 0);
   },
 
   handleToolbarButton: function SUI_handleStatusbarButton() {
     if (this._needsSetup())
       this.openSetup();
     else
       this.doSync();
   },
--- a/browser/base/content/urlbarBindings.xml
+++ b/browser/base/content/urlbarBindings.xml
@@ -270,21 +270,20 @@
               this.handleRevert();
               content.focus();
             }
             openUILinkIn(url, where,
                         { allowThirdPartyFixup: true, postData: postData });
             return;
           }
 
-          if (aTriggeringEvent && aTriggeringEvent.altKey) {
+          if (aTriggeringEvent &&
+              aTriggeringEvent.altKey &&
+              !isTabEmpty(gBrowser.selectedTab)) {
             this.handleRevert();
-            let prevTab = gBrowser.selectedTab;
-            if (isTabEmpty(prevTab))
-              gBrowser.removeTab(prevTab);
             content.focus();
             gBrowser.loadOneTab(url, {
                                 postData: postData,
                                 inBackground: false,
                                 allowThirdPartyFixup: true});
             aTriggeringEvent.preventDefault();
             aTriggeringEvent.stopPropagation();
           }
--- a/browser/themes/gnomestripe/browser/browser.css
+++ b/browser/themes/gnomestripe/browser/browser.css
@@ -1772,16 +1772,12 @@ panel[dimmed="true"] {
 
 /* Remove all borders from statusbarpanel children of
    the statusbar. */
 #status-bar > statusbarpanel {
   border-width: 0;
   -moz-appearance: none;
 }
 
-browser[tabmodalPromptShowing] {
-  filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
-}
-
 /* Add-on bar close button */
 #addonbar-closebutton {
   list-style-image: url("moz-icon://stock/gtk-close?size=menu");
 }
deleted file mode 100644
--- a/browser/themes/gnomestripe/browser/effects.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-# ***** 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 effects.svg.
-#
-# The Initial Developer of the Original Code is the Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Justin Dolske <dolske@mozilla.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 *****
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-         "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="0">
-    <filter id="blurAndDesaturate">
-        <feGaussianBlur stdDeviation="2"/>
-        <feColorMatrix type="saturate" values="0.7"/>
-    </filter>
-</svg>
--- a/browser/themes/gnomestripe/browser/jar.mn
+++ b/browser/themes/gnomestripe/browser/jar.mn
@@ -7,17 +7,16 @@ browser.jar:
 * skin/classic/browser/aboutSessionRestore.css        (aboutSessionRestore.css)
   skin/classic/browser/aboutSessionRestore-window-icon.png
   skin/classic/browser/aboutCertError.css             (aboutCertError.css)
 #ifdef MOZ_SERVICES_SYNC
   skin/classic/browser/aboutSyncTabs.css
 #endif
   skin/classic/browser/actionicon-tab.png
 * skin/classic/browser/browser.css                    (browser.css)
-* skin/classic/browser/effects.svg                    (effects.svg)
 * skin/classic/browser/engineManager.css              (engineManager.css)
   skin/classic/browser/fullscreen-video.css
   skin/classic/browser/inspector.css
   skin/classic/browser/Geolocation-16.png
   skin/classic/browser/Geolocation-64.png
   skin/classic/browser/Go-arrow.png
   skin/classic/browser/identity.png
   skin/classic/browser/Info.png
--- a/browser/themes/pinstripe/browser/browser.css
+++ b/browser/themes/pinstripe/browser/browser.css
@@ -2279,12 +2279,8 @@ panel[dimmed="true"] {
 
 #addonbar-closebutton:hover {
   list-style-image: url("chrome://global/skin/icons/closetab-hover.png");
 }
 
 #addonbar-closebutton:hover:active {
   list-style-image: url("chrome://global/skin/icons/closetab-active.png");
 }
-
-browser[tabmodalPromptShowing] {
-  filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
-}
deleted file mode 100644
--- a/browser/themes/pinstripe/browser/effects.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-# ***** 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 effects.svg.
-#
-# The Initial Developer of the Original Code is the Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Justin Dolske <dolske@mozilla.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 *****
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-         "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="0">
-    <filter id="blurAndDesaturate">
-        <feGaussianBlur stdDeviation="2"/>
-        <feColorMatrix type="saturate" values="0.7"/>
-    </filter>
-</svg>
--- a/browser/themes/pinstripe/browser/jar.mn
+++ b/browser/themes/pinstripe/browser/jar.mn
@@ -6,17 +6,16 @@ browser.jar:
 * skin/classic/browser/aboutSessionRestore.css              (aboutSessionRestore.css)
   skin/classic/browser/aboutSessionRestore-window-icon.png
   skin/classic/browser/aboutCertError.css                   (aboutCertError.css)
 #ifdef MOZ_SERVICES_SYNC
   skin/classic/browser/aboutSyncTabs.css
 #endif
   skin/classic/browser/actionicon-tab.png
 * skin/classic/browser/browser.css                          (browser.css)
-* skin/classic/browser/effects.svg                          (effects.svg)
 * skin/classic/browser/engineManager.css                    (engineManager.css)
   skin/classic/browser/fullscreen-video.css
   skin/classic/browser/Geolocation-16.png
   skin/classic/browser/Geolocation-64.png
   skin/classic/browser/Go-arrow.png
   skin/classic/browser/home.png
   skin/classic/browser/hud-style-check-box-checked.png
   skin/classic/browser/hud-style-check-box-empty.png
--- a/browser/themes/winstripe/browser/browser.css
+++ b/browser/themes/winstripe/browser/browser.css
@@ -2122,20 +2122,16 @@ panel[dimmed="true"] {
 
 /* Remove all borders from statusbarpanel children of
    the statusbar. */
 #status-bar > statusbarpanel {
   border-width: 0;
   -moz-appearance: none;
 }
 
-browser[tabmodalPromptShowing] {
-  filter: url("chrome://browser/skin/effects.svg#blurAndDesaturate");
-}
-
 /* Add-on bar close button */
 #addonbar-closebutton {
   border: none;
   padding: 3px 5px;
   list-style-image: url("chrome://global/skin/icons/close.png");
   -moz-appearance: none;
   -moz-image-region: rect(0, 16px, 16px, 0);
 }
deleted file mode 100644
--- a/browser/themes/winstripe/browser/effects.svg
+++ /dev/null
@@ -1,46 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-# ***** 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 effects.svg.
-#
-# The Initial Developer of the Original Code is the Mozilla Foundation.
-# Portions created by the Initial Developer are Copyright (C) 2010
-# the Initial Developer. All Rights Reserved.
-#
-# Contributor(s):
-#   Justin Dolske <dolske@mozilla.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 *****
-
-<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
-         "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
-
-<svg xmlns="http://www.w3.org/2000/svg" version="1.1" height="0">
-    <filter id="blurAndDesaturate">
-        <feGaussianBlur stdDeviation="2"/>
-        <feColorMatrix type="saturate" values="0.7"/>
-    </filter>
-</svg>
--- a/browser/themes/winstripe/browser/jar.mn
+++ b/browser/themes/winstripe/browser/jar.mn
@@ -11,17 +11,16 @@ browser.jar:
         skin/classic/browser/aboutCertError.css                      (aboutCertError.css)
 #ifdef MOZ_SERVICES_SYNC
         skin/classic/browser/aboutSyncTabs.css
 #endif
         skin/classic/browser/actionicon-tab.png
         skin/classic/browser/appmenu-icons.png
         skin/classic/browser/appmenu-dropmarker.png
 *       skin/classic/browser/browser.css                             (browser.css)
-*       skin/classic/browser/effects.svg                             (effects.svg)
 *       skin/classic/browser/engineManager.css                       (engineManager.css)
         skin/classic/browser/fullscreen-video.css
         skin/classic/browser/Geolocation-16.png
         skin/classic/browser/Geolocation-64.png
         skin/classic/browser/Info.png                                (Info.png)
         skin/classic/browser/identity.png                            (identity.png)
         skin/classic/browser/keyhole-forward-mask.svg
         skin/classic/browser/KUI-background.png
@@ -124,17 +123,16 @@ browser.jar:
         skin/classic/aero/browser/aboutCertError.css                 (aboutCertError.css)
 #ifdef MOZ_SERVICES_SYNC
         skin/classic/aero/browser/aboutSyncTabs.css
 #endif
         skin/classic/aero/browser/actionicon-tab.png                 (actionicon-tab.png)
         skin/classic/aero/browser/appmenu-dropmarker.png
         skin/classic/aero/browser/appmenu-icons.png
 *       skin/classic/aero/browser/browser.css                        (browser-aero.css)
-*       skin/classic/aero/browser/effects.svg                        (effects.svg)
 *       skin/classic/aero/browser/engineManager.css                  (engineManager.css)
         skin/classic/aero/browser/fullscreen-video.css
         skin/classic/aero/browser/Geolocation-16.png
         skin/classic/aero/browser/Geolocation-64.png
         skin/classic/aero/browser/Info.png                           (Info-aero.png)
         skin/classic/aero/browser/identity.png                       (identity-aero.png)
         skin/classic/aero/browser/keyhole-forward-mask.svg
         skin/classic/aero/browser/KUI-background.png
--- a/build/Makefile.in
+++ b/build/Makefile.in
@@ -96,26 +96,16 @@ leaktest.py: leaktest.py.in
 	$(PYTHON) $(topsrcdir)/config/Preprocessor.py $^ > $@
 	chmod +x $@
 GARBAGE += leaktest.py
 
 libs:: $(_LEAKTEST_FILES)
 	$(INSTALL) $^ $(_LEAKTEST_DIR)
 
 ifdef ENABLE_TESTS
-# Install bloaturls.txt file for tinderbox bloat test.
-libs:: bloaturls.txt
-	$(INSTALL) $< $(DIST)/bin
-
-# Install bloatcycle.html into dist/bin/res, for auto-cycling
-# of bloaturls.txt.  This is for browsers that can't do -f
-# autocycling of URLs.
-libs:: bloatcycle.html
-	$(INSTALL) $< $(DIST)/bin/res
-
 libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py
 	$(INSTALL) $< $(DIST)/bin
 
 ifeq ($(OS_ARCH),Darwin)
 libs:: $(topsrcdir)/tools/rb/fix-macosx-stack.pl
 	$(INSTALL) $< $(DIST)/bin
 libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py
 	$(INSTALL) $< $(DIST)/bin
--- a/build/binary-location.mk
+++ b/build/binary-location.mk
@@ -1,8 +1,45 @@
+# ***** 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.org.
+# Portions created by the Initial Developer are Copyright (C) 2010
+# the Initial Developer. All Rights Reserved.
+# 
+# Contributor(s):
+#     Jeff Hammel <jhammel@mozilla.com>     (Original author)
+# 
+# Alternatively, the contents of this file may be used under the terms of
+# either of 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 *****
+
 # finds the location of the browser and puts it in the variable $(browser_path)
 
 ifneq (,$(filter OS2 WINCE WINNT,$(OS_ARCH)))
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 else
 PROGRAM = $(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 endif
 
deleted file mode 100644
--- a/build/bloaturls.txt
+++ /dev/null
@@ -1,7 +0,0 @@
-http://www.mozilla.org
-ftp://ftp.mozilla.org
-http://www.mozilla.org
-http://www.mozilla.org/newlayout/samples/test2.html
-http://www.mozilla.org/newlayout/samples/test8.html
-http://www.mozilla.org/newlayout/samples/test6.html
-http://www.mozilla.org/newlayout/samples/test8.html
--- a/content/base/public/nsIDOMFileError.idl
+++ b/content/base/public/nsIDOMFileError.idl
@@ -35,18 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "domstubs.idl"
 
 [scriptable, uuid(4BDAFB64-15E2-49C1-A090-4315A7884A56)]
 interface nsIDOMFileError : nsISupports
 {
-  //File error codes
-  const unsigned short NOT_FOUND_ERR = 8;
-  const unsigned short NOT_READABLE_ERR = 24;
-  const unsigned short SECURITY_ERR = 18;
-  const unsigned short ABORT_ERR = 20;
-  const unsigned short ENCODING_ERR = 26;
+  const unsigned short NOT_FOUND_ERR = 1;
+  const unsigned short SECURITY_ERR = 2;
+  const unsigned short ABORT_ERR = 3;
+  const unsigned short NOT_READABLE_ERR = 4;
+  const unsigned short ENCODING_ERR = 5;
 
   readonly attribute unsigned short code;
 };
-
--- a/content/base/public/nsIDOMFileException.idl
+++ b/content/base/public/nsIDOMFileException.idl
@@ -35,13 +35,16 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "domstubs.idl"
 
 [scriptable, uuid(b52356e1-45c5-4d61-b61a-fb9bd91690e1)]
 interface nsIDOMFileException : nsISupports
 {
-  const unsigned short NOT_FOUND_ERR    = 0;
-  const unsigned short NOT_READABLE_ERR = 1;
-
+  const unsigned short NOT_FOUND_ERR = 1;
+  const unsigned short SECURITY_ERR = 2;
+  const unsigned short ABORT_ERR = 3;
+  const unsigned short NOT_READABLE_ERR = 4;
+  const unsigned short ENCODING_ERR = 5;
+ 
   readonly attribute unsigned short code;
 };
--- a/content/base/test/test_bug435425.html
+++ b/content/base/test/test_bug435425.html
@@ -25,17 +25,17 @@ var upload = null;
 var currentEvents = null;
 var expectedResponseText = null;
 
 function logEvent(evt) {
   var i = 0;
   while ((currentEvents.length != i) &&
          currentEvents[i].optional &&
          ((currentEvents[i].type != evt.type) ||
-          (!evt.target instanceof currentEvents[i].target))) {
+          !(evt.target instanceof currentEvents[i].target))) {
     ++i;
   }
   ok(i != currentEvents.length, "Extra or wrong event?");
   is(evt.type, currentEvents[i].type, "Wrong event!")
   ok(evt.target instanceof currentEvents[i].target,
      "Wrong event target [" + evt.target + "," + evt.type + "]!");
   // If we handled non-optional event, remove all optional events before the 
   // handled event and then the non-optional event from the list.
--- a/content/canvas/src/WebGLContext.cpp
+++ b/content/canvas/src/WebGLContext.cpp
@@ -705,24 +705,24 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUO
 NS_IMPL_CYCLE_COLLECTION_CLASS(WebGLContext)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(WebGLContext)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mCanvasElement)
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(WebGLContext)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mCanvasElement)
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
-DOMCI_DATA(CanvasRenderingContextWebGL, WebGLContext)
+DOMCI_DATA(WebGLRenderingContext, WebGLContext)
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WebGLContext)
   NS_INTERFACE_MAP_ENTRY(nsIDOMWebGLRenderingContext)
   NS_INTERFACE_MAP_ENTRY(nsICanvasRenderingContextInternal)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMWebGLRenderingContext)
-  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(CanvasRenderingContextWebGL)
+  NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(WebGLRenderingContext)
 NS_INTERFACE_MAP_END
 
 NS_IMPL_ADDREF(WebGLBuffer)
 NS_IMPL_RELEASE(WebGLBuffer)
 
 DOMCI_DATA(WebGLBuffer, WebGLBuffer)
 
 NS_INTERFACE_MAP_BEGIN(WebGLBuffer)
new file mode 100644
--- /dev/null
+++ b/content/smil/crashtests/615002-1.svg
@@ -0,0 +1,16 @@
+<svg xmlns="http://www.w3.org/2000/svg" class="reftest-wait">
+<script>
+function boom()
+{
+  var a = document.getElementById("a");
+  a.removeAttribute('dur');
+  document.documentElement.appendChild(a);
+  // Force a sample
+  document.documentElement.setCurrentTime(0);
+  document.documentElement.removeAttribute("class");
+}
+
+window.addEventListener("load", boom, false);
+</script>
+<animate begin="-2s" dur="2s" id="a"/>
+</svg>
--- a/content/smil/crashtests/crashtests.list
+++ b/content/smil/crashtests/crashtests.list
@@ -27,8 +27,9 @@ load 590425-1.html
 load 592477-1.xhtml
 load 594653-1.svg
 load 596796-1.svg
 load 605345-1.svg
 load 606101-1.svg
 load 608549-1.svg
 load 608295-1.html
 load 611927-1.svg
+load 615002-1.svg
--- a/content/smil/nsSMILTimedElement.cpp
+++ b/content/smil/nsSMILTimedElement.cpp
@@ -496,19 +496,29 @@ nsSMILTimedElement::DoSampleAt(nsSMILTim
   // This could probably happen if we later implement externalResourcesRequired
   // (bug 277955) and whilst waiting for those resources (and the animation to
   // start) we transfer a node from another document fragment that has already
   // started. In such a case we might receive milestone samples registered with
   // the already active container.
   if (GetTimeContainer()->IsPausedByType(nsSMILTimeContainer::PAUSE_BEGIN))
     return;
 
-  NS_ABORT_IF_FALSE(mElementState != STATE_STARTUP || aEndOnly,
-      "Got a regular sample during startup state, expected an end sample"
-      " instead");
+  // We use an end-sample to start animation since an end-sample lets us
+  // tentatively create an interval without committing to it (by transitioning
+  // to the ACTIVE state) and this is necessary because we might have
+  // dependencies on other animations that are yet to start. After these
+  // other animations start, it may be necessary to revise our initial interval.
+  //
+  // However, sometimes instead of an end-sample we can get a regular sample
+  // during STARTUP state. This can happen, for example, if we register
+  // a milestone before time t=0 and are then re-bound to the tree (which sends
+  // us back to the STARTUP state). In such a case we should just ignore the
+  // sample and wait for our real initial sample which will be an end-sample.
+  if (mElementState == STATE_STARTUP && !aEndOnly)
+    return;
 
   PRBool finishedSeek = PR_FALSE;
   if (GetTimeContainer()->IsSeeking() && mSeekState == SEEK_NOT_SEEKING) {
     mSeekState = mElementState == STATE_ACTIVE ?
                  SEEK_FORWARD_FROM_ACTIVE :
                  SEEK_FORWARD_FROM_INACTIVE;
   } else if (mSeekState != SEEK_NOT_SEEKING &&
              !GetTimeContainer()->IsSeeking()) {
new file mode 100644
--- /dev/null
+++ b/content/xslt/crashtests/602115.html
@@ -0,0 +1,22 @@
+<!DOCTYPE html>
+<script>
+
+try {
+  var docType = document.implementation.createDocumentType(undefined, '', '');
+  var doc = document.implementation.createDocument('', '', null);
+  var xp = new XSLTProcessor;
+  xp.importStylesheet(doc);
+  xp.transformToDocument(docType);
+}
+catch (ex) {}
+
+try {
+  docType = document.implementation.createDocumentType(undefined, '', '');
+  doc = document.implementation.createDocument('', '', null);
+  xp = new XSLTProcessor;
+  xp.importStylesheet(doc);
+  xp.transformToFragment(docType, document);
+}
+catch (ex) {}
+
+</script>
--- a/content/xslt/crashtests/crashtests.list
+++ b/content/xslt/crashtests/crashtests.list
@@ -6,8 +6,9 @@ load 406106-1.html
 load 483444.xml
 load 485217.xml
 load 485286.xml
 load 528300.xml
 load 528488.xml
 load 528963.xml
 load 545927.html
 load 601543.html
+load 602115.html
--- a/content/xslt/src/xslt/txExecutionState.cpp
+++ b/content/xslt/src/xslt/txExecutionState.cpp
@@ -85,41 +85,32 @@ txLoadedDocumentsHash::~txLoadedDocument
 }
 
 txExecutionState::txExecutionState(txStylesheet* aStylesheet,
                                    PRBool aDisableLoads)
     : mStylesheet(aStylesheet),
       mNextInstruction(nsnull),
       mLocalVariables(nsnull),
       mRecursionDepth(0),
-      mTemplateRules(nsnull),
-      mTemplateRulesBufferSize(0),
-      mTemplateRuleCount(0),
       mEvalContext(nsnull),
       mInitialEvalContext(nsnull),
       mGlobalParams(nsnull),
       mKeyHash(aStylesheet->getKeyMap()),
       mDisableLoads(aDisableLoads)
 {
     MOZ_COUNT_CTOR(txExecutionState);
 }
 
 txExecutionState::~txExecutionState()
 {
     MOZ_COUNT_DTOR(txExecutionState);
 
     delete mResultHandler;
     delete mLocalVariables;
     delete mEvalContext;
-
-    PRInt32 i;
-    for (i = 0; i < mTemplateRuleCount; ++i) {
-        NS_IF_RELEASE(mTemplateRules[i].mModeLocalName);
-    }
-    delete [] mTemplateRules;
     
     txStackIterator varsIter(&mLocalVarsStack);
     while (varsIter.hasNext()) {
         delete (txVariableMap*)varsIter.next();
     }
 
     txStackIterator contextIter(&mEvalContextStack);
     while (contextIter.hasNext()) {
@@ -190,26 +181,29 @@ txExecutionState::init(const txXPathNode
     NS_ENSURE_TRUE(mGlobalVarPlaceholderValue, NS_ERROR_OUT_OF_MEMORY);
 
     // Initiate first instruction. This has to be done last since findTemplate
     // might use us.
     txStylesheet::ImportFrame* frame = 0;
     txExpandedName nullName;
     txInstruction* templ = mStylesheet->findTemplate(aNode, nullName,
                                                      this, nsnull, &frame);
-    rv = pushTemplateRule(frame, nullName, nsnull);
-    NS_ENSURE_SUCCESS(rv, rv);
+    pushTemplateRule(frame, nullName, nsnull);
 
     return runTemplate(templ);
 }
 
 nsresult
 txExecutionState::end(nsresult aResult)
 {
-    popTemplateRule();
+    NS_ASSERTION(NS_FAILED(aResult) || mTemplateRules.Length() == 1,
+                 "Didn't clean up template rules properly");
+    if (NS_SUCCEEDED(aResult)) {
+        popTemplateRule();
+    }
     return mOutputHandler->endDocument(aResult);
 }
 
 
 
 nsresult
 txExecutionState::getVariable(PRInt32 aNamespace, nsIAtom* aLName,
                               txAExprResult*& aResult)
@@ -288,19 +282,17 @@ txExecutionState::getVariable(PRInt32 aN
         rtfHandler.forget();
 
         txInstruction* prevInstr = mNextInstruction;
         // set return to nsnull to stop execution
         mNextInstruction = nsnull;
         rv = runTemplate(var->mFirstInstruction);
         NS_ENSURE_SUCCESS(rv, rv);
 
-        rv = pushTemplateRule(nsnull, txExpandedName(), nsnull);
-        NS_ENSURE_SUCCESS(rv, rv);
-
+        pushTemplateRule(nsnull, txExpandedName(), nsnull);
         rv = txXSLTProcessor::execute(*this);
         NS_ENSURE_SUCCESS(rv, rv);
 
         popTemplateRule();
 
         mNextInstruction = prevInstr;
         rtfHandler = (txRtfHandler*)popResultHandler();
         rv = rtfHandler->getAsRTF(&aResult);
@@ -398,50 +390,33 @@ txAXMLEventHandler*
 txExecutionState::popResultHandler()
 {
     txAXMLEventHandler* oldHandler = mResultHandler;
     mResultHandler = (txAXMLEventHandler*)mResultHandlerStack.pop();
 
     return oldHandler;
 }
 
-nsresult
+void
 txExecutionState::pushTemplateRule(txStylesheet::ImportFrame* aFrame,
                                    const txExpandedName& aMode,
                                    txVariableMap* aParams)
 {
-    if (mTemplateRuleCount == mTemplateRulesBufferSize) {
-        PRInt32 newSize =
-            mTemplateRulesBufferSize ? mTemplateRulesBufferSize * 2 : 10;
-        TemplateRule* newRules = new TemplateRule[newSize];
-        NS_ENSURE_TRUE(newRules, NS_ERROR_OUT_OF_MEMORY);
-        
-        memcpy(newRules, mTemplateRules,
-               mTemplateRuleCount * sizeof(TemplateRule));
-        delete [] mTemplateRules;
-        mTemplateRules = newRules;
-        mTemplateRulesBufferSize = newSize;
-    }
-
-    mTemplateRules[mTemplateRuleCount].mFrame = aFrame;
-    mTemplateRules[mTemplateRuleCount].mModeNsId = aMode.mNamespaceID;
-    mTemplateRules[mTemplateRuleCount].mModeLocalName = aMode.mLocalName;
-    mTemplateRules[mTemplateRuleCount].mParams = aParams;
-    NS_IF_ADDREF(mTemplateRules[mTemplateRuleCount].mModeLocalName);
-    ++mTemplateRuleCount;
-    
-    return NS_OK;
+    TemplateRule* rule = mTemplateRules.AppendElement();
+    rule->mFrame = aFrame;
+    rule->mModeNsId = aMode.mNamespaceID;
+    rule->mModeLocalName = aMode.mLocalName;
+    rule->mParams = aParams;
 }
 
 void
 txExecutionState::popTemplateRule()
 {
-    // decrement outside of RELEASE, that would decrement twice
-    --mTemplateRuleCount;
-    NS_IF_RELEASE(mTemplateRules[mTemplateRuleCount].mModeLocalName);
+    NS_PRECONDITION(!mTemplateRules.IsEmpty(), "No rules to pop");
+    mTemplateRules.RemoveElementAt(mTemplateRules.Length() - 1);
 }
 
 txIEvalContext*
 txExecutionState::getEvalContext()
 {
     return mEvalContext;
 }
 
@@ -492,17 +467,18 @@ txExecutionState::getKeyNodes(const txEx
 {
     return mKeyHash.getKeyNodes(aKeyName, aRoot, aKeyValue,
                                 aIndexIfNotFound, *this, aResult);
 }
 
 txExecutionState::TemplateRule*
 txExecutionState::getCurrentTemplateRule()
 {
-    return mTemplateRules + mTemplateRuleCount - 1;
+    NS_PRECONDITION(!mTemplateRules.IsEmpty(), "No current rule!");
+    return &mTemplateRules[mTemplateRules.Length() - 1];
 }
 
 txInstruction*
 txExecutionState::getNextInstruction()
 {
     txInstruction* instr = mNextInstruction;
     if (instr) {
         mNextInstruction = instr->mNext;
--- a/content/xslt/src/xslt/txExecutionState.h
+++ b/content/xslt/src/xslt/txExecutionState.h
@@ -107,33 +107,34 @@ public:
                   txOwningExpandedNameMap<txIGlobalParameter>* aGlobalParams);
     nsresult end(nsresult aResult);
 
     TX_DECL_MATCH_CONTEXT;
 
     /**
      * Struct holding information about a current template rule
      */
-    struct TemplateRule {
+    class TemplateRule {
+    public:
         txStylesheet::ImportFrame* mFrame;
         PRInt32 mModeNsId;
-        nsIAtom* mModeLocalName;
+        nsCOMPtr<nsIAtom> mModeLocalName;
         txVariableMap* mParams;
     };
 
     // Stack functions
     nsresult pushEvalContext(txIEvalContext* aContext);
     txIEvalContext* popEvalContext();
     nsresult pushBool(PRBool aBool);
     PRBool popBool();
     nsresult pushResultHandler(txAXMLEventHandler* aHandler);
     txAXMLEventHandler* popResultHandler();
-    nsresult pushTemplateRule(txStylesheet::ImportFrame* aFrame,
-                              const txExpandedName& aMode,
-                              txVariableMap* aParams);
+    void pushTemplateRule(txStylesheet::ImportFrame* aFrame,
+                          const txExpandedName& aMode,
+                          txVariableMap* aParams);
     void popTemplateRule();
     nsresult pushParamMap(txVariableMap* aParams);
     txVariableMap* popParamMap();
 
     // state-getting functions
     txIEvalContext* getEvalContext();
     const txXPathNode* retrieveDocument(const nsAString& aUri);
     nsresult getKeyNodes(const txExpandedName& aKeyName,
@@ -176,19 +177,17 @@ private:
     txStack mResultHandlerStack;
     txStack mParamStack;
     txInstruction* mNextInstruction;
     txVariableMap* mLocalVariables;
     txVariableMap mGlobalVariableValues;
     nsRefPtr<txAExprResult> mGlobalVarPlaceholderValue;
     PRInt32 mRecursionDepth;
 
-    TemplateRule* mTemplateRules;
-    PRInt32 mTemplateRulesBufferSize;
-    PRInt32 mTemplateRuleCount;
+    AutoInfallibleTArray<TemplateRule, 10> mTemplateRules;
 
     txIEvalContext* mEvalContext;
     txIEvalContext* mInitialEvalContext;
     //Document* mRTFDocument;
     txOwningExpandedNameMap<txIGlobalParameter>* mGlobalParams;
 
     txLoadedDocumentsHash mLoadedDocuments;
     txKeyHash mKeyHash;
--- a/content/xslt/src/xslt/txInstructions.cpp
+++ b/content/xslt/src/xslt/txInstructions.cpp
@@ -56,18 +56,17 @@ txApplyDefaultElementTemplate::execute(t
 {
     txExecutionState::TemplateRule* rule = aEs.getCurrentTemplateRule();
     txExpandedName mode(rule->mModeNsId, rule->mModeLocalName);
     txStylesheet::ImportFrame* frame = 0;
     txInstruction* templ =
         aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
                                       mode, &aEs, nsnull, &frame);
 
-    nsresult rv = aEs.pushTemplateRule(frame, mode, aEs.mTemplateParams);
-    NS_ENSURE_SUCCESS(rv, rv);
+    aEs.pushTemplateRule(frame, mode, aEs.mTemplateParams);
 
     return aEs.runTemplate(templ);
 }
 
 nsresult
 txApplyImportsEnd::execute(txExecutionState& aEs)
 {
     aEs.popTemplateRule();
@@ -92,18 +91,17 @@ txApplyImportsStart::execute(txExecution
     NS_ENSURE_SUCCESS(rv, rv);
 
     txStylesheet::ImportFrame* frame = 0;
     txExpandedName mode(rule->mModeNsId, rule->mModeLocalName);
     txInstruction* templ =
         aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
                                       mode, &aEs, rule->mFrame, &frame);
 
-    rv = aEs.pushTemplateRule(frame, mode, rule->mParams);
-    NS_ENSURE_SUCCESS(rv, rv);
+    aEs.pushTemplateRule(frame, mode, rule->mParams);
 
     return aEs.runTemplate(templ);
 }
 
 txApplyTemplates::txApplyTemplates(const txExpandedName& aMode)
     : mMode(aMode)
 {
 }
@@ -111,18 +109,17 @@ txApplyTemplates::txApplyTemplates(const
 nsresult
 txApplyTemplates::execute(txExecutionState& aEs)
 {
     txStylesheet::ImportFrame* frame = 0;
     txInstruction* templ =
         aEs.mStylesheet->findTemplate(aEs.getEvalContext()->getContextNode(),
                                       mMode, &aEs, nsnull, &frame);
 
-    nsresult rv = aEs.pushTemplateRule(frame, mMode, aEs.mTemplateParams);
-    NS_ENSURE_SUCCESS(rv, rv);
+    aEs.pushTemplateRule(frame, mMode, aEs.mTemplateParams);
 
     return aEs.runTemplate(templ);
 }
 
 txAttribute::txAttribute(nsAutoPtr<Expr> aName, nsAutoPtr<Expr> aNamespace,
                          txNamespaceMap* aMappings)
     : mName(aName),
       mNamespace(aNamespace),
@@ -712,17 +709,18 @@ txPushNewContext::addSort(nsAutoPtr<Expr
         return NS_OK;
     }
     return NS_ERROR_OUT_OF_MEMORY;
 }
 
 nsresult
 txPushNullTemplateRule::execute(txExecutionState& aEs)
 {
-    return aEs.pushTemplateRule(nsnull, txExpandedName(), nsnull);
+    aEs.pushTemplateRule(nsnull, txExpandedName(), nsnull);
+    return NS_OK;
 }
 
 nsresult
 txPushParams::execute(txExecutionState& aEs)
 {
     return aEs.pushParamMap(nsnull);
 }
 
--- a/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
+++ b/content/xslt/src/xslt/txMozillaXSLTProcessor.cpp
@@ -677,20 +677,22 @@ txMozillaXSLTProcessor::TransformToDoc(n
     txExecutionState es(mStylesheet, IsLoadDisabled());
 
     // XXX Need to add error observers
 
     txToDocHandlerFactory handlerFactory(&es, sourceDOMDocument, aOutputDoc,
                                          mObserver);
     es.mOutputHandlerFactory = &handlerFactory;
 
-    es.init(*sourceNode, &mVariables);
+    nsresult rv = es.init(*sourceNode, &mVariables);
 
     // Process root of XML source document
-    nsresult rv = txXSLTProcessor::execute(es);
+    if (NS_SUCCEEDED(rv)) {
+        rv = txXSLTProcessor::execute(es);
+    }
     
     nsresult endRv = es.end(rv);
     if (NS_SUCCEEDED(rv)) {
       rv = endRv;
     }
     
     if (NS_SUCCEEDED(rv)) {
         if (aResult) {
@@ -736,20 +738,22 @@ txMozillaXSLTProcessor::TransformToFragm
 
     // XXX Need to add error observers
 
     rv = aOutput->CreateDocumentFragment(aResult);
     NS_ENSURE_SUCCESS(rv, rv);
     txToFragmentHandlerFactory handlerFactory(*aResult);
     es.mOutputHandlerFactory = &handlerFactory;
 
-    es.init(*sourceNode, &mVariables);
+    rv = es.init(*sourceNode, &mVariables);
 
     // Process root of XML source document
-    rv = txXSLTProcessor::execute(es);
+    if (NS_SUCCEEDED(rv)) {
+        rv = txXSLTProcessor::execute(es);
+    }
     // XXX setup exception context, bug 204658
     nsresult endRv = es.end(rv);
     if (NS_SUCCEEDED(rv)) {
       rv = endRv;
     }
 
     return rv;
 }
--- a/docshell/base/crashtests/crashtests.list
+++ b/docshell/base/crashtests/crashtests.list
@@ -1,11 +1,11 @@
 load 40929-1.html
 load 369126-1.html
 load 403574-1.xhtml
 load 430124-1.html
 load 430628-1.html
 asserts(1-4) load 432114-1.html # bug 570215
-asserts(1) load 432114-2.html # bug 570210
+asserts(1) load 432114-2.html # bug 570215
 load 436900-1.html
 asserts(0-2) load 436900-2.html # bug 566159
 load 500328-1.html
 load 514779-1.xhtml
--- a/dom/base/nsDOMClassInfo.cpp
+++ b/dom/base/nsDOMClassInfo.cpp
@@ -1398,17 +1398,17 @@ static nsDOMClassInfoData sClassInfoData
                                      ELEMENT_SCRIPTABLE_FLAGS)
 #endif
 
   NS_DEFINE_CLASSINFO_DATA(Worker, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CHROME_ONLY_CLASSINFO_DATA(ChromeWorker, nsDOMGenericSH,
                                        DOM_DEFAULT_SCRIPTABLE_FLAGS)
 
-  NS_DEFINE_CLASSINFO_DATA(CanvasRenderingContextWebGL, nsDOMGenericSH,
+  NS_DEFINE_CLASSINFO_DATA(WebGLRenderingContext, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLBuffer, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLTexture, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLProgram, nsDOMGenericSH,
                            DOM_DEFAULT_SCRIPTABLE_FLAGS)
   NS_DEFINE_CLASSINFO_DATA(WebGLShader, nsDOMGenericSH,
@@ -3965,17 +3965,17 @@ nsDOMClassInfo::Init()
 
   DOM_CLASSINFO_MAP_BEGIN(ChromeWorker, nsIWorker)
     DOM_CLASSINFO_MAP_ENTRY(nsIWorker)
     DOM_CLASSINFO_MAP_ENTRY(nsIAbstractWorker)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEventTarget)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMEventTarget)
   DOM_CLASSINFO_MAP_END
 
-  DOM_CLASSINFO_MAP_BEGIN(CanvasRenderingContextWebGL, nsIDOMWebGLRenderingContext)
+  DOM_CLASSINFO_MAP_BEGIN(WebGLRenderingContext, nsIDOMWebGLRenderingContext)
     DOM_CLASSINFO_MAP_ENTRY(nsIDOMWebGLRenderingContext)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(WebGLBuffer, nsIWebGLBuffer)
     DOM_CLASSINFO_MAP_ENTRY(nsIWebGLBuffer)
   DOM_CLASSINFO_MAP_END
 
   DOM_CLASSINFO_MAP_BEGIN(WebGLTexture, nsIWebGLTexture)
--- a/dom/base/nsDOMClassInfoClasses.h
+++ b/dom/base/nsDOMClassInfoClasses.h
@@ -457,17 +457,17 @@ DOMCI_CLASS(MozTouchEvent)
 #ifdef MOZ_MATHML
 DOMCI_CLASS(MathMLElement)
 #endif
 
 DOMCI_CLASS(Worker)
 DOMCI_CLASS(ChromeWorker)
 
 // WebGL
-DOMCI_CLASS(CanvasRenderingContextWebGL)
+DOMCI_CLASS(WebGLRenderingContext)
 DOMCI_CLASS(WebGLBuffer)
 DOMCI_CLASS(WebGLTexture)
 DOMCI_CLASS(WebGLProgram)
 DOMCI_CLASS(WebGLShader)
 DOMCI_CLASS(WebGLFramebuffer)
 DOMCI_CLASS(WebGLRenderbuffer)
 DOMCI_CLASS(WebGLUniformLocation)
 DOMCI_CLASS(WebGLActiveInfo)
--- a/embedding/android/GeckoEvent.java
+++ b/embedding/android/GeckoEvent.java
@@ -63,16 +63,19 @@ public class GeckoEvent {
     public static final int IME_EVENT = 5;
     public static final int DRAW = 6;
     public static final int SIZE_CHANGED = 7;
     public static final int ACTIVITY_STOPPING = 8;
     public static final int ACTIVITY_PAUSING = 9;
     public static final int ACTIVITY_SHUTDOWN = 10;
     public static final int LOAD_URI = 11;
 
+    public static final int SURFACE_CREATED = 12;
+    public static final int SURFACE_DESTROYED = 13;
+
     public static final int IME_COMPOSITION_END = 0;
     public static final int IME_COMPOSITION_BEGIN = 1;
     public static final int IME_SET_TEXT = 2;
     public static final int IME_GET_TEXT = 3;
     public static final int IME_DELETE_TEXT = 4;
     public static final int IME_SET_SELECTION = 5;
     public static final int IME_GET_SELECTION = 6;
     public static final int IME_ADD_RANGE = 7;
--- a/embedding/android/GeckoSurfaceView.java
+++ b/embedding/android/GeckoSurfaceView.java
@@ -154,22 +154,27 @@ class GeckoSurfaceView
             mSoftwareBitmap.copyPixelsFromBuffer(bb);
             Canvas c = holder.lockCanvas();
             c.drawBitmap(mSoftwareBitmap, 0, 0, null);
             holder.unlockCanvasAndPost(c);
         }
     }
 
     public void surfaceCreated(SurfaceHolder holder) {
+        Log.i("GeckoAppJava", "surface created");
+        GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_CREATED);
+        GeckoAppShell.sendEventToGecko(e);
     }
 
     public void surfaceDestroyed(SurfaceHolder holder) {
         Log.i("GeckoAppJava", "surface destroyed");
         mSurfaceValid = false;
         mSoftwareBuffer = null;
+        GeckoEvent e = new GeckoEvent(GeckoEvent.SURFACE_DESTROYED);
+        GeckoAppShell.sendEventToGecko(e);
     }
 
     public ByteBuffer getSoftwareDrawBuffer() {
         mDrawMode = DRAW_2D;
         return mSoftwareBuffer;
     }
 
     /*
--- a/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh
+++ b/gfx/harfbuzz/src/hb-ot-layout-gsubgpos-private.hh
@@ -225,17 +225,17 @@ HB_BEGIN_DECLS
 
 static inline bool apply_lookup (hb_apply_context_t *c,
 				 unsigned int count, /* Including the first glyph */
 				 unsigned int lookupCount,
 				 const LookupRecord lookupRecord[], /* Array of LookupRecords--in design order */
 				 apply_lookup_func_t apply_func)
 {
   unsigned int end = MIN (c->buffer->len, c->buffer->i + c->context_length);
-  if (unlikely (c->buffer->i + count > end))
+  if (unlikely (count == 0 || c->buffer->i + count > end))
     return false;
 
   /* TODO We don't support lookupRecord arrays that are not increasing:
    *      Should be easy for in_place ones at least. */
 
   /* Note: If sublookup is reverse, i will underflow after the first loop
    * and we jump out of it.  Not entirely disastrous.  So we don't check
    * for reverse lookup here.
--- a/gfx/layers/Layers.h
+++ b/gfx/layers/Layers.h
@@ -300,32 +300,20 @@ public:
                                            const nsIntRegion& aRegionToInvalidate,
                                            void* aCallbackData);
   /**
    * Finish the construction phase of the transaction, perform the
    * drawing phase, and end the transaction.
    * During the drawing phase, all ThebesLayers in the tree are
    * drawn in tree order, exactly once each, except for those layers
    * where it is known that the visible region is empty.
-   *
-   * If aCallback is null, this is a 'null' transaction.
-   * There must have been no updates to the layer tree in this transaction.
-   * A null transaction can fail, in which case EndTransaction returns false,
-   * and the transaction must be retried with aCallback set to something non-null.
-   *
-   * If IsNullTransactionSupported() returns false, then aCallback must be non-null.
    */
-  virtual bool EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData) = 0;
 
-  /**
-   * See EndTransaction description
-   */
-  virtual bool IsNullTransactionSupported() { return false; }
-
   PRBool IsSnappingEffectiveTransforms() { return mSnapEffectiveTransforms; } 
 
   /**
    * CONSTRUCTION PHASE ONLY
    * Set the root layer.
    */
   virtual void SetRoot(Layer* aLayer) = 0;
   /**
--- a/gfx/layers/basic/BasicLayers.cpp
+++ b/gfx/layers/basic/BasicLayers.cpp
@@ -497,21 +497,16 @@ BasicThebesLayer::Paint(gfxContext* aCon
       (opacity == 1.0 && !canUseOpaqueSurface &&
        !ShouldRetainTransparentSurface(mContentFlags, targetSurface) &&
        !MustRetainContent())) {
     mValidRegion.SetEmpty();
     mBuffer.Clear();
 
     nsIntRegion toDraw = IntersectWithClip(mVisibleRegion, target);
     if (!toDraw.IsEmpty()) {
-      if (!aCallback) {
-        BasicManager()->SetTransactionIncomplete();
-        return;
-      }
-
       target->Save();
       gfxUtils::ClipToRegionSnapped(target, toDraw);
       if (opacity != 1.0) {
         target->PushGroup(contentType);
       }
       aCallback(this, target, toDraw, nsIntRegion(), aCallbackData);
       if (opacity != 1.0) {
         target->PopGroupToSource();
@@ -1015,17 +1010,16 @@ MayHaveOverlappingOrTransparentLayers(La
 BasicLayerManager::BasicLayerManager(nsIWidget* aWidget) :
 #ifdef DEBUG
   mPhase(PHASE_NONE),
 #endif
   mXResolution(1.0)
   , mYResolution(1.0)
   , mWidget(aWidget)
   , mDoubleBuffering(BUFFER_NONE), mUsingDefaultTarget(PR_FALSE)
-  , mTransactionIncomplete(false)
 {
   MOZ_COUNT_CTOR(BasicLayerManager);
   NS_ASSERTION(aWidget, "Must provide a widget");
 }
 
 BasicLayerManager::BasicLayerManager() :
 #ifdef DEBUG
   mPhase(PHASE_NONE),
@@ -1186,27 +1180,25 @@ MarkLeafLayersCoveredByOpaque(Layer* aLa
     }
   } else {
     for (; child; child = child->GetPrevSibling()) {
       MarkLeafLayersCoveredByOpaque(child, newClipRect, aRegion);
     }
   }
 }
 
-bool
+void
 BasicLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
                                   void* aCallbackData)
 {
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
   Log();
 #endif
 
-  mTransactionIncomplete = false;
-
   NS_ASSERTION(InConstruction(), "Should be in construction phase");
 #ifdef DEBUG
   mPhase = PHASE_DRAWING;
 #endif
 
   if (mTarget) {
     NS_ASSERTION(mRoot, "Root not set");
 
@@ -1229,22 +1221,16 @@ BasicLayerManager::EndTransaction(DrawTh
       !(mTarget->GetFlags() & gfxContext::FLAG_DISABLE_SNAPPING);
     mRoot->ComputeEffectiveTransforms(gfx3DMatrix::From2D(mTarget->CurrentMatrix()));
 
     nsIntRegion region;
     MarkLeafLayersCoveredByOpaque(mRoot,
                                   mRoot->GetEffectiveVisibleRegion().GetBounds(),
                                   region);
     PaintLayer(mRoot, aCallback, aCallbackData);
-    if (mTransactionIncomplete) {
-#ifdef DEBUG
-      mPhase = PHASE_NONE;
-#endif
-      return false;
-    }
 
     if (useDoubleBuffering) {
       finalTarget->SetOperator(gfxContext::OPERATOR_SOURCE);
       PopGroupWithCachedSurface(finalTarget, cachedSurfaceOffset);
     }
 
     mTarget = nsnull;
   }
@@ -1253,17 +1239,16 @@ BasicLayerManager::EndTransaction(DrawTh
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
 #endif
 
 #ifdef DEBUG
   mPhase = PHASE_NONE;
 #endif
   mUsingDefaultTarget = PR_FALSE;
-  return true;
 }
 
 void
 BasicLayerManager::SetRoot(Layer* aLayer)
 {
   NS_ASSERTION(aLayer, "Root can't be null");
   NS_ASSERTION(aLayer->Manager() == this, "Wrong manager");
   NS_ASSERTION(InConstruction(), "Only allowed in construction phase");
@@ -1319,26 +1304,20 @@ BasicLayerManager::PaintLayer(Layer* aLa
   if (!child) {
     BasicImplData* data = ToData(aLayer);
 #ifdef MOZ_LAYERS_HAVE_LOG
     MOZ_LAYERS_LOG(("%s (0x%p) is covered: %i\n", __FUNCTION__,
                    (void*)aLayer, data->IsCoveredByOpaque()));
 #endif
     if (!data->IsCoveredByOpaque()) {
       data->Paint(mTarget, aCallback, aCallbackData);
-      if (mTransactionIncomplete) {
-        return;
-      }
     }
   } else {
     for (; child; child = child->GetNextSibling()) {
       PaintLayer(child, aCallback, aCallbackData);
-      if (mTransactionIncomplete) {
-        return;
-      }
     }
   }
 
   if (needsGroup) {
     mTarget->PopGroupToSource();
     // If the layer is opaque in its visible region we pushed a CONTENT_COLOR
     // group. We need to make sure that only pixels inside the layer's visible
     // region are copied back to the destination.
@@ -1653,21 +1632,16 @@ BasicShadowableThebesLayer::SetBackBuffe
 
 void
 BasicShadowableThebesLayer::PaintBuffer(gfxContext* aContext,
                                         const nsIntRegion& aRegionToDraw,
                                         const nsIntRegion& aRegionToInvalidate,
                                         LayerManager::DrawThebesLayerCallback aCallback,
                                         void* aCallbackData)
 {
-  if (!aCallback) {
-    BasicManager()->SetTransactionIncomplete();
-    mIsNewBuffer = false;
-    return;
-  }
   Base::PaintBuffer(aContext, aRegionToDraw, aRegionToInvalidate,
                     aCallback, aCallbackData);
   if (!HasShadow()) {
     return;
   }
 
   nsIntRegion updatedRegion;
   if (mIsNewBuffer) {
@@ -2552,31 +2526,21 @@ BasicShadowLayerManager::BeginTransactio
 {
   NS_ABORT_IF_FALSE(mKeepAlive.IsEmpty(), "uncommitted txn?");
   if (HasShadowManager()) {
     ShadowLayerForwarder::BeginTransaction();
   }
   BasicLayerManager::BeginTransactionWithTarget(aTarget);
 }
 
-bool
+void
 BasicShadowLayerManager::EndTransaction(DrawThebesLayerCallback aCallback,
                                         void* aCallbackData)
 {
-  if (!BasicLayerManager::EndTransaction(aCallback, aCallbackData)) {
-    NS_WARNING("Failed to finish transaction, clear mKeepAlive");
-    if (HasShadowManager())
-      ShadowLayerForwarder::EndTransaction(nsnull);
-    mKeepAlive.Clear();
-#ifdef DEBUG
-    mPhase = PHASE_NONE;
-#endif
-    return false;
-  }
-
+  BasicLayerManager::EndTransaction(aCallback, aCallbackData);
 #ifdef DEBUG
   mPhase = PHASE_FORWARD;
 #endif
 
   // forward this transaction's changeset to our ShadowLayerManager
   AutoInfallibleTArray<EditReply, 10> replies;
   if (HasShadowManager() && ShadowLayerForwarder::EndTransaction(&replies)) {
     for (nsTArray<EditReply>::size_type i = 0; i < replies.Length(); ++i) {
@@ -2623,17 +2587,16 @@ BasicShadowLayerManager::EndTransaction(
 
 #ifdef DEBUG
   mPhase = PHASE_NONE;
 #endif
 
   // this may result in Layers being deleted, which results in
   // PLayer::Send__delete__() and DeallocShmem()
   mKeepAlive.Clear();
-  return true;
 }
 
 ShadowableLayer*
 BasicShadowLayerManager::Hold(Layer* aLayer)
 {
   NS_ABORT_IF_FALSE(HasShadowManager(),
                     "top-level tree, no shadow tree to remote to");
 
--- a/gfx/layers/basic/BasicLayers.h
+++ b/gfx/layers/basic/BasicLayers.h
@@ -135,17 +135,17 @@ public:
   float XResolution() const { return mXResolution; }
   float YResolution() const { return mYResolution; }
 
   nsIWidget* GetRetainerWidget() { return mWidget; }
   void ClearRetainerWidget() { mWidget = nsnull; }
 
   virtual void BeginTransaction();
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
-  virtual bool EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData);
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
   virtual already_AddRefed<ImageLayer> CreateImageLayer();
   virtual already_AddRefed<CanvasLayer> CreateCanvasLayer();
@@ -176,20 +176,16 @@ public:
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   virtual const char* Name() const { return "Basic"; }
 #endif // MOZ_LAYERS_HAVE_LOG
 
   // Clear the cached contents of this layer.
   void ClearCachedResources();
 
-  bool IsNullTransactionSupported() { return mRoot ? true : false; }
-
-  void SetTransactionIncomplete() { mTransactionIncomplete = true; }
-
 protected:
 #ifdef DEBUG
   enum TransactionPhase {
     PHASE_NONE, PHASE_CONSTRUCTION, PHASE_DRAWING, PHASE_FORWARD
   };
   TransactionPhase mPhase;
 #endif
 
@@ -220,32 +216,31 @@ private:
   // The context to draw into.
   nsRefPtr<gfxContext> mTarget;
 
   // Cached surface for double buffering
   gfxCachedTempSurface mCachedSurface;
 
   BufferMode   mDoubleBuffering;
   PRPackedBool mUsingDefaultTarget;
-  bool mTransactionIncomplete;
 };
  
 
 #ifdef MOZ_IPC
 class BasicShadowLayerManager : public BasicLayerManager,
                                 public ShadowLayerForwarder
 {
   typedef nsTArray<nsRefPtr<Layer> > LayerRefArray;
 
 public:
   BasicShadowLayerManager(nsIWidget* aWidget);
   virtual ~BasicShadowLayerManager();
 
   virtual void BeginTransactionWithTarget(gfxContext* aTarget);
-  virtual bool EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData);
 
   virtual void SetRoot(Layer* aLayer);
 
   virtual void Mutated(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
--- a/gfx/layers/d3d10/LayerManagerD3D10.cpp
+++ b/gfx/layers/d3d10/LayerManagerD3D10.cpp
@@ -225,32 +225,31 @@ LayerManagerD3D10::BeginTransaction()
 }
 
 void
 LayerManagerD3D10::BeginTransactionWithTarget(gfxContext* aTarget)
 {
   mTarget = aTarget;
 }
 
-bool
+void
 LayerManagerD3D10::EndTransaction(DrawThebesLayerCallback aCallback,
                                   void* aCallbackData)
 {
   mCurrentCallbackInfo.Callback = aCallback;
   mCurrentCallbackInfo.CallbackData = aCallbackData;
 
   // The results of our drawing always go directly into a pixel buffer,
   // so we don't need to pass any global transform here.
   mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
 
   Render();
   mCurrentCallbackInfo.Callback = nsnull;
   mCurrentCallbackInfo.CallbackData = nsnull;
   mTarget = nsnull;
-  return true;
 }
 
 already_AddRefed<ThebesLayer>
 LayerManagerD3D10::CreateThebesLayer()
 {
   nsRefPtr<ThebesLayer> layer = new ThebesLayerD3D10(this);
   return layer.forget();
 }
--- a/gfx/layers/d3d10/LayerManagerD3D10.h
+++ b/gfx/layers/d3d10/LayerManagerD3D10.h
@@ -99,17 +99,17 @@ public:
 
   void BeginTransactionWithTarget(gfxContext* aTarget);
 
   struct CallbackInfo {
     DrawThebesLayerCallback Callback;
     void *CallbackData;
   };
 
-  bool EndTransaction(DrawThebesLayerCallback aCallback,
+  void EndTransaction(DrawThebesLayerCallback aCallback,
                       void* aCallbackData);
 
   const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
 
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
 
--- a/gfx/layers/d3d9/LayerManagerD3D9.cpp
+++ b/gfx/layers/d3d9/LayerManagerD3D9.cpp
@@ -144,34 +144,33 @@ LayerManagerD3D9::BeginTransactionWithTa
   mTarget = aTarget;
 }
 
 void
 LayerManagerD3D9::EndConstruction()
 {
 }
 
-bool
+void
 LayerManagerD3D9::EndTransaction(DrawThebesLayerCallback aCallback,
                                  void* aCallbackData)
 {
   mCurrentCallbackInfo.Callback = aCallback;
   mCurrentCallbackInfo.CallbackData = aCallbackData;
 
   // The results of our drawing always go directly into a pixel buffer,
   // so we don't need to pass any global transform here.
   mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
 
   Render();
   /* Clean this out for sanity */
   mCurrentCallbackInfo.Callback = NULL;
   mCurrentCallbackInfo.CallbackData = NULL;
   // Clear mTarget, next transaction could have no target
   mTarget = NULL;
-  return true;
 }
 
 void
 LayerManagerD3D9::SetRoot(Layer *aLayer)
 {
   mRoot = aLayer;
 }
 
--- a/gfx/layers/d3d9/LayerManagerD3D9.h
+++ b/gfx/layers/d3d9/LayerManagerD3D9.h
@@ -127,17 +127,17 @@ public:
 
   void EndConstruction();
 
   struct CallbackInfo {
     DrawThebesLayerCallback Callback;
     void *CallbackData;
   };
 
-  bool EndTransaction(DrawThebesLayerCallback aCallback,
+  void EndTransaction(DrawThebesLayerCallback aCallback,
                       void* aCallbackData);
 
   const CallbackInfo &GetCallbackInfo() { return mCurrentCallbackInfo; }
 
   void SetRoot(Layer* aLayer);
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
 
--- a/gfx/layers/opengl/LayerManagerOGL.cpp
+++ b/gfx/layers/opengl/LayerManagerOGL.cpp
@@ -387,28 +387,28 @@ LayerManagerOGL::BeginTransactionWithTar
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return;
   }
 
   mTarget = aTarget;
 }
 
-bool
+void
 LayerManagerOGL::EndTransaction(DrawThebesLayerCallback aCallback,
                                 void* aCallbackData)
 {
 #ifdef MOZ_LAYERS_HAVE_LOG
   MOZ_LAYERS_LOG(("  ----- (beginning paint)"));
   Log();
 #endif
 
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
-    return false;
+    return;
   }
 
   // The results of our drawing always go directly into a pixel buffer,
   // so we don't need to pass any global transform here.
   mRoot->ComputeEffectiveTransforms(gfx3DMatrix());
 
   mThebesLayerCallback = aCallback;
   mThebesLayerCallbackData = aCallbackData;
@@ -422,17 +422,16 @@ LayerManagerOGL::EndTransaction(DrawTheb
   mThebesLayerCallbackData = nsnull;
 
   mTarget = NULL;
 
 #ifdef MOZ_LAYERS_HAVE_LOG
   Log();
   MOZ_LAYERS_LOG(("]----- EndTransaction"));
 #endif
-  return true;
 }
 
 already_AddRefed<ThebesLayer>
 LayerManagerOGL::CreateThebesLayer()
 {
   if (mDestroyed) {
     NS_WARNING("Call on destroyed layer manager");
     return nsnull;
--- a/gfx/layers/opengl/LayerManagerOGL.h
+++ b/gfx/layers/opengl/LayerManagerOGL.h
@@ -128,17 +128,17 @@ public:
    * LayerManager implementation.
    */
   void BeginTransaction();
 
   void BeginTransactionWithTarget(gfxContext* aTarget);
 
   void EndConstruction();
 
-  virtual bool EndTransaction(DrawThebesLayerCallback aCallback,
+  virtual void EndTransaction(DrawThebesLayerCallback aCallback,
                               void* aCallbackData);
 
   virtual void SetRoot(Layer* aLayer) { mRoot = aLayer; }
 
   virtual already_AddRefed<ThebesLayer> CreateThebesLayer();
 
   virtual already_AddRefed<ContainerLayer> CreateContainerLayer();
 
--- a/gfx/thebes/GLContext.h
+++ b/gfx/thebes/GLContext.h
@@ -628,16 +628,18 @@ public:
     GLuint GetOffscreenTexture() {
         return mOffscreenTexture;
     }
 
     virtual PRBool TextureImageSupportsGetBackingSurface() {
         return PR_FALSE;
     }
 
+    virtual PRBool RenewSurface() { return PR_FALSE; }
+
     /**`
      * Return a valid, allocated TextureImage of |aSize| with
      * |aContentType|.  The TextureImage's texture is configured to
      * use |aWrapMode| (usually GL_CLAMP_TO_EDGE or GL_REPEAT) and by
      * default, GL_LINEAR filtering.  Specify
      * |aUseNearestFilter=PR_TRUE| for GL_NEAREST filtering.  Return
      * NULL if creating the TextureImage fails.
      *
--- a/gfx/thebes/GLContextProviderEGL.cpp
+++ b/gfx/thebes/GLContextProviderEGL.cpp
@@ -166,16 +166,21 @@ typedef void *GLeglImageOES;
 
 #define EGL_DEFAULT_DISPLAY  ((EGLNativeDisplayType)0)
 #define EGL_NO_CONTEXT       ((EGLContext)0)
 #define EGL_NO_DISPLAY       ((EGLDisplay)0)
 #define EGL_NO_SURFACE       ((EGLSurface)0)
 
 #define EGL_DISPLAY()        sEGLLibrary.Display()
 
+EGLSurface
+CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config);
+EGLConfig
+CreateConfig();
+
 static int
 next_power_of_two(int v)
 {
     v--;
     v |= v >> 1;
     v |= v >> 2;
     v |= v >> 4;
     v |= v >> 8;
@@ -667,16 +672,36 @@ public:
                                                      mContext);
             }
             NS_ASSERTION(succeeded, "Failed to make GL context current!");
         }
 
         return succeeded;
     }
 
+#ifdef MOZ_WIDGET_QT
+    virtual PRBool
+    RenewSurface() {
+        /* We don't support renewing on QT because we don't create the surface ourselves */
+        return PR_FALSE;
+    }
+#else
+    virtual PRBool
+    RenewSurface() {
+        sEGLLibrary.fDestroySurface(EGL_DISPLAY(), mSurface);
+
+        EGLConfig config = CreateConfig();
+        mSurface = CreateSurfaceForWindow(NULL, config);
+
+        return sEGLLibrary.fMakeCurrent(EGL_DISPLAY(),
+                                        mSurface, mSurface,
+                                        mContext);
+    }
+#endif
+
     PRBool SetupLookupFunction()
     {
         mLookupFunc = (PlatformLookupFunction)sEGLLibrary.fGetProcAddress;
         return PR_TRUE;
     }
 
     void *GetNativeData(NativeDataType aType)
     {
@@ -1382,25 +1407,24 @@ DepthToGLFormat(int aDepth)
             return ContextFormat::BasicRGB16_565;
         default:
             break;
     }
     return ContextFormat::BasicRGBA32;
 }
 
 
+#ifdef MOZ_WIDGET_QT
 already_AddRefed<GLContext>
 GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
 {
     if (!sEGLLibrary.EnsureInitialized()) {
         return nsnull;
     }
 
-#ifdef MOZ_WIDGET_QT
-
     QWidget *viewport = static_cast<QWidget*>(aWidget->GetNativeData(NS_NATIVE_SHELLWIDGET));
     if (!viewport)
         return nsnull;
 
     if (viewport->paintEngine()->type() == QPaintEngine::OpenGL2) {
         // Qt widget viewport already have GL context created by Qt
         // Create dummy GLContextEGL class
         nsRefPtr<GLContextEGL> glContext =
@@ -1417,23 +1441,24 @@ GLContextProviderEGL::CreateForWindow(ns
 
     // All Qt nsIWidget's have the same X-Window surface
     // And EGL not allowing to create multiple GL context for the same window
     // we should be able to create GL context for QGV viewport once, and reuse it for all child widgets
     NS_ERROR("Need special GLContext implementation for QT widgets structure");
 
     // Switch to software rendering here
     return nsnull;
+}
 
 #else
 
+EGLConfig
+CreateConfig()
+{
     EGLConfig  config;
-    EGLSurface surface;
-    EGLContext context;
-
     EGLint attribs[] = {
         LOCAL_EGL_SURFACE_TYPE,    LOCAL_EGL_WINDOW_BIT,
         LOCAL_EGL_RENDERABLE_TYPE, LOCAL_EGL_OPENGL_ES2_BIT,
 
 #ifdef MOZ_GFX_OPTIMIZE_MOBILE
         LOCAL_EGL_RED_SIZE,        5,
         LOCAL_EGL_GREEN_SIZE,      6,
         LOCAL_EGL_BLUE_SIZE,       5,
@@ -1474,20 +1499,24 @@ GLContextProviderEGL::CreateForWindow(ns
 #else
         if (r == 8 && g == 8 && b == 8 && a == 8) {
             config = configs[i];
             break;
         }
 #endif
     }
 
-    if (!config) {
-        printf_stderr("Failed to create EGL config!\n");
-        return nsnull;
-    }
+    return config;
+}
+
+EGLSurface
+CreateSurfaceForWindow(nsIWidget *aWidget, EGLConfig config)
+{
+    EGLSurface surface;
+
 
 #ifdef DEBUG
     sEGLLibrary.DumpEGLConfig(config);
 #endif
 
 #ifdef ANDROID
     // On Android, we have to ask Java to make the eglCreateWindowSurface
     // call for us.  See GLHelpers.java for a description of why.
@@ -1498,16 +1527,38 @@ GLContextProviderEGL::CreateForWindow(ns
     surface = mozilla::AndroidBridge::Bridge()->
         CallEglCreateWindowSurface(EGL_DISPLAY(), config,
                                    mozilla::AndroidBridge::Bridge()->SurfaceView());
     printf_stderr("got surface %p\n", surface);
 #else
     surface = sEGLLibrary.fCreateWindowSurface(EGL_DISPLAY(), config, GET_NATIVE_WINDOW(aWidget), 0);
 #endif
 
+    return surface;
+}
+
+already_AddRefed<GLContext>
+GLContextProviderEGL::CreateForWindow(nsIWidget *aWidget)
+{
+    EGLContext context;
+    EGLConfig config;
+
+    if (!sEGLLibrary.EnsureInitialized()) {
+        return nsnull;
+    }
+
+    config = CreateConfig();
+
+    if (!config) {
+        printf_stderr("Failed to create EGL config!\n");
+        return nsnull;
+    }
+
+    EGLSurface surface = CreateSurfaceForWindow(aWidget, config);
+
     if (!surface) {
         return nsnull;
     }
 
     if (!sEGLLibrary.fBindAPI(LOCAL_EGL_OPENGL_ES_API)) {
         sEGLLibrary.fDestroySurface(EGL_DISPLAY(), surface);
         return nsnull;
     }
@@ -1543,18 +1594,18 @@ TRY_AGAIN_NO_SHARING:
     if (!glContext->Init())
         return nsnull;
 
 #if defined(XP_WIN) || defined(ANDROID)
     glContext->SetIsDoubleBuffered(PR_TRUE);
 #endif
 
     return glContext.forget();
+}
 #endif
-}
 
 already_AddRefed<GLContextEGL>
 GLContextEGL::CreateEGLPBufferOffscreenContext(const gfxIntSize& aSize,
                                                const ContextFormat& aFormat)
 {
     EGLConfig config;
     EGLSurface surface;
     EGLContext context;
--- a/layout/base/nsPresContext.cpp
+++ b/layout/base/nsPresContext.cpp
@@ -2384,18 +2384,17 @@ nsPresContext::IsRootContentDocument()
   return (f && f->PresContext()->IsChrome());
 }
 
 nsRootPresContext::nsRootPresContext(nsIDocument* aDocument,
                                      nsPresContextType aType)
   : nsPresContext(aDocument, aType),
     mUpdatePluginGeometryForFrame(nsnull),
     mDOMGeneration(0),
-    mNeedsToUpdatePluginGeometry(PR_FALSE),
-    mUpdateLayerTree(false)
+    mNeedsToUpdatePluginGeometry(PR_FALSE)
 {
   mRegisteredPlugins.Init();
 }
 
 nsRootPresContext::~nsRootPresContext()
 {
   NS_ASSERTION(mRegisteredPlugins.Count() == 0,
                "All plugins should have been unregistered");
--- a/layout/base/nsPresContext.h
+++ b/layout/base/nsPresContext.h
@@ -1270,28 +1270,24 @@ public:
    */
   void IncrementDOMGeneration() { mDOMGeneration++; }
 
   /**
    * Get the current DOM generation counter.
    */
   PRUint32 GetDOMGeneration() { return mDOMGeneration; }
 
-  void SetNeedToUpdateLayerTree(bool aUpdate) { mUpdateLayerTree = aUpdate; }
-  bool NeedToUpdateLayerTree() { return mUpdateLayerTree; }
-
 private:
   nsTHashtable<nsPtrHashKey<nsObjectFrame> > mRegisteredPlugins;
   // if mNeedsToUpdatePluginGeometry is set, then this is the frame to
   // use as the root of the subtree to search for plugin updates, or
   // null to use the root frame of this prescontext
   nsIFrame* mUpdatePluginGeometryForFrame;
   PRUint32 mDOMGeneration;
   PRPackedBool mNeedsToUpdatePluginGeometry;
-  bool mUpdateLayerTree;
 };
 
 inline void
 nsPresContext::ForgetUpdatePluginGeometryFrame(nsIFrame* aFrame)
 {
   if (mContainsUpdatePluginGeometryFrame) {
     nsRootPresContext* rootPC = GetRootPresContext();
     if (rootPC) {
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -6068,29 +6068,16 @@ PresShell::Paint(nsIView*           aDis
   nsPresContext* presContext = GetPresContext();
   AUTO_LAYOUT_PHASE_ENTRY_POINT(presContext, Paint);
 
   NS_ASSERTION(!mIsDestroying, "painting a destroyed PresShell");
   NS_ASSERTION(aDisplayRoot, "null view");
   NS_ASSERTION(aViewToPaint, "null view");
   NS_ASSERTION(aWidgetToPaint, "Can't paint without a widget");
 
-  nsRootPresContext* rootPC = presContext->GetRootPresContext();
-  if (!rootPC->NeedToUpdateLayerTree() && aWidgetToPaint) {
-    LayerManager* layerManager = aWidgetToPaint->GetLayerManager();
-    NS_ASSERTION(layerManager, "Must be in paint event");
-    if (layerManager->IsNullTransactionSupported()) {
-      layerManager->BeginTransaction();
-      if (layerManager->EndTransaction(nsnull, nsnull)) {
-        return NS_OK;
-      }
-    }
-  }
-  rootPC->SetNeedToUpdateLayerTree(false);
-
   nscolor bgcolor = ComputeBackstopColor(aDisplayRoot);
 
   nsIFrame* frame = aPaintDefaultBackground
       ? nsnull : static_cast<nsIFrame*>(aDisplayRoot->GetClientData());
 
   if (frame && aViewToPaint == aDisplayRoot) {
     // Defer invalidates that are triggered during painting, and discard
     // invalidates of areas that are already being repainted.
--- a/layout/generic/nsFrame.cpp
+++ b/layout/generic/nsFrame.cpp
@@ -3945,24 +3945,17 @@ nsIFrame::InvalidateLayer(const nsRect& 
 {
   NS_ASSERTION(aDisplayItemKey > 0, "Need a key");
 
   if (!FrameLayerBuilder::HasDedicatedLayer(this, aDisplayItemKey)) {
     Invalidate(aDamageRect);
     return;
   }
 
-  nsRootPresContext* rootPC = PresContext()->GetRootPresContext();
-  PRUint32 flags = INVALIDATE_NO_THEBES_LAYERS;
-  if (aDisplayItemKey == nsDisplayItem::TYPE_VIDEO ||
-      aDisplayItemKey == nsDisplayItem::TYPE_PLUGIN) {
-    flags = INVALIDATE_NO_UPDATE_LAYER_TREE;
-  }
-
-  InvalidateWithFlags(aDamageRect, flags);
+  InvalidateWithFlags(aDamageRect, INVALIDATE_NO_THEBES_LAYERS);
 }
 
 class LayerActivity {
 public:
   LayerActivity(nsIFrame* aFrame) : mFrame(aFrame) {}
   ~LayerActivity();
   nsExpirationState* GetExpirationState() { return &mState; }
 
@@ -4046,28 +4039,22 @@ void
 nsIFrame::InvalidateWithFlags(const nsRect& aDamageRect, PRUint32 aFlags)
 {
   if (aDamageRect.IsEmpty()) {
     return;
   }
 
   // Don't allow invalidates to do anything when
   // painting is suppressed.
-  nsPresContext* context = PresContext();
-  nsIPresShell *shell = context->GetPresShell();
+  nsIPresShell *shell = PresContext()->GetPresShell();
   if (shell) {
     if (shell->IsPaintingSuppressed())
       return;
   }
 
-  if (!(aFlags & INVALIDATE_NO_UPDATE_LAYER_TREE)) {
-    nsRootPresContext* rootPC = context->GetRootPresContext();
-    rootPC->SetNeedToUpdateLayerTree(true);
-  }
-
   InvalidateInternal(aDamageRect, 0, 0, nsnull, aFlags);
 }
 
 /**
  * Helper function that funnels an InvalidateInternal request up to the
  * parent.  This function is used so that if MOZ_SVG is not defined, we still
  * have unified control paths in the InvalidateInternal chain.
  *
--- a/layout/generic/nsIFrame.h
+++ b/layout/generic/nsIFrame.h
@@ -2033,30 +2033,27 @@ public:
    * then invalidation in the current paint region is simply discarded.
    * Use this flag if areas that are being painted do not need
    * to be invalidated. By default, when this flag is not specified,
    * areas that are invalidated while currently being painted will be repainted
    * again.
    * This flag is useful when, during painting, FrameLayerBuilder discovers that
    * a region of the window needs to be drawn differently, and that region
    * may or may not be contained in the currently painted region.
-   * @param aFlags INVALIDATE_NO_UPDATE_LAYER_TREE: invalidate only in the Non-Thebes Layers
-   * Video, Plugin.
    */
   enum {
     INVALIDATE_IMMEDIATE = 0x01,
     INVALIDATE_CROSS_DOC = 0x02,
     INVALIDATE_REASON_SCROLL_BLIT = 0x04,
     INVALIDATE_REASON_SCROLL_REPAINT = 0x08,
     INVALIDATE_REASON_MASK = INVALIDATE_REASON_SCROLL_BLIT |
                              INVALIDATE_REASON_SCROLL_REPAINT,
     INVALIDATE_NO_THEBES_LAYERS = 0x10,
     INVALIDATE_ONLY_THEBES_LAYERS = 0x20,
-    INVALIDATE_EXCLUDE_CURRENT_PAINT = 0x40,
-    INVALIDATE_NO_UPDATE_LAYER_TREE = 0x80
+    INVALIDATE_EXCLUDE_CURRENT_PAINT = 0x40
   };
   virtual void InvalidateInternal(const nsRect& aDamageRect,
                                   nscoord aOffsetX, nscoord aOffsetY,
                                   nsIFrame* aForChild, PRUint32 aFlags);
 
   /**
    * Helper function that funnels an InvalidateInternal request up to the
    * parent.  This function is used so that if MOZ_SVG is not defined, we still
--- a/services/sync/modules/base_records/crypto.js
+++ b/services/sync/modules/base_records/crypto.js
@@ -503,17 +503,16 @@ SyncKeyBundle.prototype = {
     return this.password;
   },
 
   set keyStr(value) {
     this.password = value;
     this._hmac    = null;
     this._hmacObj = null;
     this._encrypt = null;
-    this.generateEntry();
   },
   
   /*
    * Can't rely on password being set through any of our setters:
    * Identity does work under the hood.
    * 
    * Consequently, make sure we derive keys if that work hasn't already been
    * done.
--- a/services/sync/tests/unit/test_service_sync_remoteSetup.js
+++ b/services/sync/tests/unit/test_service_sync_remoteSetup.js
@@ -47,17 +47,27 @@ function run_test() {
     Weave.Service.serverURL = "http://localhost:8080/";
     Weave.Service.clusterURL = "http://localhost:8080/";
     
     _("Checking Status.sync with no credentials.");
     Weave.Service.verifyAndFetchSymmetricKeys();
     do_check_eq(Status.sync, CREDENTIALS_CHANGED);
     do_check_eq(Status.login, LOGIN_FAILED_INVALID_PASSPHRASE);
 
-    Weave.Service.login("johndoe", "ilovejane", "abcdeabcdeabcdeabcdeabcdea");
+    _("Log in with an old secret phrase, is upgraded to Sync Key.");
+    Weave.Service.login("johndoe", "ilovejane", "my old secret phrase!!1!");
+    do_check_true(Weave.Service.isLoggedIn);
+    do_check_true(Utils.isPassphrase(Weave.Service.passphrase));
+    do_check_true(Utils.isPassphrase(Weave.Service.syncKeyBundle.keyStr));
+    let syncKey = Weave.Service.passphrase;
+    Weave.Service.startOver();
+
+    Weave.Service.serverURL = "http://localhost:8080/";
+    Weave.Service.clusterURL = "http://localhost:8080/";
+    Weave.Service.login("johndoe", "ilovejane", syncKey);
     do_check_true(Weave.Service.isLoggedIn);
 
     _("Checking that remoteSetup returns true when credentials have changed.");
     Records.get(Weave.Service.metaURL).payload.syncID = "foobar";
     do_check_true(Weave.Service._remoteSetup());
     
     _("Do an initial sync.");
     let beforeSync = Date.now()/1000;
--- a/toolkit/crashreporter/test/unit/test_crashreporter_crash.js
+++ b/toolkit/crashreporter/test/unit/test_crashreporter_crash.js
@@ -1,16 +1,10 @@
 function run_test()
 {
-  var isOSX = ("nsILocalFileMac" in Components.interfaces);
-  if (isOSX) {
-    dump("INFO | test_crashreporter.js | Skipping test on mac, bug 599475")
-    return;
-  }
-
   if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
     dump("INFO | test_crashreporter.js | Can't test crashreporter in a non-libxul build.\n");
     return;
   }
 
   // try a basic crash
   do_crash(null, function(mdump, extra) {
              do_check_true(mdump.exists());
--- a/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js
+++ b/toolkit/crashreporter/test/unit/test_crashreporter_crash_profile_lock.js
@@ -1,16 +1,10 @@
 function run_test()
 {
-  var isOSX = ("nsILocalFileMac" in Components.interfaces);
-  if (isOSX) {
-    dump("INFO | test_crashreporter_crash_profile_lock.js | Skipping test on mac, bug 599475")
-    return;
-  }
-
   if (!("@mozilla.org/toolkit/crash-reporter;1" in Components.classes)) {
     dump("INFO | test_crashreporter.js | Can't test crashreporter in a non-libxul build.\n");
     return;
   }
 
   // lock a profile directory, crash, and ensure that
   // the profile lock signal handler doesn't interfere with
   // writing a minidump
--- a/toolkit/mozapps/installer/packager.mk
+++ b/toolkit/mozapps/installer/packager.mk
@@ -384,17 +384,16 @@ NO_PKG_FILES += \
 	bsdecho \
 	gtscc \
 	js \
 	js-config \
 	jscpucfg \
 	nsinstall \
 	viewer \
 	TestGtkEmbed \
-	bloaturls.txt \
 	codesighs* \
 	elf-dynstr-gc \
 	mangle* \
 	maptsv* \
 	mfc* \
 	mkdepend* \
 	msdump* \
 	msmap* \
copy from toolkit/themes/pinstripe/mozapps/extensions/background-texture.png
copy to toolkit/themes/pinstripe/global/icons/tabprompts-bgtexture.png
--- a/toolkit/themes/pinstripe/global/jar.mn
+++ b/toolkit/themes/pinstripe/global/jar.mn
@@ -108,16 +108,17 @@ toolkit.jar:
   skin/classic/global/icons/panebutton-active.png                    (icons/panebutton-active.png)
   skin/classic/global/icons/panebutton-inactive.png                  (icons/panebutton-inactive.png)
   skin/classic/global/icons/question-mark.png                        (icons/question-mark.png)
   skin/classic/global/icons/resizer.png                              (icons/resizer.png)
   skin/classic/global/icons/resizer-rtl.png                          (icons/resizer-rtl.png)
   skin/classic/global/icons/search-textbox.png                       (icons/search-textbox.png)
   skin/classic/global/icons/searchfield-regular-cancel.png           (icons/searchfield-regular-cancel.png)
   skin/classic/global/icons/searchfield-small-cancel.png             (icons/searchfield-small-cancel.png)
+  skin/classic/global/icons/tabprompts-bgtexture.png                 (icons/tabprompts-bgtexture.png)
   skin/classic/global/icons/warning-16.png                           (icons/warning-16.png)
   skin/classic/global/icons/warning-24.png                           (icons/warning-24.png)
   skin/classic/global/icons/warning-32.png                           (icons/warning-32.png)
   skin/classic/global/icons/warning-64.png                           (icons/warning-64.png)
   skin/classic/global/icons/warning-large.png                        (icons/warning-large.png)
   skin/classic/global/icons/error-16.png                             (icons/error-16.png)
   skin/classic/global/icons/error-24.png                             (icons/error-24.png)
   skin/classic/global/icons/error-64.png                             (icons/error-64.png)
--- a/toolkit/themes/pinstripe/global/tabprompts.css
+++ b/toolkit/themes/pinstripe/global/tabprompts.css
@@ -1,23 +1,24 @@
 /* Tab Modal Prompt boxes */
 tabmodalprompt {
-  background-color: hsla(0,0%,97%,.15);
-  background-image: -moz-radial-gradient(center 40%, circle closest-side, hsla(0,0%,90%,.5), hsla(0,0%,90%,0));
+  background-image: url(chrome://global/skin/icons/tabprompts-bgtexture.png),
+                    -moz-radial-gradient(center 40%, circle farthest-side, hsla(0,0%,10%,.1), hsla(0,0%,0%,.5));
 }
 
 .mainContainer {
   padding: 20px;
   color: black;
-  background-image: -moz-linear-gradient(hsla(0,0%,97%,.9), hsla(0,0%,87%,.9));
-  border-radius: 8px;
-  box-shadow: 0 0 0 1px hsla(0,0%,0%,.25) inset,
+  background-image: -moz-linear-gradient(hsla(0,0%,89%,.97), hsla(0,0%,96%,.97));
+  border-radius: 6px;
+  box-shadow: 0 0 1px 1px hsla(0,0%,0%,.6) inset,
               0 1px 1px hsla(0,0%,0%,.2) inset,
-              0 1px 2px hsla(0,0%,0%,.1) inset,
-              0 1px 0 hsla(0,0%,100%,.4);
+              0 2px 5px hsla(0,0%,0%,.2) inset,
+              0 0 0 1px hsla(0,0%,100%,.3),
+              0 1px 0 hsla(0,0%,100%,.1);
 }
 
 .buttonContainer {
   margin-top: 10px;
 }
 
 .info\.icon {
   width: 64px !important;
copy from toolkit/themes/winstripe/mozapps/extensions/background-texture.png
copy to toolkit/themes/winstripe/global/icons/tabprompts-bgtexture.png
--- a/toolkit/themes/winstripe/global/jar.mn
+++ b/toolkit/themes/winstripe/global/jar.mn
@@ -131,16 +131,17 @@ toolkit.jar:
         skin/classic/global/icons/question-64.png                (icons/question-64.png)
         skin/classic/global/icons/question-tabmodal-64.png       (icons/question-tabmodal-64.png)
         skin/classic/global/icons/resizer.png                    (icons/resizer.png)
         skin/classic/global/icons/resizer-rtl.png                (icons/resizer-rtl.png)
         skin/classic/global/icons/Restore.gif                    (icons/Restore.gif)
         skin/classic/global/icons/Search-close.png               (icons/Search-close.png)
         skin/classic/global/icons/Search-glass.png               (icons/Search-glass.png)
         skin/classic/global/icons/sslWarning.png                 (icons/sslWarning.png)
+        skin/classic/global/icons/tabprompts-bgtexture.png       (icons/tabprompts-bgtexture.png)
         skin/classic/global/icons/Warning.png                    (icons/Warning.png)
         skin/classic/global/icons/warning-large.png              (icons/warning-large.png)
         skin/classic/global/icons/warning-16.png                 (icons/warning-16.png)
         skin/classic/global/icons/warning-24.png                 (icons/warning-24.png)
         skin/classic/global/icons/warning-64.png                 (icons/warning-64.png)
         skin/classic/global/icons/webconsole.png                 (icons/webconsole.png)
         skin/classic/global/icons/windowControls.png             (icons/windowControls.png)
         skin/classic/global/icons/wrap.png                       (icons/wrap.png)
@@ -307,16 +308,17 @@ toolkit.jar:
         skin/classic/aero/global/icons/question-64.png                   (icons/question-64-aero.png)
         skin/classic/aero/global/icons/question-tabmodal-64.png          (icons/question-tabmodal-64.png)
         skin/classic/aero/global/icons/resizer.png                       (icons/resizer.png)
         skin/classic/aero/global/icons/resizer-rtl.png                   (icons/resizer-rtl.png)
         skin/classic/aero/global/icons/Restore.gif                       (icons/Restore.gif)
         skin/classic/aero/global/icons/Search-close.png                  (icons/Search-close-aero.png)
         skin/classic/aero/global/icons/Search-glass.png                  (icons/Search-glass-aero.png)
         skin/classic/aero/global/icons/sslWarning.png                    (icons/sslWarning-aero.png)
+        skin/classic/aero/global/icons/tabprompts-bgtexture.png          (icons/tabprompts-bgtexture.png)
         skin/classic/aero/global/icons/Warning.png                       (icons/Warning-aero.png)
         skin/classic/aero/global/icons/warning-large.png                 (icons/warning-large-aero.png)
         skin/classic/aero/global/icons/warning-16.png                    (icons/warning-16-aero.png)
         skin/classic/aero/global/icons/warning-24.png                    (icons/warning-24-aero.png)
         skin/classic/aero/global/icons/warning-64.png                    (icons/warning-64-aero.png)
         skin/classic/aero/global/icons/webconsole.png                    (icons/webconsole.png)
         skin/classic/aero/global/icons/windowControls.png                (icons/windowControls-aero.png)
         skin/classic/aero/global/icons/wrap.png                          (icons/wrap-aero.png)
--- a/toolkit/themes/winstripe/global/tabprompts.css
+++ b/toolkit/themes/winstripe/global/tabprompts.css
@@ -1,23 +1,24 @@
 /* Tab Modal Prompt boxes */
 tabmodalprompt {
-  background-color: hsla(0,0%,97%,.15);
-  background-image: -moz-radial-gradient(center 40%, circle closest-side, hsla(0,0%,90%,.5), hsla(0,0%,90%,0));
+  background-image: url(chrome://global/skin/icons/tabprompts-bgtexture.png),
+                    -moz-radial-gradient(center 40%, circle farthest-side, hsla(0,0%,10%,.1), hsla(0,0%,0%,.5));
 }
 
 .mainContainer {
   padding: 20px;
   color: black;
-  background-image: -moz-linear-gradient(hsla(0,0%,97%,.9), hsla(0,0%,87%,.9));
-  border-radius: 8px;
-  box-shadow: 0 0 0 1px hsla(0,0%,0%,.25) inset,
+  background-image: -moz-linear-gradient(hsla(0,0%,89%,.97), hsla(0,0%,96%,.97));
+  border-radius: 6px;
+  box-shadow: 0 0 1px 1px hsla(0,0%,0%,.6) inset,
               0 1px 1px hsla(0,0%,0%,.2) inset,
-              0 1px 2px hsla(0,0%,0%,.1) inset,
-              0 1px 0 hsla(0,0%,100%,.4);
+              0 2px 5px hsla(0,0%,0%,.2) inset,
+              0 0 0 1px hsla(0,0%,100%,.3),
+              0 1px 0 hsla(0,0%,100%,.1);
 }
 
 .buttonContainer {
   margin-top: 10px;
 }
 
 .info\.icon {
   width: 64px !important;
--- a/widget/src/android/AndroidJavaWrappers.h
+++ b/widget/src/android/AndroidJavaWrappers.h
@@ -446,16 +446,18 @@ public:
         LOCATION_EVENT = 4,
         IME_EVENT = 5,
         DRAW = 6,
         SIZE_CHANGED = 7,
         ACTIVITY_STOPPING = 8,
         ACTIVITY_PAUSING = 9,
         ACTIVITY_SHUTDOWN = 10,
         LOAD_URI = 11,
+        SURFACE_CREATED = 12,
+        SURFACE_DESTROYED = 13,
         dummy_java_enum_list_end
     };
 
     enum {
         IME_COMPOSITION_END = 0,
         IME_COMPOSITION_BEGIN = 1,
         IME_SET_TEXT = 2,
         IME_GET_TEXT = 3,
--- a/widget/src/android/nsWindow.cpp
+++ b/widget/src/android/nsWindow.cpp
@@ -130,16 +130,17 @@ static PRBool gMenuConsumed;
 // All the toplevel windows that have been created; these are in
 // stacking order, so the window at gAndroidBounds[0] is the topmost
 // one.
 static nsTArray<nsWindow*> gTopLevelWindows;
 static nsWindow* gFocusedWindow = nsnull;
 
 static nsRefPtr<gl::GLContext> sGLContext;
 static bool sFailedToCreateGLContext = false;
+static bool sValidSurface;
 
 // Multitouch swipe thresholds in inches
 static const double SWIPE_MAX_PINCH_DELTA_INCHES = 0.4;
 static const double SWIPE_MIN_DISTANCE_INCHES = 0.6;
 
 static nsWindow*
 TopWindow()
 {
@@ -692,16 +693,17 @@ nsWindow::GetLayerManager(LayerManagerPe
     }
 
     if (sGLContext) {
         nsRefPtr<mozilla::layers::LayerManagerOGL> layerManager =
             new mozilla::layers::LayerManagerOGL(this);
 
         if (layerManager && layerManager->Initialize(sGLContext))
             mLayerManager = layerManager;
+        sValidSurface = true;
     }
 
     if (!sGLContext || !mLayerManager) {
         sGLContext = nsnull;
         sFailedToCreateGLContext = PR_TRUE;
 
         mLayerManager = CreateBasicLayerManager();
     }
@@ -815,16 +817,23 @@ nsWindow::OnGlobalAndroidEvent(AndroidGe
             if (gFocusedWindow) {
                 gFocusedWindow->OnIMEEvent(ae);
             } else {
                 NS_WARNING("Sending unexpected IME event to top window");
                 win->OnIMEEvent(ae);
             }
             break;
 
+	case AndroidGeckoEvent::SURFACE_CREATED:
+	    break;
+
+	case AndroidGeckoEvent::SURFACE_DESTROYED:
+	    sValidSurface = false;
+	    break;
+
         default:
             break;
     }
 }
 
 void
 nsWindow::OnAndroidEvent(AndroidGeckoEvent *ae)
 {
@@ -985,16 +994,22 @@ nsWindow::OnDraw(AndroidGeckoEvent *ae)
     } else {
         int drawType = sview.BeginDrawing();
 
         if (drawType == AndroidGeckoSurfaceView::DRAW_ERROR) {
             ALOG("##### BeginDrawing failed!");
             return;
         }
 
+        if (!sValidSurface) {
+            sGLContext->RenewSurface();
+            sValidSurface = true;
+        }
+
+
         NS_ASSERTION(sGLContext, "Drawing with GLES without a GL context?");
 
         DrawTo(nsnull);
 
         sview.EndDrawing();
     }
 }