Merge from mozilla-central.
authorDavid Anderson <danderson@mozilla.com>
Wed, 11 Apr 2012 14:37:59 -0700
changeset 106158 8ee84aca3656e2a9314b8320882497e24c506889
parent 106156 72596946ff9607adfe37d6aa681a069e650032e3 (current diff)
parent 91487 1711e06ca9f7b8cba7ecb27a48b9fd8ad1980a26 (diff)
child 106159 030178aae6e440021bba032721ecd64d9b2b7906
push id14706
push usereakhgari@mozilla.com
push dateTue, 11 Sep 2012 20:39:52 +0000
treeherdermozilla-inbound@d50bf1edaabe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone14.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Merge from mozilla-central.
accessible/src/atk/nsARIAGridAccessibleWrap.h
accessible/src/base/Makefile.in
accessible/src/base/nsARIAGridAccessible.cpp
accessible/src/base/nsARIAGridAccessible.h
accessible/src/base/nsAccessNode.cpp
accessible/src/base/nsAccessNode.h
accessible/src/base/nsAccessibilityService.cpp
accessible/src/base/nsAccessible.cpp
accessible/src/base/nsAccessible.h
accessible/src/base/nsApplicationAccessible.cpp
accessible/src/base/nsApplicationAccessible.h
accessible/src/base/nsBaseWidgetAccessible.h
accessible/src/base/nsCoreUtils.cpp
accessible/src/base/nsCoreUtils.h
accessible/src/base/nsDocAccessible.cpp
accessible/src/base/nsDocAccessible.h
accessible/src/base/nsFormControlAccessible.cpp
accessible/src/base/nsFormControlAccessible.h
accessible/src/base/nsRootAccessible.cpp
accessible/src/base/nsRootAccessible.h
accessible/src/base/nsTextEquivUtils.cpp
accessible/src/generic/ARIAGridAccessible.cpp
accessible/src/generic/ARIAGridAccessible.h
accessible/src/html/nsHTMLFormControlAccessible.cpp
accessible/src/html/nsHTMLFormControlAccessible.h
accessible/src/html/nsHTMLLinkAccessible.cpp
accessible/src/html/nsHTMLLinkAccessible.h
accessible/src/html/nsHTMLSelectAccessible.cpp
accessible/src/html/nsHTMLSelectAccessible.h
accessible/src/html/nsHTMLTableAccessible.cpp
accessible/src/html/nsHTMLTableAccessible.h
accessible/src/html/nsHyperTextAccessible.cpp
accessible/src/mac/nsARIAGridAccessibleWrap.h
accessible/src/msaa/CAccessibleText.cpp
accessible/src/msaa/nsARIAGridAccessibleWrap.cpp
accessible/src/msaa/nsARIAGridAccessibleWrap.h
accessible/src/msaa/nsAccessNodeWrap.cpp
accessible/src/msaa/nsAccessibleWrap.cpp
accessible/src/msaa/nsTextAccessibleWrap.cpp
accessible/src/other/nsARIAGridAccessibleWrap.h
accessible/src/xforms/nsXFormsAccessible.cpp
accessible/src/xforms/nsXFormsAccessible.h
accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
accessible/src/xforms/nsXFormsFormControlsAccessible.h
accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.cpp
accessible/src/xul/nsXULColorPickerAccessible.h
accessible/src/xul/nsXULComboboxAccessible.cpp
accessible/src/xul/nsXULComboboxAccessible.h
accessible/src/xul/nsXULFormControlAccessible.cpp
accessible/src/xul/nsXULFormControlAccessible.h
accessible/src/xul/nsXULListboxAccessible.cpp
accessible/src/xul/nsXULListboxAccessible.h
accessible/src/xul/nsXULSliderAccessible.cpp
accessible/src/xul/nsXULSliderAccessible.h
accessible/src/xul/nsXULTabAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.cpp
accessible/src/xul/nsXULTreeAccessible.h
accessible/src/xul/nsXULTreeGridAccessible.cpp
accessible/tests/mochitest/Makefile.in
accessible/tests/mochitest/elm/test_landmarks.html
accessible/tests/mochitest/name/test_general.html
accessible/tests/mochitest/test_aria_role_article.html
accessible/tests/mochitest/test_aria_role_equation.html
accessible/tests/mochitest/test_aria_roles.html
accessible/tests/mochitest/test_aria_roles.xul
accessible/tests/mochitest/test_role_nsHyperTextAcc.html
b2g/installer/package-manifest.in
browser/base/content/sync/notification.xml
browser/config/mozconfigs/macosx-lion-universal/nightly
browser/config/mozconfigs/macosx-lion-universal/release
browser/config/mozconfigs/macosx-lion-universal/shark
browser/config/mozconfigs/macosx32-lion/debug
browser/config/mozconfigs/macosx64-lion/debug
browser/config/mozconfigs/macosx64-lion/l10n-mozconfig
configure.in
content/base/src/nsRange.cpp
content/canvas/src/WebGLContext.h
content/canvas/src/WebGLContextGL.cpp
content/canvas/src/WebGLContextValidate.cpp
content/html/document/src/ImageDocument.cpp
content/html/document/src/VideoDocument.cpp
content/html/document/src/nsHTMLDocument.cpp
dom/ipc/ContentChild.cpp
dom/ipc/ContentParent.cpp
dom/plugins/base/nsNPAPIPlugin.cpp
dom/plugins/base/nsPluginHost.cpp
dom/plugins/base/nsPluginInstanceOwner.cpp
dom/plugins/base/nsPluginNativeWindowWin.cpp
dom/wifi/WifiWorker.js
editor/libeditor/html/nsHTMLEditor.cpp
gfx/gl/GLContext.cpp
gfx/gl/GLContext.h
gfx/gl/GLContextProviderCGL.mm
gfx/gl/GLContextProviderEGL.cpp
gfx/layers/Layers.cpp
gfx/layers/Layers.h
gfx/layers/opengl/ImageLayerOGL.cpp
gfx/layers/opengl/LayerManagerOGL.cpp
gfx/thebes/gfxASurface.cpp
gfx/thebes/gfxASurface.h
gfx/thebes/gfxDWriteFontList.cpp
gfx/thebes/gfxFT2FontList.cpp
gfx/thebes/gfxFont.cpp
gfx/thebes/gfxFont.h
gfx/thebes/gfxFontUtils.h
gfx/thebes/gfxGDIFontList.cpp
gfx/thebes/gfxGDIFontList.h
gfx/thebes/gfxMacPlatformFontList.mm
gfx/thebes/gfxPlatform.cpp
gfx/thebes/gfxPlatform.h
gfx/thebes/gfxPlatformFontList.cpp
gfx/thebes/gfxPlatformFontList.h
gfx/thebes/gfxUtils.cpp
gfx/thebes/gfxUtils.h
image/src/imgRequest.cpp
js/src/frontend/BytecodeCompiler.cpp
js/src/frontend/BytecodeEmitter.cpp
js/src/frontend/BytecodeEmitter.h
js/src/frontend/ParseNode.h
js/src/frontend/Parser.cpp
js/src/frontend/Parser.h
js/src/gc/Barrier.h
js/src/ion/Ion.cpp
js/src/ion/IonBuilder.cpp
js/src/ion/MIR.cpp
js/src/jit-test/tests/jaeger/bug563000/eif-trap-newvar.js
js/src/jit-test/tests/jaeger/bug563000/trap-from-add-ool.js
js/src/jsanalyze.cpp
js/src/jsanalyze.h
js/src/jsapi.cpp
js/src/jscntxt.h
js/src/jscompartment.cpp
js/src/jscompartment.h
js/src/jsdate.cpp
js/src/jsdbgapi.cpp
js/src/jsfun.cpp
js/src/jsfun.h
js/src/jsfuninlines.h
js/src/jsgc.cpp
js/src/jsinfer.cpp
js/src/jsinfer.h
js/src/jsinferinlines.h
js/src/jsinterp.cpp
js/src/jsinterpinlines.h
js/src/jsopcode.cpp
js/src/jsopcode.h
js/src/jsopcode.tbl
js/src/jsscript.cpp
js/src/jsscript.h
js/src/jstypedarray.cpp
js/src/jstypedarray.h
js/src/methodjit/BaseAssembler.h
js/src/methodjit/Compiler.cpp
js/src/methodjit/Compiler.h
js/src/methodjit/FastOps.cpp
js/src/methodjit/InvokeHelpers.cpp
js/src/methodjit/LoopState.cpp
js/src/methodjit/MethodJIT.h
js/src/methodjit/MonoIC.cpp
js/src/methodjit/PolyIC.cpp
js/src/methodjit/StubCalls.cpp
js/src/methodjit/TypedArrayIC.h
js/src/shell/js.cpp
js/src/vm/ArgumentsObject.cpp
js/src/vm/ArgumentsObject.h
js/src/vm/Debugger.cpp
js/src/vm/Stack-inl.h
js/src/vm/Stack.cpp
js/src/vm/Stack.h
js/xpconnect/src/Makefile.in
layout/base/FrameLayerBuilder.cpp
layout/base/FrameLayerBuilder.h
layout/base/nsDisplayList.cpp
layout/base/nsDisplayList.h
layout/base/nsImageLoader.cpp
layout/base/nsImageLoader.h
layout/base/nsLayoutDebugger.cpp
layout/base/nsLayoutUtils.cpp
layout/base/nsPresShell.cpp
layout/base/tests/Makefile.in
layout/base/tests/font-inflation/bug707855-innerFrame-ref.html
layout/base/tests/font-inflation/bug707855-innerFrame.html
layout/base/tests/font-inflation/bug707855-ref.html
layout/base/tests/font-inflation/bug707855.html
layout/base/tests/font-inflation/bullet-1-ref.html
layout/base/tests/font-inflation/bullet-1.html
layout/base/tests/font-inflation/bullet-2-ref.html
layout/base/tests/font-inflation/bullet-2.html
layout/base/tests/font-inflation/consecutive-inline-ref.html
layout/base/tests/font-inflation/consecutive-inline.html
layout/base/tests/font-inflation/container-with-clamping-innerFrame-ref.html
layout/base/tests/font-inflation/container-with-clamping-innerFrame.html
layout/base/tests/font-inflation/container-with-clamping-ref.html
layout/base/tests/font-inflation/container-with-clamping.html
layout/base/tests/font-inflation/css-transform-1-ref.html
layout/base/tests/font-inflation/css-transform-1.html
layout/base/tests/font-inflation/css-transform-2-ref.html
layout/base/tests/font-inflation/css-transform-2.html
layout/base/tests/font-inflation/decoration-1-ref.html
layout/base/tests/font-inflation/decoration-1.html
layout/base/tests/font-inflation/disable-fontinfl-on-mobile-2.html
layout/base/tests/font-inflation/disable-fontinfl-on-mobile-3.html
layout/base/tests/font-inflation/disable-fontinfl-on-mobile-4.html
layout/base/tests/font-inflation/disable-fontinfl-on-mobile-ref.html
layout/base/tests/font-inflation/disable-fontinfl-on-mobile.html
layout/base/tests/font-inflation/fixed-height-body-child-ref.html
layout/base/tests/font-inflation/fixed-height-body-child.html
layout/base/tests/font-inflation/fixed-height-body-ref.html
layout/base/tests/font-inflation/fixed-height-body.html
layout/base/tests/font-inflation/input-checkbox.html
layout/base/tests/font-inflation/input-radio.html
layout/base/tests/font-inflation/input-text-1-ref.html
layout/base/tests/font-inflation/input-text-1.html
layout/base/tests/font-inflation/input-text-2-ref.html
layout/base/tests/font-inflation/input-text-2.html
layout/base/tests/font-inflation/input-text-3-ref.html
layout/base/tests/font-inflation/input-text-3.html
layout/base/tests/font-inflation/intrinsic-fit-1a-ref.html
layout/base/tests/font-inflation/intrinsic-fit-1a.html
layout/base/tests/font-inflation/intrinsic-fit-1b-ref.html
layout/base/tests/font-inflation/intrinsic-fit-1b.html
layout/base/tests/font-inflation/intrinsic-fit-1c-ref.html
layout/base/tests/font-inflation/intrinsic-fit-1c.html
layout/base/tests/font-inflation/intrinsic-fit-2a.html
layout/base/tests/font-inflation/intrinsic-fit-2b.html
layout/base/tests/font-inflation/intrinsic-fit-2c.html
layout/base/tests/font-inflation/intrinsic-max-1-ref.html
layout/base/tests/font-inflation/intrinsic-max-1.html
layout/base/tests/font-inflation/intrinsic-min-1-ref.html
layout/base/tests/font-inflation/intrinsic-min-1.html
layout/base/tests/font-inflation/preformatted-text-ref.html
layout/base/tests/font-inflation/preformatted-text.html
layout/base/tests/font-inflation/select-combobox-1-ref.html
layout/base/tests/font-inflation/select-combobox-1.html
layout/base/tests/font-inflation/select-combobox-2-ref.html
layout/base/tests/font-inflation/select-combobox-2.html
layout/base/tests/font-inflation/select-listbox-1-ref.html
layout/base/tests/font-inflation/select-listbox-1.html
layout/base/tests/font-inflation/select-listbox-2-ref.html
layout/base/tests/font-inflation/select-listbox-2.html
layout/base/tests/font-inflation/text-1-ref.html
layout/base/tests/font-inflation/text-1.html
layout/base/tests/font-inflation/text-2-ref.html
layout/base/tests/font-inflation/text-2.html
layout/base/tests/font-inflation/text-3-ref.html
layout/base/tests/font-inflation/text-3.html
layout/base/tests/font-inflation/text-4-ref.html
layout/base/tests/font-inflation/text-4.html
layout/base/tests/font-inflation/textarea-1-ref.html
layout/base/tests/font-inflation/textarea-1.html
layout/base/tests/font-inflation/textarea-2-ref.html
layout/base/tests/font-inflation/textarea-2.html
layout/base/tests/font-inflation/textarea-3-ref.html
layout/base/tests/font-inflation/textarea-3.html
layout/base/tests/font-inflation/video-1.html
layout/base/tests/test_font_inflation_reftests.html
layout/forms/nsButtonFrameRenderer.cpp
layout/forms/nsSelectsAreaFrame.cpp
layout/generic/TextOverflow.cpp
layout/generic/nsBulletFrame.cpp
layout/generic/nsCanvasFrame.cpp
layout/generic/nsCanvasFrame.h
layout/generic/nsFrame.cpp
layout/generic/nsHTMLCanvasFrame.cpp
layout/generic/nsObjectFrame.cpp
layout/generic/nsObjectFrame.h
layout/generic/nsTextFrameThebes.cpp
layout/generic/nsVideoFrame.cpp
layout/ipc/RenderFrameParent.h
layout/mathml/nsMathMLChar.cpp
layout/reftests/reftest-sanity/reftest.list
layout/reftests/reftest.list
layout/reftests/text-overflow/reftest.list
layout/tables/nsTableCellFrame.cpp
layout/tables/nsTableFrame.cpp
layout/tables/nsTableFrame.h
layout/tools/reftest/reftest.js
layout/xul/base/src/nsTextBoxFrame.cpp
mobile/android/base/Makefile.in
modules/libpref/src/init/all.js
mozglue/android/APKOpen.cpp
mozglue/gonk/GonkGlue.cpp
mozglue/gonk/Makefile.in
netwerk/protocol/http/HttpChannelParent.cpp
netwerk/protocol/http/nsAHttpConnection.h
netwerk/protocol/http/nsHttpChannel.cpp
netwerk/protocol/http/nsHttpChunkedDecoder.h
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpConnection.h
netwerk/protocol/http/nsHttpConnectionMgr.cpp
netwerk/protocol/http/nsHttpConnectionMgr.h
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
netwerk/protocol/http/nsHttpHeaderArray.cpp
netwerk/protocol/http/nsHttpHeaderArray.h
netwerk/protocol/http/nsHttpPipeline.cpp
netwerk/protocol/http/nsHttpTransaction.cpp
netwerk/test/unit/test_mismatch_lm.js
parser/html/nsHtml5TreeOperation.cpp
parser/htmlparser/src/nsParser.cpp
services/makefiles.sh
services/sync/modules/async.js
services/sync/modules/ext/Observers.js
services/sync/modules/ext/Preferences.js
services/sync/modules/ext/StringBundle.js
services/sync/modules/jpakeclient.js
services/sync/modules/log4moz.js
services/sync/modules/policies.js
services/sync/modules/resource.js
services/sync/modules/rest.js
services/sync/modules/service.js
services/sync/tests/unit/head_http_server.js
services/sync/tests/unit/test_Observers.js
services/sync/tests/unit/test_Preferences.js
services/sync/tests/unit/test_async_chain.js
services/sync/tests/unit/test_async_querySpinningly.js
services/sync/tests/unit/test_bookmark_engine.js
services/sync/tests/unit/test_bookmark_smart_bookmarks.js
services/sync/tests/unit/test_corrupt_keys.js
services/sync/tests/unit/test_jpakeclient.js
services/sync/tests/unit/test_log4moz.js
services/sync/tests/unit/test_restrequest.js
services/sync/tests/unit/test_utils_atob.js
services/sync/tests/unit/test_utils_makeURI.js
services/sync/tests/unit/test_utils_namedTimer.js
services/sync/tests/unit/test_utils_stackTrace.js
services/sync/tests/unit/test_utils_utf8.js
services/sync/tests/unit/xpcshell.ini
storage/src/VacuumManager.cpp
testing/testsuite-targets.mk
testing/xpcshell/xpcshell.ini
toolkit/components/telemetry/TelemetryHistograms.h
widget/android/AndroidBridge.cpp
widget/android/AndroidBridge.h
widget/android/nsAppShell.cpp
widget/android/nsAppShell.h
widget/windows/nsFilePicker.cpp
xpcom/base/nsDebugImpl.cpp
xpcom/build/nsXPComInit.cpp
xpcom/io/nsILocalFileMac.idl
xpcom/io/nsLocalFileUnix.cpp
rename from accessible/src/atk/nsARIAGridAccessibleWrap.h
rename to accessible/src/atk/ARIAGridAccessibleWrap.h
--- a/accessible/src/atk/nsARIAGridAccessibleWrap.h
+++ b/accessible/src/atk/ARIAGridAccessibleWrap.h
@@ -32,18 +32,23 @@
  * 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 ***** */
 
-#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
-#define _NSARIAGRIDACCESSIBLEWRAP_H
+#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+
+#include "ARIAGridAccessible.h"
 
-#include "nsARIAGridAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
-typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
+typedef class ARIAGridAccessible ARIAGridAccessibleWrap;
+typedef class ARIAGridCellAccessible ARIAGridCellAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
-
--- a/accessible/src/atk/Makefile.in
+++ b/accessible/src/atk/Makefile.in
@@ -64,19 +64,19 @@ CPPSRCS = \
   nsMaiInterfaceHypertext.cpp \
   nsMaiInterfaceHyperlinkImpl.cpp \
   nsMaiInterfaceTable.cpp \
   nsMaiInterfaceDocument.cpp \
   nsMaiInterfaceImage.cpp \
   $(NULL)
 
 EXPORTS = \
+  ARIAGridAccessibleWrap.h \
   AtkSocketAccessible.h \
   nsAccessNodeWrap.h \
-  nsARIAGridAccessibleWrap.h \
   nsAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
--- a/accessible/src/base/Makefile.in
+++ b/accessible/src/base/Makefile.in
@@ -53,17 +53,16 @@ CPPSRCS = \
   AccGroupInfo.cpp \
   AccIterator.cpp \
   ARIAStateMap.cpp \
   filters.cpp \
   FocusManager.cpp \
   NotificationController.cpp \
   nsAccDocManager.cpp \
   nsAccessNode.cpp \
-  nsARIAGridAccessible.cpp \
   nsARIAMap.cpp \
   nsDocAccessible.cpp \
   nsCoreUtils.cpp \
   nsAccUtils.cpp \
   nsAccessibilityService.cpp \
   nsAccessible.cpp \
   nsAccessiblePivot.cpp \
   nsAccTreeWalker.cpp \
@@ -104,19 +103,19 @@ FORCE_STATIC_LIB = 1
 include $(topsrcdir)/config/rules.mk
 
 LOCAL_INCLUDES += \
   -I$(srcdir) \
   -I$(srcdir)/../generic \
   -I$(srcdir)/../html \
   -I$(srcdir)/../xpcom \
   -I$(srcdir)/../xul \
+  -I$(srcdir)/../xforms \
   -I$(srcdir)/../../../layout/generic \
   -I$(srcdir)/../../../layout/style \
   -I$(srcdir)/../../../layout/xul/base/src \
-  -I$(srcdir)/../xforms \
   $(NULL)
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 LOCAL_INCLUDES += \
   -I$(srcdir)/../atk \
   $(NULL)
 endif
--- a/accessible/src/base/nsAccessNode.cpp
+++ b/accessible/src/base/nsAccessNode.cpp
@@ -204,27 +204,16 @@ void nsAccessNode::ShutdownXPAccessibili
   if (gApplicationAccessible) {
     gApplicationAccessible->Shutdown();
     NS_RELEASE(gApplicationAccessible);
   }
 
   NotifyA11yInitOrShutdown(false);
 }
 
-// nsAccessNode protected
-nsPresContext* nsAccessNode::GetPresContext()
-{
-  if (!mDoc)
-    return nsnull;
-
-  nsIPresShell* presShell(mDoc->PresShell());
-
-  return presShell ? presShell->GetPresContext() : nsnull;
-}
-
 nsRootAccessible*
 nsAccessNode::RootAccessible() const
 {
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mContent);
   NS_ASSERTION(docShellTreeItem, "No docshell tree item for mContent");
   if (!docShellTreeItem) {
     return nsnull;
@@ -247,41 +236,16 @@ nsAccessNode::GetFrame() const
 }
 
 bool
 nsAccessNode::IsPrimaryForNode() const
 {
   return true;
 }
 
-////////////////////////////////////////////////////////////////////////////////
-void
-nsAccessNode::ScrollTo(PRUint32 aScrollType)
-{
-  if (!mDoc)
-    return;
-
-  nsIPresShell* shell = mDoc->PresShell();
-  if (!shell)
-    return;
-
-  nsIFrame *frame = GetFrame();
-  if (!frame)
-    return;
-
-  nsIContent* content = frame->GetContent();
-  if (!content)
-    return;
-
-  nsIPresShell::ScrollAxis vertical, horizontal;
-  nsCoreUtils::ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
-  shell->ScrollContentIntoView(content, vertical, horizontal,
-                               nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
-}
-
 void
 nsAccessNode::Language(nsAString& aLanguage)
 {
   aLanguage.Truncate();
 
   if (!mDoc)
     return;
 
--- a/accessible/src/base/nsAccessNode.h
+++ b/accessible/src/base/nsAccessNode.h
@@ -147,35 +147,32 @@ public:
    * that DOM node in terms it gets stored in the accessible to node map.
    */
   virtual bool IsPrimaryForNode() const;
 
   /**
    * Interface methods on nsIAccessible shared with ISimpleDOM.
    */
   void Language(nsAString& aLocale);
-  void ScrollTo(PRUint32 aType);
 
 protected:
-    nsPresContext* GetPresContext();
-
-    void LastRelease();
+  void LastRelease();
 
   nsCOMPtr<nsIContent> mContent;
   nsDocAccessible* mDoc;
 
-    /**
-     * Notify global nsIObserver's that a11y is getting init'd or shutdown
-     */
-    static void NotifyA11yInitOrShutdown(bool aIsInit);
+  /**
+   * Notify global nsIObserver's that a11y is getting init'd or shutdown.
+   */
+  static void NotifyA11yInitOrShutdown(bool aIsInit);
 
-    // Static data, we do our own refcounting for our static data
-    static nsIStringBundle *gStringBundle;
+  // Static data, we do our own refcounting for our static data.
+  static nsIStringBundle* gStringBundle;
 
-    static bool gIsFormFillEnabled;
+  static bool gIsFormFillEnabled;
 
 private:
   nsAccessNode() MOZ_DELETE;
   nsAccessNode(const nsAccessNode&) MOZ_DELETE;
   nsAccessNode& operator =(const nsAccessNode&) MOZ_DELETE;
   
   static nsApplicationAccessible *gApplicationAccessible;
 };
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -31,94 +31,84 @@
  * 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 ***** */
 
-#include "mozilla/Util.h"
+#include "nsAccessibilityService.h"
 
 // NOTE: alphabetically ordered
-#include "nsAccessibilityService.h"
+#include "ARIAGridAccessibleWrap.h"
+#ifdef MOZ_ACCESSIBILITY_ATK
+#include "AtkSocketAccessible.h"
+#endif
+#include "FocusManager.h"
 #include "nsAccessiblePivot.h"
-#include "nsCoreUtils.h"
 #include "nsAccUtils.h"
+#include "nsARIAMap.h"
 #include "nsApplicationAccessibleWrap.h"
-#include "nsARIAGridAccessibleWrap.h"
-#include "nsARIAMap.h"
-#include "FocusManager.h"
-
-#include "nsIContentViewer.h"
-#include "nsCURILoader.h"
-#include "nsDocAccessible.h"
+#include "nsIAccessibleProvider.h"
 #include "nsHTMLCanvasAccessible.h"
 #include "nsHTMLImageMapAccessible.h"
 #include "nsHTMLLinkAccessible.h"
 #include "nsHTMLSelectAccessible.h"
 #include "nsHTMLTableAccessibleWrap.h"
 #include "nsHTMLTextAccessible.h"
 #include "nsHyperTextAccessibleWrap.h"
-#include "nsIAccessibilityService.h"
-#include "nsIAccessibleProvider.h"
+#include "nsRootAccessibleWrap.h"
+#include "nsXFormsFormControlsAccessible.h"
+#include "nsXFormsWidgetsAccessible.h"
+#include "OuterDocAccessible.h"
 #include "Role.h"
 #include "States.h"
 #include "Statistics.h"
+#ifdef XP_WIN
+#include "nsHTMLWin32ObjectAccessible.h"
+#endif
 
+#include "nsCURILoader.h"
+#include "nsEventStates.h"
+#include "nsIContentViewer.h"
 #include "nsIDOMDocument.h"
 #include "nsIDOMHTMLAreaElement.h"
 #include "nsIDOMHTMLLegendElement.h"
 #include "nsIDOMHTMLObjectElement.h"
 #include "nsIDOMHTMLOptGroupElement.h"
 #include "nsIDOMHTMLOptionElement.h"
 #include "nsIDOMXULElement.h"
 #include "nsIHTMLDocument.h"
 #include "nsImageFrame.h"
 #include "nsILink.h"
 #include "nsIObserverService.h"
 #include "nsLayoutUtils.h"
 #include "nsNPAPIPluginInstance.h"
 #include "nsISupportsUtils.h"
 #include "nsObjectFrame.h"
-#include "nsRootAccessibleWrap.h"
 #include "nsTextFragment.h"
+#include "mozilla/FunctionTimer.h"
+#include "mozilla/dom/Element.h"
 #include "mozilla/Services.h"
-#include "nsEventStates.h"
+#include "mozilla/Util.h"
 
 #ifdef MOZ_XUL
 #include "nsXULAlertAccessible.h"
 #include "nsXULColorPickerAccessible.h"
 #include "nsXULComboboxAccessible.h"
 #include "nsXULFormControlAccessible.h"
 #include "nsXULListboxAccessibleWrap.h"
 #include "nsXULMenuAccessibleWrap.h"
 #include "nsXULSliderAccessible.h"
 #include "nsXULTabAccessible.h"
 #include "nsXULTextAccessible.h"
 #include "nsXULTreeGridAccessibleWrap.h"
 #endif
 
-// For native window support for object/embed/applet tags
-#ifdef XP_WIN
-#include "nsHTMLWin32ObjectAccessible.h"
-#endif
-
-// For embedding plugin accessibles
-#ifdef MOZ_ACCESSIBILITY_ATK
-#include "AtkSocketAccessible.h"
-#endif
-
-#include "nsXFormsFormControlsAccessible.h"
-#include "nsXFormsWidgetsAccessible.h"
-#include "OuterDocAccessible.h"
-
-#include "mozilla/FunctionTimer.h"
-#include "mozilla/dom/Element.h"
-
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibilityService
 ////////////////////////////////////////////////////////////////////////////////
 
 nsAccessibilityService *nsAccessibilityService::gAccessibilityService = nsnull;
@@ -1171,22 +1161,22 @@ nsAccessibilityService::GetOrCreateAcces
     if (roleMapEntry) {
       // Create ARIA grid/treegrid accessibles if node is not of a child or
       // valid child of HTML table and is not a HTML table.
       if ((!partOfHTMLTable || !tryTagNameOrFrame) &&
           frameType != nsGkAtoms::tableOuterFrame) {
 
         if (roleMapEntry->role == roles::TABLE ||
             roleMapEntry->role == roles::TREE_TABLE) {
-          newAcc = new nsARIAGridAccessibleWrap(content, docAcc);
+          newAcc = new ARIAGridAccessibleWrap(content, docAcc);
 
         } else if (roleMapEntry->role == roles::GRID_CELL ||
             roleMapEntry->role == roles::ROWHEADER ||
             roleMapEntry->role == roles::COLUMNHEADER) {
-          newAcc = new nsARIAGridCellAccessibleWrap(content, docAcc);
+          newAcc = new ARIAGridCellAccessibleWrap(content, docAcc);
         }
       }
     }
 
     if (!newAcc && tryTagNameOrFrame) {
       // Prefer to use markup (mostly tag name, perhaps attributes) to
       // decide if and what kind of accessible to create.
       // The method creates accessibles for table related content too therefore
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1656,50 +1656,56 @@ nsAccessible::ApplyARIAState(PRUint64* a
 
   *aState |= mRoleMapEntry->state;
 
   if (aria::MapToState(mRoleMapEntry->attributeMap1, element, aState) &&
       aria::MapToState(mRoleMapEntry->attributeMap2, element, aState))
     aria::MapToState(mRoleMapEntry->attributeMap3, element, aState);
 }
 
-/* DOMString getValue (); */
 NS_IMETHODIMP
 nsAccessible::GetValue(nsAString& aValue)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
+  nsAutoString value;
+  Value(value);
+  aValue.Assign(value);
+
+  return NS_OK;
+}
+
+void
+nsAccessible::Value(nsString& aValue)
+{
   if (mRoleMapEntry) {
-    if (mRoleMapEntry->valueRule == eNoValue) {
-      return NS_OK;
-    }
+    if (mRoleMapEntry->valueRule == eNoValue)
+      return;
 
     // aria-valuenow is a number, and aria-valuetext is the optional text equivalent
     // For the string value, we will try the optional text equivalent first
     if (!mContent->GetAttr(kNameSpaceID_None,
                            nsGkAtoms::aria_valuetext, aValue)) {
       mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::aria_valuenow,
                         aValue);
     }
   }
 
   if (!aValue.IsEmpty())
-    return NS_OK;
+    return;
 
   // Check if it's a simple xlink.
   if (nsCoreUtils::IsXLink(mContent)) {
     nsIPresShell* presShell = mDoc->PresShell();
     if (presShell) {
       nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
-      return presShell->GetLinkLocation(DOMNode, aValue);
+      presShell->GetLinkLocation(DOMNode, aValue);
     }
   }
-
-  return NS_OK;
 }
 
 // nsIAccessibleValue
 NS_IMETHODIMP
 nsAccessible::GetMaximumValue(double *aMaximumValue)
 {
   return GetAttrValue(nsGkAtoms::aria_valuemax, aMaximumValue);
 }
@@ -2229,17 +2235,17 @@ nsAccessible::DispatchClickEvent(nsICont
     return;
 
   nsCoreUtils::DispatchMouseEvent(NS_MOUSE_BUTTON_UP, presShell, aContent);
 }
 
 NS_IMETHODIMP
 nsAccessible::ScrollTo(PRUint32 aHow)
 {
-  nsAccessNode::ScrollTo(aHow);
+  nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aHow);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY)
 {
   nsIFrame *frame = GetFrame();
   if (!frame)
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -126,21 +126,26 @@ public:
   // nsAccessNode
 
   virtual void Shutdown();
 
   //////////////////////////////////////////////////////////////////////////////
   // Public methods
 
   /**
-   * get the description of this accessible
+   * Get the description of this accessible.
    */
   virtual void Description(nsString& aDescription);
 
   /**
+   * Get the value of this accessible.
+   */
+  virtual void Value(nsString& aValue);
+
+  /**
    * Return DOM node associated with this accessible.
    */
   inline already_AddRefed<nsIDOMNode> DOMNode() const
   {
     nsIDOMNode *DOMNode = nsnull;
     if (GetNode())
       CallQueryInterface(GetNode(), &DOMNode);
     return DOMNode;
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -119,29 +119,28 @@ nsApplicationAccessible::GetName(nsAStri
     NS_WARNING("brandShortName not found, using default app name");
     appName.AssignLiteral("Gecko based application");
   }
 
   aName.Assign(appName);
   return NS_OK;
 }
 
-NS_IMETHODIMP
-nsApplicationAccessible::GetValue(nsAString &aValue)
-{
-  aValue.Truncate();
-  return NS_OK;
-}
-
 void
 nsApplicationAccessible::Description(nsString &aDescription)
 {
   aDescription.Truncate();
 }
 
+void
+nsApplicationAccessible::Value(nsString& aValue)
+{
+  aValue.Truncate();
+}
+
 PRUint64
 nsApplicationAccessible::State()
 {
   return IsDefunct() ? states::DEFUNCT : 0;
 }
 
 NS_IMETHODIMP
 nsApplicationAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
--- a/accessible/src/base/nsApplicationAccessible.h
+++ b/accessible/src/base/nsApplicationAccessible.h
@@ -75,17 +75,16 @@ public:
   NS_SCRIPTABLE NS_IMETHOD GetRootDocument(nsIAccessibleDocument** aRootDocument);
   NS_SCRIPTABLE NS_IMETHOD ScrollTo(PRUint32 aScrollType);
   NS_SCRIPTABLE NS_IMETHOD ScrollToPoint(PRUint32 aCoordinateType, PRInt32 aX, PRInt32 aY);
   NS_SCRIPTABLE NS_IMETHOD GetLanguage(nsAString& aLanguage);
   NS_IMETHOD GetParent(nsIAccessible **aParent);
   NS_IMETHOD GetNextSibling(nsIAccessible **aNextSibling);
   NS_IMETHOD GetPreviousSibling(nsIAccessible **aPreviousSibling);
   NS_IMETHOD GetName(nsAString &aName);
-  NS_IMETHOD GetValue(nsAString &aValue);
   NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
   NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
                            PRInt32 *aPositionInGroup);
   NS_IMETHOD GetBounds(PRInt32 *aX, PRInt32 *aY,
                        PRInt32 *aWidth, PRInt32 *aHeight);
   NS_IMETHOD SetSelected(bool aIsSelected);
   NS_IMETHOD TakeSelection();
   NS_IMETHOD TakeFocus();
@@ -99,16 +98,17 @@ public:
   // nsAccessNode
   virtual bool Init();
   virtual void Shutdown();
   virtual bool IsPrimaryForNode() const;
 
   // nsAccessible
   virtual void ApplyARIAState(PRUint64* aState);
   virtual void Description(nsString& aDescription);
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
   virtual PRUint64 NativeState();
   virtual Relation RelationByType(PRUint32 aRelType);
 
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
   virtual nsAccessible* FocusedChild();
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -119,26 +119,27 @@ nsLinkableAccessible::NativeState()
     states |= states::LINKED;
     if (mActionAcc->State() & states::TRAVERSED)
       states |= states::TRAVERSED;
   }
 
   return states;
 }
 
-NS_IMETHODIMP
-nsLinkableAccessible::GetValue(nsAString& aValue)
+void
+nsLinkableAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
-  nsAccessible::GetValue(aValue);
+  nsAccessible::Value(aValue);
   if (!aValue.IsEmpty())
-    return NS_OK;
+    return;
 
-  return mIsLink ? mActionAcc->GetValue(aValue) : NS_ERROR_NOT_IMPLEMENTED;
+  if (aValue.IsEmpty() && mIsLink)
+    mActionAcc->Value(aValue);
 }
 
 
 PRUint8
 nsLinkableAccessible::ActionCount()
 {
   return (mIsOnclick || mIsLink) ? 1 : 0;
 }
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -84,23 +84,23 @@ public:
 
   nsLinkableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
-  NS_IMETHOD GetValue(nsAString& _retval);
   NS_IMETHOD TakeFocus();
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
   virtual KeyBinding AccessKey() const;
 
   // HyperLinkAccessible
   virtual already_AddRefed<nsIURI> AnchorURIAt(PRUint32 aAnchorIndex);
--- a/accessible/src/base/nsCoreUtils.cpp
+++ b/accessible/src/base/nsCoreUtils.cpp
@@ -721,16 +721,27 @@ nsCoreUtils::IsColumnHidden(nsITreeColum
 {
   nsCOMPtr<nsIDOMElement> element;
   aColumn->GetElement(getter_AddRefs(element));
   nsCOMPtr<nsIContent> content = do_QueryInterface(element);
   return content->AttrValueIs(kNameSpaceID_None, nsGkAtoms::hidden,
                               nsGkAtoms::_true, eCaseMatters);
 }
 
+void
+nsCoreUtils::ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent,
+                      PRUint32 aScrollType)
+{
+  nsIPresShell::ScrollAxis vertical, horizontal;
+  ConvertScrollTypeToPercents(aScrollType, &vertical, &horizontal);
+  aPresShell->ScrollContentIntoView(aContent, vertical, horizontal,
+                                    nsIPresShell::SCROLL_OVERFLOW_HIDDEN);
+}
+
+
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessibleDOMStringList
 ////////////////////////////////////////////////////////////////////////////////
 
 NS_IMPL_ISUPPORTS1(nsAccessibleDOMStringList, nsIDOMDOMStringList)
 
 NS_IMETHODIMP
 nsAccessibleDOMStringList::Item(PRUint32 aIndex, nsAString& aResult)
--- a/accessible/src/base/nsCoreUtils.h
+++ b/accessible/src/base/nsCoreUtils.h
@@ -331,16 +331,22 @@ public:
     GetPreviousSensibleColumn(nsITreeColumn *aColumn);
 
   /**
    * Return true if the given column is hidden (i.e. not sensible).
    */
   static bool IsColumnHidden(nsITreeColumn *aColumn);
 
   /**
+   * Scroll content into view.
+   */
+  static void ScrollTo(nsIPresShell* aPresShell, nsIContent* aContent,
+                       PRUint32 aScrollType);
+
+  /**
    * Return true if the given node is table header element.
    */
   static bool IsHTMLTableHeader(nsIContent *aContent)
   {
     return aContent->NodeInfo()->Equals(nsGkAtoms::th) ||
       aContent->HasAttr(kNameSpaceID_None, nsGkAtoms::scope);
   }
 
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -170,17 +170,16 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_IN
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mVirtualCursor)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
   tmp->mDependentIDsHash.Clear();
   tmp->mNodeToAccessibleMap.Clear();
   ClearCache(tmp->mAccessibleCache);
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDocAccessible)
-  NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsDocAccessible)
   NS_INTERFACE_MAP_ENTRY(nsIAccessibleDocument)
   NS_INTERFACE_MAP_ENTRY(nsIDocumentObserver)
   NS_INTERFACE_MAP_ENTRY(nsIMutationObserver)
   NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
   NS_INTERFACE_MAP_ENTRY(nsIObserver)
   NS_INTERFACE_MAP_ENTRY(nsIAccessiblePivotObserver)
   NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIAccessibleDocument)
   NS_INTERFACE_MAP_ENTRY_CONDITIONAL(nsIAccessibleCursorable,
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -59,38 +59,29 @@
 #include "nsCOMArray.h"
 #include "nsIDocShellTreeNode.h"
 
 class nsIScrollableView;
 class nsAccessiblePivot;
 
 const PRUint32 kDefaultCacheSize = 256;
 
-#define NS_DOCACCESSIBLE_IMPL_CID                       \
-{  /* 5641921c-a093-4292-9dca-0b51813db57d */           \
-  0x5641921c,                                           \
-  0xa093,                                               \
-  0x4292,                                               \
-  { 0x9d, 0xca, 0x0b, 0x51, 0x81, 0x3d, 0xb5, 0x7d }    \
-}
-
 class nsDocAccessible : public nsHyperTextAccessibleWrap,
                         public nsIAccessibleDocument,
                         public nsIDocumentObserver,
                         public nsIObserver,
                         public nsIScrollPositionListener,
                         public nsSupportsWeakReference,
                         public nsIAccessibleCursorable,
                         public nsIAccessiblePivotObserver
 {
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDocAccessible, nsAccessible)
 
   NS_DECL_NSIACCESSIBLEDOCUMENT
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_DOCACCESSIBLE_IMPL_CID)
 
   NS_DECL_NSIOBSERVER
 
   NS_DECL_NSIACCESSIBLECURSORABLE
 
   NS_DECL_NSIACCESSIBLEPIVOTOBSERVER
 
 public:
@@ -138,16 +129,21 @@ public:
   // nsDocAccessible
 
   /**
    * Return presentation shell for this document accessible.
    */
   nsIPresShell* PresShell() const { return mPresShell; }
 
   /**
+   * Return the presentation shell's context.
+   */
+  nsPresContext* PresContext() const { return mPresShell->GetPresContext(); }
+    
+  /**
    * Return true if associated DOM document was loaded and isn't unloading.
    */
   bool IsContentLoaded() const
   {
     // eDOMLoaded flag check is used for error pages as workaround to make this
     // method return correct result since error pages do not receive 'pageshow'
     // event and as consequence nsIDocument::IsShowing() returns false.
     return mDocument && mDocument->IsVisible() &&
@@ -661,19 +657,16 @@ protected:
   nsRefPtr<NotificationController> mNotificationController;
   friend class NotificationController;
 
 private:
 
   nsIPresShell* mPresShell;
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible,
-                              NS_DOCACCESSIBLE_IMPL_CID)
-
 inline nsDocAccessible*
 nsAccessible::AsDoc()
 {
   return mFlags & eDocAccessible ?
     static_cast<nsDocAccessible*>(this) : nsnull;
 }
 
 #endif
--- a/accessible/src/base/nsFormControlAccessible.cpp
+++ b/accessible/src/base/nsFormControlAccessible.cpp
@@ -105,42 +105,39 @@ ProgressMeterAccessible<Max>::IsWidget()
 {
   return true;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleValue
 
 template<int Max>
-NS_IMETHODIMP
-ProgressMeterAccessible<Max>::GetValue(nsAString& aValue)
+void
+ProgressMeterAccessible<Max>::Value(nsString& aValue)
 {
-  nsresult rv = nsFormControlAccessible::GetValue(aValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
+  nsFormControlAccessible::Value(aValue);
   if (!aValue.IsEmpty())
-    return NS_OK;
+    return;
 
   double maxValue = 0;
-  rv = GetMaximumValue(&maxValue);
-  NS_ENSURE_SUCCESS(rv, rv);
+  nsresult rv = GetMaximumValue(&maxValue);
+  NS_ENSURE_SUCCESS(rv, );
+  if (maxValue == 0)
+    return;
 
   double curValue = 0;
-  rv = GetCurrentValue(&curValue);
-  NS_ENSURE_SUCCESS(rv, rv);
+  GetCurrentValue(&curValue);
+  NS_ENSURE_SUCCESS(rv, );
 
   // Treat the current value bigger than maximum as 100%.
   double percentValue = (curValue < maxValue) ?
     (curValue / maxValue) * 100 : 100;
 
-  nsAutoString value;
-  value.AppendFloat(percentValue); // AppendFloat isn't available on nsAString
-  value.AppendLiteral("%");
-  aValue = value;
-  return NS_OK;
+  aValue.AppendFloat(percentValue);
+  aValue.AppendLiteral("%");
 }
 
 template<int Max>
 NS_IMETHODIMP
 ProgressMeterAccessible<Max>::GetMaximumValue(double* aMaximumValue)
 {
   nsresult rv = nsFormControlAccessible::GetMaximumValue(aMaximumValue);
   if (rv != NS_OK_NO_ARIA_VALUE)
--- a/accessible/src/base/nsFormControlAccessible.h
+++ b/accessible/src/base/nsFormControlAccessible.h
@@ -53,20 +53,18 @@ public:
   ProgressMeterAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     nsFormControlAccessible(aContent, aDoc)
   {
   }
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString &aValue);
-
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
 };
 
 /**
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -87,27 +87,17 @@
 #endif
 
 using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-// Expanded version of NS_IMPL_ISUPPORTS_INHERITED2 
-// so we can QI directly to concrete nsRootAccessible
-NS_IMPL_QUERY_HEAD(nsRootAccessible)
-NS_IMPL_QUERY_BODY(nsIDOMEventListener)
-if (aIID.Equals(NS_GET_IID(nsRootAccessible)))
-  foundInterface = reinterpret_cast<nsISupports*>(this);
-else
-NS_IMPL_QUERY_TAIL_INHERITING(nsDocAccessible)
-
-NS_IMPL_ADDREF_INHERITED(nsRootAccessible, nsDocAccessible) 
-NS_IMPL_RELEASE_INHERITED(nsRootAccessible, nsDocAccessible)
+NS_IMPL_ISUPPORTS_INHERITED1(nsRootAccessible, nsDocAccessible, nsIAccessibleDocument)
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsRootAccessible::
   nsRootAccessible(nsIDocument* aDocument, nsIContent* aRootContent,
                    nsIPresShell* aPresShell) :
   nsDocAccessibleWrap(aDocument, aRootContent, aPresShell)
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/base/nsRootAccessible.h
@@ -45,24 +45,16 @@
 #include "nsHashtable.h"
 #include "nsCaretAccessible.h"
 #include "nsIDocument.h"
 #include "nsIDOMEventListener.h"
 
 class nsXULTreeAccessible;
 class Relation;
 
-#define NS_ROOTACCESSIBLE_IMPL_CID                      \
-{  /* eaba2cf0-21b1-4e2b-b711-d3a89dcd5e1a */           \
-  0xeaba2cf0,                                           \
-  0x21b1,                                               \
-  0x4e2b,                                               \
-  { 0xb7, 0x11, 0xd3, 0xa8, 0x9d, 0xcd, 0x5e, 0x1a }    \
-}
-
 const PRInt32 SCROLL_HASH_START_SIZE = 6;
 
 class nsRootAccessible : public nsDocAccessibleWrap,
                          public nsIDOMEventListener
 {
   NS_DECL_ISUPPORTS_INHERITED
 
 public:
@@ -80,19 +72,17 @@ public:
   virtual void Shutdown();
 
   // nsAccessible
   virtual Relation RelationByType(PRUint32 aType);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // nsRootAccessible
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
-
-    nsCaretAccessible *GetCaretAccessible();
+  nsCaretAccessible* GetCaretAccessible();
 
   /**
    * Notify that the sub document presshell was activated.
    */
   virtual void DocumentActivated(nsDocAccessible* aDocument);
 
 protected:
 
@@ -124,18 +114,16 @@ protected:
                                     nsXULTreeAccessible* aAccessible);
 
     PRUint32 GetChromeFlags();
 #endif
 
     nsRefPtr<nsCaretAccessible> mCaretAccessible;
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsRootAccessible, NS_ROOTACCESSIBLE_IMPL_CID)
-
 inline nsRootAccessible*
 nsAccessible::AsRoot()
 {
   return mFlags & eRootAccessible ?
     static_cast<nsRootAccessible*>(this) : nsnull;
 }
 
 #endif
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -278,18 +278,17 @@ nsTextEquivUtils::AppendFromValue(nsAcce
 
   // Implementation of step f. of text equivalent computation. If the given
   // accessible is not root accessible (the accessible the text equivalent is
   // computed for in the end) then append accessible value. Otherwise append
   // value if and only if the given accessible is in the middle of its parent.
 
   nsAutoString text;
   if (aAccessible != gInitiatorAcc) {
-    nsresult rv = aAccessible->GetValue(text);
-    NS_ENSURE_SUCCESS(rv, rv);
+    aAccessible->Value(text);
 
     return AppendString(aString, text) ?
       NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
   }
 
   //XXX: is it necessary to care the accessible is not a document?
   if (aAccessible->IsDocumentNode())
     return NS_ERROR_UNEXPECTED;
@@ -299,18 +298,17 @@ nsTextEquivUtils::AppendFromValue(nsAcce
   for (nsIContent* childContent = content->GetPreviousSibling(); childContent;
        childContent = childContent->GetPreviousSibling()) {
     // check for preceding text...
     if (!childContent->TextIsOnlyWhitespace()) {
       for (nsIContent* siblingContent = content->GetNextSibling(); siblingContent;
            siblingContent = siblingContent->GetNextSibling()) {
         // .. and subsequent text
         if (!siblingContent->TextIsOnlyWhitespace()) {
-          nsresult rv = aAccessible->GetValue(text);
-          NS_ENSURE_SUCCESS(rv, rv);
+          aAccessible->Value(text);
 
           return AppendString(aString, text) ?
             NS_OK : NS_OK_NO_NAME_CLAUSE_HANDLED;
           break;
         }
       }
       break;
     }
rename from accessible/src/base/nsARIAGridAccessible.cpp
rename to accessible/src/generic/ARIAGridAccessible.cpp
--- a/accessible/src/base/nsARIAGridAccessible.cpp
+++ b/accessible/src/generic/ARIAGridAccessible.cpp
@@ -31,136 +31,137 @@
  * 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 ***** */
 
-#include "nsARIAGridAccessible.h"
+#include "ARIAGridAccessible.h"
 
 #include "AccIterator.h"
 #include "nsAccUtils.h"
 #include "Role.h"
 #include "States.h"
 
 #include "nsIMutableArray.h"
 #include "nsComponentManagerUtils.h"
 
+using namespace mozilla;
 using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsARIAGridAccessible
+// ARIAGridAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor
 
-nsARIAGridAccessible::
-  nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+ARIAGridAccessible::
+  ARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridAccessible,
+NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridAccessible,
                              nsAccessible,
                              nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 //nsAccessNode
 
 void
-nsARIAGridAccessible::Shutdown()
+ARIAGridAccessible::Shutdown()
 {
   mTable = nsnull;
   nsAccessibleWrap::Shutdown();
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTable
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSummary(nsAString &aSummary)
+ARIAGridAccessible::GetSummary(nsAString& aSummary)
 {
   aSummary.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   // XXX: should be pointed by aria-describedby on grid?
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetColumnCount(PRInt32 *acolumnCount)
+ARIAGridAccessible::GetColumnCount(PRInt32* aColumnCount)
 {
-  NS_ENSURE_ARG_POINTER(acolumnCount);
-  *acolumnCount = 0;
+  NS_ENSURE_ARG_POINTER(aColumnCount);
+  *aColumnCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
   nsAccessible* row = rowIter.Next();
   if (!row)
     return NS_OK;
 
   AccIterator cellIter(row, filters::GetCell);
   nsAccessible *cell = nsnull;
 
   while ((cell = cellIter.Next()))
-    (*acolumnCount)++;
+    (*aColumnCount)++;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetRowCount(PRInt32 *arowCount)
+ARIAGridAccessible::GetRowCount(PRInt32* aRowCount)
 {
-  NS_ENSURE_ARG_POINTER(arowCount);
-  *arowCount = 0;
+  NS_ENSURE_ARG_POINTER(aRowCount);
+  *aRowCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
   while (rowIter.Next())
-    (*arowCount)++;
+    (*aRowCount)++;
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
-                                nsIAccessible **aAccessible)
+ARIAGridAccessible::GetCellAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
+                              nsIAccessible** aCell)
 {
-  NS_ENSURE_ARG_POINTER(aAccessible);
-  *aAccessible = nsnull;
+  NS_ENSURE_ARG_POINTER(aCell);
+  *aCell = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible *row = GetRowAt(aRowIndex);
   NS_ENSURE_ARG(row);
 
   nsAccessible *cell = GetCellInRowAt(row, aColumnIndex);
   NS_ENSURE_ARG(cell);
 
-  NS_ADDREF(*aAccessible = cell);
+  NS_ADDREF(*aCell = cell);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
-                                     PRInt32 *aCellIndex)
+ARIAGridAccessible::GetCellIndexAt(PRInt32 aRowIndex, PRInt32 aColumnIndex,
+                                   PRInt32* aCellIndex)
 {
   NS_ENSURE_ARG_POINTER(aCellIndex);
   *aCellIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(aRowIndex >= 0 && aColumnIndex >= 0);
@@ -173,18 +174,18 @@ nsARIAGridAccessible::GetCellIndexAt(PRI
   GetColumnCount(&colsCount);
   NS_ENSURE_ARG(aColumnIndex < colsCount);
 
   *aCellIndex = colsCount * aRowIndex + aColumnIndex;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
-                                       PRInt32 *aColumnIndex)
+ARIAGridAccessible::GetColumnIndexAt(PRInt32 aCellIndex,
+                                     PRInt32* aColumnIndex)
 {
   NS_ENSURE_ARG_POINTER(aColumnIndex);
   *aColumnIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(aCellIndex >= 0);
@@ -197,17 +198,17 @@ nsARIAGridAccessible::GetColumnIndexAt(P
 
   NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
 
   *aColumnIndex = aCellIndex % colsCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32 *aRowIndex)
+ARIAGridAccessible::GetRowIndexAt(PRInt32 aCellIndex, PRInt32* aRowIndex)
 {
   NS_ENSURE_ARG_POINTER(aRowIndex);
   *aRowIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(aCellIndex >= 0);
@@ -220,19 +221,19 @@ nsARIAGridAccessible::GetRowIndexAt(PRIn
 
   NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
 
   *aRowIndex = aCellIndex / colsCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
-                                               PRInt32* aRowIndex,
-                                               PRInt32* aColumnIndex)
+ARIAGridAccessible::GetRowAndColumnIndicesAt(PRInt32 aCellIndex,
+                                             PRInt32* aRowIndex,
+                                             PRInt32* aColumnIndex)
 {
   NS_ENSURE_ARG_POINTER(aRowIndex);
   *aRowIndex = -1;
   NS_ENSURE_ARG_POINTER(aColumnIndex);
   *aColumnIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
@@ -248,78 +249,78 @@ nsARIAGridAccessible::GetRowAndColumnInd
   NS_ENSURE_ARG(aCellIndex < rowCount * colsCount);
 
   *aColumnIndex = aCellIndex % colsCount;
   *aRowIndex = aCellIndex / colsCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
-                                        PRInt32 *aExtentCount)
+ARIAGridAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
+                                   PRInt32* aExtentCount)
 {
   NS_ENSURE_ARG_POINTER(aExtentCount);
   *aExtentCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(IsValidRowNColumn(aRow, aColumn));
 
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetRowExtentAt(PRInt32 aRow, PRInt32 aColumn,
-                                      PRInt32 *aExtentCount)
+ARIAGridAccessible::GetColumnExtentAt(PRInt32 aRow, PRInt32 aColumn,
+                                      PRInt32* aExtentCount)
 {
   NS_ENSURE_ARG_POINTER(aExtentCount);
   *aExtentCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(IsValidRowNColumn(aRow, aColumn));
 
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetColumnDescription(PRInt32 aColumn,
-                                           nsAString& aDescription)
+ARIAGridAccessible::GetColumnDescription(PRInt32 aColumn,
+                                         nsAString& aDescription)
 {
   aDescription.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(IsValidColumn(aColumn));
 
   // XXX: not implemented
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetRowDescription(PRInt32 aRow, nsAString& aDescription)
+ARIAGridAccessible::GetRowDescription(PRInt32 aRow, nsAString& aDescription)
 {
   aDescription.Truncate();
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(IsValidRow(aRow));
 
   // XXX: not implemented
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool *aIsSelected)
+ARIAGridAccessible::IsColumnSelected(PRInt32 aColumn, bool* aIsSelected)
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = false;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   NS_ENSURE_ARG(IsValidColumn(aColumn));
@@ -340,17 +341,17 @@ nsARIAGridAccessible::IsColumnSelected(P
     }
   } while ((row = rowIter.Next()));
 
   *aIsSelected = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool *aIsSelected)
+ARIAGridAccessible::IsRowSelected(PRInt32 aRow, bool* aIsSelected)
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = false;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible *row = GetRowAt(aRow);
@@ -365,18 +366,18 @@ nsARIAGridAccessible::IsRowSelected(PRIn
     }
   }
 
   *aIsSelected = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
-                                     bool *aIsSelected)
+ARIAGridAccessible::IsCellSelected(PRInt32 aRow, PRInt32 aColumn,
+                                   bool* aIsSelected)
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = false;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible *row = GetRowAt(aRow);
@@ -390,17 +391,17 @@ nsARIAGridAccessible::IsCellSelected(PRI
       return NS_OK;
   }
 
   *aIsSelected = true;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
+ARIAGridAccessible::GetSelectedCellCount(PRUint32* aCount)
 {
   NS_ENSURE_ARG_POINTER(aCount);
   *aCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   PRInt32 colCount = 0;
@@ -423,23 +424,23 @@ nsARIAGridAccessible::GetSelectedCellCou
         (*aCount)++;
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
+ARIAGridAccessible::GetSelectedColumnCount(PRUint32* aCount)
 {
   return GetSelectedColumnsArray(aCount);
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
+ARIAGridAccessible::GetSelectedRowCount(PRUint32* aCount)
 {
   NS_ENSURE_ARG_POINTER(aCount);
   *aCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
@@ -467,17 +468,17 @@ nsARIAGridAccessible::GetSelectedRowCoun
     if (isRowSelected)
       (*aCount)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedCells(nsIArray **aCells)
+ARIAGridAccessible::GetSelectedCells(nsIArray** aCells)
 {
   NS_ENSURE_ARG_POINTER(aCells);
   *aCells = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsresult rv = NS_OK;
@@ -505,18 +506,18 @@ nsARIAGridAccessible::GetSelectedCells(n
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedCellIndices(PRUint32 *aCellsCount,
-                                             PRInt32 **aCells)
+ARIAGridAccessible::GetSelectedCellIndices(PRUint32* aCellsCount,
+                                           PRInt32** aCells)
 {
   NS_ENSURE_ARG_POINTER(aCellsCount);
   *aCellsCount = 0;
   NS_ENSURE_ARG_POINTER(aCells);
   *aCells = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
@@ -557,30 +558,30 @@ nsARIAGridAccessible::GetSelectedCellInd
     nsMemory::Clone(selCells.Elements(), selCellsCount * sizeof(PRInt32)));
   NS_ENSURE_TRUE(*aCells, NS_ERROR_OUT_OF_MEMORY);
 
   *aCellsCount = selCellsCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedColumnIndices(PRUint32 *acolumnCount,
-                                               PRInt32 **aColumns)
+ARIAGridAccessible::GetSelectedColumnIndices(PRUint32* aColumnCount,
+                                             PRInt32** aColumns)
 {
   NS_ENSURE_ARG_POINTER(aColumns);
 
-  return GetSelectedColumnsArray(acolumnCount, aColumns);
+  return GetSelectedColumnsArray(aColumnCount, aColumns);
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::GetSelectedRowIndices(PRUint32 *arowCount,
-                                            PRInt32 **aRows)
+ARIAGridAccessible::GetSelectedRowIndices(PRUint32* aRowCount,
+                                          PRInt32** aRows)
 {
-  NS_ENSURE_ARG_POINTER(arowCount);
-  *arowCount = 0;
+  NS_ENSURE_ARG_POINTER(aRowCount);
+  *aRowCount = 0;
   NS_ENSURE_ARG_POINTER(aRows);
   *aRows = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   PRInt32 rowCount = 0;
   GetRowCount(&rowCount);
@@ -618,22 +619,22 @@ nsARIAGridAccessible::GetSelectedRowIndi
   PRUint32 selrowCount = selRows.Length();
   if (!selrowCount)
     return NS_OK;
 
   *aRows = static_cast<PRInt32*>(
     nsMemory::Clone(selRows.Elements(), selrowCount * sizeof(PRInt32)));
   NS_ENSURE_TRUE(*aRows, NS_ERROR_OUT_OF_MEMORY);
 
-  *arowCount = selrowCount;
+  *aRowCount = selrowCount;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::SelectRow(PRInt32 aRow)
+ARIAGridAccessible::SelectRow(PRInt32 aRow)
 {
   NS_ENSURE_ARG(IsValidRow(aRow));
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
 
@@ -642,17 +643,17 @@ nsARIAGridAccessible::SelectRow(PRInt32 
     nsresult rv = SetARIASelected(row, rowIdx == aRow);
     NS_ENSURE_SUCCESS(rv, rv);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::SelectColumn(PRInt32 aColumn)
+ARIAGridAccessible::SelectColumn(PRInt32 aColumn)
 {
   NS_ENSURE_ARG(IsValidColumn(aColumn));
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
 
@@ -669,29 +670,29 @@ nsARIAGridAccessible::SelectColumn(PRInt
       NS_ENSURE_SUCCESS(rv, rv);
     }
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::UnselectRow(PRInt32 aRow)
+ARIAGridAccessible::UnselectRow(PRInt32 aRow)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible *row = GetRowAt(aRow);
   NS_ENSURE_ARG(row);
 
   return SetARIASelected(row, false);
 }
 
 NS_IMETHODIMP
-nsARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
+ARIAGridAccessible::UnselectColumn(PRInt32 aColumn)
 {
   NS_ENSURE_ARG(IsValidColumn(aColumn));
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
 
@@ -706,83 +707,83 @@ nsARIAGridAccessible::UnselectColumn(PRI
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected
 
 bool
-nsARIAGridAccessible::IsValidRow(PRInt32 aRow)
+ARIAGridAccessible::IsValidRow(PRInt32 aRow)
 {
   if (aRow < 0)
     return false;
   
   PRInt32 rowCount = 0;
   GetRowCount(&rowCount);
   return aRow < rowCount;
 }
 
 bool
-nsARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
+ARIAGridAccessible::IsValidColumn(PRInt32 aColumn)
 {
   if (aColumn < 0)
     return false;
 
   PRInt32 colCount = 0;
   GetColumnCount(&colCount);
   return aColumn < colCount;
 }
 
 bool
-nsARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
+ARIAGridAccessible::IsValidRowNColumn(PRInt32 aRow, PRInt32 aColumn)
 {
   if (aRow < 0 || aColumn < 0)
     return false;
   
   PRInt32 rowCount = 0;
   GetRowCount(&rowCount);
   if (aRow >= rowCount)
     return false;
 
   PRInt32 colCount = 0;
   GetColumnCount(&colCount);
   return aColumn < colCount;
 }
 
 nsAccessible*
-nsARIAGridAccessible::GetRowAt(PRInt32 aRow)
+ARIAGridAccessible::GetRowAt(PRInt32 aRow)
 {
   PRInt32 rowIdx = aRow;
 
   AccIterator rowIter(this, filters::GetRow);
 
   nsAccessible *row = rowIter.Next();
   while (rowIdx != 0 && (row = rowIter.Next()))
     rowIdx--;
 
   return row;
 }
 
 nsAccessible*
-nsARIAGridAccessible::GetCellInRowAt(nsAccessible *aRow, PRInt32 aColumn)
+ARIAGridAccessible::GetCellInRowAt(nsAccessible* aRow, PRInt32 aColumn)
 {
   PRInt32 colIdx = aColumn;
 
   AccIterator cellIter(aRow, filters::GetCell);
   nsAccessible *cell = cellIter.Next();
   while (colIdx != 0 && (cell = cellIter.Next()))
     colIdx--;
 
   return cell;
 }
 
 nsresult
-nsARIAGridAccessible::SetARIASelected(nsAccessible *aAccessible,
-                                      bool aIsSelected, bool aNotify)
+ARIAGridAccessible::SetARIASelected(nsAccessible* aAccessible,
+                                    bool aIsSelected, bool aNotify)
 {
   nsIContent *content = aAccessible->GetContent();
   NS_ENSURE_STATE(content);
 
   nsresult rv = NS_OK;
   if (aIsSelected)
     rv = content->SetAttr(kNameSpaceID_None, nsGkAtoms::aria_selected,
                           NS_LITERAL_STRING("true"), aNotify);
@@ -839,21 +840,21 @@ nsARIAGridAccessible::SetARIASelected(ns
       }
     }
   }
 
   return NS_OK;
 }
 
 nsresult
-nsARIAGridAccessible::GetSelectedColumnsArray(PRUint32 *acolumnCount,
-                                              PRInt32 **aColumns)
+ARIAGridAccessible::GetSelectedColumnsArray(PRUint32* aColumnCount,
+                                            PRInt32** aColumns)
 {
-  NS_ENSURE_ARG_POINTER(acolumnCount);
-  *acolumnCount = 0;
+  NS_ENSURE_ARG_POINTER(aColumnCount);
+  *aColumnCount = 0;
   if (aColumns)
     *aColumns = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   AccIterator rowIter(this, filters::GetRow);
   nsAccessible *row = rowIter.Next();
@@ -888,60 +889,60 @@ nsARIAGridAccessible::GetSelectedColumns
       }
     }
   } while ((row = rowIter.Next()));
 
   if (!selColCount)
     return NS_OK;
 
   if (!aColumns) {
-    *acolumnCount = selColCount;
+    *aColumnCount = selColCount;
     return NS_OK;
   }
 
   *aColumns = static_cast<PRInt32*>(
     nsMemory::Alloc(selColCount * sizeof(PRInt32)));
   NS_ENSURE_TRUE(*aColumns, NS_ERROR_OUT_OF_MEMORY);
 
-  *acolumnCount = selColCount;
+  *aColumnCount = selColCount;
   for (PRInt32 colIdx = 0, idx = 0; colIdx < colCount; colIdx++) {
     if (isColSelArray[colIdx])
       (*aColumns)[idx++] = colIdx;
   }
 
   return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsARIAGridCellAccessible
+// ARIAGridCellAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor
 
-nsARIAGridCellAccessible::
-  nsARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
+ARIAGridCellAccessible::
+  ARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsHyperTextAccessibleWrap(aContent, aDoc)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsISupports
 
-NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridCellAccessible,
+NS_IMPL_ISUPPORTS_INHERITED1(ARIAGridCellAccessible,
                              nsHyperTextAccessible,
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessibleTableCell
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
+ARIAGridCellAccessible::GetTable(nsIAccessibleTable** aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
   *aTable = nsnull;
 
   nsAccessible* thisRow = Parent();
   if (!thisRow || thisRow->Role() != roles::ROW)
     return NS_OK;
 
@@ -953,17 +954,17 @@ nsARIAGridCellAccessible::GetTable(nsIAc
   if (tableRole != roles::TABLE && tableRole != roles::TREE_TABLE)
     return NS_OK;
 
   CallQueryInterface(table, aTable);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
+ARIAGridCellAccessible::GetColumnIndex(PRInt32* aColumnIndex)
 {
   NS_ENSURE_ARG_POINTER(aColumnIndex);
   *aColumnIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible* row = Parent();
@@ -980,17 +981,17 @@ nsARIAGridCellAccessible::GetColumnIndex
         role == roles::COLUMNHEADER)
       (*aColumnIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
+ARIAGridCellAccessible::GetRowIndex(PRInt32* aRowIndex)
 {
   NS_ENSURE_ARG_POINTER(aRowIndex);
   *aRowIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible* row = Parent();
@@ -1009,43 +1010,43 @@ nsARIAGridCellAccessible::GetRowIndex(PR
     if (row->Role() == roles::ROW)
       (*aRowIndex)++;
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
+ARIAGridCellAccessible::GetColumnExtent(PRInt32* aExtentCount)
 {
   NS_ENSURE_ARG_POINTER(aExtentCount);
   *aExtentCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetRowExtent(PRInt32 *aExtentCount)
+ARIAGridCellAccessible::GetRowExtent(PRInt32* aExtentCount)
 {
   NS_ENSURE_ARG_POINTER(aExtentCount);
   *aExtentCount = 0;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   *aExtentCount = 1;
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetColumnHeaderCells(nsIArray **aHeaderCells)
+ARIAGridCellAccessible::GetColumnHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
   *aHeaderCells = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
@@ -1054,17 +1055,17 @@ nsARIAGridCellAccessible::GetColumnHeade
     return NS_OK;
 
   return nsAccUtils::GetHeaderCellsFor(table, this,
                                        nsAccUtils::eColumnHeaderCells,
                                        aHeaderCells);
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::GetRowHeaderCells(nsIArray **aHeaderCells)
+ARIAGridCellAccessible::GetRowHeaderCells(nsIArray** aHeaderCells)
 {
   NS_ENSURE_ARG_POINTER(aHeaderCells);
   *aHeaderCells = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsCOMPtr<nsIAccessibleTable> table;
@@ -1073,17 +1074,17 @@ nsARIAGridCellAccessible::GetRowHeaderCe
     return NS_OK;
 
   return nsAccUtils::GetHeaderCellsFor(table, this,
                                        nsAccUtils::eRowHeaderCells,
                                        aHeaderCells);
 }
 
 NS_IMETHODIMP
-nsARIAGridCellAccessible::IsSelected(bool *aIsSelected)
+ARIAGridCellAccessible::IsSelected(bool* aIsSelected)
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = false;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible* row = Parent();
@@ -1096,17 +1097,17 @@ nsARIAGridCellAccessible::IsSelected(boo
   *aIsSelected = true;
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible
 
 void
-nsARIAGridCellAccessible::ApplyARIAState(PRUint64* aState)
+ARIAGridCellAccessible::ApplyARIAState(PRUint64* aState)
 {
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   // Return if the gridcell has aria-selected="true".
   if (*aState & states::SELECTED)
     return;
 
   // Check aria-selected="true" on the row.
@@ -1119,17 +1120,17 @@ nsARIAGridCellAccessible::ApplyARIAState
                                       nsGkAtoms::aria_selected) &&
       !rowContent->AttrValueIs(kNameSpaceID_None,
                                nsGkAtoms::aria_selected,
                                nsGkAtoms::_false, eCaseMatters))
     *aState |= states::SELECTABLE | states::SELECTED;
 }
 
 nsresult
-nsARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
+ARIAGridCellAccessible::GetAttributesInternal(nsIPersistentProperties* aAttributes)
 {
   if (IsDefunct())
     return NS_ERROR_FAILURE;
   
   nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose "table-cell-index" attribute.
rename from accessible/src/base/nsARIAGridAccessible.h
rename to accessible/src/generic/ARIAGridAccessible.h
--- a/accessible/src/base/nsARIAGridAccessible.h
+++ b/accessible/src/generic/ARIAGridAccessible.h
@@ -31,35 +31,38 @@
  * 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 ***** */
 
-#ifndef nsARIAGridAccessible_h_
-#define nsARIAGridAccessible_h_
+#ifndef MOZILLA_A11Y_ARIAGridAccessible_h_
+#define MOZILLA_A11Y_ARIAGridAccessible_h_
 
 #include "nsIAccessibleTable.h"
 
 #include "nsHyperTextAccessibleWrap.h"
 #include "TableAccessible.h"
 #include "xpcAccessibleTable.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
  * Accessible for ARIA grid and treegrid.
  */
-class nsARIAGridAccessible : public nsAccessibleWrap,
-                             public xpcAccessibleTable,
-                             public nsIAccessibleTable,
-                             public mozilla::a11y::TableAccessible
+class ARIAGridAccessible : public nsAccessibleWrap,
+                           public xpcAccessibleTable,
+                           public nsIAccessibleTable,
+                           public TableAccessible
 {
 public:
-  nsARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  ARIAGridAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTable
   NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
 
   // nsAccessible
@@ -111,26 +114,29 @@ protected:
   nsresult GetSelectedColumnsArray(PRUint32 *acolumnCount,
                                    PRInt32 **aColumns = nsnull);
 };
 
 
 /**
  * Accessible for ARIA gridcell and rowheader/columnheader.
  */
-class nsARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
-                                 public nsIAccessibleTableCell
+class ARIAGridCellAccessible : public nsHyperTextAccessibleWrap,
+                               public nsIAccessibleTableCell
 {
 public:
-  nsARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
+  ARIAGridCellAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // nsAccessible
   virtual void ApplyARIAState(PRUint64* aState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/generic/Makefile.in
+++ b/accessible/src/generic/Makefile.in
@@ -10,16 +10,17 @@ VPATH = @srcdir@
 include $(DEPTH)/config/autoconf.mk
 
 MODULE = accessibility
 LIBRARY_NAME = accessibility_generic_s
 LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
+  ARIAGridAccessible.cpp \
   OuterDocAccessible.cpp \
   $(NULL)
 
 # we don't want the shared lib, but we want to force the creation of a static lib.
 FORCE_STATIC_LIB = 1
 
 include $(topsrcdir)/config/rules.mk
 
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -401,35 +401,33 @@ nsHTMLTextFieldAccessible::GetNameIntern
     return NS_OK;
 
   // text inputs and textareas might have useful placeholder text
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::placeholder, aName);
 
   return NS_OK;
 }
 
-NS_IMETHODIMP nsHTMLTextFieldAccessible::GetValue(nsAString& _retval)
+void
+nsHTMLTextFieldAccessible::Value(nsString& aValue)
 {
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
+  aValue.Truncate();
   if (NativeState() & states::PROTECTED)    // Don't return password text!
-    return NS_ERROR_FAILURE;
+    return;
 
   nsCOMPtr<nsIDOMHTMLTextAreaElement> textArea(do_QueryInterface(mContent));
   if (textArea) {
-    return textArea->GetValue(_retval);
+    textArea->GetValue(aValue);
+    return;
   }
   
   nsCOMPtr<nsIDOMHTMLInputElement> inputElement(do_QueryInterface(mContent));
   if (inputElement) {
-    return inputElement->GetValue(_retval);
+    inputElement->GetValue(aValue);
   }
-
-  return NS_ERROR_FAILURE;
 }
 
 void
 nsHTMLTextFieldAccessible::ApplyARIAState(PRUint64* aState)
 {
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -129,24 +129,24 @@ class nsHTMLTextFieldAccessible : public
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& _retval); 
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsHyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual void ApplyARIAState(PRUint64* aState);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 State();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -101,30 +101,28 @@ nsHTMLLinkAccessible::NativeState()
   // it doesn't have any attributes. Check if 'click' event handler is
   // registered, otherwise bail out.
   if (nsCoreUtils::HasClickListener(mContent))
     states |= states::LINKED;
 
   return states;
 }
 
-NS_IMETHODIMP
-nsHTMLLinkAccessible::GetValue(nsAString& aValue)
+void
+nsHTMLLinkAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
-  nsresult rv = nsHyperTextAccessible::GetValue(aValue);
-  NS_ENSURE_SUCCESS(rv, rv);
-
+  nsHyperTextAccessible::Value(aValue);
   if (!aValue.IsEmpty())
-    return NS_OK;
+    return;
   
   nsIPresShell* presShell(mDoc->PresShell());
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
-  return presShell->GetLinkLocation(DOMNode, aValue);
+  presShell->GetLinkLocation(DOMNode, aValue);
 }
 
 PRUint8
 nsHTMLLinkAccessible::ActionCount()
 {
   return IsLinked() ? 1 : nsHyperTextAccessible::ActionCount();
 }
 
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -45,22 +45,21 @@
 class nsHTMLLinkAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
  
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // HyperLinkAccessible
   virtual bool IsLink();
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -582,21 +582,23 @@ nsHTMLComboboxAccessible::Description(ns
     return;
 
   // Otherwise use description of selected option.
   nsAccessible* option = SelectedOption();
   if (option)
     option->Description(aDescription);
 }
 
-NS_IMETHODIMP nsHTMLComboboxAccessible::GetValue(nsAString& aValue)
+void
+nsHTMLComboboxAccessible::Value(nsString& aValue)
 {
   // Use accessible name of selected option.
   nsAccessible* option = SelectedOption();
-  return option ? option->GetName(aValue) : NS_OK;
+  if (option)
+    option->GetName(aValue);
 }
 
 PRUint8
 nsHTMLComboboxAccessible::ActionCount()
 {
   return 1;
 }
 
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -182,25 +182,25 @@ class nsHTMLComboboxAccessible : public 
 {
 public:
   enum { eAction_Click = 0 };
 
   nsHTMLComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
   virtual ~nsHTMLComboboxAccessible() {}
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& _retval);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual void InvalidateChildren();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -438,18 +438,18 @@ nsHTMLTableAccessible::
   nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc), xpcAccessibleTable(this)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableAccessible: nsISupports implementation
 
-NS_IMPL_ISUPPORTS_INHERITED2(nsHTMLTableAccessible, nsAccessible,
-                             nsHTMLTableAccessible, nsIAccessibleTable)
+NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableAccessible, nsAccessible,
+                             nsIAccessibleTable)
 
 ////////////////////////////////////////////////////////////////////////////////
 //nsAccessNode
 
 void
 nsHTMLTableAccessible::Shutdown()
 {
   mTable = nsnull;
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -109,34 +109,25 @@ public:
  * HTML table accessible (html:table).
  */
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
 // This allow release trunk builds to be used by testers to refine the
 // data vs. layout heuristic
 // #define SHOW_LAYOUT_HEURISTIC
 
-#define NS_TABLEACCESSIBLE_IMPL_CID                     \
-{  /* 8d6d9c40-74bd-47ac-88dc-4a23516aa23d */           \
-  0x8d6d9c40,                                           \
-  0x74bd,                                               \
-  0x47ac,                                               \
-  { 0x88, 0xdc, 0x4a, 0x23, 0x51, 0x6a, 0xa2, 0x3d }    \
-}
-
 class nsHTMLTableAccessible : public nsAccessibleWrap,
                               public xpcAccessibleTable,
                               public nsIAccessibleTable,
                               public mozilla::a11y::TableAccessible
 {
 public:
   nsHTMLTableAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_TABLEACCESSIBLE_IMPL_CID)
 
   // nsIAccessible Table
   NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
 
   // TableAccessible
   virtual nsAccessible* Caption();
   virtual bool IsProbablyLayoutTable();
 
@@ -203,20 +194,16 @@ protected:
    */
   bool HasDescendant(const nsAString& aTagName, bool aAllowEmpty = true);
 
 #ifdef SHOW_LAYOUT_HEURISTIC
   nsString mLayoutHeuristic;
 #endif
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsHTMLTableAccessible,
-                              NS_TABLEACCESSIBLE_IMPL_CID)
-
-
 /**
  * HTML caption accessible (html:caption).
  */
 class nsHTMLCaptionAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLCaptionAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
     nsHyperTextAccessibleWrap(aContent, aDoc) { }
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -202,21 +202,17 @@ nsIntRect nsHyperTextAccessible::GetBoun
   nsIFrame *frame;
   PRInt32 startContentOffsetInFrame;
   // Get the right frame continuation -- not really a child, but a sibling of
   // the primary frame passed in
   rv = aFrame->GetChildFrameContainingOffset(startContentOffset, false,
                                              &startContentOffsetInFrame, &frame);
   NS_ENSURE_SUCCESS(rv, screenRect);
 
-  NS_ENSURE_TRUE(mDoc, screenRect);
-  nsIPresShell* shell = mDoc->PresShell();
-  NS_ENSURE_TRUE(shell, screenRect);
-
-  nsPresContext *context = shell->GetPresContext();
+  nsPresContext* context = mDoc->PresContext();
 
   while (frame && startContentOffset < endContentOffset) {
     // Start with this frame's screen rect, which we will 
     // shrink based on the substring we care about within it.
     // We will then add that frame to the total screenRect we
     // are returning.
     nsIntRect frameScreenRect = frame->GetScreenRectExternal();
 
@@ -1289,23 +1285,20 @@ NS_IMETHODIMP nsHyperTextAccessible::Get
  * Gets the offset of the character located at coordinates x and y. x and y are interpreted as being relative to
  * the screen or this widget's window depending on coords.
  */
 NS_IMETHODIMP
 nsHyperTextAccessible::GetOffsetAtPoint(PRInt32 aX, PRInt32 aY,
                                         PRUint32 aCoordType, PRInt32 *aOffset)
 {
   *aOffset = -1;
-  if (!mDoc)
+
+  if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  nsIPresShell* shell = mDoc->PresShell();
-  if (!shell) {
-    return NS_ERROR_FAILURE;
-  }
   nsIFrame *hyperFrame = GetFrame();
   if (!hyperFrame) {
     return NS_ERROR_FAILURE;
   }
   nsIntRect frameScreenRect = hyperFrame->GetScreenRectExternal();
 
   nsIntPoint coords;
   nsresult rv = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordType,
@@ -1314,18 +1307,17 @@ nsHyperTextAccessible::GetOffsetAtPoint(
 
   // coords are currently screen coordinates, and we need to turn them into
   // frame coordinates relative to the current accessible
   if (!frameScreenRect.Contains(coords.x, coords.y)) {
     return NS_OK;   // Not found, will return -1
   }
   nsIntPoint pxInHyperText(coords.x - frameScreenRect.x,
                            coords.y - frameScreenRect.y);
-  nsPresContext *context = GetPresContext();
-  NS_ENSURE_TRUE(context, NS_ERROR_FAILURE);
+  nsPresContext* context = mDoc->PresContext();
   nsPoint pointInHyperText(context->DevPixelsToAppUnits(pxInHyperText.x),
                            context->DevPixelsToAppUnits(pxInHyperText.y));
 
   // Go through the frames to check if each one has the point.
   // When one does, add up the character offsets until we have a match
 
   // We have an point in an accessible child of this, now we need to add up the
   // offsets before it to what we already have
rename from accessible/src/mac/nsARIAGridAccessibleWrap.h
rename to accessible/src/mac/ARIAGridAccessibleWrap.h
--- a/accessible/src/mac/nsARIAGridAccessibleWrap.h
+++ b/accessible/src/mac/ARIAGridAccessibleWrap.h
@@ -33,18 +33,23 @@
  * 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 ***** */
 
-#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
-#define _NSARIAGRIDACCESSIBLEWRAP_H
+#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+
+#include "ARIAGridAccessible.h"
 
-#include "nsARIAGridAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
-typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
+typedef class ARIAGridAccessible ARIAGridAccessibleWrap;
+typedef class ARIAGridCellAccessible ARIAGridCellAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
-
--- a/accessible/src/mac/Makefile.in
+++ b/accessible/src/mac/Makefile.in
@@ -57,20 +57,20 @@ CMMSRCS = nsAccessNodeWrap.mm \
           mozActionElements.mm \
           mozTextAccessible.mm \
           mozHTMLAccessible.mm \
           MacUtils.mm \
           $(NULL)
 
 
 EXPORTS = \
+  ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
   nsTextAccessibleWrap.h \
   nsAccessibleWrap.h \
-  nsARIAGridAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
--- a/accessible/src/mac/mozHTMLAccessible.mm
+++ b/accessible/src/mac/mozHTMLAccessible.mm
@@ -111,22 +111,21 @@
   if ([action isEqualToString:NSAccessibilityPressAction])
     mGeckoAccessible->DoAction(0);
   else
     [super accessibilityPerformAction:action];
 }
 
 - (NSURL*)url
 {
-  if (!mGeckoAccessible)
+  if (!mGeckoAccessible || mGeckoAccessible->IsDefunct())
     return nil;
 
   nsAutoString value;
-  nsresult rv = mGeckoAccessible->GetValue(value);
-  NS_ENSURE_SUCCESS(rv, nil);
+  mGeckoAccessible->Value(value);
 
   NSString* urlString = value.IsEmpty() ? nil : nsCocoaUtils::ToNSString(value);
   if (!urlString)
     return nil;
 
   return [NSURL URLWithString:urlString];
 }
 
rename from accessible/src/msaa/nsARIAGridAccessibleWrap.cpp
rename to accessible/src/msaa/ARIAGridAccessibleWrap.cpp
--- a/accessible/src/msaa/nsARIAGridAccessibleWrap.cpp
+++ b/accessible/src/msaa/ARIAGridAccessibleWrap.cpp
@@ -33,32 +33,36 @@
  * 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 ***** */
 
-#include "nsARIAGridAccessibleWrap.h"
+#include "ARIAGridAccessibleWrap.h"
+
+using namespace mozilla;
+using namespace mozilla::a11y;
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsARIAGridAccessibleWrap
+// ARIAGridAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridAccessibleWrap,
-                             nsARIAGridAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridAccessibleWrap,
+                             ARIAGridAccessible)
 
-IMPL_IUNKNOWN_INHERITED1(nsARIAGridAccessibleWrap,
+IMPL_IUNKNOWN_INHERITED1(ARIAGridAccessibleWrap,
                          nsAccessibleWrap,
                          CAccessibleTable)
 
 
 ////////////////////////////////////////////////////////////////////////////////
-// nsARIAGridCellAccessibleWrap
+// ARIAGridCellAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
-NS_IMPL_ISUPPORTS_INHERITED0(nsARIAGridCellAccessibleWrap,
-                             nsARIAGridCellAccessible)
+NS_IMPL_ISUPPORTS_INHERITED0(ARIAGridCellAccessibleWrap,
+                             ARIAGridCellAccessible)
 
-IMPL_IUNKNOWN_INHERITED1(nsARIAGridCellAccessibleWrap,
+IMPL_IUNKNOWN_INHERITED1(ARIAGridCellAccessibleWrap,
                          nsHyperTextAccessibleWrap,
                          CAccessibleTableCell)
+
rename from accessible/src/msaa/nsARIAGridAccessibleWrap.h
rename to accessible/src/msaa/ARIAGridAccessibleWrap.h
--- a/accessible/src/msaa/nsARIAGridAccessibleWrap.h
+++ b/accessible/src/msaa/ARIAGridAccessibleWrap.h
@@ -33,52 +33,58 @@
  * 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 ***** */
 
-#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
-#define _NSARIAGRIDACCESSIBLEWRAP_H
+#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
 
-#include "nsARIAGridAccessible.h"
+#include "ARIAGridAccessible.h"
 #include "CAccessibleTable.h"
 #include "CAccessibleTableCell.h"
 
+namespace mozilla {
+namespace a11y {
+
 /**
- * IA2 wrapper class for nsARIAGridAccessible implementing IAccessibleTable and
+ * IA2 wrapper class for ARIAGridAccessible implementing IAccessibleTable and
  * IAccessibleTable2 interfaces.
  */
-class nsARIAGridAccessibleWrap : public nsARIAGridAccessible,
-                                 public CAccessibleTable
+class ARIAGridAccessibleWrap : public ARIAGridAccessible,
+                               public CAccessibleTable
 {
 public:
-  nsARIAGridAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
-    nsARIAGridAccessible(aContent, aDoc) {}
+  ARIAGridAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
+    ARIAGridAccessible(aContent, aDoc) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 };
 
 /**
- * IA2 wrapper class for nsARIAGridCellAccessible implementing
+ * IA2 wrapper class for ARIAGridCellAccessible implementing
  * IAccessibleTableCell interface.
  */
-class nsARIAGridCellAccessibleWrap : public nsARIAGridCellAccessible,
-                                     public CAccessibleTableCell
+class ARIAGridCellAccessibleWrap : public ARIAGridCellAccessible,
+                                   public CAccessibleTableCell
 {
 public:
-  nsARIAGridCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
-    nsARIAGridCellAccessible(aContent, aDoc) {}
+  ARIAGridCellAccessibleWrap(nsIContent* aContent, nsDocAccessible* aDoc) :
+    ARIAGridCellAccessible(aContent, aDoc) {}
 
   // IUnknown
   DECL_IUNKNOWN_INHERITED
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 };
 
+} // namespace a11y
+} // namespace mozilla
+
 #endif
--- a/accessible/src/msaa/CAccessibleComponent.cpp
+++ b/accessible/src/msaa/CAccessibleComponent.cpp
@@ -75,18 +75,18 @@ CAccessibleComponent::QueryInterface(REF
 STDMETHODIMP
 CAccessibleComponent::get_locationInParent(long *aX, long *aY)
 {
 __try {
   *aX = 0;
   *aY = 0;
 
   nsRefPtr<nsAccessible> acc(do_QueryObject(this));
-  if (!acc)
-    return E_FAIL;
+  if (acc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   // If the object is not on any screen the returned position is (0,0).
   PRUint64 state = acc->State();
   if (state & states::INVISIBLE)
     return S_OK;
 
   PRInt32 x = 0, y = 0, width = 0, height = 0;
   nsresult rv = acc->GetBounds(&x, &y, &width, &height);
@@ -123,17 +123,17 @@ CAccessibleComponent::get_locationInPare
 }
 
 STDMETHODIMP
 CAccessibleComponent::get_foreground(IA2Color* aForeground)
 {
 __try {
   nsRefPtr<nsAccessible> acc(do_QueryObject(this));
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = acc->GetFrame();
   if (frame)
     *aForeground = frame->GetStyleColor()->mColor;
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@@ -142,17 +142,17 @@ CAccessibleComponent::get_foreground(IA2
 }
 
 STDMETHODIMP
 CAccessibleComponent::get_background(IA2Color* aBackground)
 {
 __try {
   nsRefPtr<nsAccessible> acc(do_QueryObject(this));
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = acc->GetFrame();
   if (frame)
     *aBackground = frame->GetStyleBackground()->mBackgroundColor;
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
--- a/accessible/src/msaa/CAccessibleEditableText.cpp
+++ b/accessible/src/msaa/CAccessibleEditableText.cpp
@@ -35,30 +35,22 @@
  * and other provisions required by the GPL or the LGPL. If you do not delete
  * the provisions above, a recipient may use your version of this file under
  * the terms of any one of the MPL, the GPL or the LGPL.
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "CAccessibleEditableText.h"
 
-#include "nsIAccessibleEditableText.h"
 #include "AccessibleEditableText_i.c"
-#include "nsAccessNodeWrap.h"
+#include "nsHyperTextAccessible.h"
 
 #include "nsCOMPtr.h"
 #include "nsString.h"
 
-#define GET_NSIACCESSIBLEEDITABLETEXT \
-nsCOMPtr<nsIAccessibleEditableText> textAcc(do_QueryObject(this));\
-NS_ASSERTION(textAcc,\
-             "Subclass of CAccessibleEditableText doesn't implement nsIAccessibleEditableText");\
-if (!textAcc)\
-  return E_FAIL;\
-
 // IUnknown
 
 STDMETHODIMP
 CAccessibleEditableText::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
 
   if (IID_IAccessibleEditableText == iid) {
@@ -74,86 +66,98 @@ CAccessibleEditableText::QueryInterface(
 }
 
 // IAccessibleEditableText
 
 STDMETHODIMP
 CAccessibleEditableText::copyText(long aStartOffset, long aEndOffset)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->CopyText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::deleteText(long aStartOffset, long aEndOffset)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::insertText(long aOffset, BSTR *aText)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint32 length = ::SysStringLen(*aText);
   nsAutoString text(*aText, length);
 
   nsresult rv = textAcc->InsertText(text, aOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::cutText(long aStartOffset, long aEndOffset)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->CutText(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::pasteText(long aOffset)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->PasteText(aOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleEditableText::replaceText(long aStartOffset, long aEndOffset,
                                      BSTR *aText)
 {
 __try {
-  GET_NSIACCESSIBLEEDITABLETEXT
+  nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->DeleteText(aStartOffset, aEndOffset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   PRUint32 length = ::SysStringLen(*aText);
   nsAutoString text(*aText, length);
 
--- a/accessible/src/msaa/CAccessibleHyperlink.cpp
+++ b/accessible/src/msaa/CAccessibleHyperlink.cpp
@@ -39,17 +39,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "CAccessibleHyperlink.h"
 
 #include "Accessible2.h"
 #include "AccessibleHyperlink.h"
 #include "AccessibleHyperlink_i.c"
 
-#include "nsAccessible.h"
+#include "nsAccessibleWrap.h"
 #include "nsIWinAccessNode.h"
 
 // IUnknown
 
 STDMETHODIMP
 CAccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
 {
   *ppv = NULL;
@@ -71,57 +71,60 @@ CAccessibleHyperlink::QueryInterface(REF
 
 STDMETHODIMP
 CAccessibleHyperlink::get_anchor(long aIndex, VARIANT *aAnchor)
 {
 __try {
   VariantInit(aAnchor);
 
   nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
-  if (thisObj->IsDefunct() || !thisObj->IsLink())
-    return E_FAIL;
+  if (thisObj->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
     return E_INVALIDARG;
 
-  nsAccessible* anchor = thisObj->AnchorAt(aIndex);
+  if (!thisObj->IsLink())
+    return S_FALSE;
+
+  nsAccessibleWrap* anchor =
+    static_cast<nsAccessibleWrap*>(thisObj->AnchorAt(aIndex));
   if (!anchor)
     return S_FALSE;
 
-  nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(anchor));
-  if (!winAccessNode)
-    return E_FAIL;
+  void* instancePtr = NULL;
+  HRESULT result = anchor->QueryInterface(IID_IUnknown, &instancePtr);
+  if (FAILED(result))
+    return result;
 
-  void *instancePtr = NULL;
-  nsresult rv = winAccessNode->QueryNativeInterface(IID_IUnknown, &instancePtr);
-  if (NS_FAILED(rv))
-    return E_FAIL;
-
-  IUnknown *unknownPtr = static_cast<IUnknown*>(instancePtr);
+  IUnknown* unknownPtr = static_cast<IUnknown*>(instancePtr);
   aAnchor->ppunkVal = &unknownPtr;
   aAnchor->vt = VT_UNKNOWN;
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleHyperlink::get_anchorTarget(long aIndex, VARIANT *aAnchorTarget)
 {
 __try {
   VariantInit(aAnchorTarget);
 
   nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
-  if (thisObj->IsDefunct() || !thisObj->IsLink())
-    return E_FAIL;
+  if (thisObj->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   if (aIndex < 0 || aIndex >= static_cast<long>(thisObj->AnchorCount()))
     return E_INVALIDARG;
 
+  if (!thisObj->IsLink())
+    return S_FALSE;
+
   nsCOMPtr<nsIURI> uri = thisObj->AnchorURIAt(aIndex);
   if (!uri)
     return S_FALSE;
 
   nsCAutoString prePath;
   nsresult rv = uri->GetPrePath(prePath);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
@@ -146,52 +149,61 @@ CAccessibleHyperlink::get_anchorTarget(l
 
 STDMETHODIMP
 CAccessibleHyperlink::get_startIndex(long *aIndex)
 {
 __try {
   *aIndex = 0;
 
   nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
-  if (thisObj->IsDefunct() || !thisObj->IsLink())
-    return E_FAIL;
+  if (thisObj->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  if (!thisObj->IsLink())
+    return S_FALSE;
 
   *aIndex = thisObj->StartOffset();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleHyperlink::get_endIndex(long *aIndex)
 {
 __try {
   *aIndex = 0;
 
   nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
-  if (thisObj->IsDefunct() || !thisObj->IsLink())
-    return E_FAIL;
+  if (thisObj->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  if (!thisObj->IsLink())
+    return S_FALSE;
 
   *aIndex = thisObj->EndOffset();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleHyperlink::get_valid(boolean *aValid)
 {
 __try {
   *aValid = false;
 
   nsRefPtr<nsAccessible> thisObj = do_QueryObject(this);
-  if (thisObj->IsDefunct() || !thisObj->IsLink())
-    return E_FAIL;
+  if (thisObj->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  if (!thisObj->IsLink())
+    return S_FALSE;
 
   *aValid = thisObj->IsLinkValid();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
--- a/accessible/src/msaa/CAccessibleHypertext.cpp
+++ b/accessible/src/msaa/CAccessibleHypertext.cpp
@@ -67,36 +67,36 @@ CAccessibleHypertext::QueryInterface(REF
 
 STDMETHODIMP
 CAccessibleHypertext::get_nHyperlinks(long *aHyperlinkCount)
 {
 __try {
   *aHyperlinkCount = 0;
 
   nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
-  if (!hyperText)
-    return E_FAIL;
+  if (hyperText->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkCount = hyperText->GetLinkCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleHypertext::get_hyperlink(long aLinkIndex,
                                     IAccessibleHyperlink **aHyperlink)
 {
 __try {
   *aHyperlink = NULL;
 
   nsRefPtr<nsHyperTextAccessible> hyperText = do_QueryObject(this);
-  if (!hyperText)
-    return E_FAIL;
+  if (hyperText->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsAccessible* hyperLink = hyperText->GetLinkAt(aLinkIndex);
   nsCOMPtr<nsIWinAccessNode> winAccessNode(do_QueryObject(hyperLink));
   if (!winAccessNode)
     return E_FAIL;
 
   void *instancePtr = NULL;
   nsresult rv =  winAccessNode->QueryNativeInterface(IID_IAccessibleHyperlink,
@@ -113,18 +113,18 @@ CAccessibleHypertext::get_hyperlink(long
 
 STDMETHODIMP
 CAccessibleHypertext::get_hyperlinkIndex(long aCharIndex, long *aHyperlinkIndex)
 {
 __try {
   *aHyperlinkIndex = 0;
 
   nsRefPtr<nsHyperTextAccessible> hyperAcc(do_QueryObject(this));
-  if (!hyperAcc)
-    return E_FAIL;
+  if (hyperAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   *aHyperlinkIndex = hyperAcc->GetLinkIndexAtOffset(aCharIndex);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
--- a/accessible/src/msaa/CAccessibleText.cpp
+++ b/accessible/src/msaa/CAccessibleText.cpp
@@ -69,16 +69,19 @@ CAccessibleText::QueryInterface(REFIID i
 
 // IAccessibleText
 
 STDMETHODIMP
 CAccessibleText::addSelection(long aStartOffset, long aEndOffset)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsresult rv = textAcc->AddSelection(aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
@@ -89,16 +92,18 @@ CAccessibleText::get_attributes(long aOf
   if (!aStartOffset || !aEndOffset || !aTextAttributes)
     return E_INVALIDARG;
 
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aTextAttributes = NULL;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRInt32 startOffset = 0, endOffset = 0;
   nsCOMPtr<nsIPersistentProperties> attributes;
   nsresult rv = textAcc->GetTextAttributes(true, aOffset,
                                            &startOffset, &endOffset,
                                            getter_AddRefs(attributes));
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
@@ -119,16 +124,18 @@ CAccessibleText::get_attributes(long aOf
 
 STDMETHODIMP
 CAccessibleText::get_caretOffset(long *aOffset)
 {
 __try {
   *aOffset = -1;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRInt32 offset = 0;
   nsresult rv = textAcc->GetCaretOffset(&offset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   *aOffset = offset;
   return offset != -1 ? S_OK : S_FALSE;
@@ -145,16 +152,18 @@ CAccessibleText::get_characterExtents(lo
 {
 __try {
   *aX = 0;
   *aY = 0;
   *aWidth = 0;
   *aHeight = 0;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   PRInt32 x = 0, y =0, width = 0, height = 0;
   nsresult rv = textAcc->GetCharacterExtents (aOffset, &x, &y, &width, &height,
                                               geckoCoordType);
@@ -174,17 +183,17 @@ CAccessibleText::get_characterExtents(lo
 STDMETHODIMP
 CAccessibleText::get_nSelections(long *aNSelections)
 {
 __try {
   *aNSelections = 0;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   PRInt32 selCount = 0;
   nsresult rv = textAcc->GetSelectionCount(&selCount);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   *aNSelections = selCount;
   return S_OK;
@@ -197,16 +206,18 @@ STDMETHODIMP
 CAccessibleText::get_offsetAtPoint(long aX, long aY,
                                    enum IA2CoordinateType aCoordType,
                                    long *aOffset)
 {
 __try {
   *aOffset = 0;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   PRInt32 offset = 0;
   nsresult rv = textAcc->GetOffsetAtPoint(aX, aY, geckoCoordType, &offset);
   if (NS_FAILED(rv))
@@ -223,16 +234,18 @@ STDMETHODIMP
 CAccessibleText::get_selection(long aSelectionIndex, long *aStartOffset,
                                long *aEndOffset)
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRInt32 startOffset = 0, endOffset = 0;
   nsresult rv = textAcc->GetSelectionBounds(aSelectionIndex,
                                             &startOffset, &endOffset);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   *aStartOffset = startOffset;
@@ -245,16 +258,18 @@ CAccessibleText::get_selection(long aSel
 
 STDMETHODIMP
 CAccessibleText::get_text(long aStartOffset, long aEndOffset, BSTR *aText)
 {
 __try {
   *aText = NULL;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsAutoString text;
   nsresult rv = textAcc->GetText(aStartOffset, aEndOffset, text);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (text.IsEmpty())
     return S_FALSE;
@@ -274,17 +289,17 @@ CAccessibleText::get_textBeforeOffset(lo
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
     startOffset = 0;
     endOffset = textAcc->CharacterCount();
@@ -321,17 +336,17 @@ CAccessibleText::get_textAfterOffset(lon
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
     startOffset = 0;
     endOffset = textAcc->CharacterCount();
@@ -368,17 +383,17 @@ CAccessibleText::get_textAtOffset(long a
 {
 __try {
   *aStartOffset = 0;
   *aEndOffset = 0;
   *aText = NULL;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = NS_OK;
   nsAutoString text;
   PRInt32 startOffset = 0, endOffset = 0;
 
   if (aBoundaryType == IA2_TEXT_BOUNDARY_ALL) {
     startOffset = 0;
     endOffset = textAcc->CharacterCount();
@@ -407,43 +422,49 @@ CAccessibleText::get_textAtOffset(long a
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::removeSelection(long aSelectionIndex)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->RemoveSelection(aSelectionIndex);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::setCaretOffset(long aOffset)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->SetCaretOffset(aOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::setSelection(long aSelectionIndex, long aStartOffset,
                               long aEndOffset)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->SetSelectionBounds(aSelectionIndex,
                                             aStartOffset, aEndOffset);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
@@ -451,46 +472,50 @@ CAccessibleText::setSelection(long aSele
 STDMETHODIMP
 CAccessibleText::get_nCharacters(long *aNCharacters)
 {
 __try {
   *aNCharacters = 0;
 
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
   if (textAcc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   *aNCharacters  = textAcc->CharacterCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::scrollSubstringTo(long aStartIndex, long aEndIndex,
                                    enum IA2ScrollType aScrollType)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsresult rv = textAcc->ScrollSubstringTo(aStartIndex, aEndIndex, aScrollType);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 CAccessibleText::scrollSubstringToPoint(long aStartIndex, long aEndIndex,
                                         enum IA2CoordinateType aCoordType,
                                         long aX, long aY)
 {
 __try {
   nsRefPtr<nsHyperTextAccessible> textAcc(do_QueryObject(this));
+  if (textAcc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   nsresult rv = textAcc->ScrollSubstringToPoint(aStartIndex, aEndIndex,
                                                 geckoCoordType, aX, aY);
   return GetHRESULT(rv);
--- a/accessible/src/msaa/Makefile.in
+++ b/accessible/src/msaa/Makefile.in
@@ -48,17 +48,17 @@ LIBXUL_LIBRARY = 1
 
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsTextAccessibleWrap.cpp \
   nsDocAccessibleWrap.cpp \
   nsHTMLWin32ObjectAccessible.cpp \
-  nsARIAGridAccessibleWrap.cpp \
+  ARIAGridAccessibleWrap.cpp \
   nsRootAccessibleWrap.cpp \
   nsXULMenuAccessibleWrap.cpp \
   nsXULListboxAccessibleWrap.cpp \
   nsXULTreeGridAccessibleWrap.cpp \
   nsHyperTextAccessibleWrap.cpp \
   nsHTMLImageAccessibleWrap.cpp \
   nsHTMLTableAccessibleWrap.cpp \
   nsApplicationAccessibleWrap.cpp \
@@ -73,23 +73,23 @@ CPPSRCS = \
   ia2AccessibleRelation.cpp \
   CAccessibleTable.cpp \
   CAccessibleTableCell.cpp \
   CAccessibleValue.cpp \
   Compatibility.cpp \
   $(NULL)
 
 EXPORTS = \
+  ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
   nsAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
   nsHTMLWin32ObjectAccessible.h \
-  nsARIAGridAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
   nsHTMLImageAccessibleWrap.h \
   nsHTMLTableAccessibleWrap.h \
   nsApplicationAccessibleWrap.h \
   ia2AccessibleAction.h \
--- a/accessible/src/msaa/ia2AccessibleAction.cpp
+++ b/accessible/src/msaa/ia2AccessibleAction.cpp
@@ -68,32 +68,32 @@ ia2AccessibleAction::nActions(long* aAct
 __try {
   if (!aActionCount)
     return E_INVALIDARG;
 
   *aActionCount = 0;
 
   nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   *aActionCount = acc->ActionCount();
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 ia2AccessibleAction::doAction(long aActionIndex)
 {
 __try {
   nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint8 index = static_cast<PRUint8>(aActionIndex);
   nsresult rv = acc->DoAction(index);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
@@ -101,17 +101,17 @@ ia2AccessibleAction::doAction(long aActi
 STDMETHODIMP
 ia2AccessibleAction::get_description(long aActionIndex, BSTR *aDescription)
 {
 __try {
   *aDescription = NULL;
 
   nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsAutoString description;
   PRUint8 index = static_cast<PRUint8>(aActionIndex);
   nsresult rv = acc->GetActionDescription(index, description);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (description.IsEmpty())
@@ -139,17 +139,17 @@ ia2AccessibleAction::get_keyBinding(long
     return E_INVALIDARG;
   *aNumBinding = 0;
 
   if (aActionIndex != 0 || aNumMaxBinding < 1)
     return E_INVALIDARG;
 
   nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   // Expose keyboard shortcut if it's not exposed via MSAA keyboard shortcut.
   KeyBinding keyBinding = acc->AccessKey();
   if (keyBinding.IsEmpty())
     return S_FALSE;
 
   keyBinding = acc->KeyboardShortcut();
   if (keyBinding.IsEmpty())
@@ -178,17 +178,17 @@ ia2AccessibleAction::get_keyBinding(long
 STDMETHODIMP
 ia2AccessibleAction::get_name(long aActionIndex, BSTR *aName)
 {
 __try {
   *aName = NULL;
 
   nsAccessibleWrap* acc = static_cast<nsAccessibleWrap*>(this);
   if (acc->IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsAutoString name;
   PRUint8 index = static_cast<PRUint8>(aActionIndex);
   nsresult rv = acc->GetActionName(index, name);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (name.IsEmpty())
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -392,17 +392,17 @@ STDMETHODIMP nsAccessNodeWrap::get_compu
 
 STDMETHODIMP nsAccessNodeWrap::scrollTo(/* [in] */ boolean aScrollTopLeft)
 {
 __try {
   PRUint32 scrollType =
     aScrollTopLeft ? nsIAccessibleScrollType::SCROLL_TYPE_TOP_LEFT :
                      nsIAccessibleScrollType::SCROLL_TYPE_BOTTOM_RIGHT;
 
-  ScrollTo(scrollType);
+  nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, scrollType);
   return S_OK;
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return E_FAIL;
 }
 
 ISimpleDOMNode*
 nsAccessNodeWrap::MakeAccessNode(nsINode *aNode)
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -163,19 +163,19 @@ STDMETHODIMP nsAccessibleWrap::QueryInte
 //-----------------------------------------------------
 
 STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
 {
 __try {
   *ppdispParent = NULL;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
-  nsRefPtr<nsDocAccessible> doc(do_QueryObject(this));
+  nsDocAccessible* doc = AsDoc();
   if (doc) {
     // Return window system accessible object for root document and tab document
     // accessibles.
     if (!doc->ParentDocument() ||
         nsWinUtils::IsWindowEmulationStarted() &&
         nsCoreUtils::IsTabDocument(doc->GetDocumentNode())) {
       HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
       if (hwnd && SUCCEEDED(::AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
@@ -205,17 +205,17 @@ STDMETHODIMP nsAccessibleWrap::get_accCh
 {
 __try {
   if (!pcountChildren)
     return E_INVALIDARG;
 
   *pcountChildren = 0;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   if (nsAccUtils::MustPrune(this))
     return S_OK;
 
   *pcountChildren = GetChildCount();
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return S_OK;
@@ -223,41 +223,54 @@ STDMETHODIMP nsAccessibleWrap::get_accCh
 
 STDMETHODIMP nsAccessibleWrap::get_accChild(
       /* [in] */ VARIANT varChild,
       /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
 {
 __try {
   *ppdispChild = NULL;
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   // IAccessible::accChild is used to return this accessible or child accessible
   // at the given index or to get an accessible by child ID in the case of
   // document accessible (it's handled by overriden GetXPAccessibleFor method
   // on the document accessible). The getting an accessible by child ID is used
   // by AccessibleObjectFromEvent() called by AT when AT handles our MSAA event.
   nsAccessible* child = GetXPAccessibleFor(varChild);
-  if (child)
-    *ppdispChild = NativeAccessible(child);
+  if (!child)
+    return E_INVALIDARG;
+
+  if (child->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  *ppdispChild = NativeAccessible(child);
 
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
-  return (*ppdispChild)? S_OK: E_INVALIDARG;
+  return S_OK;
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accName(
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ BSTR __RPC_FAR *pszName)
 {
 __try {
   *pszName = NULL;
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
+
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
-    return E_FAIL;
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString name;
   nsresult rv = xpAccessible->GetName(name);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   // The name was not provided, e.g. no alt attribute for an image. A screen
   // reader may choose to invent its own accessible name, e.g. from an image src
   // attribute. Refer to NS_OK_EMPTY_NAME return value.
@@ -276,23 +289,31 @@ STDMETHODIMP nsAccessibleWrap::get_accNa
 
 STDMETHODIMP nsAccessibleWrap::get_accValue(
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ BSTR __RPC_FAR *pszValue)
 {
 __try {
   *pszValue = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
-  if (!xpAccessible || xpAccessible->IsDefunct())
-    return E_FAIL;
+  if (!xpAccessible)
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  if (xpAccessible->NativeRole() == roles::PASSWORD_TEXT)
+    return E_ACCESSDENIED;
 
   nsAutoString value;
-  if (NS_FAILED(xpAccessible->GetValue(value)))
-    return E_FAIL;
+  xpAccessible->Value(value);
 
   // See bug 438784: need to expose URL on doc's value attribute. For this,
   // reverting part of fix for bug 425693 to make this MSAA method behave
   // IAccessible2-style.
   if (value.IsEmpty())
     return S_FALSE;
 
   *pszValue = ::SysAllocStringLen(value.get(), value.Length());
@@ -305,19 +326,25 @@ STDMETHODIMP nsAccessibleWrap::get_accVa
 
 STDMETHODIMP
 nsAccessibleWrap::get_accDescription(VARIANT varChild,
                                      BSTR __RPC_FAR *pszDescription)
 {
 __try {
   *pszDescription = NULL;
 
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
-  if (!xpAccessible || xpAccessible->IsDefunct())
-    return E_FAIL;
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
+  if (!xpAccessible)
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   nsAutoString description;
   xpAccessible->Description(description);
 
   *pszDescription = ::SysAllocStringLen(description.get(),
                                         description.Length());
   return *pszDescription ? S_OK : E_OUTOFMEMORY;
 
@@ -328,21 +355,24 @@ nsAccessibleWrap::get_accDescription(VAR
 STDMETHODIMP nsAccessibleWrap::get_accRole(
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ VARIANT __RPC_FAR *pvarRole)
 {
 __try {
   VariantInit(pvarRole);
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
-    return E_FAIL;
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
 
   roles::Role role = xpAccessible->Role();
   PRUint32 msaaRole = gWindowsRoleMap[role].msaaRole;
@@ -405,19 +435,25 @@ STDMETHODIMP nsAccessibleWrap::get_accSt
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ VARIANT __RPC_FAR *pvarState)
 {
 __try {
   VariantInit(pvarState);
   pvarState->vt = VT_I4;
   pvarState->lVal = 0;
 
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
-    return E_FAIL;
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   // MSAA only has 31 states and the lowest 31 bits of our state bit mask
   // are the same states as MSAA.
   // Note: we map the following Gecko states to different MSAA states:
   //   REQUIRED -> ALERT_LOW
   //   ALERT -> ALERT_MEDIUM
   //   INVALID -> ALERT_HIGH
   //   CHECKABLE -> MARQUEED
@@ -462,19 +498,25 @@ STDMETHODIMP nsAccessibleWrap::get_accKe
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ BSTR __RPC_FAR *pszKeyboardShortcut)
 {
 __try {
   if (!pszKeyboardShortcut)
     return E_INVALIDARG;
   *pszKeyboardShortcut = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAccessible* acc = GetXPAccessibleFor(varChild);
-  if (!acc || acc->IsDefunct())
-    return E_FAIL;
+  if (!acc)
+    return E_INVALIDARG;
+
+  if (acc->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   KeyBinding keyBinding = acc->AccessKey();
   if (keyBinding.IsEmpty())
     keyBinding = acc->KeyboardShortcut();
 
   nsAutoString shortcut;
   keyBinding.ToString(shortcut);
 
@@ -491,17 +533,17 @@ STDMETHODIMP nsAccessibleWrap::get_accFo
   // VT_EMPTY:    None. This object does not have the keyboard focus itself
   //              and does not contain a child that has the keyboard focus.
   // VT_I4:       lVal is CHILDID_SELF. The object itself has the keyboard focus.
   // VT_I4:       lVal contains the child ID of the child element with the keyboard focus.
   // VT_DISPATCH: pdispVal member is the address of the IDispatch interface
   //              for the child object with the keyboard focus.
 __try {
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   VariantInit(pvarChild);
 
   // Return the current IAccessible child that has focus
   nsAccessible* focusedAccessible = FocusedChild();
   if (focusedAccessible == this) {
     pvarChild->vt = VT_I4;
     pvarChild->lVal = CHILDID_SELF;
@@ -665,16 +707,19 @@ AccessibleEnumerator::Skip(unsigned long
   *  - the object is not the type that can have children selected
   */
 STDMETHODIMP nsAccessibleWrap::get_accSelection(VARIANT __RPC_FAR *pvarChildren)
 {
 __try {
   VariantInit(pvarChildren);
   pvarChildren->vt = VT_EMPTY;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   if (IsSelect()) {
     nsCOMPtr<nsIArray> selectedItems = SelectedItems();
     if (selectedItems) {
       // 1) Create and initialize the enumeration
       nsRefPtr<AccessibleEnumerator> pEnum =
         new AccessibleEnumerator(selectedItems);
 
       // 2) Put the enumerator in the VARIANT
@@ -689,39 +734,54 @@ STDMETHODIMP nsAccessibleWrap::get_accSe
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accDefaultAction(
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ BSTR __RPC_FAR *pszDefaultAction)
 {
 __try {
   *pszDefaultAction = NULL;
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
-  if (xpAccessible) {
-    nsAutoString defaultAction;
-    if (NS_FAILED(xpAccessible->GetActionName(0, defaultAction)))
-      return E_FAIL;
+
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
+  if (!xpAccessible)
+    return E_INVALIDARG;
 
-    *pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
-                                            defaultAction.Length());
-    return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
-  }
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAutoString defaultAction;
+  if (NS_FAILED(xpAccessible->GetActionName(0, defaultAction)))
+    return E_FAIL;
+
+  *pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
+                                          defaultAction.Length());
+  return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
 
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP nsAccessibleWrap::accSelect(
       /* [in] */ long flagsSelect,
       /* [optional][in] */ VARIANT varChild)
 {
 __try {
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   // currently only handle focus and selection
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
-  NS_ENSURE_TRUE(xpAccessible, E_FAIL);
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
+  if (!xpAccessible)
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   if (flagsSelect & (SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION|SELFLAG_REMOVESELECTION))
   {
     if (flagsSelect & SELFLAG_TAKEFOCUS)
       xpAccessible->TakeFocus();
 
     if (flagsSelect & SELFLAG_TAKESELECTION)
       xpAccessible->TakeSelection();
@@ -745,46 +805,59 @@ STDMETHODIMP nsAccessibleWrap::accSelect
 STDMETHODIMP nsAccessibleWrap::accLocation(
       /* [out] */ long __RPC_FAR *pxLeft,
       /* [out] */ long __RPC_FAR *pyTop,
       /* [out] */ long __RPC_FAR *pcxWidth,
       /* [out] */ long __RPC_FAR *pcyHeight,
       /* [optional][in] */ VARIANT varChild)
 {
 __try {
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
-  if (xpAccessible) {
-    PRInt32 x, y, width, height;
-    if (NS_FAILED(xpAccessible->GetBounds(&x, &y, &width, &height)))
-      return E_FAIL;
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
+  if (!xpAccessible)
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
-    *pxLeft = x;
-    *pyTop = y;
-    *pcxWidth = width;
-    *pcyHeight = height;
-    return S_OK;
-  }
+  PRInt32 x, y, width, height;
+  if (NS_FAILED(xpAccessible->GetBounds(&x, &y, &width, &height)))
+    return E_FAIL;
+
+  *pxLeft = x;
+  *pyTop = y;
+  *pcxWidth = width;
+  *pcyHeight = height;
+  return S_OK;
+
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
   return E_FAIL;
 }
 
 STDMETHODIMP nsAccessibleWrap::accNavigate(
       /* [in] */ long navDir,
       /* [optional][in] */ VARIANT varStart,
       /* [retval][out] */ VARIANT __RPC_FAR *pvarEndUpAt)
 {
 __try {
   if (!pvarEndUpAt)
     return E_INVALIDARG;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAccessible* accessible = GetXPAccessibleFor(varStart);
-  if (!accessible || accessible->IsDefunct())
-    return E_FAIL;
+  if (!accessible)
+    return E_INVALIDARG;
+
+  if (accessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
 
   VariantInit(pvarEndUpAt);
 
   nsAccessible* navAccessible = nsnull;
   PRUint32 xpRelation = 0;
 
   switch(navDir) {
     case NAVDIR_FIRSTCHILD:
@@ -879,18 +952,19 @@ STDMETHODIMP nsAccessibleWrap::accNaviga
 
 STDMETHODIMP nsAccessibleWrap::accHitTest(
       /* [in] */ long xLeft,
       /* [in] */ long yTop,
       /* [retval][out] */ VARIANT __RPC_FAR *pvarChild)
 {
 __try {
   VariantInit(pvarChild);
+
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   nsAccessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
 
   // if we got a child
   if (accessible) {
     // if the child is us
     if (accessible == this) {
       pvarChild->vt = VT_I4;
@@ -908,22 +982,30 @@ STDMETHODIMP nsAccessibleWrap::accHitTes
 
   return S_OK;
 }
 
 STDMETHODIMP nsAccessibleWrap::accDoDefaultAction(
       /* [optional][in] */ VARIANT varChild)
 {
 __try {
-  nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
-  if (!xpAccessible || FAILED(xpAccessible->DoAction(0))) {
-    return E_FAIL;
-  }
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsAccessible* xpAccessible = GetXPAccessibleFor(varChild);
+  if (!xpAccessible)
+    return E_INVALIDARG;
+
+  if (xpAccessible->IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  return GetHRESULT(xpAccessible->DoAction(0));
+
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
-  return S_OK;
+  return E_FAIL;
 }
 
 STDMETHODIMP nsAccessibleWrap::put_accName(
       /* [optional][in] */ VARIANT varChild,
       /* [in] */ BSTR szName)
 {
   return E_NOTIMPL;
 }
@@ -1028,17 +1110,17 @@ nsAccessibleWrap::get_nRelations(long *a
 {
 __try {
   if (!aNRelations)
     return E_INVALIDARG;
 
   *aNRelations = 0;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
        relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
     Relation rel = RelationByType(relType);
     if (rel.Next())
       (*aNRelations)++;
   }
   return S_OK;
@@ -1052,17 +1134,17 @@ nsAccessibleWrap::get_relation(long aRel
 {
 __try {
   if (!aRelation)
     return E_INVALIDARG;
 
   *aRelation = NULL;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   PRUint32 relIdx = 0;
   for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
        relType <= nsIAccessibleRelation::RELATION_LAST; relType++) {
     Relation rel = RelationByType(relType);
     nsRefPtr<ia2AccessibleRelation> ia2Relation =
       new ia2AccessibleRelation(relType, &rel);
     if (ia2Relation->HasTargets()) {
@@ -1087,17 +1169,17 @@ nsAccessibleWrap::get_relations(long aMa
 {
 __try {
   if (!aRelation || !aNRelations)
     return E_INVALIDARG;
 
   *aNRelations = 0;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   for (PRUint32 relType = nsIAccessibleRelation::RELATION_FIRST;
        relType <= nsIAccessibleRelation::RELATION_LAST &&
        *aNRelations < aMaxRelations; relType++) {
     Relation rel = RelationByType(relType);
     nsRefPtr<ia2AccessibleRelation> ia2Rel =
       new ia2AccessibleRelation(relType, &rel);
     if (ia2Rel->HasTargets()) {
@@ -1113,17 +1195,17 @@ nsAccessibleWrap::get_relations(long aMa
 
 STDMETHODIMP
 nsAccessibleWrap::role(long *aRole)
 {
 __try {
   *aRole = 0;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   NS_ASSERTION(gWindowsRoleMap[roles::LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
   roles::Role role = Role();
   *aRole = gWindowsRoleMap[role].ia2Role;
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
@@ -1139,28 +1221,34 @@ nsAccessibleWrap::role(long *aRole)
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 nsAccessibleWrap::scrollTo(enum IA2ScrollType aScrollType)
 {
 __try {
-  nsAccessNode::ScrollTo(aScrollType);
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsCoreUtils::ScrollTo(mDoc->PresShell(), mContent, aScrollType);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 nsAccessibleWrap::scrollToPoint(enum IA2CoordinateType aCoordType,
                                 long aX, long aY)
 {
 __try {
+  if (IsDefunct())
+      return CO_E_OBJNOTCONNECTED;
+
   PRUint32 geckoCoordType = (aCoordType == IA2_COORDTYPE_SCREEN_RELATIVE) ?
     nsIAccessibleCoordinateType::COORDTYPE_SCREEN_RELATIVE :
     nsIAccessibleCoordinateType::COORDTYPE_PARENT_RELATIVE;
 
   nsresult rv = ScrollToPoint(geckoCoordType, aX, aY);
   return GetHRESULT(rv);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
@@ -1168,16 +1256,19 @@ nsAccessibleWrap::scrollToPoint(enum IA2
 }
 
 STDMETHODIMP
 nsAccessibleWrap::get_groupPosition(long *aGroupLevel,
                                     long *aSimilarItemsInGroup,
                                     long *aPositionInGroup)
 {
 __try {
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   PRInt32 groupLevel = 0;
   PRInt32 similarItemsInGroup = 0;
   PRInt32 positionInGroup = 0;
 
   nsresult rv = GroupPosition(&groupLevel, &similarItemsInGroup,
                               &positionInGroup);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
@@ -1199,16 +1290,19 @@ nsAccessibleWrap::get_groupPosition(long
 }
 
 STDMETHODIMP
 nsAccessibleWrap::get_states(AccessibleStates *aStates)
 {
 __try {
   *aStates = 0;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   // XXX: bug 344674 should come with better approach that we have here.
 
   PRUint64 state = State();
 
   if (state & states::INVALID)
     *aStates |= IA2_STATE_INVALID_ENTRY;
   if (state & states::REQUIRED)
     *aStates |= IA2_STATE_REQUIRED;
@@ -1321,17 +1415,17 @@ nsAccessibleWrap::get_uniqueID(long *uni
 
 STDMETHODIMP
 nsAccessibleWrap::get_windowHandle(HWND *aWindowHandle)
 {
 __try {
   *aWindowHandle = 0;
 
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   *aWindowHandle = GetHWNDFor(this);
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
@@ -1339,17 +1433,17 @@ STDMETHODIMP
 nsAccessibleWrap::get_indexInParent(long *aIndexInParent)
 {
 __try {
   if (!aIndexInParent)
     return E_INVALIDARG;
 
   *aIndexInParent = -1;
   if (IsDefunct())
-    return E_FAIL;
+    return CO_E_OBJNOTCONNECTED;
 
   *aIndexInParent = IndexInParent();
   if (*aIndexInParent == -1)
     return S_FALSE;
 
   return S_OK;
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
@@ -1359,16 +1453,19 @@ STDMETHODIMP
 nsAccessibleWrap::get_locale(IA2Locale *aLocale)
 {
 __try {
   // Language codes consist of a primary code and a possibly empty series of
   // subcodes: language-code = primary-code ( "-" subcode )*
   // Two-letter primary codes are reserved for [ISO639] language abbreviations.
   // Any two-letter subcode is understood to be a [ISO3166] country code.
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString lang;
   Language(lang);
 
   // If primary code consists from two letters then expose it as language.
   PRInt32 offset = lang.FindChar('-', 0);
   if (offset == -1) {
     if (lang.Length() == 2) {
       aLocale->language = ::SysAllocString(lang.get());
@@ -1402,16 +1499,19 @@ nsAccessibleWrap::get_locale(IA2Locale *
 STDMETHODIMP
 nsAccessibleWrap::get_attributes(BSTR *aAttributes)
 {
   // The format is name:value;name:value; with \ for escaping these
   // characters ":;=,\".
 __try {
   *aAttributes = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsCOMPtr<nsIPersistentProperties> attributes;
   nsresult rv = GetAttributes(getter_AddRefs(attributes));
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   return ConvertToIA2Attributes(attributes, aAttributes);
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
--- a/accessible/src/msaa/nsApplicationAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsApplicationAccessibleWrap.cpp
@@ -97,16 +97,19 @@ nsApplicationAccessibleWrap::QueryInterf
 // IAccessibleApplication
 
 STDMETHODIMP
 nsApplicationAccessibleWrap::get_appName(BSTR *aName)
 {
 __try {
   *aName = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString name;
   nsresult rv = GetAppName(name);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (name.IsEmpty())
     return S_FALSE;
 
@@ -118,16 +121,19 @@ nsApplicationAccessibleWrap::get_appName
 }
 
 STDMETHODIMP
 nsApplicationAccessibleWrap::get_appVersion(BSTR *aVersion)
 {
 __try {
   *aVersion = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString version;
   nsresult rv = GetAppVersion(version);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (version.IsEmpty())
     return S_FALSE;
 
@@ -137,16 +143,19 @@ nsApplicationAccessibleWrap::get_appVers
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
 
 STDMETHODIMP
 nsApplicationAccessibleWrap::get_toolkitName(BSTR *aName)
 {
 __try {
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString name;
   nsresult rv = GetPlatformName(name);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (name.IsEmpty())
     return S_FALSE;
 
@@ -158,16 +167,19 @@ nsApplicationAccessibleWrap::get_toolkit
 }
 
 STDMETHODIMP
 nsApplicationAccessibleWrap::get_toolkitVersion(BSTR *aVersion)
 {
 __try {
   *aVersion = NULL;
 
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
   nsAutoString version;
   nsresult rv = GetPlatformVersion(version);
   if (NS_FAILED(rv))
     return GetHRESULT(rv);
 
   if (version.IsEmpty())
     return S_FALSE;
 
--- a/accessible/src/msaa/nsTextAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsTextAccessibleWrap.cpp
@@ -212,18 +212,21 @@ nsIFrame* nsTextAccessibleWrap::GetPoint
 /*
  * Given an offset, the x, y, width, and height values are filled appropriately.
  */
 nsresult nsTextAccessibleWrap::GetCharacterExtents(PRInt32 aStartOffset, PRInt32 aEndOffset,
                                                    PRInt32* aX, PRInt32* aY, 
                                                    PRInt32* aWidth, PRInt32* aHeight) 
 {
   *aX = *aY = *aWidth = *aHeight = 0;
-  nsPresContext *presContext = GetPresContext();
-  NS_ENSURE_TRUE(presContext, NS_ERROR_FAILURE);
+
+  if (IsDefunct())
+    return CO_E_OBJNOTCONNECTED;
+
+  nsPresContext* presContext = mDoc->PresContext();
 
   nsIFrame *frame = GetFrame();
   NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
 
   nsPoint startPoint, endPoint;
   nsIFrame *startFrame = GetPointFromOffset(frame, aStartOffset, true, startPoint);
   nsIFrame *endFrame = GetPointFromOffset(frame, aEndOffset, false, endPoint);
   if (!startFrame || !endFrame) {
rename from accessible/src/other/nsARIAGridAccessibleWrap.h
rename to accessible/src/other/ARIAGridAccessibleWrap.h
--- a/accessible/src/other/nsARIAGridAccessibleWrap.h
+++ b/accessible/src/other/ARIAGridAccessibleWrap.h
@@ -33,18 +33,24 @@
  * 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 ***** */
 
-#ifndef _NSARIAGRIDACCESSIBLEWRAP_H
-#define _NSARIAGRIDACCESSIBLEWRAP_H
+#ifndef MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+#define MOZILLA_A11Y_ARIAGRIDACCESSIBLEWRAP_H
+
+#include "ARIAGridAccessible.h"
 
-#include "nsARIAGridAccessible.h"
+namespace mozilla {
+namespace a11y {
 
-typedef class nsARIAGridAccessible nsARIAGridAccessibleWrap;
-typedef class nsARIAGridCellAccessible nsARIAGridCellAccessibleWrap;
+typedef class ARIAGridAccessible ARIAGridAccessibleWrap;
+typedef class ARIAGridCellAccessible ARIAGridCellAccessibleWrap;
+
+} // namespace a11y
+} // namespace mozilla
 
 #endif
 
--- a/accessible/src/other/Makefile.in
+++ b/accessible/src/other/Makefile.in
@@ -49,18 +49,18 @@ LIBXUL_LIBRARY = 1
 
 CPPSRCS = \
   nsAccessNodeWrap.cpp \
   nsAccessibleWrap.cpp \
   nsRootAccessibleWrap.cpp \
   $(NULL)
 
 EXPORTS = \
+  ARIAGridAccessibleWrap.h \
   nsAccessNodeWrap.h \
-  nsARIAGridAccessibleWrap.h \
   nsTextAccessibleWrap.h \
   nsAccessibleWrap.h \
   nsDocAccessibleWrap.h \
   nsRootAccessibleWrap.h \
   nsXULMenuAccessibleWrap.h \
   nsXULListboxAccessibleWrap.h \
   nsXULTreeGridAccessibleWrap.h \
   nsHyperTextAccessibleWrap.h \
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -140,26 +140,16 @@ nsXFormsAccessible::CacheSelectChildren(
       GetAccService()->GetOrCreateAccessible(child, mDoc);
     if (!accessible)
       continue;
 
     AppendChild(accessible);
   }
 }
 
-// nsIAccessible
-
-NS_IMETHODIMP
-nsXFormsAccessible::GetValue(nsAString& aValue)
-{
-  NS_ENSURE_TRUE(sXFormsService, NS_ERROR_FAILURE);
-  nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
-  return sXFormsService->GetValue(DOMNode, aValue);
-}
-
 PRUint64
 nsXFormsAccessible::NativeState()
 {
   NS_ENSURE_TRUE(sXFormsService, 0);
 
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
 
   bool isRelevant = false;
@@ -208,16 +198,23 @@ nsXFormsAccessible::Description(nsString
   nsTextEquivUtils::
     GetTextEquivFromIDRefs(this, nsGkAtoms::aria_describedby,
                            aDescription);
 
   if (aDescription.IsEmpty())
     GetBoundChildElementValue(NS_LITERAL_STRING("hint"), aDescription);
 }
 
+void
+nsXFormsAccessible::Value(nsString& aValue)
+{
+  nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
+  sXFormsService->GetValue(DOMNode, aValue);
+}
+
 bool
 nsXFormsAccessible::CanHaveAnonChildren()
 {
   return false;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -540,21 +537,21 @@ nsXFormsSelectableAccessible::GetItemByI
 
 nsXFormsSelectableItemAccessible::
   nsXFormsSelectableItemAccessible(nsIContent* aContent,
                                    nsDocAccessible* aDoc) :
   nsXFormsAccessible(aContent, aDoc)
 {
 }
 
-NS_IMETHODIMP
-nsXFormsSelectableItemAccessible::GetValue(nsAString& aValue)
+void
+nsXFormsSelectableItemAccessible::Value(nsString& aValue)
 {
   nsCOMPtr<nsIDOMNode> DOMNode(do_QueryInterface(mContent));
-  return sXFormsService->GetValue(DOMNode, aValue);
+  sXFormsService->GetValue(DOMNode, aValue);
 }
 
 PRUint8
 nsXFormsSelectableItemAccessible::ActionCount()
 {
   return 1;
 }
 
--- a/accessible/src/xforms/nsXFormsAccessible.h
+++ b/accessible/src/xforms/nsXFormsAccessible.h
@@ -67,25 +67,23 @@ protected:
  * class is base class for accessible objects for these XForms elements.
  */
 class nsXFormsAccessible : public nsHyperTextAccessibleWrap,
                            public nsXFormsAccessibleBase
 {
 public:
   nsXFormsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
-  // nsIAccessible
-
-  // Returns value of instance node that xforms element is bound to.
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   // nsAccessible
   // Returns value of child xforms 'hint' element.
   virtual void Description(nsString& aDescription);
 
+  // Returns value of instance node that xforms element is bound to.
+  virtual void Value(nsString& aValue);
+
   // Returns value of child xforms 'label' element.
   virtual nsresult GetNameInternal(nsAString& aName);
 
   // Returns state of xforms element taking into account state of instance node
   // that it is bound to.
   virtual PRUint64 NativeState();
 
   // Denies accessible nodes in anonymous content of xforms element by
@@ -184,19 +182,21 @@ protected:
  * The class is base for accessible objects for XForms item elements.
  */
 class nsXFormsSelectableItemAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsSelectableItemAccessible(nsIContent* aContent,
                                    nsDocAccessible* aDoc);
 
-  NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
+  // nsAccessible
+  virtual void Value(nsString& aValue);
+
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
   bool IsSelected();
 };
 
 #endif
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -104,21 +104,20 @@ nsXFormsTriggerAccessible::
 }
 
 role
 nsXFormsTriggerAccessible::NativeRole()
 {
   return roles::PUSHBUTTON;
 }
 
-NS_IMETHODIMP
-nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
+void
+nsXFormsTriggerAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
-  return NS_OK;
 }
 
 PRUint8
 nsXFormsTriggerAccessible::ActionCount()
 {
   return 1;
 }
 
@@ -290,20 +289,20 @@ nsXFormsSecretAccessible::NativeRole()
 }
 
 PRUint64
 nsXFormsSecretAccessible::NativeState()
 {
   return nsXFormsInputAccessible::NativeState() | states::PROTECTED;
 }
 
-NS_IMETHODIMP
-nsXFormsSecretAccessible::GetValue(nsAString& aValue)
+void
+nsXFormsSecretAccessible::Value(nsString& aValue)
 {
-  return NS_ERROR_FAILURE;
+  aValue.Truncate();
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsRangeAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsRangeAccessible::
@@ -433,21 +432,20 @@ nsXFormsChoicesAccessible::
 }
 
 role
 nsXFormsChoicesAccessible::NativeRole()
 {
   return roles::GROUPING;
 }
 
-NS_IMETHODIMP
-nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
+void
+nsXFormsChoicesAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
-  return NS_OK;
 }
 
 void
 nsXFormsChoicesAccessible::CacheChildren()
 {
   CacheSelectChildren();
 }
 
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.h
@@ -74,22 +74,21 @@ public:
  */
 
 class nsXFormsTriggerAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsTriggerAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 /**
  * Accessible object for xforms:input and xforms:textarea.
@@ -151,20 +150,18 @@ public:
  * Accessible object for xforms:secret.
  */
 
 class nsXFormsSecretAccessible : public nsXFormsInputAccessible
 {
 public:
   nsXFormsSecretAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 };
 
 
 /**
  * Accessible object for xforms:range.
  */
@@ -206,19 +203,19 @@ public:
  */
 
 class nsXFormsChoicesAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsChoicesAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
@@ -157,37 +157,36 @@ nsXFormsComboboxPopupWidgetAccessible::N
   if (isOpen)
     state = states::FLOATING;
   else
     state = states::INVISIBLE;
 
   return state;
 }
 
-NS_IMETHODIMP
-nsXFormsComboboxPopupWidgetAccessible::GetValue(nsAString& aValue)
-{
-  aValue.Truncate();
-  return NS_OK;
-}
-
 nsresult
 nsXFormsComboboxPopupWidgetAccessible::GetNameInternal(nsAString& aName)
 {
   // Override nsXFormsAccessible::GetName() to prevent name calculation by
   // XForms rules.
   return NS_OK;
 }
 
 void
 nsXFormsComboboxPopupWidgetAccessible::Description(nsString& aDescription)
 {
   aDescription.Truncate();
 }
 
 void
+nsXFormsComboboxPopupWidgetAccessible::Value(nsString& aValue)
+{
+  aValue.Truncate();
+}
+
+void
 nsXFormsComboboxPopupWidgetAccessible::CacheChildren()
 {
   nsCOMPtr<nsIDOMNode> parent = do_QueryInterface(mContent->GetNodeParent());
   // Parent node must be an xforms:select1 element.
   CacheSelectChildren(parent);
 }
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.h
@@ -86,21 +86,19 @@ public:
  * represented by combobox.
  */
 class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsComboboxPopupWidgetAccessible(nsIContent* aContent,
                                         nsDocAccessible* aDoc);
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   // nsAccessible
   virtual void Description(nsString& aDescription);
+  virtual void Value(nsString& aValue);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -58,26 +58,22 @@ nsXULColorPickerTileAccessible::
   nsXULColorPickerTileAccessible(nsIContent* aContent, nsDocAccessible* aDoc) :
   nsAccessibleWrap(aContent, aDoc)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerTileAccessible: nsIAccessible
 
-NS_IMETHODIMP
-nsXULColorPickerTileAccessible::GetValue(nsAString& aValue)
+void
+nsXULColorPickerTileAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::color, aValue);
-  return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerTileAccessible: nsAccessible
 
 role
 nsXULColorPickerTileAccessible::NativeRole()
 {
--- a/accessible/src/xul/nsXULColorPickerAccessible.h
+++ b/accessible/src/xul/nsXULColorPickerAccessible.h
@@ -45,20 +45,18 @@
  * Used for color button in colorpicker palette.
  */
 class nsXULColorPickerTileAccessible : public nsAccessibleWrap
 {
 public:
   nsXULColorPickerTileAccessible(nsIContent* aContent,
                                  nsDocAccessible* aDoc);
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& _retval);
-
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual nsAccessible* ContainerWidget() const;
 };
 
 
--- a/accessible/src/xul/nsXULComboboxAccessible.cpp
+++ b/accessible/src/xul/nsXULComboboxAccessible.cpp
@@ -98,32 +98,16 @@ nsXULComboboxAccessible::NativeState()
     }
   }
 
   states |= states::HASPOPUP | states::FOCUSABLE;
 
   return states;
 }
 
-NS_IMETHODIMP
-nsXULComboboxAccessible::GetValue(nsAString& aValue)
-{
-  aValue.Truncate();
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  // The value is the option or text shown entered in the combobox.
-  nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
-  if (menuList)
-    return menuList->GetLabel(aValue);
-
-  return NS_ERROR_FAILURE;
-}
-
 void
 nsXULComboboxAccessible::Description(nsString& aDescription)
 {
   aDescription.Truncate();
   // Use description of currently focused option
   nsCOMPtr<nsIDOMXULMenuListElement> menuListElm(do_QueryInterface(mContent));
   if (!menuListElm)
     return;
@@ -134,16 +118,27 @@ nsXULComboboxAccessible::Description(nsS
     do_QueryInterface(focusedOptionItem);
   if (focusedOptionContent && mDoc) {
     nsAccessible* focusedOptionAcc = mDoc->GetAccessible(focusedOptionContent);
     if (focusedOptionAcc)
       focusedOptionAcc->Description(aDescription);
   }
 }
 
+void
+nsXULComboboxAccessible::Value(nsString& aValue)
+{
+  aValue.Truncate();
+
+  // The value is the option or text shown entered in the combobox.
+  nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
+  if (menuList)
+    menuList->GetLabel(aValue);
+}
+
 bool
 nsXULComboboxAccessible::CanHaveAnonChildren()
 {
   if (mContent->NodeInfo()->Equals(nsGkAtoms::textbox, kNameSpaceID_XUL) ||
       mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::editable,
                             nsGkAtoms::_true, eIgnoreCase)) {
     // Both the XUL <textbox type="autocomplete"> and <menulist editable="true"> widgets
     // use nsXULComboboxAccessible. We need to walk the anonymous children for these
--- a/accessible/src/xul/nsXULComboboxAccessible.h
+++ b/accessible/src/xul/nsXULComboboxAccessible.h
@@ -48,22 +48,22 @@
 class nsXULComboboxAccessible : public nsAccessibleWrap
 {
 public:
   enum { eAction_Click = 0 };
 
   nsXULComboboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD DoAction(PRUint8 aIndex);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
   virtual void Description(nsString& aDescription);
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool CanHaveAnonChildren();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // Widgets
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/nsXULFormControlAccessible.cpp
@@ -723,35 +723,32 @@ nsXULTextFieldAccessible::
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsXULTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTextFieldAccessible: nsIAccessible
 
-NS_IMETHODIMP nsXULTextFieldAccessible::GetValue(nsAString& aValue)
+void
+nsXULTextFieldAccessible::Value(nsString& aValue)
 {
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  PRUint64 state = NativeState();
-
-  if (state & states::PROTECTED)    // Don't return password text!
-    return NS_ERROR_FAILURE;
+  aValue.Truncate();
+  if (NativeRole() == roles::PASSWORD_TEXT) // Don't return password text!
+    return;
 
   nsCOMPtr<nsIDOMXULTextBoxElement> textBox(do_QueryInterface(mContent));
   if (textBox) {
-    return textBox->GetValue(aValue);
+    textBox->GetValue(aValue);
+    return;
   }
+
   nsCOMPtr<nsIDOMXULMenuListElement> menuList(do_QueryInterface(mContent));
-  if (menuList) {
-    return menuList->GetLabel(aValue);
-  }
-  return NS_ERROR_FAILURE;
+  if (menuList)
+    menuList->GetLabel(aValue);
 }
 
 void
 nsXULTextFieldAccessible::ApplyARIAState(PRUint64* aState)
 {
   nsHyperTextAccessibleWrap::ApplyARIAState(aState);
 
   aria::MapToState(aria::eARIAAutoComplete, mContent->AsElement(), aState);
--- a/accessible/src/xul/nsXULFormControlAccessible.h
+++ b/accessible/src/xul/nsXULFormControlAccessible.h
@@ -249,24 +249,24 @@ class nsXULTextFieldAccessible : public 
 public:
   enum { eAction_Click = 0 };
 
   nsXULTextFieldAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsHyperTextAccessible
   virtual already_AddRefed<nsIEditor> GetEditor() const;
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual void ApplyARIAState(PRUint64* aState);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool CanHaveAnonChildren();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -205,27 +205,28 @@ nsXULListboxAccessible::NativeState()
   }
 
   return states;
 }
 
 /**
   * Our value is the label of our ( first ) selected child.
   */
-NS_IMETHODIMP nsXULListboxAccessible::GetValue(nsAString& _retval)
+void
+nsXULListboxAccessible::Value(nsString& aValue)
 {
-  _retval.Truncate();
+  aValue.Truncate();
+
   nsCOMPtr<nsIDOMXULSelectControlElement> select(do_QueryInterface(mContent));
   if (select) {
     nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
     select->GetSelectedItem(getter_AddRefs(selectedItem));
     if (selectedItem)
-      return selectedItem->GetLabel(_retval);
+      selectedItem->GetLabel(aValue);
   }
-  return NS_ERROR_FAILURE;
 }
 
 role
 nsXULListboxAccessible::NativeRole()
 {
   // A richlistbox is used with the new autocomplete URL bar, and has a parent
   // popup <panel>.
   nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
--- a/accessible/src/xul/nsXULListboxAccessible.h
+++ b/accessible/src/xul/nsXULListboxAccessible.h
@@ -99,23 +99,21 @@ public:
   nsXULListboxAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
   virtual ~nsXULListboxAccessible() {}
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTable
   NS_DECL_OR_FORWARD_NSIACCESSIBLETABLE_WITH_XPCACCESSIBLETABLE
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::TableAccessible* AsTable() { return this; }
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // Widgets
   virtual bool IsWidget() const;
   virtual bool IsActiveWidget() const;
   virtual bool AreItemsOperable() const;
--- a/accessible/src/xul/nsXULSliderAccessible.cpp
+++ b/accessible/src/xul/nsXULSliderAccessible.cpp
@@ -87,20 +87,20 @@ nsXULSliderAccessible::NativeState()
   if (FocusMgr()->IsFocused(this))
     states |= states::FOCUSED;
 
   return states;
 }
 
 // nsIAccessible
 
-NS_IMETHODIMP
-nsXULSliderAccessible::GetValue(nsAString& aValue)
+void
+nsXULSliderAccessible::Value(nsString& aValue)
 {
-  return GetSliderAttr(nsGkAtoms::curpos, aValue);
+  GetSliderAttr(nsGkAtoms::curpos, aValue);
 }
 
 PRUint8
 nsXULSliderAccessible::ActionCount()
 {
   return 1;
 }
 
--- a/accessible/src/xul/nsXULSliderAccessible.h
+++ b/accessible/src/xul/nsXULSliderAccessible.h
@@ -50,24 +50,24 @@ class nsXULSliderAccessible : public nsA
 {
 public:
   nsXULSliderAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsIAccessibleValue
   NS_DECL_NSIACCESSIBLEVALUE
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual bool CanHaveAnonChildren();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
 protected:
--- a/accessible/src/xul/nsXULTabAccessible.cpp
+++ b/accessible/src/xul/nsXULTabAccessible.cpp
@@ -182,20 +182,20 @@ nsXULTabsAccessible::NativeRole()
 }
 
 PRUint8
 nsXULTabsAccessible::ActionCount()
 {
   return 0;
 }
 
-/** no value */
-NS_IMETHODIMP nsXULTabsAccessible::GetValue(nsAString& _retval)
+void
+nsXULTabsAccessible::Value(nsString& aValue)
 {
-  return NS_OK;
+  aValue.Truncate();
 }
 
 nsresult
 nsXULTabsAccessible::GetNameInternal(nsAString& aName)
 {
   // no name
   return NS_OK;
 }
--- a/accessible/src/xul/nsXULTabAccessible.h
+++ b/accessible/src/xul/nsXULTabAccessible.h
@@ -71,20 +71,18 @@ public:
 /**
  * A container of tab objects, xul:tabs element.
  */
 class nsXULTabsAccessible : public XULSelectControlAccessible
 {
 public:
   nsXULTabsAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& _retval);
-
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 };
 
 
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -146,26 +146,22 @@ nsXULLinkAccessible::
 
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULLinkAccessible, nsHyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULLinkAccessible. nsIAccessible
 
-NS_IMETHODIMP
-nsXULLinkAccessible::GetValue(nsAString& aValue)
+void
+nsXULLinkAccessible::Value(nsString& aValue)
 {
   aValue.Truncate();
 
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::href, aValue);
-  return NS_OK;
 }
 
 nsresult
 nsXULLinkAccessible::GetNameInternal(nsAString& aName)
 {
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::value, aName);
   if (!aName.IsEmpty())
     return NS_OK;
--- a/accessible/src/xul/nsXULTextAccessible.h
+++ b/accessible/src/xul/nsXULTextAccessible.h
@@ -76,22 +76,21 @@ class nsXULLinkAccessible : public nsHyp
 {
 
 public:
   nsXULLinkAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual nsresult GetNameInternal(nsAString& aName);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
 
   // ActionAccessible
   virtual PRUint8 ActionCount();
 
   // HyperLinkAccessible
--- a/accessible/src/xul/nsXULTreeAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeAccessible.cpp
@@ -102,17 +102,16 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXULTreeAccessible,
                                                 nsAccessible)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTree)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTreeView)
   ClearCache(tmp->mAccessibleCache);
 NS_IMPL_CYCLE_COLLECTION_UNLINK_END
 
 NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsXULTreeAccessible)
-NS_INTERFACE_MAP_STATIC_AMBIGUOUS(nsXULTreeAccessible)
 NS_INTERFACE_MAP_END_INHERITING(nsAccessible)
 
 NS_IMPL_ADDREF_INHERITED(nsXULTreeAccessible, nsAccessible)
 NS_IMPL_RELEASE_INHERITED(nsXULTreeAccessible, nsAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: nsAccessible implementation
 
@@ -138,46 +137,42 @@ nsXULTreeAccessible::NativeState()
   NS_ENSURE_SUCCESS(rv, state);
 
   if (!isSingle)
     state |= states::MULTISELECTABLE;
 
   return state;
 }
 
-NS_IMETHODIMP
-nsXULTreeAccessible::GetValue(nsAString& aValue)
+void
+nsXULTreeAccessible::Value(nsString& aValue)
 {
   // Return the value is the first selected child.
 
   aValue.Truncate();
 
-  if (IsDefunct() || !mTreeView)
-    return NS_ERROR_FAILURE;
-
   nsCOMPtr<nsITreeSelection> selection;
   mTreeView->GetSelection(getter_AddRefs(selection));
   if (!selection)
-    return NS_ERROR_FAILURE;
+    return;
 
   PRInt32 currentIndex;
   nsCOMPtr<nsIDOMElement> selectItem;
   selection->GetCurrentIndex(&currentIndex);
   if (currentIndex >= 0) {
     nsCOMPtr<nsITreeColumn> keyCol;
 
     nsCOMPtr<nsITreeColumns> cols;
     mTree->GetColumns(getter_AddRefs(cols));
     if (cols)
       cols->GetKeyColumn(getter_AddRefs(keyCol));
 
-    return mTreeView->GetCellText(currentIndex, keyCol, aValue);
+    mTreeView->GetCellText(currentIndex, keyCol, aValue);
   }
 
-  return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTreeAccessible: nsAccessNode implementation
 
 void
 nsXULTreeAccessible::Shutdown()
 {
@@ -802,17 +797,17 @@ nsXULTreeItemAccessibleBase::GetBounds(P
 
   PRInt32 tcX = 0, tcY = 0;
   boxObj->GetScreenX(&tcX);
   boxObj->GetScreenY(&tcY);
 
   x = tcX;
   y += tcY;
 
-  nsPresContext *presContext = GetPresContext();
+  nsPresContext* presContext = mDoc->PresContext();
   *aX = presContext->CSSPixelsToDevPixels(x);
   *aY = presContext->CSSPixelsToDevPixels(y);
   *aWidth = presContext->CSSPixelsToDevPixels(width);
   *aHeight = presContext->CSSPixelsToDevPixels(height);
 
   return NS_OK;
 }
 
--- a/accessible/src/xul/nsXULTreeAccessible.h
+++ b/accessible/src/xul/nsXULTreeAccessible.h
@@ -48,44 +48,34 @@
  */
 const PRUint32 kMaxTreeColumns = 100;
 const PRUint32 kDefaultTreeCacheSize = 256;
 
 /**
  * Accessible class for XUL tree element.
  */
 
-#define NS_XULTREEACCESSIBLE_IMPL_CID                   \
-{  /* 2692e149-6176-42ee-b8e1-2c44b04185e3 */           \
-  0x2692e149,                                           \
-  0x6176,                                               \
-  0x42ee,                                               \
-  { 0xb8, 0xe1, 0x2c, 0x44, 0xb0, 0x41, 0x85, 0xe3 }    \
-}
-
 class nsXULTreeAccessible : public nsAccessibleWrap
 {
 public:
   using nsAccessible::GetChildCount;
   using nsAccessible::GetChildAt;
 
   nsXULTreeAccessible(nsIContent* aContent, nsDocAccessible* aDoc);
 
   // nsISupports and cycle collection
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsXULTreeAccessible,
                                            nsAccessible)
 
-  // nsIAccessible
-  NS_IMETHOD GetValue(nsAString& aValue);
-
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
+  virtual void Value(nsString& aValue);
   virtual mozilla::a11y::role NativeRole();
   virtual PRUint64 NativeState();
   virtual nsAccessible* ChildAtPoint(PRInt32 aX, PRInt32 aY,
                                      EWhichChildAtPoint aWhichChild);
 
   virtual nsAccessible* GetChildAt(PRUint32 aIndex);
   virtual PRInt32 GetChildCount();
 
@@ -106,18 +96,16 @@ public:
   virtual bool AreItemsOperable() const;
   virtual nsAccessible* CurrentItem();
   virtual void SetCurrentItem(nsAccessible* aItem);
 
   virtual nsAccessible* ContainerWidget() const;
 
   // nsXULTreeAccessible
 
-  NS_DECLARE_STATIC_IID_ACCESSOR(NS_XULTREEACCESSIBLE_IMPL_CID)
-
   /**
    * Return tree item accessible at the givem row. If accessible doesn't exist
    * in the cache then create and cache it.
    *
    * @param aRow         [in] the given row index
    */
   nsAccessible* GetTreeItemAccessible(PRInt32 aRow);
 
@@ -154,19 +142,16 @@ protected:
    */
   virtual already_AddRefed<nsAccessible> CreateTreeItemAccessible(PRInt32 aRow);
 
   nsCOMPtr<nsITreeBoxObject> mTree;
   nsCOMPtr<nsITreeView> mTreeView;
   nsAccessibleHashtable mAccessibleCache;
 };
 
-NS_DEFINE_STATIC_IID_ACCESSOR(nsXULTreeAccessible,
-                              NS_XULTREEACCESSIBLE_IMPL_CID)
-
 /**
  * Base class for tree item accessibles.
  */
 
 #define NS_XULTREEITEMBASEACCESSIBLE_IMPL_CID         \
 {  /* 1ab79ae7-766a-443c-940b-b1e6b0831dfc */         \
   0x1ab79ae7,                                         \
   0x766a,                                             \
--- a/accessible/src/xul/nsXULTreeGridAccessible.cpp
+++ b/accessible/src/xul/nsXULTreeGridAccessible.cpp
@@ -919,17 +919,17 @@ nsXULTreeGridCellAccessible::GetBounds(P
   NS_ENSURE_SUCCESS(rv, rv);
 
   PRInt32 tcX = 0, tcY = 0;
   boxObj->GetScreenX(&tcX);
   boxObj->GetScreenY(&tcY);
   x += tcX;
   y += tcY;
 
-  nsPresContext *presContext = GetPresContext();
+  nsPresContext* presContext = mDoc->PresContext();
   *aX = presContext->CSSPixelsToDevPixels(x);
   *aY = presContext->CSSPixelsToDevPixels(y);
   *aWidth = presContext->CSSPixelsToDevPixels(width);
   *aHeight = presContext->CSSPixelsToDevPixels(height);
 
   return NS_OK;
 }
 
--- a/accessible/tests/mochitest/Makefile.in
+++ b/accessible/tests/mochitest/Makefile.in
@@ -51,16 +51,17 @@ DIRS	= \
   events \
   focus \
   hittest \
   hyperlink \
   hypertext \
   name \
   pivot \
   relations \
+  role \
   selectable \
   states \
   table \
   text \
   textcaret \
   textselection \
   tree \
   treeupdate \
@@ -87,27 +88,22 @@ include $(topsrcdir)/config/rules.mk
 		name.js \
 		pivot.js \
 		relations.js \
 		role.js \
 		selectable.js \
 		states.js \
 		table.js \
 		value.js \
-		test_aria_role_article.html \
-		test_aria_role_equation.html \
-		test_aria_roles.html \
-		test_aria_roles.xul \
 		test_aria_token_attrs.html \
 		test_bug420863.html \
 		test_descr.html \
 		test_nsIAccessibleDocument.html \
 		test_nsIAccessibleImage.html \
 		test_OuterDocAccessible.html \
-		test_role_nsHyperTextAcc.html \
 		test_textboxes.html \
 		test_textboxes.xul \
 		testTextboxes.js \
 		text.js \
 		treeview.css \
 		treeview.js \
 		$(NULL)
 
--- a/accessible/tests/mochitest/attributes/Makefile.in
+++ b/accessible/tests/mochitest/attributes/Makefile.in
@@ -47,13 +47,15 @@ include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =\
 		test_obj.html \
 		test_obj_css.html \
 		test_obj_css.xul \
 		test_obj_group.html \
 		test_obj_group.xul \
 		test_obj_group_tree.xul \
+		test_tag.html \
 		test_text.html \
+		test_xml-roles.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
rename from accessible/tests/mochitest/elm/test_landmarks.html
rename to accessible/tests/mochitest/attributes/test_tag.html
--- a/accessible/tests/mochitest/elm/test_landmarks.html
+++ b/accessible/tests/mochitest/attributes/test_tag.html
@@ -14,34 +14,16 @@
           src="../role.js"></script>
   <script type="application/javascript"
           src="../attributes.js"></script>
 
   <script type="application/javascript">
 
     function doTest()
     {
-      testRole("nav", ROLE_SECTION);
-      testRole("header", ROLE_HEADER);
-      testRole("footer", ROLE_FOOTER);
-      testRole("article", ROLE_DOCUMENT);
-      testRole("aside", ROLE_NOTE);
-      testRole("section", ROLE_SECTION); // XXX bug 739612: not a landmark
-
-      testRole("main", ROLE_DOCUMENT);
-      testRole("form", ROLE_FORM);
-
-      // Some AT may look for this
-      testAttrs("nav", {"xml-roles" : "navigation"}, true);
-      testAttrs("footer", {"xml-roles" : "contentinfo"}, true);
-      testAttrs("aside", {"xml-roles" : "complementary"}, true);
-      testAttrs("section", {"xml-roles" : "region"}, true);
-      testAttrs("main", {"xml-roles" : "main"}, true); // // ARIA override
-      testAttrs("form", {"xml-roles" : "form"}, true);
-
       // And some AT may look for this
       testAttrs("nav", {"tag" : "nav"}, true);
       testAttrs("header", {"tag" : "header"}, true);
       testAttrs("footer", {"tag" : "footer"}, true);
       testAttrs("article", {"tag" : "article"}, true);
       testAttrs("aside", {"tag" : "aside"}, true);
       testAttrs("section", {"tag" : "section"}, true);
       testAttrs("main", {"tag" : "article"}, true);
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/attributes/test_xml-roles.html
@@ -0,0 +1,77 @@
+<!DOCTYPE html>
+<html>
+<head>
+  <title>XML landmark tests</title>
+  <link rel="stylesheet" type="text/css"
+        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+  <script type="application/javascript"
+          src="../common.js"></script>
+  <script type="application/javascript"
+          src="../role.js"></script>
+  <script type="application/javascript"
+          src="../attributes.js"></script>
+
+  <script type="application/javascript">
+
+    function doTest()
+    {
+      // Some AT may look for this
+      testAttrs("nav", {"xml-roles" : "navigation"}, true);
+      testAttrs("footer", {"xml-roles" : "contentinfo"}, true);
+      testAttrs("aside", {"xml-roles" : "complementary"}, true);
+      testAttrs("section", {"xml-roles" : "region"}, true);
+      testAttrs("main", {"xml-roles" : "main"}, true); // // ARIA override
+      testAttrs("form", {"xml-roles" : "form"}, true);
+
+      SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addA11yLoadEvent(doTest);
+  </script>
+</head>
+<body>
+
+  <a target="_blank"
+     title="Provide mappings for html5 <nav> <header> <footer> <article>"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=593368">
+    Bug 593368
+  </a><br/>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=613502"
+     title="Map <article> like we do aria role article">
+    Bug 613502
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=610650"
+     title="Change implementation of HTML5 landmark elements to conform">
+    Bug 610650
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=614310"
+     title="Map section to pane (like role=region)">
+    Mozilla Bug 614310
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=734982"
+     title="Map ARIA role FORM">
+    Bug 734982
+  </a>
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <nav id="nav">a nav</nav>
+  <footer id="footer">a footer</footer>
+  <aside id="aside">by the way I am an aside</aside>
+  <section id="section">a section</section>
+  <article id="main" role="main">a main area</article>
+  <article id="form" role="form">a form area</article>
+
+</body>
+</html>
--- a/accessible/tests/mochitest/elm/Makefile.in
+++ b/accessible/tests/mochitest/elm/Makefile.in
@@ -42,16 +42,15 @@ srcdir		= @srcdir@
 VPATH		= @srcdir@
 relativesrcdir  = accessible/elm
 
 include $(DEPTH)/config/autoconf.mk
 include $(topsrcdir)/config/rules.mk
 
 _TEST_FILES =\
 		test_figure.html \
-		test_landmarks.html \
 		test_listbox.xul \
 		test_nsApplicationAcc.html \
 		test_plugin.html \
 		$(NULL)
 
 libs:: $(_TEST_FILES)
 	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
--- a/accessible/tests/mochitest/name/test_general.html
+++ b/accessible/tests/mochitest/name/test_general.html
@@ -9,16 +9,17 @@
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
           src="../common.js"></script>
   <script type="application/javascript"
           src="../name.js"></script>
 
   <script type="application/javascript">
+
     function doTest()
     {
       // aria-label
 
       // Simple label provided via ARIA
       testName("btn_simple_aria_label", "I am a button");
 
       // aria-label and aria-labelledby, expect aria-labelledby
@@ -131,16 +132,18 @@
       // Get the name from subtree of menuitem crossing role nothing to get
       // the name from its children.
       testName("tablemenuitem", "menuitem 1");
 
       // Get the name from child acronym title attribute rather than from
       // acronym content.
       testName("label_with_acronym", "O A T F World Wide Web");
 
+      testName("testArticle", "Test article");
+
       //////////////////////////////////////////////////////////////////////////
       // title attribute
 
       // If nothing is left. Let's try title attribute.
       testName("btn_title", "title");
 
       //////////////////////////////////////////////////////////////////////////
       // textarea name
@@ -188,28 +191,42 @@
       // placeholder
       testName("ph_password", "a placeholder");
       testName("ph_text", "a placeholder");
       testName("ph_textarea", "a placeholder");
       testName("ph_text2", "a label");
       testName("ph_textarea2", "a label");
       testName("ph_text3", "a label");
 
+      // Test equation image
+      testName("img_eq", "x^2 + y^2 + z^2")
+      testName("txt_eq", "x^2 + y^2 + z^2")
+
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 
 </head>
 
 <body>
 
   <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479"
+     title="Bug 428479 - Support ARIA role=math">
+    Mozilla Bug 428479
+  </a><br>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666"
+     title="Expose ROLE_DOCUMENT for ARIA landmarks that inherit from document">
+    Mozilla Bug 429666
+  </a><br>
+  <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=444279"
      title="mochitest for accessible name calculating">
     Mozilla Bug 444279
   </a><br>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=530081"
      title="Clean up our tree walker ">
     Mozilla Bug 530081
@@ -404,16 +421,20 @@
     </tr>
   </table>
 
   <label id="label_with_acronym">
     <acronym title="O A T F">OATF</acronym>
     <abbr title="World Wide Web">WWW</abbr>
   </label>
 
+  <div id="testArticle" role="article" title="Test article">
+    <p>This is a paragraph inside the article.</p>
+  </div>
+
   <!-- name from title attribute -->
   <span id="btn_title" role="group" title="title">15</span>
 
   <!-- A textarea nested in a label with a text child (bug #453371). -->
   <form>
     <label>Story
       <textarea id="textareawithchild" name="name">Foo</textarea>
       is ended.
@@ -488,10 +509,18 @@
   <!-- placeholder does not win -->
   <input id="ph_text2" type="text" aria-label="a label" placeholder="meh" />
   <textarea id="ph_textarea2" cols="5" aria-labelledby="ph_text2" 
             placeholder="meh"></textarea>
 
   <label for="ph_text3">a label</label>
   <input id="ph_text3" placeholder="meh" />
 
+  <p>Image: 
+    <img id="img_eq" role="math" src="foo" alt="x^2 + y^2 + z^2">
+  </p>
+
+  <p>Text: 
+    <span id="txt_eq" role="math" title="x^2 + y^2 + z^2">x<sup>2</sup> + 
+      y<sup>2</sup> + z<sup>2</sup></span>
+
 </body>
 </html>
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/role/Makefile.in
@@ -0,0 +1,21 @@
+# This Source Code Form is subject to the terms of the Mozilla Public
+# License, v. 2.0. If a copy of the MPL was not distributed with this file,
+# You can obtain one at http://mozilla.org/MPL/2.0/.
+
+DEPTH		= ../../../..
+topsrcdir	= @top_srcdir@
+srcdir		= @srcdir@
+VPATH		= @srcdir@
+relativesrcdir  = accessible/role
+
+include $(DEPTH)/config/autoconf.mk
+include $(topsrcdir)/config/rules.mk
+
+_TEST_FILES =\
+		test_aria.html \
+		test_aria.xul \
+		test_general.html \
+		$(NULL)
+
+libs:: $(_TEST_FILES)
+	$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/a11y/$(relativesrcdir)
rename from accessible/tests/mochitest/test_aria_roles.html
rename to accessible/tests/mochitest/role/test_aria.html
--- a/accessible/tests/mochitest/test_aria_roles.html
+++ b/accessible/tests/mochitest/role/test_aria.html
@@ -1,46 +1,49 @@
 <!DOCTYPE html>
 <html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=481114
-https://bugzilla.mozilla.org/show_bug.cgi?id=469688
-https://bugzilla.mozilla.org/show_bug.cgi?id=520188
-https://bugzilla.mozilla.org/show_bug.cgi?id=529289
--->
 <head>
   <title>Test weak ARIA roles</title>
+
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
-          src="common.js"></script>
+          src="../common.js"></script>
   <script type="application/javascript"
-          src="role.js"></script>
+          src="../role.js"></script>
 
   <script type="application/javascript">
+
     function doTest()
     {
       // Note:
       // The phrase "weak foo" here means that there is no good foo-to-platform
       // role mapping. Similarly "strong foo" means there is a good foo-to-
       // platform role mapping.
 
+      testRole("articlemain", ROLE_DOCUMENT);
+      testRole("articleform", ROLE_FORM);
+
+      // Test article exposed as document
+      testRole("testArticle", ROLE_DOCUMENT);
+
       // weak roles that are forms of "live regions"
       testRole("log_table", ROLE_TABLE);
       testRole("timer_div", ROLE_SECTION);
 
       // other roles that are forms of "live regions"
       testRole("marquee_h1", ROLE_ANIMATION);
 
       // strong landmark
       testRole("application", ROLE_APPLICATION);
       testRole("form", ROLE_FORM);
+      testRole("application_table", ROLE_APPLICATION);
 
       // weak landmarks
       var weak_landmarks = ["banner", "complementary", "contentinfo",
           "main", "navigation", "search"];
       for (l in weak_landmarks)
         testRole(weak_landmarks[l], ROLE_SECTION);
 
       for (l in weak_landmarks) {
@@ -79,25 +82,33 @@ https://bugzilla.mozilla.org/show_bug.cg
 
       //////////////////////////////////////////////////////////////////////////
       // test document role map update
       var testDoc = getAccessible(document, [nsIAccessibleDocument]);
       testRole(testDoc, ROLE_DOCUMENT);
       document.body.setAttribute("role", "application");
       testRole(testDoc, ROLE_APPLICATION);
 
+      // Test equation image
+      testRole("img_eq", ROLE_FLAT_EQUATION);
+
+      // Test textual equation
+      testRole("txt_eq", ROLE_FLAT_EQUATION);
+
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 <body>
 
+  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479">Mozilla Bug 428479</a>
+  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666">Mozilla Bug 429666</a>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=481114">Mozilla Bug 481114</a>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 469688</a>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=469688">Mozilla Bug 520188</a>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 529289</a>
   <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=529289">Mozilla Bug 607219</a>
   <a target="_blank"
      title="HTML buttons with aria-pressed not exposing IA2 TOGGLE_BUTTON role"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=725432">
@@ -107,17 +118,24 @@ https://bugzilla.mozilla.org/show_bug.cg
      title="Map ARIA role FORM"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=735645">
     Bug 735645
   </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
-  
+
+  <article id="articlemain" role="main">a main area</article>
+  <article id="articleform" role="form">a form area</article>
+
+  <div id="testArticle" role="article" title="Test article">
+    <p>This is a paragraph inside the article.</p>
+  </div>
+
   <!-- "live" roles -->
   <table role="log" id="log_table">
     <tr><td>Table based log</td></tr>
   </table>
   <h1 role="marquee" id="marquee_h1">marquee</h1>
   <div role="timer" id="timer_div">timer</div>
 
   <!-- landmarks -->
@@ -178,10 +196,19 @@ https://bugzilla.mozilla.org/show_bug.cg
   <div role="note" id="note">note</div>
   <div role="scrollbar" id="scrollbar">scrollbar</div>
 
   <div id="dir" role="directory">
     <div role="listitem">A</div>
     <div role="listitem">B</div>
     <div role="listitem">C</div>
   </div>
+
+  <p>Image: 
+    <img id="img_eq" role="math" src="foo" alt="x^2 + y^2 + z^2">
+  </p>
+
+  <p>Text: 
+    <span id="txt_eq" role="math" title="x^2 + y^2 + z^2">x<sup>2</sup> + 
+      y<sup>2</sup> + z<sup>2</sup></span>
+
 </body>
 </html>
rename from accessible/tests/mochitest/test_aria_roles.xul
rename to accessible/tests/mochitest/role/test_aria.xul
--- a/accessible/tests/mochitest/test_aria_roles.xul
+++ b/accessible/tests/mochitest/role/test_aria.xul
@@ -5,17 +5,17 @@
 
 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
         title="Accessibility Name Calculating Test.">
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js" />
 
   <script type="application/javascript"
-          src="common.js"></script>
+          src="../common.js"></script>
 
   <script type="application/javascript">
   <![CDATA[
     function doTest()
     {
       ok(!isAccessible("presentation_label"),
                       "Presentation label shouldn't be accessible.");
       ok(!isAccessible("presentation_descr"),
rename from accessible/tests/mochitest/test_role_nsHyperTextAcc.html
rename to accessible/tests/mochitest/role/test_general.html
--- a/accessible/tests/mochitest/test_role_nsHyperTextAcc.html
+++ b/accessible/tests/mochitest/role/test_general.html
@@ -3,25 +3,36 @@
 <head>
   <title>test nsHyperTextAccessible accesible objects creation and their roles</title>
   <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
 
   <script type="application/javascript"
-          src="common.js"></script>
+          src="../common.js"></script>
   <script type="application/javascript"
-          src="role.js"></script>
+          src="../role.js"></script>
+  <script type="application/javascript"
+          src="../attributes.js"></script>
 
   <script type="application/javascript">
     function doTests()
     {
+      // landmark tests section
+      testRole("frm", ROLE_FORM);
+
+      // nsHyperTextAcc tests section
       // Test html:form.
-      testRole("frm", ROLE_FORM);
+      testRole("nav", ROLE_SECTION);
+      testRole("header", ROLE_HEADER);
+      testRole("footer", ROLE_FOOTER);
+      testRole("article", ROLE_DOCUMENT);
+      testRole("aside", ROLE_NOTE);
+      testRole("section", ROLE_SECTION);
 
       // test html:div
       testRole("sec", ROLE_SECTION);
 
       // Test html:blockquote
       testRole("quote", ROLE_SECTION);
 
       // Test html:h, all levels
@@ -68,24 +79,59 @@
       title="Test remaining implementations in nsHypertextAccessible::GetRole">
     bug 474261
   </a><br>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=423409"
      title="Expose click action if mouseup and mousedown are registered">
     Mozilla Bug 423409
   </a>
+  <a target="_blank"
+     title="Provide mappings for html5 <nav> <header> <footer> <article>"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=593368">
+    Bug 593368
+  </a><br/>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=613502"
+     title="Map <article> like we do aria role article">
+    Bug 613502
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=610650"
+     title="Change implementation of HTML5 landmark elements to conform">
+    Bug 610650
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=614310"
+     title="Map section to pane (like role=region)">
+    Mozilla Bug 614310
+  </a>
+  <a target="_blank"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=734982"
+     title="Map ARIA role FORM">
+    Bug 734982
+  </a>
+
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
+
   <form id="frm" action="submit.php" method="post">
     <label for="data">File</label>:
     <input type="file" id="data" name="data" size="50"/>
   </form>
+
+  <nav id="nav">a nav</nav>
+  <header id="header">a header</header>
+  <footer id="footer">a footer</footer>
+  <article id="article">an article</article>
+  <aside id="aside">by the way I am an aside</aside>
+  <section id="section">a section</section>
+
   <p id="p">A paragraph for comparison.</p>
   <div id="sec">A normal div</div>
   <blockquote id="quote">A citation</blockquote>
   <h1 id="head1">A heading level 1</h1>
   <h2 id="head2">A heading level 2</h2>
   <h3 id="head3">A heading level 3</h3>
   <h4 id="head4">A heading level 4</h4>
   <h5 id="head5">A heading level 5</h5>
--- a/accessible/tests/mochitest/testTextboxes.js
+++ b/accessible/tests/mochitest/testTextboxes.js
@@ -1,21 +1,11 @@
 function testValue(aID, aAcc, aValue, aRole)
 {
-  if (aRole == ROLE_PASSWORD_TEXT) {
-    var value;
-    try {
-      value = aAcc.value;
-      do_throw("We do not want a value on " + aID + "!");
-    } catch(e) {
-      is(e.result, Components.results.NS_ERROR_FAILURE,
-         "Wrong return value for getValue on " + aID + "!");
-    }
-  } else
-    is(aAcc.value, aValue, "Wrong value for " + aID + "!");
+  is(aAcc.value, aValue, "Wrong value for " + aID + "!");
 }
 
 function testAction(aID, aAcc, aNumActions, aActionName, aActionDescription)
 {
   var numActions = aAcc.numActions;
   is(numActions, aNumActions, "Wrong number of actions for " + aID + "!");
 
   if (numActions != 0) {
deleted file mode 100644
--- a/accessible/tests/mochitest/test_aria_role_article.html
+++ /dev/null
@@ -1,46 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=429666
--->
-<head>
-  <title>Expose ROLE_DOCUMENT for ARIA landmarks that inherit from document chrome tests</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
-  <script type="application/javascript"
-          src="common.js"></script>
-  <script type="application/javascript"
-          src="role.js"></script>
-
-  <script type="application/javascript">
-    function doTest()
-    {
-      // Test article exposed as document
-      testRole("testArticle", ROLE_DOCUMENT);
-
-      var articleAcc = getAccessible("testArticle");
-      if (articleAcc)
-        is(articleAcc.name, "Test article", "Wrong name for article!");
-
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addA11yLoadEvent(doTest);
-  </script>
-</head>
-<body>
-
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=429666">Mozilla Bug 429666</a>
-  <p id="display"></p>
-  <div id="content" style="display: none"></div>
-  <pre id="test">
-  </pre>
-  <div id="testArticle" role="article" title="Test article">
-    <p>This is a paragraph inside the article.</p>
-  </div>
-</body>
-</html>
deleted file mode 100644
--- a/accessible/tests/mochitest/test_aria_role_equation.html
+++ /dev/null
@@ -1,57 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=428479
--->
-<head>
-  <title>ARIA role math chrome tests</title>
-  <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-
-  <script type="application/javascript"
-          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
-
-  <script type="application/javascript"
-          src="common.js"></script>
-  <script type="application/javascript"
-          src="role.js"></script>
-
-  <script type="application/javascript">
-    function testThis(aID)
-    {
-      getRole(aID, ROLE_FLAT_EQUATION);
-      var eqAcc = getAccessible(aID);
-      if (eqAcc)
-        is(eqAcc.name, "x^2 + y^2 + z^2", "Wrong name for " + aID + "!");
-    }
-
-    function doTest()
-    {
-      // Test equation image
-      testThis("img_eq");
-
-      // Test textual equation
-      testThis("txt_eq");
-
-      SimpleTest.finish();
-    }
-
-    SimpleTest.waitForExplicitFinish();
-    addA11yLoadEvent(doTest);
-  </script>
-</head>
-<body>
-
-  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=428479">Mozilla Bug 428479</a>
-  <p id="display"></p>
-  <div id="content" style="display: none"></div>
-  <pre id="test">
-  </pre>
-  <p>Image: 
-    <img id="img_eq" role="math" src="foo" alt="x^2 + y^2 + z^2">
-  </p>
-  <p>Text: 
-    <span id="txt_eq" role="math" title="x^2 + y^2 + z^2">x<sup>2</sup> + 
-      y<sup>2</sup> + z<sup>2</sup></span>
-  </p>
-</body>
-</html>
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -232,17 +232,19 @@
 @BINPATH@/components/necko.xpt
 @BINPATH@/components/loginmgr.xpt
 @BINPATH@/components/parentalcontrols.xpt
 @BINPATH@/components/places.xpt
 @BINPATH@/components/plugin.xpt
 @BINPATH@/components/pref.xpt
 @BINPATH@/components/prefetch.xpt
 @BINPATH@/components/profile.xpt
+#ifdef MOZ_ENABLE_PROFILER_SPS
 @BINPATH@/components/profiler.xpt
+#endif
 @BINPATH@/components/proxyObject.xpt
 @BINPATH@/components/rdf.xpt
 @BINPATH@/components/satchel.xpt
 @BINPATH@/components/saxparser.xpt
 @BINPATH@/components/sessionstore.xpt
 #ifdef MOZ_SERVICES_SYNC
 @BINPATH@/components/services-crypto.xpt
 #endif
--- a/browser/app/Makefile.in
+++ b/browser/app/Makefile.in
@@ -41,34 +41,35 @@
 
 DEPTH		= ../..
 topsrcdir	= @top_srcdir@
 srcdir		= @srcdir@
 VPATH		= @srcdir@
 
 include $(DEPTH)/config/autoconf.mk
 
-DIRS		= profile/extensions
+DIRS        = profile/extensions
+dist_dest   = $(DIST)/$(MOZ_MACBUNDLE_NAME)
 
 PREF_JS_EXPORTS = $(srcdir)/profile/firefox.js \
 		  $(srcdir)/profile/channel-prefs.js \
 		  $(NULL)
 
 
 # hardcode en-US for the moment
 AB_CD = en-US
 
 DEFINES += \
   -DAB_CD=$(AB_CD) \
   -DAPP_VERSION="$(MOZ_APP_VERSION)" \
   -DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" \
   -DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\" \
   $(NULL)
 
-ifdef LIBXUL_SDK
+ifdef LIBXUL_SDK #{
 include $(topsrcdir)/config/rules.mk
 else
 # Build a binary bootstrapping with XRE_main
 
 PROGRAM = $(MOZ_APP_NAME)$(BIN_SUFFIX)
 
 CPPSRCS = nsBrowserApp.cpp
 
@@ -123,46 +124,46 @@ endif
 ifeq ($(OS_ARCH),OS2)
 RESFILE=splashos2.res
 RCFLAGS += -DMOZ_PHOENIX
 RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\"
 endif
 
 include $(topsrcdir)/config/rules.mk
 
-ifeq ($(OS_ARCH),WINNT)
+ifeq ($(OS_ARCH),WINNT) #{
 #
 # Control the default heap size.
 # This is the heap returned by GetProcessHeap().
 # As we use the CRT heap, the default size is too large and wastes VM.
 #
 # The default heap size is 1MB on Win32.
 # The heap will grow if need be.
 #
 # Set it to 256k.  See bug 127069.
 #
-ifndef GNU_CC
+ifndef GNU_CC #{
 LDFLAGS += /HEAP:0x40000
-ifeq ($(OS_TEST),x86_64)
+ifeq ($(OS_TEST),x86_64) #{
 # set stack to 2MB on x64 build.  See bug 582910
 LDFLAGS += -STACK:2097152
-endif
-endif
-endif
+endif #}
+endif #}
+endif #}
 
 ifneq (,$(filter-out OS2 WINNT,$(OS_ARCH)))
 
 libs:: 
 	cp -p $(MOZ_APP_NAME)$(BIN_SUFFIX) $(DIST)/bin/$(MOZ_APP_NAME)-bin$(BIN_SUFFIX)
 
 GARBAGE += $(addprefix $(DIST)/bin/defaults/pref/, firefox.js)
 
 endif
 
-endif # LIBXUL_SDK
+endif #} LIBXUL_SDK
 
 ifeq ($(MOZ_WIDGET_TOOLKIT),gtk2)
 libs::
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/mozicon128.png $(DIST)/bin/icons
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default16.png  $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default32.png  $(DIST)/bin/chrome/icons/default
 	$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png  $(DIST)/bin/chrome/icons/default
 endif
@@ -183,52 +184,52 @@ endif
 
 LOWER_MAC_APP_NAME = $(shell echo $(MAC_APP_NAME) | tr '[A-Z]' '[a-z]')
 
 AB_CD = $(MOZ_UI_LOCALE)
 
 AB := $(firstword $(subst -, ,$(AB_CD)))
 
 clean clobber repackage::
-	$(RM) -r $(DIST)/$(MOZ_MACBUNDLE_NAME)
+	$(RM) -r $(dist_dest)
 
 ifdef LIBXUL_SDK
 APPFILES = Resources
 else
 APPFILES = MacOS
 endif
 
 libs repackage:: $(PROGRAM)
-	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
-	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(MOZ_MACBUNDLE_NAME) --exclude English.lproj
-	$(MKDIR) -p $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
-	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj
-	sed -e "s/%APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" -e "s/%LOWER_MAC_APP_NAME%/$(LOWER_MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Info.plist
-	sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/$(AB).lproj/InfoPlist.strings
-	rsync -a $(DIST)/bin/ $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/$(APPFILES)
+	$(MKDIR) -p $(dist_dest)/Contents/MacOS
+	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(dist_dest) --exclude English.lproj
+	$(MKDIR) -p $(dist_dest)/Contents/Resources/$(AB).lproj
+	rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(dist_dest)/Contents/Resources/$(AB).lproj
+	sed -e "s/%APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" -e "s/%LOWER_MAC_APP_NAME%/$(LOWER_MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(dist_dest)/Contents/Info.plist
+	sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(dist_dest)/Contents/Resources/$(AB).lproj/InfoPlist.strings
+	rsync -a $(DIST)/bin/ $(dist_dest)/Contents/$(APPFILES)
 ifdef LIBXUL_SDK
-	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/firefox
+	cp $(LIBXUL_DIST)/bin/$(XR_STUB_NAME) $(dist_dest)/Contents/MacOS/firefox
 else
-	$(RM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS/$(PROGRAM)
-	rsync -aL $(PROGRAM) $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/MacOS
+	$(RM) $(dist_dest)/Contents/MacOS/$(PROGRAM)
+	rsync -aL $(PROGRAM) $(dist_dest)/Contents/MacOS
 endif
-	cp -RL $(DIST)/branding/firefox.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/firefox.icns
-	cp -RL $(DIST)/branding/document.icns $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Resources/document.icns
-	printf APPLMOZB > $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/PkgInfo
+	cp -RL $(DIST)/branding/firefox.icns $(dist_dest)/Contents/Resources/firefox.icns
+	cp -RL $(DIST)/branding/document.icns $(dist_dest)/Contents/Resources/document.icns
+	printf APPLMOZB > $(dist_dest)/Contents/PkgInfo
 
 else
 ifdef LIBXUL_SDK
 libs::
 	cp $(LIBXUL_DIST)/bin/$(XULRUNNER_STUB_NAME)$(BIN_SUFFIX) $(DIST)/bin/firefox$(BIN_SUFFIX)
 endif
 endif
 
-ifdef LIBXUL_SDK
-ifndef SKIP_COPY_XULRUNNER
+ifdef LIBXUL_SDK #{
+ifndef SKIP_COPY_XULRUNNER #{
 libs::
-ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
-	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(MOZ_MACBUNDLE_NAME)/Contents/Frameworks
+ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{
+	rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(dist_dest)/Contents/Frameworks
 else
 	$(NSINSTALL) -D $(DIST)/bin/xulrunner
 	(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
-endif # cocoa
-endif # SKIP_COPY_XULRUNNER
-endif # LIBXUL_SDK
+endif #} cocoa
+endif #} SKIP_COPY_XULRUNNER
+endif #} LIBXUL_SDK
--- a/browser/base/content/sync/notification.xml
+++ b/browser/base/content/sync/notification.xml
@@ -52,27 +52,27 @@
         <children includes="notification"/>
       </xul:vbox>
       <children/>
     </content>
 
     <implementation>
       <constructor><![CDATA[
         let temp = {};
-        Cu.import("resource://services-sync/ext/Observers.js", temp);
+        Cu.import("resource://services-common/observers.js", temp);
         temp.Observers.add("weave:notification:added", this.onNotificationAdded, this);
         temp.Observers.add("weave:notification:removed", this.onNotificationRemoved, this);
 
         for each (var notification in Weave.Notifications.notifications)
           this._appendNotification(notification);
       ]]></constructor>
 
       <destructor><![CDATA[
         let temp = {};
-        Cu.import("resource://services-sync/ext/Observers.js", temp);
+        Cu.import("resource://services-common/observers.js", temp);
         temp.Observers.remove("weave:notification:added", this.onNotificationAdded, this);
         temp.Observers.remove("weave:notification:removed", this.onNotificationRemoved, this);
       ]]></destructor>
 
       <method name="onNotificationAdded">
         <parameter name="subject"/>
         <parameter name="data"/>
         <body><![CDATA[
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx-lion-universal/nightly
+++ /dev/null
@@ -1,25 +0,0 @@
-. $topsrcdir/build/macosx/universal/mozconfig
-
-# Universal builds override the default of browser (bug 575283 comment 29)
-ac_add_options --enable-application=browser
-
-ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-update-packaging
-ac_add_options --enable-codesighs
-ac_add_options --disable-install-strip
-ac_add_options --enable-signmar
-
-# Nightlies only since this has a cost in performance
-ac_add_options --enable-js-diagnostics
-
-# Needed to enable breakpad in application.ini
-export MOZILLA_OFFICIAL=1
-
-export MOZ_TELEMETRY_REPORTING=1
-mk_add_options MOZ_MAKE_FLAGS="-j12"
-
-ac_add_options --with-macbundlename-prefix=Firefox
-
-# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
-ac_add_options --enable-warnings-as-errors
-ac_add_options --with-ccache
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx-lion-universal/release
+++ /dev/null
@@ -1,20 +0,0 @@
-. $topsrcdir/build/macosx/universal/mozconfig
-
-# Universal builds override the default of browser (bug 575283 comment 29)
-ac_add_options --enable-application=browser
-
-ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-update-packaging
-ac_add_options --enable-official-branding
-
-# Needed to enable breakpad in application.ini
-export MOZILLA_OFFICIAL=1
-
-export MOZ_TELEMETRY_REPORTING=1
-
-# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
-ac_add_options --enable-warnings-as-errors
-
-# Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j4"
-ac_add_options --with-ccache
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx-lion-universal/shark
+++ /dev/null
@@ -1,26 +0,0 @@
-# Just like nightlies, but without tests, not on an update channel, and with
-# shark and dtrace enabled
-. $topsrcdir/build/macosx/universal/mozconfig
-
-# Universal builds override the default of browser (bug 575283 comment 29)
-ac_add_options --enable-application=browser
-
-ac_add_options --disable-tests
-ac_add_options --disable-install-strip
-
-# Needed to enable breakpad in application.ini
-export MOZILLA_OFFICIAL=1
-
-# Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j12"
-
-# shark specific options
-ac_add_options --enable-shark
-ac_add_options --enable-dtrace
-
-# Need this to prevent name conflicts with the normal nightly build packages
-export MOZ_PKG_SPECIAL="shark"
-
-# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
-ac_add_options --enable-warnings-as-errors
-ac_add_options --with-ccache
--- a/browser/config/mozconfigs/macosx-universal/nightly
+++ b/browser/config/mozconfigs/macosx-universal/nightly
@@ -11,17 +11,18 @@ ac_add_options --enable-signmar
 
 # Nightlies only since this has a cost in performance
 ac_add_options --enable-js-diagnostics
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 export MOZ_TELEMETRY_REPORTING=1
-mk_add_options MOZ_MAKE_FLAGS="-j4"
+mk_add_options MOZ_MAKE_FLAGS="-j12"
 
 ac_add_options --with-macbundlename-prefix=Firefox
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
+ac_add_options --with-ccache
 
 # Package js shell.
 export MOZ_PACKAGE_JSSHELL=1
--- a/browser/config/mozconfigs/macosx-universal/shark
+++ b/browser/config/mozconfigs/macosx-universal/shark
@@ -7,19 +7,20 @@ ac_add_options --enable-application=brow
 
 ac_add_options --disable-tests
 ac_add_options --disable-install-strip
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 # Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j4"
+mk_add_options MOZ_MAKE_FLAGS="-j12"
 
 # shark specific options
 ac_add_options --enable-shark
 ac_add_options --enable-dtrace
 
 # Need this to prevent name conflicts with the normal nightly build packages
 export MOZ_PKG_SPECIAL="shark"
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
+ac_add_options --with-ccache
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx32-lion/debug
+++ /dev/null
@@ -1,13 +0,0 @@
-. $topsrcdir/build/macosx/mozconfig.leopard
-ac_add_options --enable-debug
-ac_add_options --enable-trace-malloc
-ac_add_options --enable-signmar
-
-# Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j12"
-
-# Needed to enable breakpad in application.ini
-export MOZILLA_OFFICIAL=1
-
-ac_add_options --with-macbundlename-prefix=Firefox
-ac_add_options --with-ccache
--- a/browser/config/mozconfigs/macosx32/debug
+++ b/browser/config/mozconfigs/macosx32/debug
@@ -1,15 +1,16 @@
 . $topsrcdir/build/macosx/mozconfig.leopard
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 ac_add_options --enable-signmar
 
 # Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j4"
+mk_add_options MOZ_MAKE_FLAGS="-j12"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 ac_add_options --with-macbundlename-prefix=Firefox
+ac_add_options --with-ccache
 
 # Package js shell.
 export MOZ_PACKAGE_JSSHELL=1
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx64-lion/debug
+++ /dev/null
@@ -1,18 +0,0 @@
-. $topsrcdir/build/macosx/common
-
-ac_add_options --enable-debug
-ac_add_options --enable-trace-malloc
-ac_add_options --enable-accessibility
-ac_add_options --enable-signmar
-
-# Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j12"
-
-# Needed to enable breakpad in application.ini
-export MOZILLA_OFFICIAL=1
-
-ac_add_options --with-macbundlename-prefix=Firefox
-
-# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
-ac_add_options --enable-warnings-as-errors
-ac_add_options --with-ccache
deleted file mode 100644
--- a/browser/config/mozconfigs/macosx64-lion/l10n-mozconfig
+++ /dev/null
@@ -1,5 +0,0 @@
-ac_add_options --with-l10n-base=../../l10n-central
-ac_add_options --enable-official-branding
-ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
-ac_add_options --enable-update-packaging
-ac_add_options --with-ccache
--- a/browser/config/mozconfigs/macosx64/debug
+++ b/browser/config/mozconfigs/macosx64/debug
@@ -1,20 +1,21 @@
 . $topsrcdir/build/macosx/common
 
 ac_add_options --enable-debug
 ac_add_options --enable-trace-malloc
 ac_add_options --enable-accessibility
 ac_add_options --enable-signmar
 
 # Enable parallel compiling
-mk_add_options MOZ_MAKE_FLAGS="-j4"
+mk_add_options MOZ_MAKE_FLAGS="-j12"
 
 # Needed to enable breakpad in application.ini
 export MOZILLA_OFFICIAL=1
 
 ac_add_options --with-macbundlename-prefix=Firefox
 
 # Treat warnings as errors in directories with FAIL_ON_WARNINGS.
 ac_add_options --enable-warnings-as-errors
+ac_add_options --with-ccache
 
 # Package js shell.
 export MOZ_PACKAGE_JSSHELL=1
--- a/browser/config/mozconfigs/macosx64/l10n-mozconfig
+++ b/browser/config/mozconfigs/macosx64/l10n-mozconfig
@@ -1,4 +1,5 @@
 ac_add_options --with-l10n-base=../../l10n-central
 ac_add_options --enable-official-branding
 ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
 ac_add_options --enable-update-packaging
+ac_add_options --with-ccache
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -237,17 +237,19 @@
 @BINPATH@/components/necko.xpt
 @BINPATH@/components/loginmgr.xpt
 @BINPATH@/components/parentalcontrols.xpt
 @BINPATH@/components/places.xpt
 @BINPATH@/components/plugin.xpt
 @BINPATH@/components/pref.xpt
 @BINPATH@/components/prefetch.xpt
 @BINPATH@/components/profile.xpt
+#ifdef MOZ_ENABLE_PROFILER_SPS
 @BINPATH@/components/profiler.xpt
+#endif
 @BINPATH@/components/rdf.xpt
 @BINPATH@/components/satchel.xpt
 @BINPATH@/components/saxparser.xpt
 @BINPATH@/components/sessionstore.xpt
 @BINPATH@/components/services-crypto-component.xpt
 @BINPATH@/components/shellservice.xpt
 @BINPATH@/components/shistory.xpt
 @BINPATH@/components/spellchecker.xpt
--- a/browser/installer/removed-files.in
+++ b/browser/installer/removed-files.in
@@ -1026,16 +1026,23 @@ xpicleanup@BIN_SUFFIX@
   modules/PlacesUIUtils.jsm
   modules/PlacesUtils.jsm
   modules/PluginProvider.jsm
   modules/PluralForm.jsm
   modules/PopupNotifications.jsm
   modules/PropertyPanel.jsm
   modules/reflect.jsm
   modules/Services.jsm
+  modules/services-common/async.js
+  modules/services-common/log4moz.js
+  modules/services-common/observers.js
+  modules/services-common/preferences.js
+  modules/services-common/rest.js
+  modules/services-common/stringbundle.js
+  modules/services-common/utils.js
   modules/services-sync/auth.js
   modules/services-sync/base_records/collection.js
   modules/services-sync/base_records/crypto.js
   modules/services-sync/base_records/keys.js
   modules/services-sync/base_records/wbo.js
   modules/services-sync/constants.js
   modules/services-sync/engines/bookmarks.js
   modules/services-sync/engines/clients.js
--- a/build/mobile/robocop/FennecMochitestAssert.java.in
+++ b/build/mobile/robocop/FennecMochitestAssert.java.in
@@ -58,22 +58,22 @@ public class FennecMochitestAssert imple
     // Measure the time it takes to run test case
     private long mStartTime = 0;
 
     public FennecMochitestAssert() {
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message, Throwable t) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message, t);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
     }
 
     /** Set the filename used for dumpLog. */
     public void setLogFile(String filename) {
         FennecNativeDriver.setLogFile(filename);
 
         String message;
         if (!mLogStarted) {
--- a/build/mobile/robocop/FennecNativeActions.java.in
+++ b/build/mobile/robocop/FennecNativeActions.java.in
@@ -58,16 +58,18 @@ import android.os.SystemClock;
 import android.view.View;
 import android.view.KeyEvent;
 import android.util.Log;
 
 import org.json.*;
 
 import com.jayway.android.robotium.solo.Solo;
 
+import static @ANDROID_PACKAGE_NAME@.FennecNativeDriver.LogLevel;
+
 public class FennecNativeActions implements Actions {
     private Solo mSolo;
     private Instrumentation mInstr;
     private Activity mGeckoApp;
 
     // Objects for reflexive access of fennec classes.
     private ClassLoader mClassLoader;
     private Class mGel;
@@ -99,25 +101,25 @@ public class FennecNativeActions impleme
             parameters = new Class[1];
             parameters[0] = mGe;
             mSendGE = mGas.getMethod("sendEventToGecko", parameters);
 
             mGetLayerClient = activity.getClass().getMethod("getLayerClient");
             Class gslc = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoLayerClient");
             mDrawListener = mClassLoader.loadClass("org.mozilla.gecko.gfx.GeckoLayerClient$DrawListener");
             mSetDrawListener = gslc.getDeclaredMethod("setDrawListener", mDrawListener);
-         } catch (ClassNotFoundException e) {
-             e.printStackTrace();
-         } catch (SecurityException e) {
-             e.printStackTrace();
-         } catch (NoSuchMethodException e) {
-             e.printStackTrace();
-         } catch (IllegalArgumentException e) {
-             e.printStackTrace();
-         }
+        } catch (ClassNotFoundException e) {
+            FennecNativeDriver.log(LogLevel.ERROR, e);
+        } catch (SecurityException e) {
+            FennecNativeDriver.log(LogLevel.ERROR, e);
+        } catch (NoSuchMethodException e) {
+            FennecNativeDriver.log(LogLevel.ERROR, e);
+        } catch (IllegalArgumentException e) {
+            FennecNativeDriver.log(LogLevel.ERROR, e);
+        }
     }
 
     class wakeInvocationHandler implements InvocationHandler {
         private final GeckoEventExpecter mEventExpecter;
 
         public wakeInvocationHandler(GeckoEventExpecter expecter) {
             mEventExpecter = expecter;
         }
@@ -132,17 +134,17 @@ public class FennecNativeActions impleme
                 return this == args[0];
             }
             if(methodName.equals("clone")) {
                 return this;
             }
             if(methodName.equals("hashCode")) {
                 return 314;
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG, 
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG, 
                 "Waking up on "+methodName);
             mEventExpecter.notifyOfEvent();
             return null;
         }
     }
 
     class GeckoEventExpecter implements EventExpecter {
         private final String mGeckoEvent;
@@ -154,80 +156,80 @@ public class FennecNativeActions impleme
             mRegistrationParams = registrationParams;
         }
 
         public synchronized void blockForEvent() {
             while (! mEventReceived) {
                 try {
                     this.wait();
                 } catch (InterruptedException ie) {
-                    ie.printStackTrace();
+                    FennecNativeDriver.log(LogLevel.ERROR, ie);
                     break;
                 }
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                 "unblocked on expecter for " + mGeckoEvent);
         }
 
         public synchronized boolean eventReceived() {
             return mEventReceived;
         }
 
         void notifyOfEvent() {
             try {
                 mUnregisterGEL.invoke(null, mRegistrationParams);
             } catch (IllegalAccessException e) {
-                e.printStackTrace();
+                FennecNativeDriver.log(LogLevel.ERROR, e);
             } catch (InvocationTargetException e) {
-                e.printStackTrace();
+                FennecNativeDriver.log(LogLevel.ERROR, e);
             }
-            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                 "received event " + mGeckoEvent);
             synchronized (this) {
                 mEventReceived = true;
                 this.notifyAll();
             }
         }
     }
     
     public EventExpecter expectGeckoEvent(String geckoEvent) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
             "waiting for "+geckoEvent);
         try {
             Class [] interfaces = new Class[1];
             interfaces[0] = mGel;
             Object[] finalParams = new Object[2];
             finalParams[0] = geckoEvent;
          
             GeckoEventExpecter expecter = new GeckoEventExpecter(geckoEvent, finalParams);
             wakeInvocationHandler wIH = new wakeInvocationHandler(expecter);
             Object proxy = Proxy.newProxyInstance(mClassLoader, interfaces, wIH);
             finalParams[1] = proxy;
             mRegisterGEL.invoke(null, finalParams);
             
             return expecter;
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(LogLevel.ERROR, e);
         }
         return null;
     }
 
     class DrawListenerProxy implements InvocationHandler {
         private final PaintExpecter mPaintExpecter;
 
         DrawListenerProxy(PaintExpecter paintExpecter) {
             mPaintExpecter = paintExpecter;
         }
 
         public Object invoke(Object proxy, Method method, Object[] args) {
             String methodName = method.getName();
             if ("drawFinished".equals(methodName)) {
-                FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_DEBUG,
+                FennecNativeDriver.log(FennecNativeDriver.LogLevel.DEBUG,
                     "Received drawFinished notification");
                 mPaintExpecter.notifyOfEvent();
             } else if ("toString".equals(methodName)) {
                 return "DrawListenerProxy";
             } else if ("equals".equals(methodName)) {
                 return false;
             } else if ("hashCode".equals(methodName)) {
                 return 0;
@@ -252,74 +254,74 @@ public class FennecNativeActions impleme
             }
         }
 
         public synchronized void blockForEvent() {
             while (!mPaintDone) {
                 try {
                     this.wait();
                 } catch (InterruptedException ie) {
-                    ie.printStackTrace();
+                    FennecNativeDriver.log(LogLevel.ERROR, ie);
                     break;
                 }
             }
             try {
                 mSetDrawListener.invoke(mLayerClient, (Object)null);
             } catch (Exception e) {
-                e.printStackTrace();
+                FennecNativeDriver.log(LogLevel.ERROR, e);
             }
         }
 
         public synchronized boolean eventReceived() {
             return mPaintDone;
         }
 
         public synchronized void blockUntilClear(long millis) {
             if (millis <= 0) {
                 throw new IllegalArgumentException("millis must be > 0");
             }
             // wait for at least one event
             while (!mPaintDone) {
                 try {
                     this.wait();
                 } catch (InterruptedException ie) {
-                    ie.printStackTrace();
+                    FennecNativeDriver.log(LogLevel.ERROR, ie);
                     break;
                 }
             }
             // now wait for a period of millis where we don't get an event
             long startTime = SystemClock.uptimeMillis();
             while (true) {
                 try {
                     this.wait(millis);
                 } catch (InterruptedException ie) {
-                    ie.printStackTrace();
+                    FennecNativeDriver.log(LogLevel.ERROR, ie);
                     break;
                 }
                 long endTime = SystemClock.uptimeMillis();
                 if (endTime - startTime >= millis) {
                     // success
                     break;
                 }
                 // we got a notify() before we could wait long enough, so we need to start over
                 startTime = endTime;
             }
             try {
                 mSetDrawListener.invoke(mLayerClient, (Object)null);
             } catch (Exception e) {
-                e.printStackTrace();
+                FennecNativeDriver.log(LogLevel.ERROR, e);
             }
         }
     }
 
     public RepeatedEventExpecter expectPaint() {
         try {
             return new PaintExpecter();
         } catch (Exception e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(LogLevel.ERROR, e);
             return null;
         }
     }
 
     public void sendSpecialKey(SpecialKey button) {
         switch(button) {
             case DOWN:
                 mInstr.sendCharacterSync(KeyEvent.KEYCODE_DPAD_DOWN);
--- a/build/mobile/robocop/FennecNativeDriver.java.in
+++ b/build/mobile/robocop/FennecNativeDriver.java.in
@@ -73,37 +73,37 @@ public class FennecNativeDriver implemen
     private static final int FRAME_TIME_THRESHOLD = 17;     // allow 17ms per frame (~60fps)
 
     // Map of IDs to element names.
     private HashMap mLocators = null;
     private Activity mActivity;
     private Solo mSolo;
 
     private static String mLogFile = null;
-    private static LogLevel mLogLevel = LogLevel.LOG_LEVEL_INFO;
+    private static LogLevel mLogLevel = LogLevel.INFO;
 
     // Objects for reflexive access of fennec classes.
     private ClassLoader mClassLoader;
     private Class mGel;
     private Class mGe;
     private Class mGas;
     private Method mRegisterGEL;
     private Method mUnregisterGEL;
     private Method mSendGE;
     private Method _startFrameRecording;
     private Method _stopFrameRecording;
     private Method _startCheckerboardRecording;
     private Method _stopCheckerboardRecording;
     private Method _getPixels;
 
     public enum LogLevel {
-        LOG_LEVEL_DEBUG(1), 
-        LOG_LEVEL_INFO(2),    
-        LOG_LEVEL_WARN(3), 
-        LOG_LEVEL_ERROR(4);
+        DEBUG(1),
+        INFO(2),
+        WARN(3),
+        ERROR(4);
 
         private int mValue;
         LogLevel(int value) {
             mValue = value;
         }
         public boolean isEnabled(LogLevel configuredLevel) {
             return mValue >= configuredLevel.getValue();
         }
@@ -137,25 +137,25 @@ public class FennecNativeDriver implemen
             Class gfx = mClassLoader.loadClass("org.mozilla.gecko.gfx.PanningPerfAPI");
             _startFrameRecording = gfx.getDeclaredMethod("startFrameTimeRecording");
             _stopFrameRecording = gfx.getDeclaredMethod("stopFrameTimeRecording");
             _startCheckerboardRecording = gfx.getDeclaredMethod("startCheckerboardRecording");
             _stopCheckerboardRecording = gfx.getDeclaredMethod("stopCheckerboardRecording");
 
             Class layerView = mClassLoader.loadClass("org.mozilla.gecko.gfx.LayerView");
             _getPixels = layerView.getDeclaredMethod("getPixels");
-         } catch (ClassNotFoundException e) {
-             e.printStackTrace();
-         } catch (SecurityException e) {
-             e.printStackTrace();
-         } catch (NoSuchMethodException e) {
-             e.printStackTrace();
-         } catch (IllegalArgumentException e) {
-             e.printStackTrace();
-         }
+        } catch (ClassNotFoundException e) {
+            log(LogLevel.ERROR, e);
+        } catch (SecurityException e) {
+            log(LogLevel.ERROR, e);
+        } catch (NoSuchMethodException e) {
+            log(LogLevel.ERROR, e);
+        } catch (IllegalArgumentException e) {
+            log(LogLevel.ERROR, e);
+        }
     }
 
     //Information on the location of the Gecko Frame.
     private boolean mGeckoInfo = false;
     private int mGeckoTop = 100;
     private int mGeckoLeft = 0;
     private int mGeckoHeight= 700;
     private int mGeckoWidth = 1024;
@@ -213,19 +213,19 @@ public class FennecNativeDriver implemen
         throw new RoboCopException("Element does not exist in the list");
     }
 
     public void startFrameRecording() {
         try {
             Object [] params = null;
             _startFrameRecording.invoke(null, params);
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
     }
 
     public int stopFrameRecording() {
         Class [] parameters = new Class[1];
         parameters[0] = null;
 
         try {
@@ -234,80 +234,80 @@ public class FennecNativeDriver implemen
             int numDelays = 0;
             for (int i = 1; i < frames.size(); i++) {
                 if (frames.get(i) - frames.get(i-1) > FRAME_TIME_THRESHOLD) {
                     numDelays++;
                 }
             }
             return numDelays;
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
 
         return 0;
     }
 
     public void startCheckerboardRecording() {
         try {
             Object [] params = null;
             _startCheckerboardRecording.invoke(null, params);
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
     }
 
     public float stopCheckerboardRecording() {
         Class [] parameters = new Class[1];
         parameters[0] = null;
 
         try {
             Object [] params = null;
             List<Float> checkerboard = (List<Float>)_stopCheckerboardRecording.invoke(null, params);
             float completeness = 0;
             for (float val : checkerboard) {
                 completeness += (1.0f - val);
             }
             return completeness / (float)checkerboard.size();
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
 
         return 0.0f;
     }
 
     private View getSurfaceView() {
         try {
             Class c = Class.forName("org.mozilla.gecko.gfx.LayerView");
             for (View v : mSolo.getCurrentViews()) {
                 if (c.isInstance(v)) {
                     return v;
                 }
             }
         } catch (ClassNotFoundException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
         return null;
     }
 
     public PaintedSurface getPaintedSurface() {
         View view = getSurfaceView();
         if (view == null) {
             return null;
         }
         IntBuffer pixelBuffer;
         try {
             pixelBuffer = (IntBuffer)_getPixels.invoke(view);
         } catch (Exception e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
             return null;
         }
 
         // now we need to (1) flip the image, because GL likes to do things up-side-down,
         // and (2) rearrange the bits from AGBR-8888 to ARGB-8888.
         int w = view.getWidth();
         int h = view.getHeight();
         pixelBuffer.position(0);
@@ -336,17 +336,17 @@ public class FennecNativeDriver implemen
                     dos.close();
                 }
                 // closing dos automatically closes bos
                 if (fos != null) {
                     fos.flush();
                     fos.close();
                 }
             } catch (IOException e) {
-                e.printStackTrace();
+                log(LogLevel.ERROR, e);
                 throw new RoboCopException("exception closing pixel writer on file: " + mapFile);
             }
         }
         return new PaintedSurface(mapFile, w, h);
     }
 
     public int mHeight=0;
     public int mScrollHeight=0;
@@ -361,17 +361,17 @@ public class FennecNativeDriver implemen
                 mScrollHeight = jo.getInt("y");
                 mHeight = jo.getInt("cheight");
                 // We don't want a height of 0. That means it's a bad response.
                 if (mHeight > 0) {
                     mPageHeight = jo.getInt("height");
                 }
 
             } catch( Throwable e) {
-                FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN, 
+                FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN, 
                     "WARNING: ScrollReceived, but read wrong!");
             }
             return null;
         }
     }
 
     public int getScrollHeight() {
         return mScrollHeight;
@@ -388,19 +388,19 @@ public class FennecNativeDriver implemen
         try {
             Class [] interfaces = new Class[1];
             interfaces[0] = mGel;
             Object[] finalParams = new Object[2];
             finalParams[0] = "robocop:scroll";
             finalParams[1] = Proxy.newProxyInstance(mClassLoader, interfaces, new scrollHandler());
             mRegisterGEL.invoke(null, finalParams);
         } catch (IllegalAccessException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         } catch (InvocationTargetException e) {
-            e.printStackTrace();
+            log(LogLevel.ERROR, e);
         }
 
     }
 
     /**
      *  Takes a filename, loads the file, and returns a string version of the entire file.
      */
     public static String getFile(String filename)
@@ -411,18 +411,18 @@ public class FennecNativeDriver implemen
         try {
             br = new BufferedReader(new FileReader(filename));
             String line;
 
             while ((line = br.readLine()) != null) {
                 text.append(line);
                 text.append('\n');
             }
-        } catch(IOException e) {
-            e.printStackTrace();
+        } catch (IOException e) {
+            log(LogLevel.ERROR, e);
         } finally {
             try {
                 br.close();
             } catch (IOException e) {
             }
         }
         return text.toString();    
     }
@@ -488,19 +488,19 @@ public class FennecNativeDriver implemen
             }
             // PrintWriter doesn't throw IOE but sets an error flag instead,
             // so check for that
             if (pw.checkError()) {
                 Log.e("Robocop", "exception with file writer on: " + mLogFile);
             }
         }
 
-        if (level == LogLevel.LOG_LEVEL_INFO) {
+        if (level == LogLevel.INFO) {
             Log.i("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_DEBUG) {
+        } else if (level == LogLevel.DEBUG) {
             Log.d("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_WARN) {
+        } else if (level == LogLevel.WARN) {
             Log.w("Robocop", message, t);
-        } else if (level == LogLevel.LOG_LEVEL_ERROR) {
+        } else if (level == LogLevel.ERROR) {
             Log.e("Robocop", message, t);
         }
     }
 }
--- a/build/mobile/robocop/FennecNativeElement.java.in
+++ b/build/mobile/robocop/FennecNativeElement.java.in
@@ -71,29 +71,29 @@ public class FennecNativeElement impleme
     public void click() {
         final SynchronousQueue syncQueue = new SynchronousQueue();
         mActivity.runOnUiThread(
             new Runnable() {
                 public void run() {
                     View view = (View)mActivity.findViewById(mId);
                     if(view != null) {
                         if (!view.performClick()) {
-                            FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_WARN,
+                            FennecNativeDriver.log(FennecNativeDriver.LogLevel.WARN,
                                 "Robocop called click on an element with no listener");
                         }
                     } else {
                         throw new RoboCopException("click: unable to find view "+mId); 
                     }
                     syncQueue.offer(new Object());
                 }
             });
         try {
             syncQueue.take();
         } catch (InterruptedException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
         }
     }
 
     private Object mText;
 
     public String getText() {
         final SynchronousQueue syncQueue = new SynchronousQueue();
         mActivity.runOnUiThread(
@@ -124,17 +124,17 @@ public class FennecNativeElement impleme
                     syncQueue.offer(new Object());
                 } // end of run() method definition
             } // end of anonymous Runnable object instantiation
         );
         try {     
             // Wait for the UiThread code to finish running
             syncQueue.take();
         } catch (InterruptedException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
         }
         if (mText == null) {
             throw new RoboCopException("getText: Text is null for view "+mId);
         }
         return mText.toString();
     }
 
     private boolean mDisplayed;
@@ -150,14 +150,14 @@ public class FennecNativeElement impleme
                         mDisplayed = true;
                     }
                     syncQueue.offer(new Object());
                 }
             });
         try {
             syncQueue.take();
         } catch (InterruptedException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
         }
         return mDisplayed;
     }
 
 }
--- a/build/mobile/robocop/FennecTalosAssert.java.in
+++ b/build/mobile/robocop/FennecTalosAssert.java.in
@@ -41,22 +41,22 @@ package @ANDROID_PACKAGE_NAME@;
 public class FennecTalosAssert implements Assert {
     
     public FennecTalosAssert() { }
 
     /**
      *  Write information to a logfile and logcat
      */
     public void dumpLog(String message) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message);
     }
 
     /** Write information to a logfile and logcat */
     public void dumpLog(String message, Throwable t) {
-        FennecNativeDriver.log(FennecNativeDriver.LogLevel.LOG_LEVEL_INFO, message, t);
+        FennecNativeDriver.log(FennecNativeDriver.LogLevel.INFO, message, t);
     }
 
     /**
      *  Set the filename used for dumpLog.
      */
     public void setLogFile(String filename) {
         FennecNativeDriver.setLogFile(filename);
     }
--- a/build/mobile/robocop/PaintedSurface.java.in
+++ b/build/mobile/robocop/PaintedSurface.java.in
@@ -24,19 +24,19 @@ public class PaintedSurface {
         
         try {
             File f = new File(filename);
             int pixelSize = (int)f.length();
             
             FileInputStream pixelFile = new FileInputStream(filename);
             mPixelBuffer = pixelFile.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, pixelSize);
         } catch (java.io.FileNotFoundException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
         } catch (java.io.IOException e) {
-            e.printStackTrace();
+            FennecNativeDriver.log(FennecNativeDriver.LogLevel.ERROR, e);
         }
     }
 
     public final int getPixelAt(int x, int y) {
         if (mPixelBuffer == null) {
             throw new RoboCopException("Trying to access PaintedSurface with no active PixelBuffer");
         }
 
--- a/config/config.mk
+++ b/config/config.mk
@@ -400,21 +400,16 @@ MY_CONFIG	:= $(DEPTH)/config/myconfig.mk
 MY_RULES	:= $(DEPTH)/config/myrules.mk
 
 #
 # Default command macros; can be overridden in <arch>.mk.
 #
 CCC = $(CXX)
 PURIFY = purify $(PURIFYOPTIONS)
 QUANTIFY = quantify $(QUANTIFYOPTIONS)
-ifdef CROSS_COMPILE
-XPIDL_COMPILE = $(LIBXUL_DIST)/host/bin/host_xpidl$(HOST_BIN_SUFFIX)
-else
-XPIDL_COMPILE = $(LIBXUL_DIST)/bin/xpidl$(BIN_SUFFIX)
-endif
 XPIDL_LINK = $(PYTHON) $(LIBXUL_DIST)/sdk/bin/xpt.py link
 
 # Java macros
 JAVA_GEN_DIR  = _javagen
 JAVA_DIST_DIR = $(DEPTH)/$(JAVA_GEN_DIR)
 JAVA_IFACES_PKG_NAME = org/mozilla/interfaces
 
 INCLUDES = \
--- a/configure.in
+++ b/configure.in
@@ -7225,17 +7225,17 @@ AC_SUBST(DLLFLAGS)
 dnl We need to wrap dlopen and related functions on Android because we use
 dnl our own linker.
 if test "$OS_TARGET" = Android; then
     WRAP_LDFLAGS="${WRAP_LDFLAGS} -L$_objdir/dist/lib -lmozglue"
     if test -n "$MOZ_OLD_LINKER"; then
         WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=dlopen,--wrap=dlclose,--wrap=dlerror,--wrap=dlsym,--wrap=dladdr"
     fi
     WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=getaddrinfo,--wrap=freeaddrinfo,--wrap=gai_strerror"
-    WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork"
+    WRAP_LDFLAGS="${WRAP_LDFLAGS} -Wl,--wrap=fork,--wrap=pthread_atfork,--wrap=raise"
 fi
 
 dnl ========================================================
 dnl = Use malloc wrapper lib
 dnl ========================================================
 MOZ_ARG_ENABLE_BOOL(wrap-malloc,
 [  --enable-wrap-malloc    Wrap malloc calls (gnu linker only)],
     _WRAP_MALLOC=1,
--- a/content/base/src/nsDOMMutationObserver.cpp
+++ b/content/base/src/nsDOMMutationObserver.cpp
@@ -580,16 +580,46 @@ nsDOMMutationObserver::Disconnect()
     mReceivers[i]->Disconnect(false);
   }
   mReceivers.Clear();
   mCurrentMutations.Clear();
   mPendingMutations.Clear();
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsDOMMutationObserver::TakeRecords(nsIVariant** aRetVal)
+{
+  *aRetVal = TakeRecords().get();
+  return NS_OK;
+}
+
+already_AddRefed<nsIVariant>
+nsDOMMutationObserver::TakeRecords()
+{
+  nsCOMPtr<nsIWritableVariant> mutations =
+    do_CreateInstance("@mozilla.org/variant;1");
+  PRInt32 len = mPendingMutations.Count();
+  if (len == 0) {
+    mutations->SetAsEmptyArray();
+  } else {
+    nsTArray<nsIDOMMutationRecord*> mods(len);
+    for (PRInt32 i = 0; i < len; ++i) {
+      mods.AppendElement(mPendingMutations[i]);
+    }
+
+    mutations->SetAsArray(nsIDataType::VTYPE_INTERFACE,
+                          &NS_GET_IID(nsIDOMMutationRecord),
+                          mods.Length(),
+                          const_cast<void*>(
+                            static_cast<const void*>(mods.Elements())));
+    mPendingMutations.Clear();
+  }
+  return mutations.forget();
+}
 
 NS_IMETHODIMP
 nsDOMMutationObserver::Initialize(nsISupports* aOwner, JSContext* cx,
                                   JSObject* obj, PRUint32 argc, jsval* argv)
 {
   mOwner = do_QueryInterface(aOwner);
   if (!mOwner) {
     NS_WARNING("Unexpected nsIJSNativeInitializer owner");
@@ -634,31 +664,18 @@ nsDOMMutationObserver::HandleMutation()
     return;
   }
   nsCxPusher pusher;
   nsCOMPtr<nsIDOMEventTarget> et = do_QueryInterface(mOwner);
   if (!mCallback || !pusher.Push(et)) {
     mPendingMutations.Clear();
     return;
   }
-  
-  PRInt32 len = mPendingMutations.Count();
-  nsTArray<nsIDOMMutationRecord*> mods(len);
-  for (PRInt32 i = 0; i < len; ++i) {
-    mods.AppendElement(mPendingMutations[i]);
-  }
-  
-  nsCOMPtr<nsIWritableVariant> mutations =
-    do_CreateInstance("@mozilla.org/variant;1");
-  mutations->SetAsArray(nsIDataType::VTYPE_INTERFACE,
-                        &NS_GET_IID(nsIDOMMutationRecord),
-                        mods.Length(),
-                        const_cast<void*>(
-                          static_cast<const void*>(mods.Elements())));
-  mPendingMutations.Clear();
+
+  nsCOMPtr<nsIVariant> mutations = TakeRecords();
   nsAutoMicroTask mt;
   sCurrentObserver = this; // For 'this' handling.
   mCallback->HandleMutations(mutations, this);
   sCurrentObserver = nsnull;
 }
 
 class AsyncMutationHandler : public nsRunnable
 {
--- a/content/base/src/nsDOMMutationObserver.h
+++ b/content/base/src/nsDOMMutationObserver.h
@@ -147,17 +147,17 @@ protected:
     mRegisterTarget->AddMutationObserver(this);
     mRegisterTarget->SetMayHaveDOMMutationObserver();
     mRegisterTarget->OwnerDoc()->SetMayHaveDOMMutationObservers();
   }
 
   nsMutationReceiverBase(nsINode* aRegisterTarget,
                          nsMutationReceiverBase* aParent)
   : mTarget(nsnull), mObserver(nsnull), mParent(aParent),
-    mRegisterTarget(aRegisterTarget)
+    mRegisterTarget(aRegisterTarget), mKungFuDeathGrip(aParent->Target())
   {
     NS_ASSERTION(mParent->Subtree(), "Should clone a non-subtree observer!");
     mRegisterTarget->AddMutationObserver(this);
     mRegisterTarget->SetMayHaveDOMMutationObserver();
     mRegisterTarget->OwnerDoc()->SetMayHaveDOMMutationObservers();
   }
 
   bool ObservesAttr(mozilla::dom::Element* aElement,
@@ -190,16 +190,19 @@ protected:
   // The target for the MutationObserver.observe() method.
   nsINode*                           mTarget;
   nsIDOMMozMutationObserver*         mObserver;
   nsRefPtr<nsMutationReceiverBase>   mParent; // Cleared after microtask.
   // The node to which Gecko-internal nsIMutationObserver was registered to.
   // This is different than mTarget when dealing with transient observers.
   nsINode*                           mRegisterTarget;
   nsCOMArray<nsMutationReceiverBase> mTransientReceivers;
+  // While we have transient receivers, keep the original mutation receiver
+  // alive so it doesn't go away and disconnect all its transient receivers.
+  nsCOMPtr<nsINode>                  mKungFuDeathGrip;
   
 private:
   bool                               mSubtree;
   bool                               mChildList;
   bool                               mCharacterData;
   bool                               mCharacterDataOldValue;
   bool                               mAttributes;
   bool                               mAllAttributes;
@@ -312,16 +315,18 @@ public:
 
   static void Shutdown();
 protected:
   friend class nsMutationReceiver;
   friend class nsAutoMutationBatch;
   nsMutationReceiver* GetReceiverFor(nsINode* aNode, bool aMayCreate);
   void RemoveReceiver(nsMutationReceiver* aReceiver);
 
+  already_AddRefed<nsIVariant> TakeRecords();
+
   void GetAllSubtreeObserversFor(nsINode* aNode,
                                  nsTArray<nsMutationReceiver*>& aObservers);
   void ScheduleForRun();
   void RescheduleForRun();
 
   nsDOMMutationRecord* CurrentRecord(const nsAString& aType);
   bool HasCurrentRecord(const nsAString& aType);
 
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -660,17 +660,17 @@ nsRange::ComparePoint(nsIDOMNode* aParen
   if (!nsContentUtils::ContentIsDescendantOf(parent, mRoot)) {
     return NS_ERROR_DOM_WRONG_DOCUMENT_ERR;
   }
   
   if (parent->NodeType() == nsIDOMNode::DOCUMENT_TYPE_NODE) {
     return NS_ERROR_DOM_INVALID_NODE_TYPE_ERR;
   }
 
-  if (aOffset < 0 || aOffset > parent->Length()) {
+  if (aOffset < 0 || PRUint32(aOffset) > parent->Length()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
   
   PRInt32 cmp;
   if ((cmp = nsContentUtils::ComparePoints(parent, aOffset,
                                            mStartParent, mStartOffset)) <= 0) {
     
     *aResult = cmp;
@@ -924,17 +924,17 @@ nsRange::SetStart(nsIDOMNode* aParent, P
 }
 
 /* virtual */ nsresult
 nsRange::SetStart(nsINode* aParent, PRInt32 aOffset)
 {
   nsINode* newRoot = IsValidBoundary(aParent);
   NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
-  if (aOffset < 0 || aOffset > aParent->Length()) {
+  if (aOffset < 0 || PRUint32(aOffset) > aParent->Length()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   // Collapse if not positioned yet, if positioned in another doc or
   // if the new start is after end.
   if (!mIsPositioned || newRoot != mRoot ||
       nsContentUtils::ComparePoints(aParent, aOffset,
                                     mEndParent, mEndOffset) == 1) {
@@ -988,17 +988,17 @@ nsRange::SetEnd(nsIDOMNode* aParent, PRI
 
 
 /* virtual */ nsresult
 nsRange::SetEnd(nsINode* aParent, PRInt32 aOffset)
 {
   nsINode* newRoot = IsValidBoundary(aParent);
   NS_ENSURE_TRUE(newRoot, NS_ERROR_DOM_INVALID_NODE_TYPE_ERR);
 
-  if (aOffset < 0 || aOffset > aParent->Length()) {
+  if (aOffset < 0 || PRUint32(aOffset) > aParent->Length()) {
     return NS_ERROR_DOM_INDEX_SIZE_ERR;
   }
 
   // Collapse if not positioned yet, if positioned in another doc or
   // if the new end is before start.
   if (!mIsPositioned || newRoot != mRoot ||
       nsContentUtils::ComparePoints(mStartParent, mStartOffset,
                                     aParent, aOffset) == 1) {
--- a/content/base/test/test_mutationobservers.html
+++ b/content/base/test/test_mutationobservers.html
@@ -472,17 +472,55 @@ function testModalDialog() {
       observer.disconnect();
       m = null;
       didHandleCallback = true;
     });
   m.observe(div, { childList: true });
   div.innerHTML = "<span><span>foo</span></span>";
   window.showModalDialog("mutationobserver_dialog.html");
   ok(didHandleCallback, "Should have called the callback while showing modal dialog!");
-  then();
+  then(testTakeRecords);
+}
+
+function testTakeRecords() {
+  var s = "<span>1</span><span>2</span>";
+  div.innerHTML = s;
+  var takenRecords;
+  m = new M(function(records, observer) {
+      is(records.length, 3, "Should have got 3 records");
+
+      is(records[0].type, "attributes", "Should have got attributes");
+      is(records[0].attributeName, "foo", "");
+      is(records[1].type, "childList", "Should have got childList");
+      is(records[1].removedNodes.length, 2, "Should have got removedNodes");
+      is(records[1].addedNodes.length, 2, "Should have got addedNodes");
+      is(records[2].type, "attributes", "Should have got attributes");
+      is(records[2].attributeName, "foo", "");
+      
+      is(records.length, takenRecords.length, "Should have had similar mutations");
+      is(records[0].type, takenRecords[0].type, "Should have had similar mutations");
+      is(records[1].type, takenRecords[1].type, "Should have had similar mutations");
+      is(records[2].type, takenRecords[2].type, "Should have had similar mutations");
+      
+      is(records[1].removedNodes.length, takenRecords[1].removedNodes.length, "Should have had similar mutations");
+      is(records[1].addedNodes.length, takenRecords[1].addedNodes.length, "Should have had similar mutations");
+
+      is(m.takeRecords().length, 0, "Shouldn't have any records");
+      observer.disconnect();
+      then();
+      m = null;
+    });
+  m.observe(div, { childList: true, attributes: true });
+  div.setAttribute("foo", "bar");
+  div.innerHTML = s;
+  div.removeAttribute("foo");
+  takenRecords = m.takeRecords();
+  div.setAttribute("foo", "bar");
+  div.innerHTML = s;
+  div.removeAttribute("foo");
 }
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 </pre>
 <div id="log">
 </div>
--- a/content/canvas/src/WebGLContext.h
+++ b/content/canvas/src/WebGLContext.h
@@ -1162,17 +1162,17 @@ public:
       }
     }
 
     PRInt32 FindMaxUshortElement() {
       if (mHasCachedMaxUshortElement) {
         return mCachedMaxUshortElement;
       } else {
         mHasCachedMaxUshortElement = true;
-        mCachedMaxUshortElement = FindMaxElementInSubArray<GLshort>(mByteLength>>1, 0);
+        mCachedMaxUshortElement = FindMaxElementInSubArray<GLushort>(mByteLength>>1, 0);
         return mCachedMaxUshortElement;
       }
     }
 
     NS_DECL_ISUPPORTS
     NS_DECL_NSIWEBGLBUFFER
 
 protected:
--- a/content/canvas/src/WebGLContextGL.cpp
+++ b/content/canvas/src/WebGLContextGL.cpp
@@ -129,19 +129,25 @@ NS_IMETHODIMP WebGLContext::name(t1 a1, 
 
 /* void GlActiveTexture (in GLenum texture); */
 NS_IMETHODIMP
 WebGLContext::ActiveTexture(WebGLenum texture)
 {
     if (!IsContextStable())
         return NS_OK;
 
-    if (texture < LOCAL_GL_TEXTURE0 || texture >= LOCAL_GL_TEXTURE0 + mBound2DTextures.Length())
-        return ErrorInvalidEnum("ActiveTexture: texture unit %d out of range (0..%d)",
-                                texture, mBound2DTextures.Length()-1);
+    if (texture < LOCAL_GL_TEXTURE0 ||
+        texture >= LOCAL_GL_TEXTURE0 + PRUint32(mGLMaxTextureUnits))
+    {
+        return ErrorInvalidEnum(
+            "ActiveTexture: texture unit %d out of range. "
+            "Accepted values range from TEXTURE0 to TEXTURE0 + %d. "
+            "Notice that TEXTURE0 != 0.",
+            texture, mGLMaxTextureUnits);
+    }
 
     MakeContextCurrent();
     mActiveTexture = texture - LOCAL_GL_TEXTURE0;
     gl->fActiveTexture(texture);
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -1370,19 +1376,22 @@ WebGLContext::DisableVertexAttribArray(W
 
 int
 WebGLContext::WhatDoesVertexAttrib0Need()
 {
   // here we may assume that mCurrentProgram != null
 
     // work around Mac OSX crash, see bug 631420
 #ifdef XP_MACOSX
-    if (mAttribBuffers[0].enabled &&
+    if (gl->WorkAroundDriverBugs() &&
+        mAttribBuffers[0].enabled &&
         !mCurrentProgram->IsAttribInUse(0))
+    {
         return VertexAttrib0Status::EmulatedUninitializedArray;
+    }
 #endif
 
     return (gl->IsGLES2() || mAttribBuffers[0].enabled) ? VertexAttrib0Status::Default
          : mCurrentProgram->IsAttribInUse(0)            ? VertexAttrib0Status::EmulatedInitializedArray
                                                         : VertexAttrib0Status::EmulatedUninitializedArray;
 }
 
 bool
@@ -2637,17 +2646,20 @@ WebGLContext::GetProgramParameter(nsIWeb
             wrval->SetAsBool(bool(i));
         }
             break;
         case LOCAL_GL_VALIDATE_STATUS:
         {
             GLint i = 0;
 #ifdef XP_MACOSX
             // See comment in ValidateProgram below.
-            i = 1;
+            if (gl->WorkAroundDriverBugs())
+                i = 1;
+            else
+                gl->fGetProgramiv(progname, pname, &i);
 #else
             gl->fGetProgramiv(progname, pname, &i);
 #endif
             wrval->SetAsBool(bool(i));
         }
             break;
 
         default:
@@ -4392,18 +4404,20 @@ WebGLContext::ValidateProgram(nsIWebGLPr
     WebGLuint progname;
     if (!GetGLName<WebGLProgram>("validateProgram", pobj, &progname))
         return NS_OK;
 
     MakeContextCurrent();
 
 #ifdef XP_MACOSX
     // see bug 593867 for NVIDIA and bug 657201 for ATI. The latter is confirmed with Mac OS 10.6.7
-    LogMessageIfVerbose("validateProgram: implemented as a no-operation on Mac to work around crashes");
-    return NS_OK;
+    if (gl->WorkAroundDriverBugs()) {
+        LogMessageIfVerbose("validateProgram: implemented as a no-operation on Mac to work around crashes");
+        return NS_OK;
+    }
 #endif
 
     gl->fValidateProgram(progname);
 
     return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -4501,36 +4515,43 @@ WebGLContext::CompileShader(nsIWebGLShad
             return NS_OK;
 
         const nsPromiseFlatString& flatSource = PromiseFlatString(cleanSource);
 
         // shaderSource() already checks that the source stripped of comments is in the
         // 7-bit ASCII range, so we can skip the NS_IsAscii() check.
         const nsCString& sourceCString = NS_LossyConvertUTF16toASCII(flatSource);
 
-        const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
-        if (sourceCString.Length() > maxSourceLength)
-            return ErrorInvalidValue("compileShader: source has more than %d characters", maxSourceLength);
+        if (gl->WorkAroundDriverBugs()) {
+            const PRUint32 maxSourceLength = (PRUint32(1)<<18) - 1;
+            if (sourceCString.Length() > maxSourceLength)
+                return ErrorInvalidValue("compileShader: source has more than %d characters", 
+                                         maxSourceLength);
+        }
 
         const char *s = sourceCString.get();
 
         compiler = ShConstructCompiler((ShShaderType) shader->ShaderType(),
                                        SH_WEBGL_SPEC,
                                        targetShaderSourceLanguage,
                                        &resources);
 
         int compileOptions = 0;
         if (useShaderSourceTranslation) {
             compileOptions |= SH_OBJECT_CODE
                             | SH_MAP_LONG_VARIABLE_NAMES
                             | SH_ATTRIBUTES_UNIFORMS;
 #ifdef XP_MACOSX
             // work around bug 665578
-            if (!nsCocoaFeatures::OnLionOrLater() && gl->Vendor() == gl::GLContext::VendorATI)
+            if (gl->WorkAroundDriverBugs() &&
+                !nsCocoaFeatures::OnLionOrLater() &&
+                gl->Vendor() == gl::GLContext::VendorATI)
+            {
                 compileOptions |= SH_EMULATE_BUILT_IN_FUNCTIONS;
+            }
 #endif
         }
 
         if (!ShCompile(compiler, &s, 1, compileOptions)) {
             int len = 0;
             ShGetInfo(compiler, SH_INFO_LOG_LENGTH, &len);
 
             if (len) {
--- a/content/canvas/src/WebGLContextValidate.cpp
+++ b/content/canvas/src/WebGLContextValidate.cpp
@@ -636,17 +636,18 @@ WebGLContext::InitAndValidateGL()
         // specifically enabled on desktop GLSL.
         gl->fEnable(LOCAL_GL_VERTEX_PROGRAM_POINT_SIZE);
 
         // we don't do the following glEnable(GL_POINT_SPRITE) on ATI cards on Windows, because bug 602183 shows that it causes
         // crashes in the ATI/Windows driver; and point sprites on ATI seem like a lost cause anyway, see
         //    http://www.gamedev.net/community/forums/topic.asp?topic_id=525643
         // Also, if the ATI/Windows driver implements a recent GL spec version, this shouldn't be needed anyway.
 #ifdef XP_WIN
-        if (gl->Vendor() != gl::GLContext::VendorATI)
+        if (!(gl->WorkAroundDriverBugs() &&
+              gl->Vendor() == gl::GLContext::VendorATI))
 #else
         if (true)
 #endif
         {
             // gl_PointCoord is always available in ES2 GLSL and in newer desktop GLSL versions, but apparently
             // not in OpenGL 2 and apparently not (due to a driver bug) on certain NVIDIA setups. See:
             //   http://www.opengl.org/discussion_boards/ubbthreads.php?ubb=showflat&Number=261472
             gl->fEnable(LOCAL_GL_POINT_SPRITE);
--- a/content/html/document/src/ImageDocument.cpp
+++ b/content/html/document/src/ImageDocument.cpp
@@ -379,16 +379,17 @@ ImageDocument::SetScriptGlobalObject(nsI
     }
 
     target = do_QueryInterface(aScriptGlobalObject);
     target->AddEventListener(NS_LITERAL_STRING("resize"), this, false);
     target->AddEventListener(NS_LITERAL_STRING("keypress"), this, false);
 
     if (!nsContentUtils::IsChildOfSameType(this)) {
       LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelImageDocument.css"));
+      LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/TopLevelImageDocument.css"));
     }
   }
 }
 
 void
 ImageDocument::OnPageShow(bool aPersisted,
                           nsIDOMEventTarget* aDispatchStartTarget)
 {
--- a/content/html/document/src/VideoDocument.cpp
+++ b/content/html/document/src/VideoDocument.cpp
@@ -99,16 +99,17 @@ void
 VideoDocument::SetScriptGlobalObject(nsIScriptGlobalObject* aScriptGlobalObject)
 {
   // Set the script global object on the superclass before doing
   // anything that might require it....
   MediaDocument::SetScriptGlobalObject(aScriptGlobalObject);
 
   if (aScriptGlobalObject && !nsContentUtils::IsChildOfSameType(this)) {
     LinkStylesheet(NS_LITERAL_STRING("resource://gre/res/TopLevelVideoDocument.css"));
+    LinkStylesheet(NS_LITERAL_STRING("chrome://global/skin/TopLevelVideoDocument.css"));
   }
 }
 
 nsresult
 VideoDocument::CreateSyntheticVideoDocument(nsIChannel* aChannel,
                                             nsIStreamListener** aListener)
 {
   // make our generic document
--- a/content/html/document/src/nsHTMLDocument.cpp
+++ b/content/html/document/src/nsHTMLDocument.cpp
@@ -555,52 +555,52 @@ nsHTMLDocument::StartDocumentLoad(const 
                                   nsIChannel* aChannel,
                                   nsILoadGroup* aLoadGroup,
                                   nsISupports* aContainer,
                                   nsIStreamListener **aDocListener,
                                   bool aReset,
                                   nsIContentSink* aSink)
 {
   if (!aCommand) {
-    MOZ_NOT_REACHED("Command is mandatory");
+    MOZ_ASSERT(false, "Command is mandatory");
     return NS_ERROR_INVALID_POINTER;
   }
   if (aSink) {
-    MOZ_NOT_REACHED("Got a sink override. Should not happen for HTML doc.");
+    MOZ_ASSERT(false, "Got a sink override. Should not happen for HTML doc.");
     return NS_ERROR_INVALID_ARG;
   }
   if (!mIsRegularHTML) {
-    MOZ_NOT_REACHED("Must not set HTML doc to XHTML mode before load start.");
+    MOZ_ASSERT(false, "Must not set HTML doc to XHTML mode before load start.");
     return NS_ERROR_DOM_INVALID_STATE_ERR;
   }
 
   nsCAutoString contentType;
   aChannel->GetContentType(contentType);
 
   bool view = !strcmp(aCommand, "view") ||
               !strcmp(aCommand, "external-resource");
   bool viewSource = !strcmp(aCommand, "view-source");
   bool asData = !strcmp(aCommand, kLoadAsData);
   if(!(view || viewSource || asData)) {
-    MOZ_NOT_REACHED("Bad parser command");
+    MOZ_ASSERT(false, "Bad parser command");
     return NS_ERROR_INVALID_ARG;
   }
 
   bool html = contentType.EqualsLiteral(TEXT_HTML);
   bool xhtml = !html && contentType.EqualsLiteral(APPLICATION_XHTML_XML);
   bool plainText = !html && !xhtml && (contentType.EqualsLiteral(TEXT_PLAIN) ||
     contentType.EqualsLiteral(TEXT_CSS) ||
     contentType.EqualsLiteral(APPLICATION_JAVASCRIPT) ||
     contentType.EqualsLiteral(APPLICATION_XJAVASCRIPT) ||
     contentType.EqualsLiteral(TEXT_ECMASCRIPT) ||
     contentType.EqualsLiteral(APPLICATION_ECMASCRIPT) ||
     contentType.EqualsLiteral(TEXT_JAVASCRIPT) ||
     contentType.EqualsLiteral(APPLICATION_JSON));
   if (!(html || xhtml || plainText || viewSource)) {
-    MOZ_NOT_REACHED("Channel with bad content type.");
+    MOZ_ASSERT(false, "Channel with bad content type.");
     return NS_ERROR_INVALID_ARG;
   }
 
   bool loadAsHtml5 = true;
 
   if (!viewSource && xhtml) {
       // We're parsing XHTML as XML, remember that.
       mIsRegularHTML = false;
--- a/dom/base/nsScreen.cpp
+++ b/dom/base/nsScreen.cpp
@@ -367,18 +367,25 @@ nsScreen::MozLockOrientation(const nsASt
   }
 
   if (!GetOwner()) {
     *aReturn = false;
     return NS_OK;
   }
 
   if (!IsChromeType(GetOwner()->GetDocShell())) {
+    nsCOMPtr<nsIDOMDocument> doc;
+    GetOwner()->GetDocument(getter_AddRefs(doc));
+    if (!doc) {
+      *aReturn = false;
+      return NS_OK;
+    }
+
     bool fullscreen;
-    GetOwner()->GetFullScreen(&fullscreen);
+    doc->GetMozFullScreen(&fullscreen);
     if (!fullscreen) {
       *aReturn = false;
       return NS_OK;
     }
 
     nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(GetOwner());
     if (!target) {
       *aReturn = false;
--- a/dom/bindings/Codegen.py
+++ b/dom/bindings/Codegen.py
@@ -599,17 +599,17 @@ class CGClassHasInstanceHook(CGAbstractS
   nsISupports* native =
     nsContentUtils::XPConnect()->GetNativeOfWrapper(cx, instance);
   nsCOMPtr<%s> qiResult = do_QueryInterface(native);
   *bp = !!qiResult;
   return true;
 """ % (self.descriptor.name, self.descriptor.hasInstanceInterface)
 
 def isChromeOnly(m):
-    return m.extendedAttribute("ChromeOnly")
+    return m.getExtendedAttribute("ChromeOnly")
 
 class PropertyDefiner:
     """
     A common superclass for defining things on prototype objects.
 
     Subclasses should implement generateArray to generate the actual arrays of
     things we're defining.  They should also set self.chrome to the list of
     things exposed to chrome and self.regular to the list of things exposed to
@@ -956,26 +956,22 @@ class CGNativeToSupportsMethod(CGAbstrac
     interface chain in hopes of getting to something that singly-inherits from
     nsISupports.
     """
     def __init__(self, descriptor):
         args = [Argument(descriptor.nativeType + '*', 'aNative')]
         CGAbstractStaticMethod.__init__(self, descriptor, 'NativeToSupports', 'nsISupports*', args)
 
     def definition_body(self):
-        cast = "aNative"
-        whitespace = ""
-        addspace = ""
+        cur = CGGeneric("aNative")
         for proto in reversed(self.descriptor.prototypeChain[:-1]):
             d = self.descriptor.getDescriptor(proto)
-            cast = "static_cast<%s*>(%s)" % (d.nativeType, whitespace + cast)
-            addspace += "  "
-            whitespace = "\n  " + addspace
-        return """
-  return %s;""" % (cast)
+            cast = "static_cast<%s*>(\n" % d.nativeType;
+            cur = CGWrapper(CGIndenter(cur), pre=cast, post=")")
+        return CGIndenter(CGWrapper(cur, pre="return ", post=";")).define();
 
 class CGWrapMethod(CGAbstractMethod):
     def __init__(self, descriptor):
         # XXX can we wrap if we don't have an interface prototype object?
         assert descriptor.interface.hasInterfacePrototypeObject()
         args = [Argument('JSContext*', 'aCx'), Argument('JSObject*', 'aScope'),
                 Argument(descriptor.nativeType + '*', 'aObject'),
                 Argument('bool*', 'aTriedToWrap')]
@@ -1386,17 +1382,17 @@ class CGArgumentConverter(CGThing):
         CGThing.__init__(self)
         self.argument = argument
         # XXXbz should optional jsval args get JSVAL_VOID? What about
         # others?
         self.replacementVariables = {
             "index" : index,
             "argc" : argc,
             "argv" : argv,
-            "defaultValue" : "JSVAL_NULL",
+            "defaultValue" : "JSVAL_VOID",
             "name" : "arg%d" % index
             }
         if argument.optional:
             if argument.defaultValue:
                 self.replacementVariables["defaultValue"] = convertIDLDefaultValueToJSVal(argument.defaultValue)
             self.replacementVariables["argVal"] = string.Template(
                 "(${index} < ${argc} ? ${argv}[${index}] : ${defaultValue})"
                 ).substitute(self.replacementVariables)
--- a/dom/bindings/parser/WebIDL.py
+++ b/dom/bindings/parser/WebIDL.py
@@ -1335,17 +1335,17 @@ class IDLInterfaceMember(IDLObjectWithId
             attrlist = list(attr)
             identifier = attrlist.pop(0)
             self.handleExtendedAttribute(identifier, attrlist)
             self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True
 
     def handleExtendedAttribute(self, name, list):
         pass
 
-    def extendedAttribute(self, name):
+    def getExtendedAttribute(self, name):
         return self._extendedAttrDict.get(name, None)
 
 class IDLConst(IDLInterfaceMember):
     def __init__(self, location, identifier, type, value):
         IDLInterfaceMember.__init__(self, location, identifier,
                                     IDLInterfaceMember.Tags.Const)
 
         assert isinstance(type, IDLType)
--- a/dom/indexedDB/test/unit/test_keys.js
+++ b/dom/indexedDB/test/unit/test_keys.js
@@ -46,20 +46,20 @@ function testSteps()
     new Date(-1000),
     new Date(-10),
     new Date(-1),
     new Date(0),
     new Date(1),
     new Date(2),
     new Date(1000),
     new Date("1971-01-01"),
-    new Date("1971-01-01T01:01:01"),
-    new Date("1971-01-01T01:01:01.001"),
-    new Date("1971-01-01T01:01:01.01"),
-    new Date("1971-01-01T01:01:01.1"),
+    new Date("1971-01-01T01:01:01Z"),
+    new Date("1971-01-01T01:01:01.001Z"),
+    new Date("1971-01-01T01:01:01.01Z"),
+    new Date("1971-01-01T01:01:01.1Z"),
     new Date("1980-02-02"),
     new Date("3333-03-19T03:33:33.333"),
     "",
     "\x00",
     "\x00\x00",
     "\x00\x01",
     "\x01",
     "\x02",
--- a/dom/interfaces/core/nsIDOMMutationObserver.idl
+++ b/dom/interfaces/core/nsIDOMMutationObserver.idl
@@ -51,21 +51,22 @@ dictionary MutationObserverInit
   boolean characterData;
   boolean subtree;
   boolean attributeOldValue;
   boolean characterDataOldValue;
   jsval   attributeFilter; // DOMString[]
 };
 
 //[Constructor(in nsIMutationCallback aDoneCallback)]
-[scriptable, builtinclass, uuid(daeba265-9aa7-45ab-8de2-b6b039c13ced)]
+[scriptable, builtinclass, uuid(156e2ce4-e44a-45f3-92c2-e6611f391dae)]
 interface nsIDOMMozMutationObserver : nsISupports
 {
   [implicit_jscontext]
   void observe(in nsIDOMNode aTarget, in jsval aOptions);
   void disconnect();
+  nsIVariant takeRecords();
 };
 
 [scriptable, function, uuid(fb539590-b088-4d07-96ff-2cefbc90a198)]
 interface nsIMutationObserverCallback : nsISupports
 {
   void handleMutations(in nsIVariant aRecords, in nsIDOMMozMutationObserver aObserver);
 };
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -71,16 +71,17 @@
 #include "nsIObserver.h"
 #include "nsServiceManagerUtils.h"
 #include "nsXULAppAPI.h"
 #include "nsWeakReference.h"
 #include "nsIScriptError.h"
 #include "nsIConsoleService.h"
 #include "nsJSEnvironment.h"
 #include "SandboxHal.h"
+#include "nsDebugImpl.h"
 
 #include "History.h"
 #include "nsDocShellCID.h"
 #include "nsNetUtil.h"
 
 #include "base/message_loop.h"
 #include "base/task.h"
 
@@ -232,16 +233,19 @@ ConsoleListener::Observe(nsIConsoleMessa
 ContentChild* ContentChild::sSingleton;
 
 ContentChild::ContentChild()
 #ifdef ANDROID
  : mScreenSize(0, 0)
  , mID(PRUint64(-1))
 #endif
 {
+    // This process is a content process, so it's clearly running in
+    // multiprocess mode!
+    nsDebugImpl::SetMultiprocessMode("Child");
 }
 
 ContentChild::~ContentChild()
 {
     delete gIndexedDBPath;
     gIndexedDBPath = nsnull;
 }
 
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -106,16 +106,17 @@
 #ifdef MOZ_WIDGET_ANDROID
 #include "AndroidBridge.h"
 #endif
 
 #include "nsIClipboard.h"
 #include "nsWidgetsCID.h"
 #include "nsISupportsPrimitives.h"
 #include "mozilla/dom/sms/SmsParent.h"
+#include "nsDebugImpl.h"
 
 static NS_DEFINE_CID(kCClipboardCID, NS_CLIPBOARD_CID);
 static const char* sClipboardTextFlavors[] = { kUnicodeMime };
 
 using mozilla::Preferences;
 using namespace mozilla::ipc;
 using namespace mozilla::hal_sandbox;
 using namespace mozilla::net;
@@ -405,16 +406,20 @@ ContentParent::GetTestShellSingleton()
 
 ContentParent::ContentParent()
     : mGeolocationWatchID(-1)
     , mRunToCompletionDepth(0)
     , mShouldCallUnblockChild(false)
     , mIsAlive(true)
     , mSendPermissionUpdates(false)
 {
+    // From this point on, NS_WARNING, NS_ASSERTION, etc. should print out the
+    // PID along with the warning.
+    nsDebugImpl::SetMultiprocessMode("Parent");
+
     NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
     mSubprocess = new GeckoChildProcessHost(GeckoProcessType_Content);
     mSubprocess->AsyncLaunch();
     Open(mSubprocess->GetChannel(), mSubprocess->GetChildProcessHandle());
     unused << SendSetID(gContentChildID++);
 
     nsCOMPtr<nsIChromeRegistry> registrySvc = nsChromeRegistry::GetService();
     nsChromeRegistryChrome* chromeRegistry =
--- a/dom/plugins/base/nsNPAPIPlugin.cpp
+++ b/dom/plugins/base/nsNPAPIPlugin.cpp
@@ -377,17 +377,16 @@ nsNPAPIPlugin::RunPluginOOP(const nsPlug
   nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.ppc.");
 #endif
 #else
   nsCAutoString prefGroupKey("dom.ipc.plugins.enabled.");
 #endif
 
   // Java plugins include a number of different file names,
   // so use the mime type (mIsJavaPlugin) and a special pref.
-  bool javaIsEnabled;
   if (aPluginTag->mIsJavaPlugin &&
       !Preferences::GetBool("dom.ipc.plugins.java.enabled", true)) {
     return false;
   }
 
   PRUint32 prefCount;
   char** prefNames;
   nsresult rv = prefs->GetChildList(prefGroupKey.get(),
--- a/dom/plugins/base/nsPluginHost.cpp
+++ b/dom/plugins/base/nsPluginHost.cpp
@@ -63,16 +63,19 @@
 #include "nsIInputStream.h"
 #include "nsIOutputStream.h"
 #include "nsIURL.h"
 #include "nsXPIDLString.h"
 #include "nsReadableUtils.h"
 #include "nsIProtocolProxyService.h"
 #include "nsIStreamConverterService.h"
 #include "nsIFile.h"
+#if defined(XP_MACOSX)
+#include "nsILocalFileMac.h"
+#endif
 #include "nsIInputStream.h"
 #include "nsIIOService.h"
 #include "nsIURL.h"
 #include "nsIChannel.h"
 #include "nsISeekableStream.h"
 #include "nsNetUtil.h"
 #include "nsIProgressEventSink.h"
 #include "nsIDocument.h"
@@ -1986,17 +1989,29 @@ nsresult nsPluginHost::ScanPluginsDirect
     nsCOMPtr<nsILocalFile>& localfile = pluginFiles[i];
 
     nsString utf16FilePath;
     rv = localfile->GetPath(utf16FilePath);
     if (NS_FAILED(rv))
       continue;
 
     PRInt64 fileModTime = LL_ZERO;
+#if defined(XP_MACOSX)
+    // On OS X the date of a bundle's "contents" (i.e. of its Info.plist file)
+    // is a much better guide to when it was last modified than the date of
+    // its package directory.  See bug 313700.
+    nsCOMPtr<nsILocalFileMac> localFileMac = do_QueryInterface(localfile);
+    if (localFileMac) {
+      localFileMac->GetBundleContentsLastModifiedTime(&fileModTime);
+    } else {
+      localfile->GetLastModifiedTime(&fileModTime);
+    }
+#else
     localfile->GetLastModifiedTime(&fileModTime);
+#endif
 
     // Look for it in our cache
     NS_ConvertUTF16toUTF8 filePath(utf16FilePath);
     nsRefPtr<nsPluginTag> pluginTag;
     RemoveCachedPluginsInfo(filePath.get(),
                             getter_AddRefs(pluginTag));
 
     bool enabled = true;
--- a/dom/plugins/base/nsPluginInstanceOwner.cpp
+++ b/dom/plugins/base/nsPluginInstanceOwner.cpp
@@ -1810,27 +1810,17 @@ void nsPluginInstanceOwner::RemovePlugin
 {
   if (!mInstance)
     return;
 
   void* surface = mInstance->GetJavaSurface();
   if (!surface)
     return;
 
-  JNIEnv* env = GetJNIForThread();
-  if (!env)
-    return;
-
-  AndroidBridge::AutoLocalJNIFrame frame(env, 1);
-
-  jclass cls = env->FindClass("org/mozilla/gecko/GeckoAppShell");
-  jmethodID method = env->GetStaticMethodID(cls,
-                                            "removePluginView",
-                                            "(Landroid/view/View;)V");
-  env->CallStaticVoidMethod(cls, method, surface);
+  AndroidBridge::RemovePluginView(surface);
 }
 
 void nsPluginInstanceOwner::Invalidate() {
   NPRect rect;
   rect.left = rect.top = 0;
   rect.right = mPluginWindow->width;
   rect.bottom = mPluginWindow->height;
   InvalidateRect(&rect);
--- a/dom/plugins/base/nsPluginNativeWindowWin.cpp
+++ b/dom/plugins/base/nsPluginNativeWindowWin.cpp
@@ -55,16 +55,18 @@
 #include "nsWindowsDllInterceptor.h"
 #include "nsPluginSafety.h"
 #include "nsPluginNativeWindow.h"
 #include "nsThreadUtils.h"
 #include "nsAutoPtr.h"
 #include "nsTWeakRef.h"
 #include "nsCrashOnException.h"
 
+using namespace mozilla;
+
 #define NP_POPUP_API_VERSION 16
 
 #define nsMajorVersion(v)       (((PRInt32)(v) >> 16) & 0xffff)
 #define nsMinorVersion(v)       ((PRInt32)(v) & 0xffff)
 #define versionOK(suppliedV, requiredV)                   \
   (nsMajorVersion(suppliedV) == nsMajorVersion(requiredV) \
    && nsMinorVersion(suppliedV) >= nsMinorVersion(requiredV))
 
--- a/editor/libeditor/html/nsHTMLEditor.cpp
+++ b/editor/libeditor/html/nsHTMLEditor.cpp
@@ -4299,27 +4299,27 @@ nsHTMLEditor::GetNextHTMLSibling(nsIDOMN
 //                   takes a parent/offset instead of a node.
 //                       
 nsresult
 nsHTMLEditor::GetNextHTMLSibling(nsIDOMNode *inParent, PRInt32 inOffset, nsCOMPtr<nsIDOMNode> *outNode)
 {
   NS_ENSURE_TRUE(outNode && inParent, NS_ERROR_NULL_POINTER);
   nsresult res = NS_OK;
   *outNode = nsnull;
-  nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent,inOffset);
+  nsCOMPtr<nsIDOMNode> node = nsEditor::GetChildAt(inParent, inOffset + 1);
   if (!node) {
     // return null sibling if no sibling
     return NS_OK;
   }
   if (node && IsEditable(node)) {
     *outNode = node;
     return res;
   }
   // else
-  return GetPriorHTMLSibling(node, outNode);
+  return GetNextHTMLSibling(node, outNode);
 }
 
 
 
 ///////////////////////////////////////////////////////////////////////////
 // GetPriorHTMLNode: returns the previous editable leaf node, if there is
 //                   one within the <body>
 //
--- a/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xul
+++ b/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xul
@@ -7,17 +7,16 @@
   <title>Add and remove dictionaries test</title>
 
   <script type="application/javascript"
           src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
 
   <script type="application/javascript">
   <![CDATA[
 SimpleTest.waitForExplicitFinish();
-SimpleTest.ignoreAllUncaughtExceptions();
 
 function getMisspelledWords(editor) {
   return editor.selectionController.getSelection(Components.interfaces.nsISelectionController.SELECTION_SPELLCHECK).toString();
 }
 
 function getDictionaryList(editor) {
   var spellchecker = editor.getInlineSpellChecker(true).spellChecker;
   var o1 = {};
@@ -31,17 +30,19 @@ function getCurrentDictionary(editor) {
 }
 
 function setCurrentDictionary(editor, dictionary) {
   var spellchecker = editor.getInlineSpellChecker(true).spellChecker;
   spellchecker.SetCurrentDictionary(dictionary);
 }
 
 function RunTest() {
-  var editor = document.getElementById('textbox').editor;
+  var textbox = document.getElementById('textbox');
+  textbox.focus();
+  var editor = textbox.editor;
 
   var dir = Components.classes["@mozilla.org/file/directory_service;1"].
             getService(Components.interfaces.nsIProperties).
             get("CurWorkD", Components.interfaces.nsIFile);
   dir.append("chrome");
   dir.append("extensions");
   dir.append("spellcheck");
   dir.append("tests");
--- a/gfx/cairo/cairo/src/cairo-compiler-private.h
+++ b/gfx/cairo/cairo/src/cairo-compiler-private.h
@@ -229,16 +229,20 @@ ffs (int x)
 
     if (_BitScanForward(&i, x) != 0)
 	return i + 1;
 
     return 0;
 }
 #endif
 
+#elif defined(__WIN32__) && defined(__GNUC__)
+
+#define ffs(x) __builtin_ffs(x)
+
 #endif
 
 #if defined(_MSC_VER) && defined(_M_IX86)
 /* When compiling with /Gy and /OPT:ICF identical functions will be folded in together.
    The CAIRO_ENSURE_UNIQUE macro ensures that a function is always unique and
    will never be folded into another one. Something like this might eventually
    be needed for GCC but it seems fine for now. */
 #define CAIRO_ENSURE_UNIQUE                       \
new file mode 100644
--- /dev/null
+++ b/gfx/cairo/win32-ffs-gcc.patch
@@ -0,0 +1,25 @@
+diff --git a/gfx/cairo/cairo/src/cairo-compiler-private.h b/gfx/cairo/cairo/src/cairo-compiler-private.h
+index ffac9ce..9a05831 100644
+--- a/gfx/cairo/cairo/src/cairo-compiler-private.h
++++ b/gfx/cairo/cairo/src/cairo-compiler-private.h
+@@ -229,16 +229,20 @@ ffs (int x)
+ 
+     if (_BitScanForward(&i, x) != 0)
+ 	return i + 1;
+ 
+     return 0;
+ }
+ #endif
+ 
++#elif defined(__WIN32__) && defined(__GNUC__)
++
++#define ffs(x) __builtin_ffs(x)
++
+ #endif
+ 
+ #if defined(_MSC_VER) && defined(_M_IX86)
+ /* When compiling with /Gy and /OPT:ICF identical functions will be folded in together.
+    The CAIRO_ENSURE_UNIQUE macro ensures that a function is always unique and
+    will never be folded into another one. Something like this might eventually
+    be needed for GCC but it seems fine for now. */
+ #define CAIRO_ENSURE_UNIQUE                       \