about:startup - merge with trunk
authorDaniel Brooks <db48x@db48x.net>
Tue, 21 Sep 2010 15:06:04 -0400
changeset 58855 4e82cb73ec344549ab6ce705017ecca250d9c7c5
parent 58854 f3fc7778d8c104988ebff1fe602fbacd592a4ca3 (current diff)
parent 54338 f5c0015afe0e4f941c72515353f7cce000d4cc8a (diff)
child 58856 d2099fa3d15419e4a6e6f47aa20bbcea30d14f77
push id17440
push userdb48x@yahoo.com
push dateWed, 08 Dec 2010 04:15:54 +0000
treeherdermozilla-central@a89f24bf1798 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b7pre
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
about:startup - merge with trunk
browser/base/content/aboutRobots-icon-rtl.png
browser/base/content/aboutRobots-widget-right.png
browser/base/content/browser.js
browser/base/content/credits.xhtml
browser/base/jar.mn
browser/branding/nightly/content/aboutCredits.png
browser/branding/nightly/content/aboutFooter.png
browser/branding/unofficial/content/aboutCredits.png
browser/branding/unofficial/content/aboutFooter.png
browser/components/feeds/src/GenericFactory.js
browser/components/sessionstore/nsISessionStartup.idl
browser/components/sessionstore/src/nsSessionStartup.js
browser/locales/en-US/chrome/browser/credits.dtd
browser/locales/jar.mn
browser/themes/gnomestripe/browser/sync-merge.png
browser/themes/gnomestripe/browser/sync-usedBefore.png
browser/themes/gnomestripe/browser/sync-usedNever.png
browser/themes/gnomestripe/browser/sync-wipeClient.png
browser/themes/gnomestripe/browser/sync-wipeServer.png
browser/themes/gnomestripe/browser/tabbrowser/progress-pulsing.png
browser/themes/gnomestripe/browser/tabbrowser/progress.png
browser/themes/pinstripe/browser/Search-addengines.png
browser/themes/pinstripe/browser/feed-icons.png
browser/themes/pinstripe/browser/sync-16-throbber.png
browser/themes/pinstripe/browser/sync-merge.png
browser/themes/pinstripe/browser/sync-usedBefore.png
browser/themes/pinstripe/browser/sync-usedNever.png
browser/themes/pinstripe/browser/sync-wipeClient.png
browser/themes/pinstripe/browser/sync-wipeServer.png
browser/themes/pinstripe/browser/tabbrowser/progress-pulsing.png
browser/themes/pinstripe/browser/tabbrowser/progress.png
browser/themes/winstripe/browser/Search-addengines.png
browser/themes/winstripe/browser/feeds/feed-icons-16-aero.png
browser/themes/winstripe/browser/feeds/feed-icons-16.png
browser/themes/winstripe/browser/sync-16-throbber.png
browser/themes/winstripe/browser/sync-merge.png
browser/themes/winstripe/browser/sync-usedBefore.png
browser/themes/winstripe/browser/sync-usedNever.png
browser/themes/winstripe/browser/sync-wipeClient.png
browser/themes/winstripe/browser/sync-wipeServer.png
browser/themes/winstripe/browser/tabbrowser/progress-pulsing.png
browser/themes/winstripe/browser/tabbrowser/progress.png
build/file_migrate.pl
content/base/public/nsIDOMFileInternal.idl
content/base/test/chrome/bug514705.html
content/base/test/chrome/bug514705_helper.xul
content/base/test/chrome/test_bug514705.xul
content/html/content/public/nsIFileControlElement.h
content/media/test/test_timeupdate3.html
dom/interfaces/geolocation/nsIGeolocationPrompt.idl
dom/interfaces/html/nsIDOMHTMLVoidCallback.idl
dom/ipc/TabTypes.h
dom/src/geolocation/PGeolocationRequest.ipdl
dom/src/geolocation/ipdl.mk
dom/src/geolocation/nsGeolocationOOP.h
embedding/browser/activex/src/tlb2xpt/ReadMe.txt
embedding/browser/activex/src/tlb2xpt/StdAfx.cpp
embedding/browser/activex/src/tlb2xpt/StdAfx.h
embedding/browser/activex/src/tlb2xpt/TypeDesc.cpp
embedding/browser/activex/src/tlb2xpt/TypeDesc.h
embedding/browser/activex/src/tlb2xpt/axIUnknown.idl
embedding/browser/activex/src/tlb2xpt/makefile.win
embedding/browser/activex/src/tlb2xpt/tlb2xpt.cpp
extensions/reporter/Makefile.in
extensions/reporter/install.rdf
extensions/reporter/jar.mn
extensions/reporter/locales/Makefile.in
extensions/reporter/locales/en-US/chrome/about.dtd
extensions/reporter/locales/en-US/chrome/reportResults.dtd
extensions/reporter/locales/en-US/chrome/reportWizard.dtd
extensions/reporter/locales/en-US/chrome/reportWizard.properties
extensions/reporter/locales/en-US/chrome/reporter.dtd
extensions/reporter/locales/en-US/chrome/reporterOverlay.dtd
extensions/reporter/locales/en-US/chrome/reporterOverlay.properties
extensions/reporter/locales/jar.mn
extensions/reporter/locales/l10n.ini
extensions/reporter/makefiles.sh
extensions/reporter/resources/content/prefs/reporter.js
extensions/reporter/resources/content/reporter/about.xul
extensions/reporter/resources/content/reporter/error.xhtml
extensions/reporter/resources/content/reporter/report.xhtml
extensions/reporter/resources/content/reporter/reportWizard.js
extensions/reporter/resources/content/reporter/reportWizard.xul
extensions/reporter/resources/content/reporter/reporterOverlay.js
extensions/reporter/resources/content/reporter/reporterOverlay.xul
extensions/reporter/resources/skin/classic/reporter/icon.png
extensions/reporter/resources/skin/classic/reporter/reportResults.css
extensions/reporter/resources/skin/classic/reporter/reportWizard.css
extensions/reporter/resources/skin/classic/reporter/splash.png
js/src/jsdtracef.cpp
js/src/jsdtracef.h
js/src/jsrecursion.cpp
js/src/jstask.cpp
js/src/jstask.h
js/src/trace-test/tests/basic/testCrossGlobalCall.js
js/src/trace-test/tests/bug579740.js
js/src/trace-test/tests/testPutOnEmptyArgsObject.js
layout/reftests/svg/bugs/bug314244.xul
layout/reftests/svg/bugs/bug327709.svg
layout/reftests/svg/bugs/bug337408.xul
layout/reftests/svg/bugs/bug367368.xhtml
layout/reftests/svg/bugs/reftest.list
layout/style/nsCSSRule.cpp
media/libvpx/emptyif_warning.patch
media/libvpx/safeseh.asm
media/libvpx/splitmv-bounds.patch
media/libvpx/subpixel-hidden.patch
media/libvpx/vp8/common/segmentation_common.c
media/libvpx/yasm2masm-as.sh
media/libvpx/yasm2masm.py
modules/plugin/test/reftest/pluginproblemui-direction-ref.html
modules/zlib/src/algorithm.txt
modules/zlib/src/gzio.c
modules/zlib/src/zlib.3
other-licenses/branding/firefox/content/aboutCredits.png
other-licenses/branding/firefox/content/aboutFooter.png
security/patches/maemo-rpath-link.patch
security/patches/msvc-aslr.patch
services/sync/tests/unit/test_service_checkUsername.js
testing/mochitest/runtests.py.in
testing/mozmill/jsbridge-2.3.5/MANIFEST.in
testing/mozmill/jsbridge-2.3.5/PKG-INFO
testing/mozmill/jsbridge-2.3.5/jsbridge/__init__.py
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/chrome.manifest
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/chrome/content/overlay.js
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/chrome/content/overlay.xul
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/components/cmdarg.js
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/install.rdf
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/resource/modules/events.js
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/resource/modules/init.js
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/resource/modules/json2.js
testing/mozmill/jsbridge-2.3.5/jsbridge/extension/resource/modules/server.js
testing/mozmill/jsbridge-2.3.5/jsbridge/jsobjects.py
testing/mozmill/jsbridge-2.3.5/jsbridge/network.py
testing/mozmill/jsbridge-2.3.5/jsbridge/xpi/chromebug-0.5.0a1.xpi
testing/mozmill/jsbridge-2.3.5/jsbridge/xpi/firebug-1.4.0a3.xpi
testing/mozmill/jsbridge-2.3.5/jsbridge/xpi/javascript_debugger-0.9.87.4-fx+tb+sb+sm.xpi
testing/mozmill/jsbridge-2.3.5/jsbridge/xpi/mozlab-current-0.1.9.2008050521.xpi
testing/mozmill/jsbridge-2.3.5/jsbridge/xpi/xush-0.2-fx.xpi
testing/mozmill/jsbridge-2.3.5/setup.cfg
testing/mozmill/jsbridge-2.3.5/setup.py
testing/mozmill/mozmill-1.4.1/MANIFEST.in
testing/mozmill/mozmill-1.4.1/PKG-INFO
testing/mozmill/mozmill-1.4.1/docs/Makefile
testing/mozmill/mozmill-1.4.1/docs/_build/doctrees/environment.pickle
testing/mozmill/mozmill-1.4.1/docs/_build/doctrees/index.doctree
testing/mozmill/mozmill-1.4.1/docs/_build/html/_sources/index.txt
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/contents.png
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/default.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/doctools.js
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/file.png
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/jquery.js
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/minus.png
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/navigation.png
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/plus.png
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/pygments.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/rightsidebar.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/searchtools.js
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/sphinxdoc.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/stickysidebar.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/_static/traditional.css
testing/mozmill/mozmill-1.4.1/docs/_build/html/genindex.html
testing/mozmill/mozmill-1.4.1/docs/_build/html/index.html
testing/mozmill/mozmill-1.4.1/docs/_build/html/modindex.html
testing/mozmill/mozmill-1.4.1/docs/_build/html/objects.inv
testing/mozmill/mozmill-1.4.1/docs/_build/html/search.html
testing/mozmill/mozmill-1.4.1/docs/_build/html/searchindex.js
testing/mozmill/mozmill-1.4.1/docs/conf.py
testing/mozmill/mozmill-1.4.1/docs/index.rst
testing/mozmill/mozmill-1.4.1/mozmill/__init__.py
testing/mozmill/mozmill-1.4.1/mozmill/extension/build.xml
testing/mozmill/mozmill-1.4.1/mozmill/extension/chrome-jar.manifest
testing/mozmill/mozmill-1.4.1/mozmill/extension/chrome.manifest
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/mozmill.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_flat_75_ffffff_40x100.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_glass_65_ffffff_1x400.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_glass_75_dadada_1x400.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-icons_222222_256x240.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-icons_2e83ff_256x240.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-icons_454545_256x240.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-icons_888888_256x240.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/images/ui-icons_cd0a0a_256x240.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/css/smoothness/jquery-ui-1.7.1.custom.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/dx.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/dxwindow.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/change_log.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/about.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/compatibility.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/configuration.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/credits.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/customization_language.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/customization_plugin.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/customization_syntax.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/doc_style.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/include.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/index.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/installation.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/javascript_functions.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/docs/license.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/autocompletion.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_compressor.php
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_full.gz
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_full.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_full_with_plugins.gz
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_full_with_plugins.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_functions.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/edit_area_loader.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/elements_functions.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/highlight.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/autocompletion.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/close.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/fullscreen.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/go_to_line.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/help.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/highlight.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/load.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/move.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/newdocument.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/opacity.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/processing.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/redo.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/reset_highlight.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/save.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/search.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/smooth_selection.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/spacer.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/statusbar_resize.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/undo.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/images/word_wrap.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/keyboard.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/bg.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/cs.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/de.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/dk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/en.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/eo.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/es.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/fi.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/fr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/hr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/it.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/ja.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/mk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/nl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/pl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/pt.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/ru.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/sk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/langs/zh.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/license_apache.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/license_bsd.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/license_lgpl.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/manage_area.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/charmap.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/css/charmap.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/images/charmap.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/jscripts/map.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/bg.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/cs.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/de.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/dk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/en.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/eo.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/es.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/fr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/hr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/it.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/ja.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/mk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/nl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/pl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/pt.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/ru.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/sk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/langs/zh.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/charmap/popup.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/css/test.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/images/Thumbs.db
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/images/test.gif
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/bg.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/cs.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/de.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/dk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/en.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/eo.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/es.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/fr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/hr.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/it.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/ja.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/mk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/nl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/pl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/pt.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/ru.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/sk.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/langs/zh.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/test.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/plugins/test/test2.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/basic.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/brainfuck.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/c.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/coldfusion.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/cpp.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/css.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/html.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/java.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/js.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/pas.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/perl.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/php.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/python.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/robotstxt.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/ruby.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/sql.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/tsql.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/vb.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/reg_syntax/xml.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/regexp.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/resize_area.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/search_replace.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/edit_area/template.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/exemples/exemple_full.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/license_apache.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/license_bsd.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/license_lgpl.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/editarea/todo.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/img/wmIcon.png
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/jquery/jquery-1.3.2.min.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/jquery/jquery-ui-1.7.1.custom.min.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/menus.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/mozmill.html
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/mozmill.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/mozmill.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/output.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/overlay.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/overlay.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/overlay_tb.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/prefs.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/rec.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/shell.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/shortcuts.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/testwindow.xul
testing/mozmill/mozmill-1.4.1/mozmill/extension/content/ui.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/defaults/preferences/debug.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/install.rdf
testing/mozmill/mozmill-1.4.1/mozmill/extension/locale/en-US/mozmill.dtd
testing/mozmill/mozmill-1.4.1/mozmill/extension/locale/en-US/overlay.dtd
testing/mozmill/mozmill-1.4.1/mozmill/extension/mozmill.xpi
testing/mozmill/mozmill-1.4.1/mozmill/extension/readme.txt
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/EventUtils.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/controller.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/elementslib.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/events.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/frame.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/init.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/inspection.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/jum.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/mozmill.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/modules/utils.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/arrays.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/dom.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/httpd.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/json2.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/objects.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/os.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/strings.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/resource/stdlib/withs.js
testing/mozmill/mozmill-1.4.1/mozmill/extension/skin/overlay.css
testing/mozmill/mozmill-1.4.1/mozmill/extension/zipexclude.lst
testing/mozmill/mozmill-1.4.1/setup.cfg
testing/mozmill/mozmill-1.4.1/setup.py
testing/mozmill/mozmill-1.4.1/test/test_python_callbacks_callbacks.py
testing/mozmill/mozrunner-2.4.2/PKG-INFO
testing/mozmill/mozrunner-2.4.2/mozrunner/__init__.py
testing/mozmill/mozrunner-2.4.2/mozrunner/killableprocess.py
testing/mozmill/mozrunner-2.4.2/mozrunner/qijo.py
testing/mozmill/mozrunner-2.4.2/mozrunner/winprocess.py
testing/mozmill/mozrunner-2.4.2/mozrunner/wpk.py
testing/mozmill/mozrunner-2.4.2/setup.cfg
testing/mozmill/mozrunner-2.4.2/setup.py
testing/mozmill/tests/addons/readme.txt
testing/mozmill/tests/addons/toolbar@google.com/testToolbarInstalled.js
testing/mozmill/tests/firefox/crashTests/testRemoveCookieAfterPrivateBrowsing.js
testing/mozmill/tests/firefox/helperClasses/testAddonsAPI.js
testing/mozmill/tests/firefox/helperClasses/testDownloadsAPI.js
testing/mozmill/tests/firefox/helperClasses/testPreferencesDialog.js
testing/mozmill/tests/firefox/helperClasses/testSearchAPI.js
testing/mozmill/tests/firefox/helperClasses/testSessionStoreAPI.js
testing/mozmill/tests/firefox/readme.txt
testing/mozmill/tests/firefox/restartTests/testDefaultBookmarks/test1.js
testing/mozmill/tests/firefox/restartTests/testExtensionInstallGetAddons/test1.js
testing/mozmill/tests/firefox/restartTests/testExtensionInstallGetAddons/test2.js
testing/mozmill/tests/firefox/restartTests/testExtensionInstallUninstall/test1.js
testing/mozmill/tests/firefox/restartTests/testExtensionInstallUninstall/test2.js
testing/mozmill/tests/firefox/restartTests/testExtensionInstallUninstall/test3.js
testing/mozmill/tests/firefox/restartTests/testMasterPassword/test1.js
testing/mozmill/tests/firefox/restartTests/testThemeInstallUninstall/test1.js
testing/mozmill/tests/firefox/restartTests/testThemeInstallUninstall/test2.js
testing/mozmill/tests/firefox/restartTests/testThemeInstallUninstall/test3.js
testing/mozmill/tests/firefox/softwareUpdate/testDirectUpdate/test1.js
testing/mozmill/tests/firefox/softwareUpdate/testDirectUpdate/test2.js
testing/mozmill/tests/firefox/softwareUpdate/testFallbackUpdate/test1.js
testing/mozmill/tests/firefox/softwareUpdate/testFallbackUpdate/test2.js
testing/mozmill/tests/firefox/softwareUpdate/testFallbackUpdate/test3.js
testing/mozmill/tests/firefox/testAddons/files/plugin.html
testing/mozmill/tests/firefox/testAddons/testDisableEnablePlugin.js
testing/mozmill/tests/firefox/testAddons/testGetAddons.js
testing/mozmill/tests/firefox/testAddons/testSearchAddons.js
testing/mozmill/tests/firefox/testAwesomeBar/testAccessLocationBar.js
testing/mozmill/tests/firefox/testAwesomeBar/testCheckItemHighlight.js
testing/mozmill/tests/firefox/testAwesomeBar/testEscapeAutocomplete.js
testing/mozmill/tests/firefox/testAwesomeBar/testLocationBarSearches.js
testing/mozmill/tests/firefox/testAwesomeBar/testSuggestHistoryBookmarks.js
testing/mozmill/tests/firefox/testAwesomeBar/testVisibleItemsMax.js
testing/mozmill/tests/firefox/testBookmarks/testAddBookmarkToMenu.js
testing/mozmill/tests/firefox/testCookies/testDisableCookies.js
testing/mozmill/tests/firefox/testCookies/testEnableCookies.js
testing/mozmill/tests/firefox/testCookies/testRemoveAllCookies.js
testing/mozmill/tests/firefox/testCookies/testRemoveCookie.js
testing/mozmill/tests/firefox/testDownloading/testCloseDownloadManager.js
testing/mozmill/tests/firefox/testDownloading/testDownloadStates.js
testing/mozmill/tests/firefox/testDownloading/testOpenDownloadManager.js
testing/mozmill/tests/firefox/testFindInPage/testFindInPage.js
testing/mozmill/tests/firefox/testFormManager/testAutoCompleteOff.js
testing/mozmill/tests/firefox/testFormManager/testBasicFormCompletion.js
testing/mozmill/tests/firefox/testFormManager/testClearFormHistory.js
testing/mozmill/tests/firefox/testFormManager/testDisableFormManager.js
testing/mozmill/tests/firefox/testGeneral/testBackForwardButtons.js
testing/mozmill/tests/firefox/testGeneral/testGoogleSuggestions.js
testing/mozmill/tests/firefox/testGeneral/testStopReloadButtons.js
testing/mozmill/tests/firefox/testInstallation/testBreakpadInstalled.js
testing/mozmill/tests/firefox/testLayout/testNavigateFTP.js
testing/mozmill/tests/firefox/testPasswordManager/testPasswordNotSaved.js
testing/mozmill/tests/firefox/testPasswordManager/testPasswordSavedAndDeleted.js
testing/mozmill/tests/firefox/testPopups/testPopupsAllowed.js
testing/mozmill/tests/firefox/testPopups/testPopupsBlocked.js
testing/mozmill/tests/firefox/testPreferences/testPaneRetention.js
testing/mozmill/tests/firefox/testPreferences/testPreferredLanguage.js
testing/mozmill/tests/firefox/testPreferences/testRestoreHomepageToDefault.js
testing/mozmill/tests/firefox/testPreferences/testSwitchPanes.js
testing/mozmill/tests/firefox/testPrivateBrowsing/files/geolocation.html
testing/mozmill/tests/firefox/testPrivateBrowsing/testAboutPrivateBrowsing.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testDisabledElements.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testDisabledPermissions.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testDownloadManagerClosed.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testGeolocation.js
testing/mozmill/tests/firefox/testPrivateBrowsing/testTabsDismissedOnStop.js
testing/mozmill/tests/firefox/testSearch/testAddMozSearchProvider.js
testing/mozmill/tests/firefox/testSearch/testFocusAndSearch.js
testing/mozmill/tests/firefox/testSearch/testGetMoreSearchEngines.js
testing/mozmill/tests/firefox/testSearch/testOpenSearchAutodiscovery.js
testing/mozmill/tests/firefox/testSearch/testRemoveSearchEngine.js
testing/mozmill/tests/firefox/testSearch/testReorderSearchEngines.js
testing/mozmill/tests/firefox/testSearch/testRestoreDefaults.js
testing/mozmill/tests/firefox/testSearch/testSearchSelection.js
testing/mozmill/tests/firefox/testSearch/testSearchSuggestions.js
testing/mozmill/tests/firefox/testSecurity/testBlueLarry.js
testing/mozmill/tests/firefox/testSecurity/testDefaultPhishingEnabled.js
testing/mozmill/tests/firefox/testSecurity/testDefaultSecurityPrefs.js
testing/mozmill/tests/firefox/testSecurity/testEncryptedPageWarning.js
testing/mozmill/tests/firefox/testSecurity/testGreenLarry.js
testing/mozmill/tests/firefox/testSecurity/testGreyLarry.js
testing/mozmill/tests/firefox/testSecurity/testIdentityPopupOpenClose.js
testing/mozmill/tests/firefox/testSecurity/testSSLDisabledErrorPage.js
testing/mozmill/tests/firefox/testSecurity/testSafeBrowsingNotificationBar.js
testing/mozmill/tests/firefox/testSecurity/testSafeBrowsingWarningPages.js
testing/mozmill/tests/firefox/testSecurity/testSecurityInfoViaPadlock.js
testing/mozmill/tests/firefox/testSecurity/testSecurityNotification.js
testing/mozmill/tests/firefox/testSecurity/testStatusBarSSLDisplay.js
testing/mozmill/tests/firefox/testSecurity/testSubmitUnencryptedInfoWarning.js
testing/mozmill/tests/firefox/testSecurity/testUnknownIssuer.js
testing/mozmill/tests/firefox/testSecurity/testUntrustedConnectionErrorPage.js
testing/mozmill/tests/firefox/testTabbedBrowsing/files/openinnewtab.html
testing/mozmill/tests/firefox/testTabbedBrowsing/files/openinnewtab_target.html
testing/mozmill/tests/firefox/testTabbedBrowsing/testBackgroundTabScrolling.js
testing/mozmill/tests/firefox/testTabbedBrowsing/testCloseTab.js
testing/mozmill/tests/firefox/testTabbedBrowsing/testNewTab.js
testing/mozmill/tests/firefox/testTabbedBrowsing/testNewWindow.js
testing/mozmill/tests/firefox/testTabbedBrowsing/testOpenInBackground.js
testing/mozmill/tests/firefox/testTabbedBrowsing/testOpenInForeground.js
testing/mozmill/tests/readme.txt
testing/mozmill/tests/scripts/libs/install.py
testing/mozmill/tests/scripts/libs/prefs.py
testing/mozmill/tests/scripts/readme.txt
testing/mozmill/tests/scripts/update.py
testing/mozmill/tests/templates/readme.txt
testing/mozmill/tests/templates/testEmptyTest.js
testing/mozmill/tests/templates/testModalDialog.js
testing/mozmill/tests/templates/testPreferencesDialog.js
testing/mozmill/tests/templates/testSharedModules.js
toolkit/mozapps/extensions/AddonManager.jsm
toolkit/mozapps/extensions/test/browser/browser_backgroundupdate_menuitem.js
toolkit/themes/gnomestripe/global/jar.mn
toolkit/themes/pinstripe/global/jar.mn
toolkit/themes/winstripe/global/jar.mn
toolkit/xre/nsAppRunner.cpp
xpcom/build/nsXULAppAPI.h
xpcom/components/nsManifestZIPLoader.cpp
xpcom/components/nsManifestZIPLoader.h
--- a/accessible/public/nsIAccessibleDocument.idl
+++ b/accessible/public/nsIAccessibleDocument.idl
@@ -51,17 +51,17 @@ interface nsIDOMWindow;
  * there is an nsIAccessibleDocument for each document
  * whether it is XUL, HTML or whatever.
  * You can QueryInterface to nsIAccessibleDocument from
  * the nsIAccessible or nsIAccessNode for the root node
  * of a document. You can also get one from 
  * nsIAccessNode::GetAccessibleDocument() or 
  * nsIAccessibleEvent::GetAccessibleDocument()
  */
-[scriptable, uuid(03c6ce8a-aa40-4484-9282-e6579c56e054)]
+[scriptable, uuid(451242bd-8a0c-4198-ae88-c053609a4e5d)]
 interface nsIAccessibleDocument : nsISupports
 {
   /**
    * The URL of the document
    */
   readonly attribute AString URL;
 
   /**
@@ -94,9 +94,24 @@ interface nsIAccessibleDocument : nsISup
    */
   AString getNameSpaceURIForID(in short nameSpaceID);
 
   /**
    * The window handle for the OS window the document is being displayed in.
    * For example, in Windows you can static cast it to an HWND.
    */
   [noscript] readonly attribute voidPtr windowHandle;
+
+  /**
+   * Return the parent document accessible.
+   */
+  readonly attribute nsIAccessibleDocument parentDocument;
+
+  /**
+   * Return the count of child document accessibles.
+   */
+  readonly attribute unsigned long childDocumentCount;
+
+  /**
+   * Return the child document accessible at the given index.
+   */
+  nsIAccessibleDocument getChildDocumentAt(in unsigned long index);
 };
--- a/accessible/src/atk/nsAccessibleWrap.cpp
+++ b/accessible/src/atk/nsAccessibleWrap.cpp
@@ -747,21 +747,18 @@ getRoleCB(AtkObject *aAtkObj)
     }
 
 #ifdef DEBUG_A11Y
     NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(accWrap),
                  "Does not support nsIAccessibleText when it should");
 #endif
 
     if (aAtkObj->role == ATK_ROLE_INVALID) {
-        PRUint32 accRole, atkRole;
-        nsresult rv = accWrap->GetRole(&accRole);
-        NS_ENSURE_SUCCESS(rv, ATK_ROLE_INVALID);
-
-        atkRole = atkRoleMap[accRole]; // map to the actual value
+        // map to the actual value
+        PRUint32 atkRole = atkRoleMap[accWrap->Role()];
         NS_ASSERTION(atkRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY] ==
                      kROLE_ATK_LAST_ENTRY, "ATK role map skewed");
         aAtkObj->role = static_cast<AtkRole>(atkRole);
     }
     return aAtkObj->role;
 }
 
 AtkAttributeSet*
--- a/accessible/src/atk/nsMaiInterfaceAction.cpp
+++ b/accessible/src/atk/nsMaiInterfaceAction.cpp
@@ -119,49 +119,45 @@ getKeyBindingCB(AtkAction *aAction, gint
     //return all KeyBindings including accesskey and shortcut
     nsAutoString allKeyBinding;
 
     //get accesskey
     nsAutoString accessKey;
     nsresult rv = accWrap->GetKeyboardShortcut(accessKey);
 
     if (NS_SUCCEEDED(rv) && !accessKey.IsEmpty()) {
-        nsCOMPtr<nsIAccessible> parentAccessible;
-        accWrap->GetParent(getter_AddRefs(parentAccessible));
-        if (parentAccessible) {
-          PRUint32 geckoRole = nsAccUtils::RoleInternal(parentAccessible);
-          PRUint32 atkRole = atkRoleMap[geckoRole];
+        nsAccessible* parent = accWrap->GetParent();
+        if (parent) {
+          PRUint32 atkRole = atkRoleMap[parent->NativeRole()];
 
             if (atkRole == ATK_ROLE_MENU_BAR) {
                 //it is topmenu, change from "Alt+f" to "f;<Alt>f"
                 nsAutoString rightChar;
                 accessKey.Right(rightChar, 1);
                 allKeyBinding = rightChar + NS_LITERAL_STRING(";<Alt>") +
                                 rightChar;
             }
             else if ((atkRole == ATK_ROLE_MENU) || (atkRole == ATK_ROLE_MENU_ITEM)) {
                 //it is submenu, change from "s" to "s;<Alt>f:s"
                 nsAutoString allKey = accessKey;
-                nsCOMPtr<nsIAccessible> grandParentAcc = parentAccessible;
+                nsAccessible* grandParent = parent;
 
-                while ((grandParentAcc) && (atkRole != ATK_ROLE_MENU_BAR)) {
+                do {
                     nsAutoString grandParentKey;
-                    grandParentAcc->GetKeyboardShortcut(grandParentKey);
+                    grandParent->GetKeyboardShortcut(grandParentKey);
 
                     if (!grandParentKey.IsEmpty()) {
                         nsAutoString rightChar;
                         grandParentKey.Right(rightChar, 1);
                         allKey = rightChar + NS_LITERAL_STRING(":") + allKey;
                     }
 
-                    nsCOMPtr<nsIAccessible> tempAcc = grandParentAcc;
-                    tempAcc->GetParent(getter_AddRefs(grandParentAcc));
-                  geckoRole = nsAccUtils::RoleInternal(grandParentAcc);
-                  atkRole = atkRoleMap[geckoRole];
-                }
+                } while ((grandParent = grandParent->GetParent()) &&
+                         atkRoleMap[grandParent->NativeRole()] != ATK_ROLE_MENU_BAR);
+
                 allKeyBinding = accessKey + NS_LITERAL_STRING(";<Alt>") +
                                 allKey;
             }
         }
         else {
             //default process, rarely happens.
             nsAutoString rightChar;
             accessKey.Right(rightChar, 1);
--- a/accessible/src/atk/nsMaiInterfaceText.cpp
+++ b/accessible/src/atk/nsMaiInterfaceText.cpp
@@ -75,19 +75,17 @@ textInterfaceInitCB(AtkTextIface *aIface
     aIface->set_selection = setTextSelectionCB;
     aIface->set_caret_offset = setCaretOffsetCB;
 }
 
 
 void ConvertTexttoAsterisks(nsAccessibleWrap* accWrap, nsAString& aString)
 {
     // convert each char to "*" when it's "password text" 
-    PRUint32 accRole = 0;
-    accWrap->GetRoleInternal(&accRole);
-    PRUint32 atkRole = atkRoleMap[accRole];
+    PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
     if (atkRole == ATK_ROLE_PASSWORD_TEXT) {
         for (PRUint32 i = 0; i < aString.Length(); i++)
             aString.Replace(i, 1, NS_LITERAL_STRING("*"));
     }
 }
 
 gchar *
 getTextCB(AtkText *aText, gint aStartOffset, gint aEndOffset)
@@ -184,19 +182,17 @@ getCharacterAtOffsetCB(AtkText *aText, g
 
     /* PRUnichar is unsigned short in Mozilla */
     /* gnuichar is guint32 in glib */
     PRUnichar uniChar;
     nsresult rv =
         accText->GetCharacterAtOffset(aOffset, &uniChar);
 
     // convert char to "*" when it's "password text" 
-    PRUint32 accRole;
-    accWrap->GetRoleInternal(&accRole);
-    PRUint32 atkRole = atkRoleMap[accRole];
+    PRUint32 atkRole = atkRoleMap[accWrap->NativeRole()];
     if (atkRole == ATK_ROLE_PASSWORD_TEXT)
         uniChar = '*';
 
     return (NS_FAILED(rv)) ? 0 : static_cast<gunichar>(uniChar);
 }
 
 gchar *
 getTextBeforeOffsetCB(AtkText *aText, gint aOffset,
--- a/accessible/src/base/AccGroupInfo.cpp
+++ b/accessible/src/base/AccGroupInfo.cpp
@@ -47,17 +47,17 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
 
   PRInt32 indexInParent = aItem->GetIndexInParent();
   PRInt32 level = nsAccUtils::GetARIAOrDefaultLevel(aItem);
 
   // Compute position in set.
   mPosInSet = 1;
   for (PRInt32 idx = indexInParent - 1; idx >=0 ; idx--) {
     nsAccessible* sibling = parent->GetChildAt(idx);
-    PRUint32 siblingRole = nsAccUtils::Role(sibling);
+    PRUint32 siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
     if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
       break;
 
     // If sibling is not visible and hasn't the same base role.
     if (BaseRole(siblingRole) != aRole ||
         nsAccUtils::State(sibling) & nsIAccessibleStates::STATE_INVISIBLE)
@@ -91,17 +91,17 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
 
   // Compute set size.
   mSetSize = mPosInSet;
 
   PRInt32 siblingCount = parent->GetChildCount();
   for (PRInt32 idx = indexInParent + 1; idx < siblingCount; idx++) {
     nsAccessible* sibling = parent->GetChildAt(idx);
 
-    PRUint32 siblingRole = nsAccUtils::Role(sibling);
+    PRUint32 siblingRole = sibling->Role();
 
     // If the sibling is separator then the group is ended.
     if (siblingRole == nsIAccessibleRole::ROLE_SEPARATOR)
       break;
 
     // If sibling is visible and has the same base role
     if (BaseRole(siblingRole) != aRole ||
         nsAccUtils::State(sibling) & nsIAccessibleStates::STATE_INVISIBLE)
@@ -126,17 +126,17 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
 
     mSetSize++;
   }
 
   if (mParent)
     return;
 
   // Compute parent.
-  PRUint32 parentRole = nsAccUtils::Role(parent);
+  PRUint32 parentRole = parent->Role();
 
   // In the case of ARIA row in treegrid, return treegrid since ARIA
   // groups aren't used to organize levels in ARIA treegrids.
   if (aRole == nsIAccessibleRole::ROLE_ROW &&
       parentRole == nsIAccessibleRole::ROLE_TREE_TABLE) {
     mParent = parent;
     return;
   }
@@ -148,23 +148,27 @@ AccGroupInfo::AccGroupInfo(nsAccessible*
   // return that.
 
   if (parentRole != nsIAccessibleRole::ROLE_GROUPING) {
     mParent = parent;
     return;
   }
 
   nsAccessible* parentPrevSibling = parent->GetSiblingAtOffset(-1);
-  PRUint32 parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
+  if (!parentPrevSibling)
+    return;
+
+  PRUint32 parentPrevSiblingRole = parentPrevSibling->Role();
   if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_TEXT_LEAF) {
     // XXX Sometimes an empty text accessible is in the hierarchy here,
     // although the text does not appear to be rendered, GetRenderedText()
     // says that it is so we need to skip past it to find the true
     // previous sibling.
     parentPrevSibling = parentPrevSibling->GetSiblingAtOffset(-1);
-    parentPrevSiblingRole = nsAccUtils::Role(parentPrevSibling);
+    if (parentPrevSibling)
+      parentPrevSiblingRole = parentPrevSibling->Role();
   }
 
   // Previous sibling of parent group is a tree item, this is the
   // conceptual tree item parent.
   if (parentPrevSiblingRole == nsIAccessibleRole::ROLE_OUTLINEITEM)
     mParent = parentPrevSibling;
 }
--- a/accessible/src/base/AccGroupInfo.h
+++ b/accessible/src/base/AccGroupInfo.h
@@ -54,17 +54,17 @@ public:
   PRUint32 SetSize() const { return mSetSize; }
   nsAccessible* GetConceptualParent() const { return mParent; }
 
   /**
    * Create group info.
    */
   static AccGroupInfo* CreateGroupInfo(nsAccessible* aAccessible)
   {
-    PRUint32 role = nsAccUtils::Role(aAccessible);
+    PRUint32 role = aAccessible->Role();
     if (role != nsIAccessibleRole::ROLE_ROW &&
         role != nsIAccessibleRole::ROLE_GRID_CELL &&
         role != nsIAccessibleRole::ROLE_OUTLINEITEM &&
         role != nsIAccessibleRole::ROLE_OPTION &&
         role != nsIAccessibleRole::ROLE_LISTITEM &&
         role != nsIAccessibleRole::ROLE_MENUITEM &&
         role != nsIAccessibleRole::ROLE_CHECK_MENU_ITEM &&
         role != nsIAccessibleRole::ROLE_RADIO_MENU_ITEM &&
--- a/accessible/src/base/filters.cpp
+++ b/accessible/src/base/filters.cpp
@@ -50,23 +50,23 @@ bool
 filters::GetSelectable(nsAccessible* aAccessible)
 {
   return nsAccUtils::State(aAccessible) & nsIAccessibleStates::STATE_SELECTABLE;
 }
 
 bool
 filters::GetRow(nsAccessible* aAccessible)
 {
-  return nsAccUtils::Role(aAccessible) == nsIAccessibleRole::ROLE_ROW;
+  return aAccessible->Role() == nsIAccessibleRole::ROLE_ROW;
 }
 
 bool
 filters::GetCell(nsAccessible* aAccessible)
 {
-  PRUint32 role = nsAccUtils::Role(aAccessible);
+  PRUint32 role = aAccessible->Role();
   return role == nsIAccessibleRole::ROLE_GRID_CELL ||
       role == nsIAccessibleRole::ROLE_ROWHEADER ||
       role == nsIAccessibleRole::ROLE_COLUMNHEADER;
 }
 
 bool
 filters::GetEmbeddedObject(nsAccessible* aAccessible)
 {
--- a/accessible/src/base/nsARIAGridAccessible.cpp
+++ b/accessible/src/base/nsARIAGridAccessible.cpp
@@ -803,17 +803,17 @@ nsARIAGridAccessible::SetARIASelected(ns
     return NS_OK;
 
   // If row or cell accessible was selected then we're able to not bother about
   // selection of its cells or its row because our algorithm is row oriented,
   // i.e. we check selection on row firstly and then on cells.
   if (aIsSelected)
     return NS_OK;
 
-  PRUint32 role = nsAccUtils::Role(aAccessible);
+  PRUint32 role = aAccessible->Role();
 
   // If the given accessible is row that was unselected then remove
   // aria-selected from cell accessible.
   if (role == nsIAccessibleRole::ROLE_ROW) {
     AccIterator cellIter(aAccessible, filters::GetCell);
     nsAccessible *cell = nsnull;
 
     while ((cell = cellIter.GetNext())) {
@@ -826,17 +826,17 @@ nsARIAGridAccessible::SetARIASelected(ns
   // If the given accessible is cell that was unselected and its row is selected
   // then remove aria-selected from row and put aria-selected on
   // siblings cells.
   if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
       role == nsIAccessibleRole::ROLE_ROWHEADER ||
       role == nsIAccessibleRole::ROLE_COLUMNHEADER) {
     nsAccessible *row = aAccessible->GetParent();
 
-    if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW &&
+    if (row && row->Role() == nsIAccessibleRole::ROLE_ROW &&
         nsAccUtils::IsARIASelected(row)) {
       rv = SetARIASelected(row, PR_FALSE, PR_FALSE);
       NS_ENSURE_SUCCESS(rv, rv);
 
       AccIterator cellIter(row, filters::GetCell);
       nsAccessible *cell = nsnull;
       while ((cell = cellIter.GetNext())) {
         if (cell != aAccessible) {
@@ -943,77 +943,85 @@ NS_IMPL_ISUPPORTS_INHERITED1(nsARIAGridC
 // nsIAccessibleTableCell
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetTable(nsIAccessibleTable **aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
   *aTable = nsnull;
 
-  nsCOMPtr<nsIAccessible> thisRow;
-  GetParent(getter_AddRefs(thisRow));
-  if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
+  nsAccessible* thisRow = GetParent();
+  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
     return NS_OK;
 
-  nsCOMPtr<nsIAccessible> table;
-  thisRow->GetParent(getter_AddRefs(table));
-  if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
-      nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
+  nsAccessible* table = thisRow->GetParent();
+  if (!table)
+    return NS_OK;
+
+  PRUint32 tableRole = table->Role();
+  if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
+      tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
     return NS_OK;
 
   CallQueryInterface(table, aTable);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
 {
   NS_ENSURE_ARG_POINTER(aColumnIndex);
   *aColumnIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
+  nsAccessible* row = GetParent();
+  if (!row)
+    return NS_OK;
+
   *aColumnIndex = 0;
 
-  nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
-  GetPreviousSibling(getter_AddRefs(prevCell));
-
-  while (prevCell) {
-    PRUint32 role = nsAccUtils::Role(prevCell);
+  PRInt32 indexInRow = GetIndexInParent();
+  for (PRInt32 idx = 0; idx < indexInRow; idx++) {
+    nsAccessible* cell = row->GetChildAt(idx);
+    PRUint32 role = cell->Role();
     if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
         role == nsIAccessibleRole::ROLE_ROWHEADER ||
         role == nsIAccessibleRole::ROLE_COLUMNHEADER)
       (*aColumnIndex)++;
-
-    prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
-    tmpAcc.swap(prevCell);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
 {
   NS_ENSURE_ARG_POINTER(aRowIndex);
   *aRowIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIAccessible> row, prevRow;
-  GetParent(getter_AddRefs(row));
+  nsAccessible* row = GetParent();
+  if (!row)
+    return NS_OK;
+
+  nsAccessible* table = row->GetParent();
+  if (!table)
+    return NS_OK;
 
-  while (row) {
-    if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
+  *aRowIndex = 0;
+
+  PRInt32 indexInTable = row->GetIndexInParent();
+  for (PRInt32 idx = 0; idx < indexInTable; idx++) {
+    row = table->GetChildAt(idx);
+    if (row->Role() == nsIAccessibleRole::ROLE_ROW)
       (*aRowIndex)++;
-
-    row->GetPreviousSibling(getter_AddRefs(prevRow));
-    row.swap(prevRow);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsARIAGridCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
 {
@@ -1083,17 +1091,17 @@ nsARIAGridCellAccessible::IsSelected(PRB
 {
   NS_ENSURE_ARG_POINTER(aIsSelected);
   *aIsSelected = PR_FALSE;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
   nsAccessible *row = GetParent();
-  if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
+  if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
     return NS_OK;
 
   if (!nsAccUtils::IsARIASelected(row) && !nsAccUtils::IsARIASelected(this))
     return NS_OK;
 
   *aIsSelected = PR_TRUE;
   return NS_OK;
 }
@@ -1107,18 +1115,18 @@ nsARIAGridCellAccessible::GetARIAState(P
   nsresult rv = nsHyperTextAccessibleWrap::GetARIAState(aState, aExtraState);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Return if the gridcell has aria-selected="true".
   if (*aState & nsIAccessibleStates::STATE_SELECTED)
     return NS_OK;
 
   // Check aria-selected="true" on the row.
-  nsAccessible *row = GetParent();
-  if (nsAccUtils::Role(row) != nsIAccessibleRole::ROLE_ROW)
+  nsAccessible* row = GetParent();
+  if (!row || row->Role() != nsIAccessibleRole::ROLE_ROW)
     return NS_OK;
 
   nsIContent *rowContent = row->GetContent();
   if (nsAccUtils::HasDefinedARIAToken(rowContent,
                                       nsAccessibilityAtoms::aria_selected) &&
       !rowContent->AttrValueIs(kNameSpaceID_None,
                                nsAccessibilityAtoms::aria_selected,
                                nsAccessibilityAtoms::_false, eCaseMatters)) {
@@ -1136,47 +1144,51 @@ nsARIAGridCellAccessible::GetAttributesI
   if (IsDefunct())
     return NS_ERROR_FAILURE;
   
   nsresult rv = nsHyperTextAccessibleWrap::GetAttributesInternal(aAttributes);
   NS_ENSURE_SUCCESS(rv, rv);
 
   // Expose "table-cell-index" attribute.
 
-  nsAccessible *thisRow = GetParent();
-  if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
+  nsAccessible* thisRow = GetParent();
+  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
     return NS_OK;
 
   PRInt32 colIdx = 0, colCount = 0;
   PRInt32 childCount = thisRow->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *child = thisRow->GetChildAt(childIdx);
     if (child == this)
       colIdx = colCount;
 
-    PRUint32 role = nsAccUtils::Role(child);
+    PRUint32 role = child->Role();
     if (role == nsIAccessibleRole::ROLE_GRID_CELL ||
         role == nsIAccessibleRole::ROLE_ROWHEADER ||
         role == nsIAccessibleRole::ROLE_COLUMNHEADER)
       colCount++;
   }
 
-  nsAccessible *table = thisRow->GetParent();
-  if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE &&
-      nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TREE_TABLE)
+  nsAccessible* table = thisRow->GetParent();
+  if (!table)
+    return NS_OK;
+
+  PRUint32 tableRole = table->Role();
+  if (tableRole != nsIAccessibleRole::ROLE_TABLE &&
+      tableRole != nsIAccessibleRole::ROLE_TREE_TABLE)
     return NS_OK;
 
   PRInt32 rowIdx = 0;
   childCount = table->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
     nsAccessible *child = table->GetChildAt(childIdx);
     if (child == thisRow)
       break;
 
-    if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_ROW)
+    if (child->Role() == nsIAccessibleRole::ROLE_ROW)
       rowIdx++;
   }
 
   PRInt32 idx = rowIdx * colCount + colIdx;
 
   nsAutoString stringIdx;
   stringIdx.AppendInt(idx);
   nsAccUtils::SetAccAttr(aAttributes, nsAccessibilityAtoms::tableCellIndex,
--- a/accessible/src/base/nsAccUtils.cpp
+++ b/accessible/src/base/nsAccUtils.cpp
@@ -98,24 +98,24 @@ nsAccUtils::SetAccGroupAttrs(nsIPersiste
     value.AppendInt(aSetSize);
     SetAccAttr(aAttributes, nsAccessibilityAtoms::setsize, value);
   }
 }
 
 PRInt32
 nsAccUtils::GetDefaultLevel(nsAccessible *aAccessible)
 {
-  PRUint32 role = nsAccUtils::Role(aAccessible);
+  PRUint32 role = aAccessible->Role();
 
   if (role == nsIAccessibleRole::ROLE_OUTLINEITEM)
     return 1;
 
   if (role == nsIAccessibleRole::ROLE_ROW) {
     nsAccessible *parent = aAccessible->GetParent();
-    if (Role(parent) == nsIAccessibleRole::ROLE_TREE_TABLE) {
+    if (parent && parent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE) {
       // It is a row inside flatten treegrid. Group level is always 1 until it
       // is overriden by aria-level attribute.
       return 1;
     }
   }
 
   return 0;
 }
@@ -352,17 +352,17 @@ nsAccUtils::HasAccessibleChildren(nsINod
 }
 
 nsAccessible *
 nsAccUtils::GetAncestorWithRole(nsAccessible *aDescendant, PRUint32 aRole)
 {
   nsAccessible *document = aDescendant->GetDocAccessible();
   nsAccessible *parent = aDescendant;
   while ((parent = parent->GetParent())) {
-    PRUint32 testRole = nsAccUtils::Role(parent);
+    PRUint32 testRole = parent->Role();
     if (testRole == aRole)
       return parent;
 
     if (parent == document)
       break;
   }
   return nsnull;
 }
@@ -573,33 +573,16 @@ nsAccUtils::GetRoleMapEntry(nsINode *aNo
     }
   }
 
   // Always use some entry if there is a non-empty role string
   // To ensure an accessible object is created
   return &nsARIAMap::gLandmarkRoleMap;
 }
 
-PRUint32
-nsAccUtils::RoleInternal(nsIAccessible *aAcc)
-{
-  PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
-  if (aAcc) {
-    nsAccessible* accessible = nsnull;
-    CallQueryInterface(aAcc, &accessible);
-
-    if (accessible) {
-      accessible->GetRoleInternal(&role);
-      NS_RELEASE(accessible);
-    }
-  }
-
-  return role;
-}
-
 PRUint8
 nsAccUtils::GetAttributeCharacteristics(nsIAtom* aAtom)
 {
     for (PRUint32 i = 0; i < nsARIAMap::gWAIUnivAttrMapLength; i++)
       if (*nsARIAMap::gWAIUnivAttrMap[i].attributeName == aAtom)
         return nsARIAMap::gWAIUnivAttrMap[i].characteristics;
 
     return 0;
--- a/accessible/src/base/nsAccUtils.h
+++ b/accessible/src/base/nsAccUtils.h
@@ -293,21 +293,16 @@ public:
     PRUint32 role = nsIAccessibleRole::ROLE_NOTHING;
     if (aAcc)
       aAcc->GetRole(&role);
 
     return role;
   }
 
   /**
-   * Return the role from native markup of the given accessible.
-   */
-  static PRUint32 RoleInternal(nsIAccessible *aAcc);
-
-  /**
    * Return the state for the given accessible.
    */
   static PRUint32 State(nsIAccessible *aAcc)
   {
     PRUint32 state = 0;
     if (aAcc)
       aAcc->GetState(&state, nsnull);
 
--- a/accessible/src/base/nsAccessibilityService.cpp
+++ b/accessible/src/base/nsAccessibilityService.cpp
@@ -938,17 +938,17 @@ nsAccessibilityService::GetOrCreateAcces
           continue;
 
         if (tableFrame->GetType() == nsAccessibilityAtoms::tableOuterFrame) {
           nsAccessible *tableAccessible =
             GetAccessibleInWeakShell(tableContent, aWeakShell);
 
           if (tableAccessible) {
             if (!roleMapEntry) {
-              PRUint32 role = nsAccUtils::Role(tableAccessible);
+              PRUint32 role = tableAccessible->Role();
               if (role != nsIAccessibleRole::ROLE_TABLE &&
                   role != nsIAccessibleRole::ROLE_TREE_TABLE) {
                 // No ARIA role and not in table: override role. For example,
                 // <table role="label"><td>content</td></table>
                 roleMapEntry = &nsARIAMap::gEmptyRoleMap;
               }
             }
 
--- a/accessible/src/base/nsAccessible.cpp
+++ b/accessible/src/base/nsAccessible.cpp
@@ -1258,62 +1258,18 @@ NS_IMETHODIMP
 nsAccessible::GetRole(PRUint32 *aRole)
 {
   NS_ENSURE_ARG_POINTER(aRole);
   *aRole = nsIAccessibleRole::ROLE_NOTHING;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  if (mRoleMapEntry) {
-    *aRole = mRoleMapEntry->role;
-
-    // These unfortunate exceptions don't fit into the ARIA table
-    // This is where the nsIAccessible role depends on both the role and ARIA state
-    if (*aRole == nsIAccessibleRole::ROLE_PUSHBUTTON) {
-
-      if (nsAccUtils::HasDefinedARIAToken(mContent,
-                                          nsAccessibilityAtoms::aria_pressed)) {
-        // For simplicity, any existing pressed attribute except "", or "undefined"
-        // indicates a toggle.
-        *aRole = nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
-
-      } else if (mContent->AttrValueIs(kNameSpaceID_None,
-                                       nsAccessibilityAtoms::aria_haspopup,
-                                       nsAccessibilityAtoms::_true,
-                                       eCaseMatters)) {
-        // For button with aria-haspopup="true".
-        *aRole = nsIAccessibleRole::ROLE_BUTTONMENU;
-      }
-    }
-    else if (*aRole == nsIAccessibleRole::ROLE_LISTBOX) {
-      // A listbox inside of a combo box needs a special role because of ATK mapping to menu
-      nsCOMPtr<nsIAccessible> possibleCombo;
-      GetParent(getter_AddRefs(possibleCombo));
-      if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX) {
-        *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-      }
-      else {   // Check to see if combo owns the listbox instead
-        possibleCombo = nsRelUtils::
-          GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
-        if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
-          *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-      }
-    }
-    else if (*aRole == nsIAccessibleRole::ROLE_OPTION) {
-      if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-        *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
-    }
-
-    // We are done if the mapped role trumps native semantics
-    if (mRoleMapEntry->roleRule == kUseMapRole)
-      return NS_OK;
-  }
-
-  return GetRoleInternal(aRole);
+  *aRole = Role();
+  return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessible::GetAttributes(nsIPersistentProperties **aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);  // In/out param. Created if necessary.
   
   if (IsDefunct())
@@ -1622,20 +1578,16 @@ nsAccessible::GetState(PRUint32 *aState,
             *aExtraState |= nsIAccessibleStates::EXT_STATE_ACTIVE;
           }
           break;
         }
       }
     }
   }
 
-  PRUint32 role;
-  rv = GetRole(&role);
-  NS_ENSURE_SUCCESS(rv, rv);
-
   // For some reasons DOM node may have not a frame. We tract such accessibles
   // as invisible.
   nsIFrame *frame = GetFrame();
   if (!frame)
     return NS_OK;
 
   const nsStyleDisplay* display = frame->GetStyleDisplay();
   if (display && display->mOpacity == 1.0f &&
@@ -1847,29 +1799,67 @@ nsAccessible::GetKeyBindings(PRUint8 aAc
 
   if (!defaultKey.IsEmpty())
     keyBindings->Add(defaultKey);
 
   NS_ADDREF(*aKeyBindings = keyBindings);
   return NS_OK;
 }
 
-/* unsigned long getRole (); */
-nsresult
-nsAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsAccessible::Role()
 {
-  *aRole = nsIAccessibleRole::ROLE_NOTHING;
-
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
-  if (nsCoreUtils::IsXLink(mContent))
-    *aRole = nsIAccessibleRole::ROLE_LINK;
-
-  return NS_OK;
+  // No ARIA role or it doesn't suppress role from native markup.
+  if (!mRoleMapEntry || mRoleMapEntry->roleRule != kUseMapRole)
+    return NativeRole();
+
+  // XXX: these unfortunate exceptions don't fit into the ARIA table. This is
+  // where the accessible role depends on both the role and ARIA state.
+  if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    if (nsAccUtils::HasDefinedARIAToken(mContent,
+                                        nsAccessibilityAtoms::aria_pressed)) {
+      // For simplicity, any existing pressed attribute except "" or "undefined"
+      // indicates a toggle.
+      return nsIAccessibleRole::ROLE_TOGGLE_BUTTON;
+    }
+
+    if (mContent->AttrValueIs(kNameSpaceID_None,
+                              nsAccessibilityAtoms::aria_haspopup,
+                              nsAccessibilityAtoms::_true,
+                              eCaseMatters)) {
+      // For button with aria-haspopup="true".
+      return nsIAccessibleRole::ROLE_BUTTONMENU;
+    }
+
+  } else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_LISTBOX) {
+    // A listbox inside of a combobox needs a special role because of ATK
+    // mapping to menu.
+    if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX) {
+      return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+
+      nsCOMPtr<nsIAccessible> possibleCombo =
+        nsRelUtils::GetRelatedAccessible(this,
+                                         nsIAccessibleRelation::RELATION_NODE_CHILD_OF);
+      if (nsAccUtils::Role(possibleCombo) == nsIAccessibleRole::ROLE_COMBOBOX)
+        return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+    }
+
+  } else if (mRoleMapEntry->role == nsIAccessibleRole::ROLE_OPTION) {
+    if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+      return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+  }
+
+  return mRoleMapEntry->role;
+}
+
+PRUint32
+nsAccessible::NativeRole()
+{
+  return nsCoreUtils::IsXLink(mContent) ?
+    nsIAccessibleRole::ROLE_LINK : nsIAccessibleRole::ROLE_NOTHING;
 }
 
 // readonly attribute PRUint8 numActions
 NS_IMETHODIMP
 nsAccessible::GetNumActions(PRUint8 *aNumActions)
 {
   NS_ENSURE_ARG_POINTER(aNumActions);
   *aNumActions = 0;
@@ -2780,19 +2770,17 @@ nsAccessible::GetParent()
   if (mParent)
     return mParent;
 
   if (IsDefunct())
     return nsnull;
 
   // XXX: mParent can be null randomly because supposedly we get layout
   // notification and invalidate parent-child relations, this accessible stays
-  // unattached. This should gone after bug 572951. Other reason is bug 574588
-  // since CacheChildren() implementation calls nsAccessible::GetRole() what
-  // can need to get a parent and we are here as result.
+  // unattached. This should gone after bug 572951.
   NS_WARNING("Bad accessible tree!");
 
 #ifdef DEBUG
   nsDocAccessible *docAccessible = GetDocAccessible();
   NS_ASSERTION(docAccessible, "No document accessible for valid accessible!");
 #endif
 
   nsAccessible* parent = GetAccService()->GetContainerAccessible(mContent,
@@ -3359,27 +3347,27 @@ nsAccessible::GetPositionAndSizeInternal
   }
 }
 
 PRInt32
 nsAccessible::GetLevelInternal()
 {
   PRInt32 level = nsAccUtils::GetDefaultLevel(this);
 
-  PRUint32 role = nsAccUtils::Role(this);
+  PRUint32 role = Role();
   nsAccessible* parent = GetParent();
 
   if (role == nsIAccessibleRole::ROLE_OUTLINEITEM) {
     // Always expose 'level' attribute for 'outlineitem' accessible. The number
     // of nested 'grouping' accessibles containing 'outlineitem' accessible is
     // its level.
     level = 1;
 
     while (parent) {
-      PRUint32 parentRole = nsAccUtils::Role(parent);
+      PRUint32 parentRole = parent->Role();
 
       if (parentRole == nsIAccessibleRole::ROLE_OUTLINE)
         break;
       if (parentRole == nsIAccessibleRole::ROLE_GROUPING)
         ++ level;
 
       parent = parent->GetParent();
     }
@@ -3389,17 +3377,17 @@ nsAccessible::GetLevelInternal()
     // child of listitem of parent list. We don't handle the case when nested
     // lists have more complex structure, for example when there are accessibles
     // between parent listitem and nested list.
 
     // Calculate 'level' attribute based on number of parent listitems.
     level = 0;
 
     while (parent) {
-      PRUint32 parentRole = nsAccUtils::Role(parent);
+      PRUint32 parentRole = parent->Role();
 
       if (parentRole == nsIAccessibleRole::ROLE_LISTITEM)
         ++ level;
       else if (parentRole != nsIAccessibleRole::ROLE_LIST)
         break;
 
       parent = parent->GetParent();
     }
--- a/accessible/src/base/nsAccessible.h
+++ b/accessible/src/base/nsAccessible.h
@@ -139,22 +139,25 @@ public:
    *
    * @return NS_OK_EMPTY_NAME  points empty name was specified by native markup
    *                           explicitly (see nsIAccessible::name attribute for
    *                           details)
    */
   virtual nsresult GetNameInternal(nsAString& aName);
 
   /**
+   * Return enumerated accessible role (see constants in nsIAccessibleRole).
+   */
+  virtual PRUint32 Role();
+
+  /**
    * Returns enumerated accessible role from native markup (see constants in
    * nsIAccessibleRole). Doesn't take into account ARIA roles.
-   *
-   * @param aRole  [out] accessible role.
    */
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
   /**
    * Return the state of accessible that doesn't take into account ARIA states.
    * Use nsIAccessible::state to get all states for accessible. If
    * second argument is omitted then second bit field of accessible state won't
    * be calculated.
    */
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
--- a/accessible/src/base/nsApplicationAccessible.cpp
+++ b/accessible/src/base/nsApplicationAccessible.cpp
@@ -135,23 +135,16 @@ nsApplicationAccessible::GetDescription(
 NS_IMETHODIMP
 nsApplicationAccessible::GetKeyboardShortcut(nsAString &aKeyboardShortcut)
 {
   aKeyboardShortcut.Truncate();
   return NS_OK;
 }
 
 NS_IMETHODIMP
-nsApplicationAccessible::GetRole(PRUint32 *aRole)
-{
-  NS_ENSURE_ARG_POINTER(aRole);
-  return GetRoleInternal(aRole);
-}
-
-NS_IMETHODIMP
 nsApplicationAccessible::GetState(PRUint32 *aState, PRUint32 *aExtraState)
 {
   NS_ENSURE_ARG_POINTER(aState);
   GetStateInternal(aState, aExtraState);
   return NS_OK;
 }
 
 NS_IMETHODIMP
@@ -374,21 +367,26 @@ nsApplicationAccessible::Shutdown()
 // nsAccessible public methods
 
 nsresult
 nsApplicationAccessible::GetARIAState(PRUint32 *aState, PRUint32 *aExtraState)
 {
   return NS_OK;
 }
 
-nsresult
-nsApplicationAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsApplicationAccessible::Role()
 {
-  *aRole = nsIAccessibleRole::ROLE_APP_ROOT;
-  return NS_OK;
+  return NativeRole();
+}
+
+PRUint32
+nsApplicationAccessible::NativeRole()
+{
+  return nsIAccessibleRole::ROLE_APP_ROOT;
 }
 
 nsresult
 nsApplicationAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   *aState = 0;
 
--- a/accessible/src/base/nsApplicationAccessible.h
+++ b/accessible/src/base/nsApplicationAccessible.h
@@ -76,17 +76,16 @@ public:
   // nsIAccessible
   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 GetDescription(nsAString &aDescription);
   NS_IMETHOD GetKeyboardShortcut(nsAString &aKeyboardShortcut);
-  NS_IMETHOD GetRole(PRUint32 *aRole);
   NS_IMETHOD GetState(PRUint32 *aState , PRUint32 *aExtraState );
   NS_IMETHOD GetAttributes(nsIPersistentProperties **aAttributes);
   NS_IMETHOD GroupPosition(PRInt32 *aGroupLevel, PRInt32 *aSimilarItemsInGroup,
                            PRInt32 *aPositionInGroup);
   NS_IMETHOD GetChildAtPoint(PRInt32 aX, PRInt32 aY, nsIAccessible **aChild);
   NS_IMETHOD GetDeepestChildAtPoint(PRInt32 aX, PRInt32 aY, nsIAccessible **aChild);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
@@ -108,17 +107,18 @@ public:
 
   // nsAccessNode
   virtual PRBool IsDefunct();
   virtual PRBool Init();
   virtual void Shutdown();
 
   // nsAccessible
   virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 Role();
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   virtual void InvalidateChildren();
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
--- a/accessible/src/base/nsBaseWidgetAccessible.cpp
+++ b/accessible/src/base/nsBaseWidgetAccessible.cpp
@@ -252,27 +252,27 @@ nsLinkableAccessible::CacheActionContent
 
   if (isOnclick) {
     mActionContent = walkUpContent;
     mIsOnclick = PR_TRUE;
     return;
   }
 
   while ((walkUpContent = walkUpContent->GetParent())) {
-    isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
-    nsAccessible *walkUpAcc =
+    nsAccessible* walkUpAcc =
       GetAccService()->GetAccessibleInWeakShell(walkUpContent, mWeakShell);
 
-    if (nsAccUtils::Role(walkUpAcc) == nsIAccessibleRole::ROLE_LINK &&
+    if (walkUpAcc && walkUpAcc->Role() == nsIAccessibleRole::ROLE_LINK &&
         nsAccUtils::State(walkUpAcc) & nsIAccessibleStates::STATE_LINKED) {
       mIsLink = PR_TRUE;
       mActionContent = walkUpContent;
       return;
     }
 
+    isOnclick = nsCoreUtils::HasClickListener(walkUpContent);
     if (isOnclick) {
       mActionContent = walkUpContent;
       mIsOnclick = PR_TRUE;
       return;
     }
   }
 }
 
@@ -297,14 +297,13 @@ nsEnumRoleAccessible::
   nsEnumRoleAccessible(nsIContent *aNode, nsIWeakReference *aShell,
                        PRUint32 aRole) :
   nsAccessibleWrap(aNode, aShell), mRole(aRole)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsEnumRoleAccessible, nsAccessible)
 
-nsresult
-nsEnumRoleAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsEnumRoleAccessible::NativeRole()
 {
-  *aRole = mRole;
-  return NS_OK;
+  return mRole;
 }
--- a/accessible/src/base/nsBaseWidgetAccessible.h
+++ b/accessible/src/base/nsBaseWidgetAccessible.h
@@ -130,15 +130,15 @@ class nsEnumRoleAccessible : public nsAc
 public:
   nsEnumRoleAccessible(nsIContent *aContent, nsIWeakReference *aShell,
                        PRUint32 aRole);
   virtual ~nsEnumRoleAccessible() { }
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
 protected:
   PRUint32 mRole;
 };
 
 #endif  
--- a/accessible/src/base/nsDocAccessible.cpp
+++ b/accessible/src/base/nsDocAccessible.cpp
@@ -88,37 +88,26 @@ nsIAtom *nsDocAccessible::gLastFocusedFr
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // Constructor/desctructor
 
 nsDocAccessible::
   nsDocAccessible(nsIDocument *aDocument, nsIContent *aRootContent,
                   nsIWeakReference *aShell) :
-  nsHyperTextAccessibleWrap(aRootContent, aShell), mWnd(nsnull),
+  nsHyperTextAccessibleWrap(aRootContent, aShell),
   mDocument(aDocument), mScrollPositionChangedTicks(0), mIsLoaded(PR_FALSE)
 {
   // XXX aaronl should we use an algorithm for the initial cache size?
   mAccessibleCache.Init(kDefaultCacheSize);
 
   // For GTK+ native window, we do nothing here.
   if (!mDocument)
     return;
 
-  // Initialize mWnd
-  nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
-  nsIViewManager* vm = shell->GetViewManager();
-  if (vm) {
-    nsCOMPtr<nsIWidget> widget;
-    vm->GetRootWidget(getter_AddRefs(widget));
-    if (widget) {
-      mWnd = widget->GetNativeData(NS_NATIVE_WINDOW);
-    }
-  }
-
   // nsAccDocManager creates document accessible when scrollable frame is
   // available already, it should be safe time to add scroll listener.
   AddScrollListener();
 }
 
 nsDocAccessible::~nsDocAccessible()
 {
 }
@@ -128,21 +117,28 @@ nsDocAccessible::~nsDocAccessible()
 // nsISupports
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocAccessible)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
   NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mEventQueue");
   cb.NoteXPCOMChild(tmp->mEventQueue.get());
 
+  PRUint32 i, length = tmp->mChildDocuments.Length();
+  for (i = 0; i < length; ++i) {
+    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mChildDocuments[i]");
+    cb.NoteXPCOMChild(static_cast<nsIAccessible*>(tmp->mChildDocuments[i].get()));
+  }
+
   CycleCollectorTraverseCache(tmp->mAccessibleCache, &cb);
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
 NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsDocAccessible, nsAccessible)
   NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mEventQueue)
+  NS_IMPL_CYCLE_COLLECTION_UNLINK_NSTARRAY(mChildDocuments)
   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)
@@ -198,52 +194,46 @@ nsDocAccessible::GetName(nsAString& aNam
   if (aName.IsEmpty()) {   // Last resort: use URL
     rv = GetURL(aName);
   }
 
   return rv;
 }
 
 // nsAccessible public method
-nsresult
-nsDocAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsDocAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PANE; // Fall back
-
   nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem =
     nsCoreUtils::GetDocShellTreeItemFor(mDocument);
   if (docShellTreeItem) {
     nsCOMPtr<nsIDocShellTreeItem> sameTypeRoot;
     docShellTreeItem->GetSameTypeRootTreeItem(getter_AddRefs(sameTypeRoot));
     PRInt32 itemType;
     docShellTreeItem->GetItemType(&itemType);
     if (sameTypeRoot == docShellTreeItem) {
       // Root of content or chrome tree
-      if (itemType == nsIDocShellTreeItem::typeChrome) {
-        *aRole = nsIAccessibleRole::ROLE_CHROME_WINDOW;
-      }
-      else if (itemType == nsIDocShellTreeItem::typeContent) {
+      if (itemType == nsIDocShellTreeItem::typeChrome)
+        return nsIAccessibleRole::ROLE_CHROME_WINDOW;
+
+      if (itemType == nsIDocShellTreeItem::typeContent) {
 #ifdef MOZ_XUL
         nsCOMPtr<nsIXULDocument> xulDoc(do_QueryInterface(mDocument));
-        if (xulDoc) {
-          *aRole = nsIAccessibleRole::ROLE_APPLICATION;
-        } else {
-          *aRole = nsIAccessibleRole::ROLE_DOCUMENT;
-        }
-#else
-        *aRole = nsIAccessibleRole::ROLE_DOCUMENT;
+        if (xulDoc)
+          return nsIAccessibleRole::ROLE_APPLICATION;
 #endif
+        return nsIAccessibleRole::ROLE_DOCUMENT;
       }
     }
     else if (itemType == nsIDocShellTreeItem::typeContent) {
-      *aRole = nsIAccessibleRole::ROLE_DOCUMENT;
+      return nsIAccessibleRole::ROLE_DOCUMENT;
     }
   }
 
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PANE; // Fall back;
 }
 
 // nsAccessible public method
 void
 nsDocAccessible::SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry)
 {
   NS_ASSERTION(mDocument, "No document during initialization!");
   if (!mDocument)
@@ -467,17 +457,18 @@ NS_IMETHODIMP nsDocAccessible::GetNameSp
     if (nameSpaceManager)
       return nameSpaceManager->GetNameSpaceURI(aNameSpaceID, aNameSpaceURI);
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP nsDocAccessible::GetWindowHandle(void **aWindow)
 {
-  *aWindow = mWnd;
+  NS_ENSURE_ARG_POINTER(aWindow);
+  *aWindow = GetNativeWindow();
   return NS_OK;
 }
 
 NS_IMETHODIMP nsDocAccessible::GetWindow(nsIDOMWindow **aDOMWin)
 {
   *aDOMWin = nsnull;
   if (!mDocument) {
     return NS_ERROR_FAILURE;  // Accessible is Shutdown()
@@ -499,16 +490,54 @@ nsDocAccessible::GetDOMDocument(nsIDOMDo
   *aDOMDocument = nsnull;
 
   if (mDocument)
     CallQueryInterface(mDocument, aDOMDocument);
 
   return NS_OK;
 }
 
+NS_IMETHODIMP
+nsDocAccessible::GetParentDocument(nsIAccessibleDocument** aDocument)
+{
+  NS_ENSURE_ARG_POINTER(aDocument);
+  *aDocument = nsnull;
+
+  if (!IsDefunct())
+    NS_IF_ADDREF(*aDocument = ParentDocument());
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocAccessible::GetChildDocumentCount(PRUint32* aCount)
+{
+  NS_ENSURE_ARG_POINTER(aCount);
+  *aCount = 0;
+
+  if (!IsDefunct())
+    *aCount = ChildDocumentCount();
+
+  return NS_OK;
+}
+
+NS_IMETHODIMP
+nsDocAccessible::GetChildDocumentAt(PRUint32 aIndex,
+                                    nsIAccessibleDocument** aDocument)
+{
+  NS_ENSURE_ARG_POINTER(aDocument);
+  *aDocument = nsnull;
+
+  if (IsDefunct())
+    return NS_OK;
+
+  NS_IF_ADDREF(*aDocument = GetChildDocumentAt(aIndex));
+  return *aDocument ? NS_OK : NS_ERROR_INVALID_ARG;
+}
+
 // nsIAccessibleHyperText method
 NS_IMETHODIMP nsDocAccessible::GetAssociatedEditor(nsIEditor **aEditor)
 {
   NS_ENSURE_ARG_POINTER(aEditor);
   *aEditor = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
@@ -532,16 +561,17 @@ NS_IMETHODIMP nsDocAccessible::GetAssoci
   PRBool isEditable;
   editor->GetIsDocumentEditable(&isEditable);
   if (isEditable) {
     NS_ADDREF(*aEditor = editor);
   }
   return NS_OK;
 }
 
+// nsDocAccessible public method
 nsAccessible *
 nsDocAccessible::GetCachedAccessible(void *aUniqueID)
 {
   nsAccessible* accessible = mAccessibleCache.GetWeak(aUniqueID);
 
   // No accessible in the cache, check if the given ID is unique ID of this
   // document accessible.
   if (!accessible) {
@@ -604,16 +634,20 @@ nsDocAccessible::Init()
 
   // Initialize event queue.
   mEventQueue = new nsAccEventQueue(this);
   if (!mEventQueue)
     return PR_FALSE;
 
   AddEventListeners();
 
+  nsDocAccessible* parentDocument = mParent->GetDocAccessible();
+  if (parentDocument)
+    parentDocument->AppendChildDocument(this);
+
   // Fire reorder event to notify new accessible document has been created and
   // attached to the tree.
   nsRefPtr<AccEvent> reorderEvent =
     new AccReorderEvent(mParent, PR_FALSE, PR_TRUE, mDocument);
   if (!reorderEvent)
     return PR_FALSE;
 
   FireDelayedAccessibleEvent(reorderEvent);
@@ -630,18 +664,25 @@ nsDocAccessible::Shutdown()
 
   if (mEventQueue) {
     mEventQueue->Shutdown();
     mEventQueue = nsnull;
   }
 
   RemoveEventListeners();
 
-  if (mParent)
+  if (mParent) {
+    nsDocAccessible* parentDocument = mParent->GetDocAccessible();
+    if (parentDocument)
+      parentDocument->RemoveChildDocument(this);
+
     mParent->RemoveChild(this);
+  }
+
+  mChildDocuments.Clear();
 
   mWeakShell = nsnull;  // Avoid reentrancy
 
   ClearCache(mAccessibleCache);
 
   nsCOMPtr<nsIDocument> kungFuDeathGripDoc = mDocument;
   mDocument = nsnull;
 
@@ -1279,24 +1320,55 @@ nsDocAccessible::HandleAccEvent(AccEvent
   return nsHyperTextAccessible::HandleAccEvent(aAccEvent);
 
 }
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 // Public members
 
+void*
+nsDocAccessible::GetNativeWindow() const
+{
+  nsCOMPtr<nsIPresShell> shell(do_QueryReferent(mWeakShell));
+  nsIViewManager* vm = shell->GetViewManager();
+  if (vm) {
+    nsCOMPtr<nsIWidget> widget;
+    vm->GetRootWidget(getter_AddRefs(widget));
+    if (widget)
+      return widget->GetNativeData(NS_NATIVE_WINDOW);
+  }
+  return nsnull;
+}
+
+nsAccessible*
+nsDocAccessible::GetCachedAccessibleInSubtree(void* aUniqueID)
+{
+  nsAccessible* child = GetCachedAccessible(aUniqueID);
+  if (child)
+    return child;
+
+  PRUint32 childDocCount = mChildDocuments.Length();
+  for (PRUint32 childDocIdx= 0; childDocIdx < childDocCount; childDocIdx++) {
+    nsDocAccessible* childDocument = mChildDocuments.ElementAt(childDocIdx);
+    child = childDocument->GetCachedAccessibleInSubtree(aUniqueID);
+    if (child)
+      return child;
+  }
+
+  return nsnull;
+}
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 void
 nsDocAccessible::FireValueChangeForTextFields(nsAccessible *aAccessible)
 {
-  if (nsAccUtils::Role(aAccessible) != nsIAccessibleRole::ROLE_ENTRY)
+  if (aAccessible->Role() != nsIAccessibleRole::ROLE_ENTRY)
     return;
 
   // Dependent value change event for text changes in textfields
   nsRefPtr<AccEvent> valueChangeEvent =
     new AccEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible,
                  PR_FALSE, eAutoDetect, AccEvent::eRemoveDupes);
   FireDelayedAccessibleEvent(valueChangeEvent);
 }
@@ -1373,17 +1445,17 @@ nsDocAccessible::CreateTextChangeEventFo
   if (!textAccessible) {
     return nsnull;
   }
 
   nsAutoString text;
   PRInt32 offset = 0;
   if (aChangeChild) {
     // Don't fire event for the first html:br in an editor.
-    if (nsAccUtils::Role(aChangeChild) == nsIAccessibleRole::ROLE_WHITESPACE) {
+    if (aChangeChild->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
       nsCOMPtr<nsIEditor> editor;
       textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
       if (editor) {
         PRBool isEmpty = PR_FALSE;
         editor->GetDocumentIsEmpty(&isEmpty);
         if (isEmpty) {
           return nsnull;
         }
@@ -1625,18 +1697,17 @@ nsDocAccessible::RefreshNodes(nsINode *a
     return; // All we have is a doc accessible. There is nothing to invalidate, quit early
   }
 
   // Shut down accessible subtree, which may have been created for anonymous
   // content subtree.
   nsAccessible *accessible = GetCachedAccessible(aStartNode);
   if (accessible) {
     // Fire menupopup end if a menu goes away
-    PRUint32 role = nsAccUtils::Role(accessible);
-    if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
       nsCOMPtr<nsIDOMXULPopupElement> popup(do_QueryInterface(aStartNode));
       if (!popup) {
         // Popup elements already fire these via DOMMenuInactive
         // handling in nsRootAccessible::HandleEvent
         nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
                                 accessible);
       }
     }
--- a/accessible/src/base/nsDocAccessible.h
+++ b/accessible/src/base/nsDocAccessible.h
@@ -105,17 +105,17 @@ public:
   // nsAccessNode
   virtual PRBool Init();
   virtual void Shutdown();
   virtual nsIFrame* GetFrame();
   virtual PRBool IsDefunct();
   virtual nsINode* GetNode() const { return mDocument; }
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
 
   virtual void SetRoleMapEntry(nsRoleMapEntry* aRoleMapEntry);
 
 #ifdef DEBUG_ACCDOCMGR
   virtual nsresult HandleAccEvent(AccEvent* aAccEvent);
 #endif
@@ -137,16 +137,39 @@ public:
   /**
    * Marks as loaded, used for error pages as workaround since they do not
    * receive pageshow event and as consequence nsIDocument::IsShowing() returns
    * false.
    */
   void MarkAsLoaded() { mIsLoaded = PR_TRUE; }
 
   /**
+   * Return a native window handler or pointer depending on platform.
+   */
+  virtual void* GetNativeWindow() const;
+
+  /**
+   * Return the parent document.
+   */
+  nsDocAccessible* ParentDocument() const
+    { return mParent ? mParent->GetDocAccessible() : nsnull; }
+
+  /**
+   * Return the child document count.
+   */
+  PRUint32 ChildDocumentCount() const
+    { return mChildDocuments.Length(); }
+
+  /**
+   * Return the child document at the given index.
+   */
+  nsDocAccessible* GetChildDocumentAt(PRUint32 aIndex) const
+    { return mChildDocuments.SafeElementAt(aIndex, nsnull); }
+
+  /**
    * Non-virtual method to fire a delayed event after a 0 length timeout.
    *
    * @param aEventType   [in] the nsIAccessibleEvent event type
    * @param aDOMNode     [in] DOM node the accesible event should be fired for
    * @param aAllowDupes  [in] rule to process an event (see EEventRule constants)
    * @param aIsAsynch    [in] set to PR_TRUE if this is not being called from
    *                      code synchronous with a DOM event
    */
@@ -184,16 +207,22 @@ public:
    *
    * @param  aUniqueID  [in] the unique ID used to cache the node.
    *
    * @return the accessible object
    */
   nsAccessible* GetCachedAccessible(void *aUniqueID);
 
   /**
+   * Return the cached accessible by the given unique ID looking through
+   * this and nested documents.
+   */
+  nsAccessible* GetCachedAccessibleInSubtree(void* aUniqueID);
+
+  /**
    * Cache the accessible.
    *
    * @param  aUniquID     [in] the unique identifier of accessible
    * @param  aAccessible  [in] accessible to cache
    *
    * @return true if accessible being cached, otherwise false
    */
   PRBool CacheAccessible(void *aUniqueID, nsAccessible *aAccessible);
@@ -213,16 +242,34 @@ protected:
 
     virtual void GetBoundsRect(nsRect& aRect, nsIFrame** aRelativeFrame);
     virtual nsresult AddEventListeners();
     virtual nsresult RemoveEventListeners();
     void AddScrollListener();
     void RemoveScrollListener();
 
   /**
+   * Append the given document accessible to this document's child document
+   * accessibles.
+   */
+  bool AppendChildDocument(nsDocAccessible* aChildDocument)
+  {
+    return mChildDocuments.AppendElement(aChildDocument);
+  }
+
+  /**
+   * Remove the given document accessible from this document's child document
+   * accessibles.
+   */
+  void RemoveChildDocument(nsDocAccessible* aChildDocument)
+  {
+    mChildDocuments.RemoveElement(aChildDocument);
+  }
+
+  /**
    * Invalidate parent-child relations for any cached accessible in the DOM
    * subtree. Accessible objects aren't destroyed.
    *
    * @param aStartNode  [in] the root of the subrtee to invalidate accessible
    *                      child/parent refs in
    */
   void InvalidateChildrenInSubtree(nsINode *aStartNode);
 
@@ -316,30 +363,31 @@ protected:
    */
   void FireValueChangeForTextFields(nsAccessible *aAccessible);
 
   /**
    * Cache of accessibles within this document accessible.
    */
   nsAccessibleHashtable mAccessibleCache;
 
-    void *mWnd;
     nsCOMPtr<nsIDocument> mDocument;
     nsCOMPtr<nsITimer> mScrollWatchTimer;
     PRUint16 mScrollPositionChangedTicks; // Used for tracking scroll events
 
 protected:
 
   nsRefPtr<nsAccEventQueue> mEventQueue;
 
   /**
    * Specifies if the document was loaded, used for error pages only.
    */
   PRPackedBool mIsLoaded;
 
     static PRUint32 gLastFocusedAccessiblesState;
     static nsIAtom *gLastFocusedFrameType;
+
+  nsTArray<nsRefPtr<nsDocAccessible> > mChildDocuments;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsDocAccessible,
                               NS_DOCACCESSIBLE_IMPL_CID)
 
 #endif  
--- a/accessible/src/base/nsEventShell.cpp
+++ b/accessible/src/base/nsEventShell.cpp
@@ -527,18 +527,17 @@ nsAccEventQueue::CreateTextChangeEventFo
 {
   nsRefPtr<nsHyperTextAccessible> textAccessible = do_QueryObject(
     GetAccService()->GetContainerAccessible(aEvent->mNode,
                                             aEvent->mAccessible->GetWeakShell()));
   if (!textAccessible)
     return;
 
   // Don't fire event for the first html:br in an editor.
-  if (nsAccUtils::Role(aEvent->mAccessible) ==
-      nsIAccessibleRole::ROLE_WHITESPACE) {
+  if (aEvent->mAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {
     nsCOMPtr<nsIEditor> editor;
     textAccessible->GetAssociatedEditor(getter_AddRefs(editor));
     if (editor) {
       PRBool isEmpty = PR_FALSE;
       editor->GetDocumentIsEmpty(&isEmpty);
       if (isEmpty)
         return;
     }
--- a/accessible/src/base/nsFormControlAccessible.cpp
+++ b/accessible/src/base/nsFormControlAccessible.cpp
@@ -77,15 +77,14 @@ nsRadioButtonAccessible::DoAction(PRUint
 {
   if (aIndex != eAction_Click)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
-nsresult
-nsRadioButtonAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsRadioButtonAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_RADIOBUTTON;
 }
 
--- a/accessible/src/base/nsFormControlAccessible.h
+++ b/accessible/src/base/nsFormControlAccessible.h
@@ -53,16 +53,16 @@ public:
   nsRadioButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
   enum { eAction_Click = 0 };
 };
 
 
 #endif
 
--- a/accessible/src/base/nsOuterDocAccessible.cpp
+++ b/accessible/src/base/nsOuterDocAccessible.cpp
@@ -55,21 +55,20 @@ nsOuterDocAccessible::
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsOuterDocAccessible,
                              nsAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsAccessible public (DON'T add methods here)
 
-nsresult
-nsOuterDocAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsOuterDocAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_INTERNAL_FRAME;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_INTERNAL_FRAME;
 }
 
 nsresult
 nsOuterDocAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
--- a/accessible/src/base/nsOuterDocAccessible.h
+++ b/accessible/src/base/nsOuterDocAccessible.h
@@ -62,17 +62,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetActionDescription(PRUint8 aIndex, nsAString& aDescription);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
   virtual nsresult GetChildAtPoint(PRInt32 aX, PRInt32 aY,
                                    PRBool aDeepestChild,
                                    nsIAccessible **aChild);
 
   virtual void InvalidateChildren();
   virtual PRBool AppendChild(nsAccessible *aAccessible);
--- a/accessible/src/base/nsRootAccessible.cpp
+++ b/accessible/src/base/nsRootAccessible.cpp
@@ -137,39 +137,33 @@ nsRootAccessible::GetName(nsAString& aNa
       return NS_OK;
     }
   }
 
   nsCOMPtr<nsIDOMNSDocument> document(do_QueryInterface(mDocument));
   return document->GetTitle(aName);
 }
 
-/* readonly attribute unsigned long accRole; */
-nsresult
-nsRootAccessible::GetRoleInternal(PRUint32 *aRole) 
-{ 
-  if (!mDocument) {
-    return NS_ERROR_FAILURE;
-  }
-
+PRUint32
+nsRootAccessible::NativeRole()
+{
   // If it's a <dialog> or <wizard>, use nsIAccessibleRole::ROLE_DIALOG instead
   dom::Element *root = mDocument->GetRootElement();
   if (root) {
     nsCOMPtr<nsIDOMElement> rootElement(do_QueryInterface(root));
     if (rootElement) {
       nsAutoString name;
       rootElement->GetLocalName(name);
       if (name.EqualsLiteral("dialog") || name.EqualsLiteral("wizard")) {
-        *aRole = nsIAccessibleRole::ROLE_DIALOG; // Always at the root
-        return NS_OK;
+        return nsIAccessibleRole::ROLE_DIALOG; // Always at the root
       }
     }
   }
 
-  return nsDocAccessibleWrap::GetRoleInternal(aRole);
+  return nsDocAccessibleWrap::NativeRole();
 }
 
 // nsRootAccessible protected member
 #ifdef MOZ_XUL
 PRUint32 nsRootAccessible::GetChromeFlags()
 {
   // Return the flag set for the top level window as defined 
   // by nsIWebBrowserChrome::CHROME_WINDOW_[FLAGNAME]
@@ -386,22 +380,21 @@ nsRootAccessible::FireAccessibleFocusEve
     // checks whether finalFocusNode is actually a DOM descendant of the element
     // with the aria-activedescendant attribute.
     if (!finalFocusAccessible) {
       return PR_FALSE;
     }
   }
 
   gLastFocusedAccessiblesState = nsAccUtils::State(finalFocusAccessible);
-  PRUint32 role = nsAccUtils::Role(finalFocusAccessible);
+  PRUint32 role = finalFocusAccessible->Role();
   if (role == nsIAccessibleRole::ROLE_MENUITEM) {
     if (!mCurrentARIAMenubar) {  // Entering menus
       // The natural role is the role that this type of element normally has
-      PRUint32 naturalRole = nsAccUtils::RoleInternal(finalFocusAccessible);
-      if (role != naturalRole) { // Must be a DHTML menuitem
+      if (role != finalFocusAccessible->NativeRole()) { // Must be a DHTML menuitem
         nsAccessible *menuBarAccessible =
           nsAccUtils::GetAncestorWithRole(finalFocusAccessible,
                                           nsIAccessibleRole::ROLE_MENUBAR);
         if (menuBarAccessible) {
           mCurrentARIAMenubar = menuBarAccessible->GetNode();
           if (mCurrentARIAMenubar) {
             nsRefPtr<AccEvent> menuStartEvent =
               new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
@@ -675,17 +668,17 @@ nsRootAccessible::HandleEvent(nsIDOMEven
   }
   else if (eventType.EqualsLiteral("AlertActive")) { 
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_ALERT, accessible);
   }
   else if (eventType.EqualsLiteral("popupshown")) {
     HandlePopupShownEvent(accessible);
   }
   else if (eventType.EqualsLiteral("DOMMenuInactive")) {
-    if (nsAccUtils::Role(accessible) == nsIAccessibleRole::ROLE_MENUPOPUP) {
+    if (accessible->Role() == nsIAccessibleRole::ROLE_MENUPOPUP) {
       nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END,
                               accessible);
     }
   }
   else if (eventType.EqualsLiteral("DOMMenuItemActive")) {
     PRBool fireFocus = PR_FALSE;
     if (!treeItemAccessible) {
 #ifdef MOZ_XUL
@@ -709,17 +702,17 @@ nsRootAccessible::HandleEvent(nsIDOMEven
         nsAccessible *containerAccessible = accessible->GetParent();
         NS_ENSURE_TRUE(containerAccessible, NS_ERROR_FAILURE);
         // It is not top level menuitem
         // Only fire focus event if it is not inside collapsed popup
         // and not a listitem of a combo box
         if (nsAccUtils::State(containerAccessible) & nsIAccessibleStates::STATE_COLLAPSED) {
           nsAccessible *containerParent = containerAccessible->GetParent();
           NS_ENSURE_TRUE(containerParent, NS_ERROR_FAILURE);
-          if (nsAccUtils::Role(containerParent) != nsIAccessibleRole::ROLE_COMBOBOX) {
+          if (containerParent->Role() != nsIAccessibleRole::ROLE_COMBOBOX) {
             return NS_OK;
           }
         }
       }
     }
     if (!fireFocus) {
       nsCOMPtr<nsINode> realFocusedNode = GetCurrentFocus();
       nsIContent* realFocusedContent =
@@ -858,17 +851,17 @@ nsRootAccessible::GetRelationByType(PRUi
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // Protected members
 
 nsresult
 nsRootAccessible::HandlePopupShownEvent(nsAccessible *aAccessible)
 {
-  PRUint32 role = nsAccUtils::Role(aAccessible);
+  PRUint32 role = aAccessible->Role();
 
   if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
     // Don't fire menupopup events for combobox and autocomplete lists.
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_START,
                             aAccessible);
     return NS_OK;
   }
 
@@ -878,22 +871,24 @@ nsRootAccessible::HandlePopupShownEvent(
     // AT's expect to get an EVENT_SHOW for the tooltip. 
     // In event callback the tooltip's accessible will be ready.
     nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SHOW, aAccessible);
     return NS_OK;
   }
 
   if (role == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
     // Fire expanded state change event for comboboxes and autocompeletes.
-    nsAccessible *comboboxAcc = aAccessible->GetParent();
-    PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
+    nsAccessible* combobox = aAccessible->GetParent();
+    NS_ENSURE_STATE(combobox);
+
+    PRUint32 comboboxRole = combobox->Role();
     if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
         comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
       nsRefPtr<AccEvent> event =
-        new AccStateChangeEvent(comboboxAcc,
+        new AccStateChangeEvent(combobox,
                                 nsIAccessibleStates::STATE_EXPANDED,
                                 PR_FALSE, PR_TRUE);
       NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
       nsEventShell::FireEvent(event);
       return NS_OK;
     }
   }
@@ -916,26 +911,27 @@ nsRootAccessible::HandlePopupHidingEvent
     // Focus was on or inside of a popup that's being hidden
     FireCurrentFocusEvent();
   }
 
   // Fire expanded state change event for comboboxes and autocompletes.
   if (!aAccessible)
     return NS_OK;
 
-  PRUint32 role = nsAccUtils::Role(aAccessible);
-  if (role != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+  if (aAccessible->Role() != nsIAccessibleRole::ROLE_COMBOBOX_LIST)
     return NS_OK;
 
-  nsAccessible *comboboxAcc = aAccessible->GetParent();
-  PRUint32 comboboxRole = nsAccUtils::Role(comboboxAcc);
+  nsAccessible* combobox = aAccessible->GetParent();
+  NS_ENSURE_STATE(combobox);
+
+  PRUint32 comboboxRole = combobox->Role();
   if (comboboxRole == nsIAccessibleRole::ROLE_COMBOBOX ||
       comboboxRole == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
     nsRefPtr<AccEvent> event =
-      new AccStateChangeEvent(comboboxAcc,
+      new AccStateChangeEvent(combobox,
                               nsIAccessibleStates::STATE_EXPANDED,
                               PR_FALSE, PR_FALSE);
     NS_ENSURE_TRUE(event, NS_ERROR_OUT_OF_MEMORY);
 
     nsEventShell::FireEvent(event);
     return NS_OK;
   }
 
--- a/accessible/src/base/nsRootAccessible.h
+++ b/accessible/src/base/nsRootAccessible.h
@@ -79,17 +79,17 @@ public:
 
   // nsIDOMEventListener
   NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // nsRootAccessible
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_ROOTACCESSIBLE_IMPL_CID)
 
   /**
    * Fire an accessible focus event for the current focusAccssible
    * and attach a new selection listener, if necessary.
--- a/accessible/src/base/nsTextAccessible.cpp
+++ b/accessible/src/base/nsTextAccessible.cpp
@@ -45,21 +45,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 nsTextAccessible::
   nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLinkableAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsTextAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsTextAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_TEXT_LEAF;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_TEXT_LEAF;
 }
 
 nsresult
 nsTextAccessible::AppendTextTo(nsAString& aText, PRUint32 aStartOffset, PRUint32 aLength)
 {
   nsIFrame *frame = GetFrame();
   if (!frame) return NS_ERROR_FAILURE;//NS_ENSURE_TRUE(frame, NS_ERROR_FAILURE);
 
--- a/accessible/src/base/nsTextAccessible.h
+++ b/accessible/src/base/nsTextAccessible.h
@@ -45,17 +45,17 @@
  * Generic class used for text nodes.
  */
 class nsTextAccessible : public nsLinkableAccessible
 {
 public:
   nsTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
                                 PRUint32 aLength);
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 };
--- a/accessible/src/base/nsTextEquivUtils.cpp
+++ b/accessible/src/base/nsTextEquivUtils.cpp
@@ -59,19 +59,17 @@ nsTextEquivUtils::GetNameFromSubtree(nsA
 {
   aName.Truncate();
 
   if (gInitiatorAcc)
     return NS_OK;
 
   gInitiatorAcc = aAccessible;
 
-  PRUint32 role = nsAccUtils::Role(aAccessible);
-  PRUint32 nameRule = gRoleToNameRulesMap[role];
-
+  PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
   if (nameRule == eFromSubtree) {
     //XXX: is it necessary to care the accessible is not a document?
     if (aAccessible->IsContent()) {
       nsAutoString name;
       AppendFromAccessibleChildren(aAccessible, &name);
       name.CompressWhitespace();
       if (!IsWhitespaceString(name))
         aName = name;
@@ -264,19 +262,17 @@ nsTextEquivUtils::AppendFromAccessible(n
 
   if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
     isEmptyTextEquiv = PR_FALSE;
 
   // Implementation of g) step of text equivalent computation guide. Go down
   // into subtree if accessible allows "text equivalent from subtree rule" or
   // it's not root and not control.
   if (isEmptyTextEquiv) {
-    PRUint32 role = nsAccUtils::Role(aAccessible);
-    PRUint32 nameRule = gRoleToNameRulesMap[role];
-
+    PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
     if (nameRule & eFromSubtreeIfRec) {
       rv = AppendFromAccessibleChildren(aAccessible, aString);
       NS_ENSURE_SUCCESS(rv, rv);
 
       if (rv != NS_OK_NO_NAME_CLAUSE_HANDLED)
         isEmptyTextEquiv = PR_FALSE;
     }
   }
@@ -289,19 +285,17 @@ nsTextEquivUtils::AppendFromAccessible(n
 
   return rv;
 }
 
 nsresult
 nsTextEquivUtils::AppendFromValue(nsAccessible *aAccessible,
                                   nsAString *aString)
 {
-  PRUint32 role = nsAccUtils::Role(aAccessible);
-  PRUint32 nameRule = gRoleToNameRulesMap[role];
-
+  PRUint32 nameRule = gRoleToNameRulesMap[aAccessible->Role()];
   if (nameRule != eFromValue)
     return NS_OK_NO_NAME_CLAUSE_HANDLED;
 
   // 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.
 
--- a/accessible/src/html/nsHTMLFormControlAccessible.cpp
+++ b/accessible/src/html/nsHTMLFormControlAccessible.cpp
@@ -64,21 +64,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLCheckboxAccessible::
   nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsFormControlAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLCheckboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CHECKBUTTON;
 }
 
 NS_IMETHODIMP nsHTMLCheckboxAccessible::GetNumActions(PRUint8 *_retval)
 {
   *_retval = 1;
   return NS_OK;
 }
 
@@ -277,21 +276,20 @@ nsHTMLButtonAccessible::GetStateInternal
 
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                             nsAccessibilityAtoms::submit, eIgnoreCase))
     *aState |= nsIAccessibleStates::STATE_DEFAULT;
 
   return NS_OK;
 }
 
-nsresult
-nsHTMLButtonAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLButtonAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsHTMLButtonAccessible::GetNameInternal(nsAString& aName)
 {
   nsAccessible::GetNameInternal(aName);
   if (!aName.IsEmpty())
     return NS_OK;
@@ -354,21 +352,20 @@ nsHTML4ButtonAccessible::DoAction(PRUint
 {
   if (aIndex != 0)
     return NS_ERROR_INVALID_ARG;
 
   DoCommand();
   return NS_OK;
 }
 
-nsresult
-nsHTML4ButtonAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTML4ButtonAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsHTML4ButtonAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
@@ -391,26 +388,24 @@ nsHTML4ButtonAccessible::GetStateInterna
 nsHTMLTextFieldAccessible::
   nsHTMLTextFieldAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsHTMLTextFieldAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-nsresult
-nsHTMLTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLTextFieldAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_ENTRY;
-
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                             nsAccessibilityAtoms::password, eIgnoreCase)) {
-    *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
+    return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
   }
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_ENTRY;
 }
 
 nsresult
 nsHTMLTextFieldAccessible::GetNameInternal(nsAString& aName)
 {
   nsresult rv = nsAccessible::GetNameInternal(aName);
   NS_ENSURE_SUCCESS(rv, rv);
 
@@ -460,17 +455,18 @@ nsHTMLTextFieldAccessible::GetStateInter
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   // can be focusable, focused, protected. readonly, unavailable, selected
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                             nsAccessibilityAtoms::password, eIgnoreCase)) {
     *aState |= nsIAccessibleStates::STATE_PROTECTED;
   }
   else {
-    if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
+    nsAccessible* parent = GetParent();
+    if (parent && parent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
       *aState |= nsIAccessibleStates::STATE_HASPOPUP;
   }
 
   if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::readonly)) {
     *aState |= nsIAccessibleStates::STATE_READONLY;
   }
 
   if (!aExtraState)
@@ -583,21 +579,20 @@ NS_IMETHODIMP nsHTMLTextFieldAccessible:
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLGroupboxAccessible::
   nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLGroupboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 nsIContent* nsHTMLGroupboxAccessible::GetLegend()
 {
   nsresult count = 0;
   nsIContent *legendContent = nsnull;
   while ((legendContent = mContent->GetChildAt(count++)) != nsnull) {
     if (legendContent->NodeInfo()->Equals(nsAccessibilityAtoms::legend,
@@ -663,17 +658,17 @@ nsHTMLLegendAccessible::GetRelationByTyp
   nsresult rv = nsHyperTextAccessibleWrap::
     GetRelationByType(aRelationType, aRelation);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
     // Look for groupbox parent
     nsAccessible* groupbox = GetParent();
 
-    if (nsAccUtils::Role(groupbox) == nsIAccessibleRole::ROLE_GROUPING) {
+    if (groupbox && groupbox->Role() == nsIAccessibleRole::ROLE_GROUPING) {
       // XXX: if group box exposes more than one relation of the given type
       // then we fail.
       nsCOMPtr<nsIAccessible> testLabelAccessible =
         nsRelUtils::GetRelatedAccessible(groupbox,
                                          nsIAccessibleRelation::RELATION_LABELLED_BY);
 
       if (testLabelAccessible == this) {
         // We're the first child of the parent groupbox, see
@@ -682,14 +677,13 @@ nsHTMLLegendAccessible::GetRelationByTyp
           AddTarget(aRelationType, aRelation, groupbox);
       }
     }
   }
 
   return NS_OK;
 }
 
-nsresult
-nsHTMLLegendAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLLegendAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LABEL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LABEL;
 }
--- a/accessible/src/html/nsHTMLFormControlAccessible.h
+++ b/accessible/src/html/nsHTMLFormControlAccessible.h
@@ -54,17 +54,17 @@ public:
   nsHTMLCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible for HTML input@type="radio" element.
  */
 class nsHTMLRadioButtonAccessible : public nsRadioButtonAccessible
@@ -94,17 +94,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible for HTML button element.
  */
 class nsHTML4ButtonAccessible : public nsHyperTextAccessibleWrap
@@ -116,17 +116,17 @@ public:
   nsHTML4ButtonAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible for HTML input@type="text" element.
  */
 class nsHTMLTextFieldAccessible : public nsHyperTextAccessibleWrap
@@ -145,17 +145,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible for HTML fieldset element.
  */
 class nsHTMLGroupboxAccessible : public nsHyperTextAccessibleWrap
@@ -164,17 +164,17 @@ public:
   nsHTMLGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
 protected:
   nsIContent* GetLegend();
 };
 
 
 /**
  * Accessible for HTML legend element.
@@ -184,12 +184,12 @@ class nsHTMLLegendAccessible : public ns
 public:
   nsHTMLLegendAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 #endif  
--- a/accessible/src/html/nsHTMLImageAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageAccessible.cpp
@@ -115,21 +115,20 @@ nsHTMLImageAccessible::GetNameInternal(n
     // an empty 'alt' attribute was used to indicate a decorative image (see
     // nsIAccessible::name attribute for details).
     return NS_OK_EMPTY_NAME;
   }
 
   return NS_OK;
 }
 
-nsresult
-nsHTMLImageAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLImageAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GRAPHIC;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GRAPHIC;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
 NS_IMETHODIMP
 nsHTMLImageAccessible::GetNumActions(PRUint8 *aNumActions)
 {
--- a/accessible/src/html/nsHTMLImageAccessible.h
+++ b/accessible/src/html/nsHTMLImageAccessible.h
@@ -61,17 +61,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleImage
   NS_DECL_NSIACCESSIBLEIMAGE
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 private:
   /**
    * Determine if this image accessible has a longdesc attribute.
    *
    * @returns  true if the longdesc attribute is present.
--- a/accessible/src/html/nsHTMLImageMapAccessible.cpp
+++ b/accessible/src/html/nsHTMLImageMapAccessible.cpp
@@ -63,21 +63,20 @@ nsHTMLImageMapAccessible::
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLImageMapAccessible, nsHTMLImageAccessible)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: nsAccessible public
 
-nsresult
-nsHTMLImageMapAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLImageMapAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_IMAGE_MAP;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_IMAGE_MAP;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLImageMapAccessible: HyperLinkAccessible
 
 PRUint32
 nsHTMLImageMapAccessible::AnchorCount()
 {
--- a/accessible/src/html/nsHTMLImageMapAccessible.h
+++ b/accessible/src/html/nsHTMLImageMapAccessible.h
@@ -53,17 +53,17 @@ class nsHTMLImageMapAccessible : public 
 public:
   nsHTMLImageMapAccessible(nsIContent *aContent, nsIWeakReference *aShell,
                            nsIDOMHTMLMapElement *aMapElm);
 
   // nsISupports and cycle collector
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
   // HyperLinkAccessible
   virtual PRUint32 AnchorCount();
   virtual nsAccessible* GetAnchor(PRUint32 aAnchorIndex);
   virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
 
 protected:
 
--- a/accessible/src/html/nsHTMLLinkAccessible.cpp
+++ b/accessible/src/html/nsHTMLLinkAccessible.cpp
@@ -55,21 +55,20 @@ nsHTMLLinkAccessible::
 
 // Expose nsIAccessibleHyperLink unconditionally
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLLinkAccessible, nsHyperTextAccessibleWrap,
                              nsIAccessibleHyperLink)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsIAccessible
 
-nsresult
-nsHTMLLinkAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLLinkAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LINK;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LINK;
 }
 
 nsresult
 nsHTMLLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
--- a/accessible/src/html/nsHTMLLinkAccessible.h
+++ b/accessible/src/html/nsHTMLLinkAccessible.h
@@ -52,17 +52,17 @@ public:
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // HyperLinkAccessible
   virtual bool IsHyperLink();
   virtual already_AddRefed<nsIURI> GetAnchorURI(PRUint32 aAnchorIndex);
 
 protected:
   enum { eAction_Jump = 0 };
--- a/accessible/src/html/nsHTMLSelectAccessible.cpp
+++ b/accessible/src/html/nsHTMLSelectAccessible.cpp
@@ -96,25 +96,23 @@ nsHTMLSelectListAccessible::GetStateInte
     if ( multiple )
       *aState |= nsIAccessibleStates::STATE_MULTISELECTABLE |
                  nsIAccessibleStates::STATE_EXTSELECTABLE;
   }
 
   return NS_OK;
 }
 
-nsresult
-nsHTMLSelectListAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLSelectListAccessible::NativeRole()
 {
-  if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX)
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-  else
-    *aRole = nsIAccessibleRole::ROLE_LISTBOX;
+  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX)
+    return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
 
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LISTBOX;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectListAccessible: SelectAccessible
 
 bool
 nsHTMLSelectListAccessible::IsSelect()
 {
@@ -193,25 +191,23 @@ nsHTMLSelectOptionAccessible::
   nsHTMLSelectOptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLSelectOptionAccessible: nsAccessible public
 
-nsresult
-nsHTMLSelectOptionAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLSelectOptionAccessible::NativeRole()
 {
-  if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
-  else
-    *aRole = nsIAccessibleRole::ROLE_OPTION;
+  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
 
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_OPTION;
 }
 
 nsresult
 nsHTMLSelectOptionAccessible::GetNameInternal(nsAString& aName)
 {
   // CASE #1 -- great majority of the cases
   // find the label attribute - this is what the W3C says we should use
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
@@ -347,20 +343,18 @@ nsHTMLSelectOptionAccessible::GetStateIn
 PRInt32
 nsHTMLSelectOptionAccessible::GetLevelInternal()
 {
   nsIContent *parentContent = mContent->GetParent();
 
   PRInt32 level =
     parentContent->NodeInfo()->Equals(nsAccessibilityAtoms::optgroup) ? 2 : 1;
 
-  if (level == 1 &&
-      nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_HEADING) {
+  if (level == 1 && Role() != nsIAccessibleRole::ROLE_HEADING)
     level = 0; // In a single level list, the level is irrelevant
-  }
 
   return level;
 }
 
 void
 nsHTMLSelectOptionAccessible::GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                                          PRInt32 *aSetSize)
 {
@@ -616,21 +610,20 @@ nsIContent* nsHTMLSelectOptionAccessible
 
 nsHTMLSelectOptGroupAccessible::
   nsHTMLSelectOptGroupAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell) :
   nsHTMLSelectOptionAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLSelectOptGroupAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLSelectOptGroupAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_HEADING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_HEADING;
 }
 
 nsresult
 nsHTMLSelectOptGroupAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
   nsresult rv = nsHTMLSelectOptionAccessible::GetStateInternal(aState,
                                                                aExtraState);
@@ -676,21 +669,20 @@ nsHTMLSelectOptGroupAccessible::CacheChi
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLComboboxAccessible::
   nsHTMLComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLComboboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_COMBOBOX;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_COMBOBOX;
 }
 
 void
 nsHTMLComboboxAccessible::CacheChildren()
 {
   nsIFrame* frame = GetFrame();
   if (!frame)
     return;
--- a/accessible/src/html/nsHTMLSelectAccessible.h
+++ b/accessible/src/html/nsHTMLSelectAccessible.h
@@ -68,17 +68,17 @@ class nsIMutableArray;
 class nsHTMLSelectListAccessible : public nsAccessibleWrap
 {
 public:
   
   nsHTMLSelectListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
   virtual ~nsHTMLSelectListAccessible() {}
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   // SelectAccessible
   virtual bool IsSelect();
   virtual bool SelectAll();
   virtual bool UnselectAll();
 
 protected:
@@ -108,17 +108,17 @@ public:
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD SetSelected(PRBool aSelect);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   virtual PRInt32 GetLevelInternal();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 
   /**
    * Return focused option if any.
@@ -153,17 +153,17 @@ public:
   virtual ~nsHTMLSelectOptGroupAccessible() {}
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);  
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 /** ------------------------------------------------------ */
@@ -189,17 +189,17 @@ public:
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 
   // nsHTMLComboboxAccessible
 
--- a/accessible/src/html/nsHTMLTableAccessible.cpp
+++ b/accessible/src/html/nsHTMLTableAccessible.cpp
@@ -81,21 +81,20 @@ nsHTMLTableCellAccessible::
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsHTMLTableCellAccessible,
                              nsHyperTextAccessible,
                              nsIAccessibleTableCell)
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: nsAccessible implementation
 
-nsresult
-nsHTMLTableCellAccessible::GetRoleInternal(PRUint32 *aResult)
+PRUint32
+nsHTMLTableCellAccessible::NativeRole()
 {
-  *aResult = nsIAccessibleRole::ROLE_CELL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CELL;
 }
 
 nsresult
 nsHTMLTableCellAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   nsresult rv= nsHyperTextAccessibleWrap::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -263,30 +262,25 @@ nsHTMLTableCellAccessible::IsSelected(PR
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableCellAccessible: protected implementation
 
 already_AddRefed<nsIAccessibleTable>
 nsHTMLTableCellAccessible::GetTableAccessible()
 {
-  nsCOMPtr<nsIAccessible> childAcc(this), parentAcc;
-  childAcc->GetParent(getter_AddRefs(parentAcc));
-
-  while (parentAcc) {
-    PRUint32 role = nsAccUtils::Role(parentAcc);
+  nsAccessible* parent = this;
+  while ((parent = parent->GetParent())) {
+    PRUint32 role = parent->Role();
     if (role == nsIAccessibleRole::ROLE_TABLE ||
         role == nsIAccessibleRole::ROLE_TREE_TABLE) {
       nsIAccessibleTable* tableAcc = nsnull;
-      CallQueryInterface(parentAcc, &tableAcc);
+      CallQueryInterface(parent, &tableAcc);
       return tableAcc;
     }
-
-    parentAcc.swap(childAcc);
-    childAcc->GetParent(getter_AddRefs(parentAcc));
   }
 
   return nsnull;
 }
 
 nsITableCellLayout*
 nsHTMLTableCellAccessible::GetCellLayout()
 {
@@ -330,19 +324,19 @@ nsHTMLTableCellAccessible::GetHeaderCell
       nsCOMPtr<nsIContent> headerCellContent;
       for (PRUint32 idx = 0; idx < count; idx++) {
         headerCellContent = do_QueryElementAt(headerCellElms, idx, &rv);
         nsAccessible *headerCell =
           GetAccService()->GetAccessibleInWeakShell(headerCellContent, mWeakShell);
 
         if (headerCell &&
             (aRowOrColumnHeaderCell == nsAccUtils::eRowHeaderCells &&
-             nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_ROWHEADER ||
+             headerCell->Role() == nsIAccessibleRole::ROLE_ROWHEADER ||
              aRowOrColumnHeaderCell == nsAccUtils::eColumnHeaderCells &&
-             nsAccUtils::Role(headerCell) == nsIAccessibleRole::ROLE_COLUMNHEADER))
+             headerCell->Role() == nsIAccessibleRole::ROLE_COLUMNHEADER))
           headerCells->AppendElement(static_cast<nsIAccessible*>(headerCell),
                                      PR_FALSE);
       }
     }
 
     NS_ADDREF(*aHeaderCells = headerCells);
     return NS_OK;
   }
@@ -367,72 +361,65 @@ nsHTMLTableHeaderCellAccessible::
                                   nsIWeakReference *aShell) :
   nsHTMLTableCellAccessible(aContent, aShell)
 {
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableHeaderAccessible: nsAccessible implementation
 
-nsresult
-nsHTMLTableHeaderCellAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLTableHeaderCellAccessible::NativeRole()
 {
   // Check value of @scope attribute.
   static nsIContent::AttrValuesArray scopeValues[] =
     {&nsAccessibilityAtoms::col, &nsAccessibilityAtoms::row, nsnull};
   PRInt32 valueIdx = 
     mContent->FindAttrValueIn(kNameSpaceID_None, nsAccessibilityAtoms::scope,
                               scopeValues, eCaseMatters);
 
   switch (valueIdx) {
     case 0:
-      *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
-      return NS_OK;
+      return nsIAccessibleRole::ROLE_COLUMNHEADER;
     case 1:
-      *aRole = nsIAccessibleRole::ROLE_ROWHEADER;
-      return NS_OK;
+      return nsIAccessibleRole::ROLE_ROWHEADER;
   }
 
   // Assume it's columnheader if there are headers in siblings, oterwise
   // rowheader.
   nsIContent *parent = mContent->GetParent();
-  NS_ENSURE_STATE(parent);
+  if (!parent) {
+    NS_ERROR("Deattached content on alive accessible?");
+    return nsIAccessibleRole::ROLE_NOTHING;
+  }
 
   PRInt32 indexInParent = parent->IndexOf(mContent);
 
   for (PRInt32 idx = indexInParent - 1; idx >= 0; idx--) {
     nsIContent* sibling = parent->GetChildAt(idx);
     if (sibling && sibling->IsElement()) {
       if (nsCoreUtils::IsHTMLTableHeader(sibling))
-        *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
-      else
-        *aRole = nsIAccessibleRole::ROLE_ROWHEADER;
-
-      return NS_OK;
+        return nsIAccessibleRole::ROLE_COLUMNHEADER;
+      return nsIAccessibleRole::ROLE_ROWHEADER;
     }
   }
 
   PRInt32 childCount = parent->GetChildCount();
   for (PRInt32 idx = indexInParent + 1; idx < childCount; idx++) {
     nsIContent* sibling = parent->GetChildAt(idx);
     if (sibling && sibling->IsElement()) {
       if (nsCoreUtils::IsHTMLTableHeader(sibling))
-        *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
-      else
-        *aRole = nsIAccessibleRole::ROLE_ROWHEADER;
-      
-      return NS_OK;
+        return nsIAccessibleRole::ROLE_COLUMNHEADER;
+      return nsIAccessibleRole::ROLE_ROWHEADER;
     }
   }
 
   // No elements in siblings what means the table has one column only. Therefore
   // it should be column header.
-  *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
-
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_COLUMNHEADER;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLTableAccessible::
   nsHTMLTableAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
@@ -456,30 +443,29 @@ nsHTMLTableAccessible::CacheChildren()
   // Move caption accessible so that it's the first child. Check for the first
   // caption only, because nsAccessibilityService ensures we don't create
   // accessibles for the other captions, since only the first is actually
   // visible.
   nsAccTreeWalker walker(mWeakShell, mContent, GetAllowsAnonChildAccessibles());
 
   nsRefPtr<nsAccessible> child;
   while ((child = walker.GetNextChild())) {
-    if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_CAPTION) {
+    if (child->Role() == nsIAccessibleRole::ROLE_CAPTION) {
       InsertChildAt(0, child);
       while ((child = walker.GetNextChild()) && AppendChild(child));
       break;
     }
     AppendChild(child);
   }
 }
 
-nsresult
-nsHTMLTableAccessible::GetRoleInternal(PRUint32 *aResult)
+PRUint32
+nsHTMLTableAccessible::NativeRole()
 {
-  *aResult = nsIAccessibleRole::ROLE_TABLE;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_TABLE;
 }
 
 nsresult
 nsHTMLTableAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv= nsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
@@ -536,19 +522,18 @@ nsHTMLTableAccessible::GetRelationByType
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLTableAccessible: nsIAccessibleTable implementation
 
 NS_IMETHODIMP
 nsHTMLTableAccessible::GetCaption(nsIAccessible **aCaption)
 {
-  nsCOMPtr<nsIAccessible> firstChild;
-  GetFirstChild(getter_AddRefs(firstChild));
-  if (nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_CAPTION)
+  nsAccessible* firstChild = GetChildAt(0);
+  if (firstChild && firstChild->Role() == nsIAccessibleRole::ROLE_CAPTION)
     NS_ADDREF(*aCaption = firstChild);
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsHTMLTableAccessible::GetSummary(nsAString &aSummary)
 {
@@ -1393,18 +1378,17 @@ nsHTMLTableAccessible::IsProbablyForLayo
     docAccessible->GetState(&state, &extState);
     if (extState & nsIAccessibleStates::EXT_STATE_EDITABLE) {  // Need to see all elements while document is being edited
       RETURN_LAYOUT_ANSWER(PR_FALSE, "In editable document");
     }
   }
 
   // Check to see if an ARIA role overrides the role from native markup,
   // but for which we still expose table semantics (treegrid, for example).
-  PRBool hasNonTableRole =
-    (nsAccUtils::Role(this) != nsIAccessibleRole::ROLE_TABLE);
+  PRBool hasNonTableRole = (Role() != nsIAccessibleRole::ROLE_TABLE);
   if (hasNonTableRole) {
     RETURN_LAYOUT_ANSWER(PR_FALSE, "Has role attribute");
   }
 
   if (mContent->HasAttr(kNameSpaceID_None, nsAccessibilityAtoms::role)) {
     // Role attribute is present, but overridden roles have already been dealt with.
     // Only landmarks and other roles that don't override the role from native
     // markup are left to deal with here.
@@ -1555,14 +1539,13 @@ nsHTMLCaptionAccessible::GetRelationByTy
     nsCOMPtr<nsIAccessible> accParent;
     GetParent(getter_AddRefs(accParent));
     return nsRelUtils::AddTarget(aRelationType, aRelation, accParent);
   }
 
   return NS_OK;
 }
 
-nsresult
-nsHTMLCaptionAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLCaptionAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CAPTION;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CAPTION;
 }
--- a/accessible/src/html/nsHTMLTableAccessible.h
+++ b/accessible/src/html/nsHTMLTableAccessible.h
@@ -56,17 +56,17 @@ public:
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
 protected:
   /**
    * Return host table accessible.
    */
   already_AddRefed<nsIAccessibleTable> GetTableAccessible();
@@ -94,17 +94,17 @@ protected:
  */
 class nsHTMLTableHeaderCellAccessible : public nsHTMLTableCellAccessible
 {
 public:
   nsHTMLTableHeaderCellAccessible(nsIContent *aContent,
                                   nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 
 /**
  * HTML table accessible (html:table).
  */
 
 // To turn on table debugging descriptions define SHOW_LAYOUT_HEURISTIC
@@ -132,17 +132,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetDescription(nsAString& aDescription);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
 
   // nsHTMLTableAccessible
 
   /**
    * Retun cell element at the given row and column index.
    */
@@ -210,12 +210,12 @@ public:
   nsHTMLCaptionAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
     nsHyperTextAccessibleWrap(aContent, aShell) { }
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 #endif  
--- a/accessible/src/html/nsHTMLTextAccessible.cpp
+++ b/accessible/src/html/nsHTMLTextAccessible.cpp
@@ -63,28 +63,27 @@ NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLTextA
 NS_IMETHODIMP
 nsHTMLTextAccessible::GetName(nsAString& aName)
 {
   // Text node, ARIA can't be used.
   aName.Truncate();
   return AppendTextTo(aName, 0, PR_UINT32_MAX);
 }
 
-nsresult
-nsHTMLTextAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLTextAccessible::NativeRole()
 {
   nsIFrame *frame = GetFrame();
   // Don't return on null frame -- we still return a role
   // after accessible is shutdown/DEFUNCT
   if (frame && frame->IsGeneratedContentFrame()) {
-    *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
-    return NS_OK;
+    return nsIAccessibleRole::ROLE_STATICTEXT;
   }
 
-  return nsTextAccessible::GetRoleInternal(aRole);
+  return nsTextAccessible::NativeRole();
 }
 
 nsresult
 nsHTMLTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsTextAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
@@ -98,19 +97,17 @@ nsHTMLTextAccessible::GetStateInternal(P
   }
 
   return NS_OK;
 }
 
 nsresult
 nsHTMLTextAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
-  PRUint32 role;
-  GetRoleInternal(&role);
-  if (role == nsIAccessibleRole::ROLE_STATICTEXT) {
+  if (NativeRole() == nsIAccessibleRole::ROLE_STATICTEXT) {
     nsAutoString oldValueUnused;
     aAttributes->SetStringProperty(NS_LITERAL_CSTRING("auto-generated"),
                                   NS_LITERAL_STRING("true"), oldValueUnused);
   }
 
   return NS_OK;
 }
 
@@ -120,39 +117,37 @@ nsHTMLTextAccessible::GetAttributesInter
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLHRAccessible::
   nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLHRAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLHRAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_SEPARATOR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLBRAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLBRAccessible::
   nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsHTMLBRAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLBRAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_WHITESPACE;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_WHITESPACE;
 }
 
 nsresult
 nsHTMLBRAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   *aState = 0;
 
   if (IsDefunct()) {
@@ -189,21 +184,20 @@ nsHTMLLabelAccessible::
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLLabelAccessible, nsHyperTextAccessible)
 
 nsresult
 nsHTMLLabelAccessible::GetNameInternal(nsAString& aName)
 {
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-nsresult
-nsHTMLLabelAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLLabelAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LABEL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LABEL;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLLIAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsHTMLLIAccessible::
   nsHTMLLIAccessible(nsIContent *aContent, nsIWeakReference *aShell,
@@ -227,21 +221,20 @@ nsHTMLLIAccessible::Shutdown()
     // Ensure that pointer to this is nulled out.
     mBulletAccessible->Shutdown();
   }
 
   nsHyperTextAccessibleWrap::Shutdown();
   mBulletAccessible = nsnull;
 }
 
-nsresult
-nsHTMLLIAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLLIAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LISTITEM;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LISTITEM;
 }
 
 nsresult
 nsHTMLLIAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -310,21 +303,20 @@ nsHTMLListBulletAccessible::Shutdown()
 NS_IMETHODIMP
 nsHTMLListBulletAccessible::GetName(nsAString &aName)
 {
   // Native anonymous content, ARIA can't be used.
   aName = mBulletText;
   return NS_OK;
 }
 
-nsresult
-nsHTMLListBulletAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLListBulletAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_STATICTEXT;
 }
 
 nsresult
 nsHTMLListBulletAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
@@ -352,21 +344,20 @@ nsHTMLListBulletAccessible::AppendTextTo
 nsHTMLListAccessible::
   nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsHyperTextAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsHTMLListAccessible, nsHyperTextAccessible)
 
-nsresult
-nsHTMLListAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLListAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LIST;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LIST;
 }
 
 nsresult
 nsHTMLListAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
--- a/accessible/src/html/nsHTMLTextAccessible.h
+++ b/accessible/src/html/nsHTMLTextAccessible.h
@@ -55,59 +55,59 @@ public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for HTML hr element.
  */
 class nsHTMLHRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLHRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Used for HTML br element.
  */
 class nsHTMLBRAccessible : public nsLeafAccessible
 {
 public:
   nsHTMLBRAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for HTML label element.
  */
 class nsHTMLLabelAccessible : public nsHyperTextAccessibleWrap
 {
 public:
   nsHTMLLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Used for bullet of HTML list item element (for example, HTML li).
  */
 class nsHTMLListBulletAccessible : public nsLeafAccessible
 {
 public:
@@ -119,17 +119,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual nsresult AppendTextTo(nsAString& aText, PRUint32 aStartOffset,
                                 PRUint32 aLength);
 
 protected:
   // XXX: Ideally we'd get the bullet text directly from the bullet frame via
   // nsBulletFrame::GetListItemText(), but we'd need an interface for getting
   // text from contentless anonymous frames. Perhaps something like
@@ -146,17 +146,17 @@ class nsHTMLListAccessible : public nsHy
 {
 public:
   nsHTMLListAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for HTML list item (e.g. HTML li).
  */
 class nsHTMLLIAccessible : public nsHyperTextAccessibleWrap
 {
@@ -169,17 +169,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetBounds(PRInt32 *x, PRInt32 *y, PRInt32 *width, PRInt32 *height);
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 
 private:
   nsRefPtr<nsHTMLListBulletAccessible> mBulletAccessible;
--- a/accessible/src/html/nsHyperTextAccessible.cpp
+++ b/accessible/src/html/nsHyperTextAccessible.cpp
@@ -121,52 +121,45 @@ nsresult nsHyperTextAccessible::QueryInt
     *aInstancePtr = static_cast<nsIAccessibleEditableText*>(this);
     NS_ADDREF_THIS();
     return NS_OK;
   }
 
   return nsAccessible::QueryInterface(aIID, aInstancePtr);
 }
 
-nsresult
-nsHyperTextAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHyperTextAccessible::NativeRole()
 {
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   nsIAtom *tag = mContent->Tag();
 
-  if (tag == nsAccessibilityAtoms::form) {
-    *aRole = nsIAccessibleRole::ROLE_FORM;
-  }
-  else if (tag == nsAccessibilityAtoms::div ||
-           tag == nsAccessibilityAtoms::blockquote) {
-    *aRole = nsIAccessibleRole::ROLE_SECTION;
+  if (tag == nsAccessibilityAtoms::form)
+    return nsIAccessibleRole::ROLE_FORM;
+
+  if (tag == nsAccessibilityAtoms::div ||
+      tag == nsAccessibilityAtoms::blockquote)
+    return nsIAccessibleRole::ROLE_SECTION;
+
+  if (tag == nsAccessibilityAtoms::h1 ||
+      tag == nsAccessibilityAtoms::h2 ||
+      tag == nsAccessibilityAtoms::h3 ||
+      tag == nsAccessibilityAtoms::h4 ||
+      tag == nsAccessibilityAtoms::h5 ||
+      tag == nsAccessibilityAtoms::h6)
+    return nsIAccessibleRole::ROLE_HEADING;
+
+  nsIFrame *frame = GetFrame();
+  if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
+      frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
+    // An html:input @type="file" is the only input that is exposed as a
+    // blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
+    return nsIAccessibleRole::ROLE_PARAGRAPH;
   }
-  else if (tag == nsAccessibilityAtoms::h1 ||
-           tag == nsAccessibilityAtoms::h2 ||
-           tag == nsAccessibilityAtoms::h3 ||
-           tag == nsAccessibilityAtoms::h4 ||
-           tag == nsAccessibilityAtoms::h5 ||
-           tag == nsAccessibilityAtoms::h6) {
-    *aRole = nsIAccessibleRole::ROLE_HEADING;
-  }
-  else {
-    nsIFrame *frame = GetFrame();
-    if (frame && frame->GetType() == nsAccessibilityAtoms::blockFrame &&
-        frame->GetContent()->Tag() != nsAccessibilityAtoms::input) {
-      // An html:input @type="file" is the only input that is exposed as a
-      // blockframe. It must be exposed as ROLE_TEXT_CONTAINER for JAWS.
-      *aRole = nsIAccessibleRole::ROLE_PARAGRAPH;
-    }
-    else {
-      *aRole = nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
-    }
-  }
-  return NS_OK;
+
+  return nsIAccessibleRole::ROLE_TEXT_CONTAINER; // In ATK this works
 }
 
 nsresult
 nsHyperTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
@@ -281,18 +274,17 @@ nsHyperTextAccessible::GetPosAndText(PRI
   }
   if (aEndOffset == nsIAccessibleText::TEXT_OFFSET_CARET) {
     GetCaretOffset(&aEndOffset);
   }
 
   PRInt32 startOffset = aStartOffset;
   PRInt32 endOffset = aEndOffset;
   // XXX this prevents text interface usage on <input type="password">
-  PRBool isPassword =
-    (nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
+  PRBool isPassword = (Role() == nsIAccessibleRole::ROLE_PASSWORD_TEXT);
 
   // Clear out parameters and set up loop
   if (aText) {
     aText->Truncate();
   }
   if (endOffset < 0) {
     const PRInt32 kMaxTextLength = 32767;
     endOffset = kMaxTextLength; // Max end offset
@@ -806,29 +798,29 @@ nsHyperTextAccessible::GetRelativeOffset
     // If we reached the end during search, this means we didn't find the DOM point
     // and we're actually at the start of the paragraph
     hyperTextOffset = 0;
   }  
   else if (aAmount == eSelectBeginLine) {
     nsAccessible *firstChild = mChildren.SafeElementAt(0, nsnull);
     // For line selection with needsStart, set start of line exactly to line break
     if (pos.mContentOffset == 0 && firstChild &&
-        nsAccUtils::Role(firstChild) == nsIAccessibleRole::ROLE_STATICTEXT &&
+        firstChild->Role() == nsIAccessibleRole::ROLE_STATICTEXT &&
         static_cast<PRInt32>(nsAccUtils::TextLength(firstChild)) == hyperTextOffset) {
       // XXX Bullet hack -- we should remove this once list bullets use anonymous content
       hyperTextOffset = 0;
     }
     if (!aNeedsStart && hyperTextOffset > 0) {
       -- hyperTextOffset;
     }
   }
   else if (aAmount == eSelectEndLine && finalAccessible) { 
     // If not at very end of hypertext, we may need change the end of line offset by 1, 
     // to make sure we are in the right place relative to the line ending
-    if (nsAccUtils::Role(finalAccessible) == nsIAccessibleRole::ROLE_WHITESPACE) {  // Landed on <br> hard line break
+    if (finalAccessible->Role() == nsIAccessibleRole::ROLE_WHITESPACE) {  // Landed on <br> hard line break
       // if aNeedsStart, set end of line exactly 1 character past line break
       // XXX It would be cleaner if we did not have to have the hard line break check,
       // and just got the correct results from PeekOffset() for the <br> case -- the returned offset should
       // come after the new line, as it does in other cases.
       ++ hyperTextOffset;  // Get past hard line break
     }
     // We are now 1 character past the line break
     if (!aNeedsStart) {
@@ -985,17 +977,17 @@ nsresult nsHyperTextAccessible::GetTextH
     // Start moving forward from the start so that we don't get 
     // 2 words/lines if the offset occurred on whitespace boundary
     // Careful, startOffset and endOffset are passed by reference to GetPosAndText() and changed
     // For BOUNDARY_LINE_END, make sure we start of this line
     startOffset = endOffset = finalStartOffset + (aBoundaryType == BOUNDARY_LINE_END);
     nsRefPtr<nsAccessible> endAcc;
     nsIFrame *endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
                                        nsnull, getter_AddRefs(endAcc));
-    if (nsAccUtils::Role(endAcc) == nsIAccessibleRole::ROLE_STATICTEXT) {
+    if (endAcc && endAcc->Role() == nsIAccessibleRole::ROLE_STATICTEXT) {
       // Static text like list bullets will ruin our forward calculation,
       // since the caret cannot be in the static text. Start just after the static text.
       startOffset = endOffset = finalStartOffset +
                                 (aBoundaryType == BOUNDARY_LINE_END) +
                                 nsAccUtils::TextLength(endAcc);
 
       endFrame = GetPosAndText(startOffset, endOffset, nsnull, nsnull,
                                nsnull, getter_AddRefs(endAcc));
--- a/accessible/src/html/nsHyperTextAccessible.h
+++ b/accessible/src/html/nsHyperTextAccessible.h
@@ -81,17 +81,17 @@ public:
   NS_DECL_NSIACCESSIBLETEXT
   NS_DECL_NSIACCESSIBLEHYPERTEXT
   NS_DECL_NSIACCESSIBLEEDITABLETEXT
   NS_DECLARE_STATIC_IID_ACCESSOR(NS_HYPERTEXTACCESSIBLE_IMPL_CID)
 
   // nsAccessible
   virtual PRInt32 GetLevelInternal();
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   virtual void InvalidateChildren();
 
   // nsHyperTextAccessible
 
   // Convert content offset to rendered text offset  
   static nsresult ContentToRenderedOffset(nsIFrame *aFrame, PRInt32 aContentOffset,
--- a/accessible/src/mac/mozAccessible.mm
+++ b/accessible/src/mac/mozAccessible.mm
@@ -130,17 +130,17 @@ GetNativeFromGeckoAccessible(nsIAccessib
  
 - (id)initWithAccessible:(nsAccessibleWrap*)geckoAccessible
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   if ((self = [super init])) {
     mGeckoAccessible = geckoAccessible;
     mIsExpired = NO;
-    geckoAccessible->GetRole(&mRole);
+    mRole = geckoAccessible->Role();
     
     // Check for OS X "role skew"; the role constants in nsIAccessible.idl need to match the ones
     // in nsRoleMap.h.
     NS_ASSERTION([AXRoles[nsIAccessibleRole::ROLE_LAST_ENTRY] isEqualToString:@"ROLE_LAST_ENTRY"], "Role skew in the role map!");
   }
    
   return self;
 
@@ -589,19 +589,23 @@ GetNativeFromGeckoAccessible(nsIAccessib
   NS_OBJC_END_TRY_ABORT_BLOCK;
 }
 
 - (NSWindow*)window
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
   nsAccessibleWrap *accWrap = static_cast<nsAccessibleWrap*>(mGeckoAccessible);
+
+  // Get a pointer to the native window (NSWindow) we reside in.
   NSWindow *nativeWindow = nil;
-  accWrap->GetNativeWindow ((void**)&nativeWindow);
-  
+  nsDocAccessible* docAcc = accWrap->GetDocAccessible();
+  if (docAcc)
+    nativeWindow = static_cast<NSWindow*>(docAcc->GetNativeWindow());
+
   NSAssert1(nativeWindow, @"Could not get native window for %@", self);
   return nativeWindow;
 
   NS_OBJC_END_TRY_ABORT_BLOCK_NIL;
 }
 
 - (void)invalidateChildren
 {
--- a/accessible/src/mac/nsAccessibleWrap.h
+++ b/accessible/src/mac/nsAccessibleWrap.h
@@ -66,20 +66,17 @@ class nsAccessibleWrap : public nsAccess
     
     // get the native obj-c object (mozAccessible)
     NS_IMETHOD GetNativeInterface (void **aOutAccessible);
     
     // the objective-c |Class| type that this accessible's native object
     // should be instantied with.   used on runtime to determine the
     // right type for this accessible's associated native object.
     virtual objc_class* GetNativeType ();
-    
-    // returns a pointer to the native window for this accessible tree.
-    void GetNativeWindow (void **aOutNativeWindow);
-    
+
     virtual void Shutdown ();
     virtual void InvalidateChildren();
 
     virtual nsresult HandleAccEvent(AccEvent* aEvent);
 
     // ignored means that the accessible might still have children, but is not displayed
     // to the user. it also has no native accessible object represented for it.
     PRBool IsIgnored();
--- a/accessible/src/mac/nsAccessibleWrap.mm
+++ b/accessible/src/mac/nsAccessibleWrap.mm
@@ -81,35 +81,24 @@ nsAccessibleWrap::GetNativeInterface (vo
 {
   if (mNativeWrapper) {
     *aOutInterface = (void**)mNativeWrapper->getNativeObject();
     return NS_OK;
   }
   return NS_ERROR_FAILURE;
 }
 
-// get the native NSWindow we reside in.
-void
-nsAccessibleWrap::GetNativeWindow (void **aOutNativeWindow)
-{
-  *aOutNativeWindow = nsnull;
-
-  nsDocAccessible *docAcc = GetDocAccessible();
-  if (docAcc)
-    docAcc->GetWindowHandle (aOutNativeWindow);
-}
-
 // overridden in subclasses to create the right kind of object. by default we create a generic
 // 'mozAccessible' node.
 objc_class*
 nsAccessibleWrap::GetNativeType () 
 {
   NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NIL;
 
-  PRUint32 role = nsAccUtils::Role(this);
+  PRUint32 role = Role();
   switch (role) {
     case nsIAccessibleRole::ROLE_PUSHBUTTON:
     case nsIAccessibleRole::ROLE_SPLITBUTTON:
     case nsIAccessibleRole::ROLE_TOGGLE_BUTTON:
     {
       // if this button may show a popup, let's make it of the popupbutton type.
       if (HasPopup())
         return [mozPopupButtonAccessible class];
--- a/accessible/src/msaa/nsAccessNodeWrap.cpp
+++ b/accessible/src/msaa/nsAccessNodeWrap.cpp
@@ -41,16 +41,17 @@
 #include "AccessibleApplication.h"
 #include "ISimpleDOMNode_i.c"
 
 #include "nsAccessibilityAtoms.h"
 #include "nsAccessibilityService.h"
 #include "nsApplicationAccessibleWrap.h"
 #include "nsCoreUtils.h"
 #include "nsRootAccessible.h"
+#include "nsWinUtils.h"
 
 #include "nsAttrName.h"
 #include "nsIDocument.h"
 #include "nsIDOMNodeList.h"
 #include "nsIDOMNSHTMLElement.h"
 #include "nsIDOMViewCSS.h"
 #include "nsIFrame.h"
 #include "nsINameSpaceManager.h"
@@ -58,16 +59,17 @@
 #include "nsIPrefBranch.h"
 #include "nsPIDOMWindow.h"
 #include "nsIServiceManager.h"
 
 /// the accessible library and cached methods
 HINSTANCE nsAccessNodeWrap::gmAccLib = nsnull;
 HINSTANCE nsAccessNodeWrap::gmUserLib = nsnull;
 LPFNACCESSIBLEOBJECTFROMWINDOW nsAccessNodeWrap::gmAccessibleObjectFromWindow = nsnull;
+LPFNLRESULTFROMOBJECT nsAccessNodeWrap::gmLresultFromObject = NULL;
 LPFNNOTIFYWINEVENT nsAccessNodeWrap::gmNotifyWinEvent = nsnull;
 LPFNGETGUITHREADINFO nsAccessNodeWrap::gmGetGUIThreadInfo = nsnull;
 
 PRBool nsAccessNodeWrap::gIsEnumVariantSupportDisabled = 0;
 // Used to determine whether an IAccessible2 compatible screen reader is loaded.
 PRBool nsAccessNodeWrap::gIsIA2Disabled = PR_FALSE;
 
 AccTextChangeEvent* nsAccessNodeWrap::gTextEvent = nsnull;
@@ -564,25 +566,37 @@ void nsAccessNodeWrap::InitAccessibility
   if (gmUserLib) {
     if (!gmNotifyWinEvent)
       gmNotifyWinEvent = (LPFNNOTIFYWINEVENT)GetProcAddress(gmUserLib,"NotifyWinEvent");
     if (!gmGetGUIThreadInfo)
       gmGetGUIThreadInfo = (LPFNGETGUITHREADINFO)GetProcAddress(gmUserLib,"GetGUIThreadInfo");
   }
 
   DoATSpecificProcessing();
-  
+
+  // Register window class that'll be used for document accessibles associated
+  // with tabs.
+  if (nsWinUtils::IsWindowEmulationEnabled()) {
+    nsWinUtils::RegisterNativeWindow(kClassNameTabContent);
+    sHWNDCache.Init(4);
+  }
+
   nsAccessNode::InitXPAccessibility();
 }
 
 void nsAccessNodeWrap::ShutdownAccessibility()
 {
   NS_IF_RELEASE(gTextEvent);
   ::DestroyCaret();
 
+  // Unregister window call that's used for document accessibles associated
+  // with tabs.
+  if (nsWinUtils::IsWindowEmulationEnabled())
+    ::UnregisterClassW(kClassNameTabContent, GetModuleHandle(NULL));
+
   nsAccessNode::ShutdownXPAccessibility();
 }
 
 int nsAccessNodeWrap::FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo)
 {
   if (aCode == EXCEPTION_ACCESS_VIOLATION) {
 #ifdef MOZ_CRASHREPORTER
     // MSAA swallows crashes (because it is COM-based)
@@ -619,17 +633,17 @@ GetHRESULT(nsresult aResult)
 
     default:
       return E_FAIL;
   }
 }
 
 PRBool nsAccessNodeWrap::IsOnlyMsaaCompatibleJawsPresent()
 {
-  HMODULE jhookhandle = ::GetModuleHandleW(L"jhook");
+  HMODULE jhookhandle = ::GetModuleHandleW(kJAWSModuleHandle);
   if (!jhookhandle)
     return PR_FALSE;  // No JAWS, or some other screen reader, use IA2
 
   PRUnichar fileName[MAX_PATH];
   ::GetModuleFileNameW(jhookhandle, fileName, MAX_PATH);
 
   DWORD dummy;
   DWORD length = ::GetFileVersionInfoSizeW(fileName, &dummy);
@@ -650,20 +664,20 @@ PRBool nsAccessNodeWrap::IsOnlyMsaaCompa
 //  DWORD dwRightMost = LOWORD(dwFileVersionLS);
 
   return (dwLeftMost < 8
           || (dwLeftMost == 8 && dwSecondRight < 2173));
 }
 
 void nsAccessNodeWrap::TurnOffNewTabSwitchingForJawsAndWE()
 {
-  HMODULE srHandle = ::GetModuleHandleW(L"jhook");
+  HMODULE srHandle = ::GetModuleHandleW(kJAWSModuleHandle);
   if (!srHandle) {
     // No JAWS, try Window-Eyes
-    srHandle = ::GetModuleHandleW(L"gwm32inc");
+    srHandle = ::GetModuleHandleW(kWEModuleHandle);
     if (!srHandle) {
       // no screen reader we're interested in. Bail out.
       return;
     }
   }
 
   // Check to see if the pref for disallowing CtrlTab is already set.
   // If so, bail out.
@@ -689,8 +703,54 @@ void nsAccessNodeWrap::TurnOffNewTabSwit
 void nsAccessNodeWrap::DoATSpecificProcessing()
 {
   if (IsOnlyMsaaCompatibleJawsPresent())
     // All versions below 8.0.2173 are not compatible
     gIsIA2Disabled  = PR_TRUE;
 
   TurnOffNewTabSwitchingForJawsAndWE();
 }
+
+nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> nsAccessNodeWrap::sHWNDCache;
+
+LRESULT CALLBACK
+nsAccessNodeWrap::WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+  switch (msg) {
+    case WM_GETOBJECT:
+    {
+      if (lParam == OBJID_CLIENT) {
+        nsDocAccessible* document = sHWNDCache.GetWeak(static_cast<void*>(hWnd));
+        if (document) {
+          IAccessible* msaaAccessible = NULL;
+          document->GetNativeInterface((void**)&msaaAccessible); // does an addref
+          if (msaaAccessible) {
+            LRESULT result = LresultFromObject(IID_IAccessible, wParam,
+                                               msaaAccessible); // does an addref
+            msaaAccessible->Release(); // release extra addref
+            return result;
+          }
+        }
+      }
+      return 0;
+    }
+  }
+
+  return ::DefWindowProcW(hWnd, msg, wParam, lParam);
+}
+
+STDMETHODIMP_(LRESULT)
+nsAccessNodeWrap::LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc)
+{
+  // open the dll dynamically
+  if (!gmAccLib)
+    gmAccLib =::LoadLibraryW(L"OLEACC.DLL");
+
+  if (gmAccLib) {
+    if (!gmLresultFromObject)
+      gmLresultFromObject = (LPFNLRESULTFROMOBJECT)GetProcAddress(gmAccLib,"LresultFromObject");
+
+    if (gmLresultFromObject)
+      return gmLresultFromObject(riid, wParam, pAcc);
+  }
+
+  return 0;
+}
--- a/accessible/src/msaa/nsAccessNodeWrap.h
+++ b/accessible/src/msaa/nsAccessNodeWrap.h
@@ -63,16 +63,18 @@
 #include <winuser.h>
 #ifndef WINABLEAPI
 #include <winable.h>
 #endif
 #ifdef MOZ_CRASHREPORTER
 #include "nsICrashReporter.h"
 #endif
 
+#include "nsRefPtrHashtable.h"
+
 typedef LRESULT (STDAPICALLTYPE *LPFNNOTIFYWINEVENT)(DWORD event,HWND hwnd,LONG idObjectType,LONG idObject);
 typedef LRESULT (STDAPICALLTYPE *LPFNGETGUITHREADINFO)(DWORD idThread, GUITHREADINFO* pgui);
 
 class AccTextChangeEvent;
 
 class nsAccessNodeWrap :  public nsAccessNode,
                           public nsIWinAccessNode,
                           public ISimpleDOMNode,
@@ -149,27 +151,35 @@ public: // construction, destruction
 
     static void InitAccessibility();
     static void ShutdownAccessibility();
 
     /// the accessible library and cached methods
     static HINSTANCE gmAccLib;
     static HINSTANCE gmUserLib;
     static LPFNACCESSIBLEOBJECTFROMWINDOW gmAccessibleObjectFromWindow;
+    static LPFNLRESULTFROMOBJECT gmLresultFromObject;
     static LPFNNOTIFYWINEVENT gmNotifyWinEvent;
     static LPFNGETGUITHREADINFO gmGetGUIThreadInfo;
 
     static int FilterA11yExceptions(unsigned int aCode, EXCEPTION_POINTERS *aExceptionInfo);
 
     static PRBool IsOnlyMsaaCompatibleJawsPresent();
 
     static void TurnOffNewTabSwitchingForJawsAndWE();
 
     static void DoATSpecificProcessing();
 
+  static STDMETHODIMP_(LRESULT) LresultFromObject(REFIID riid, WPARAM wParam, LPUNKNOWN pAcc);
+
+  static LRESULT CALLBACK WindowProc(HWND hWnd, UINT Msg,
+                                     WPARAM WParam, LPARAM lParam);
+
+  static nsRefPtrHashtable<nsVoidPtrHashKey, nsDocAccessible> sHWNDCache;
+
 protected:
 
   /**
    * Return ISimpleDOMNode instance for existing accessible object or
    * creates new nsAccessNode instance if the accessible doesn't exist.
    *
    * @note ISimpleDOMNode is returned addrefed
    */
--- a/accessible/src/msaa/nsAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsAccessibleWrap.cpp
@@ -37,16 +37,17 @@
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsAccessibleWrap.h"
 
 #include "nsAccessibilityAtoms.h"
 #include "nsAccUtils.h"
 #include "nsCoreUtils.h"
 #include "nsRelUtils.h"
+#include "nsWinUtils.h"
 
 #include "nsIAccessibleDocument.h"
 #include "nsIAccessibleEvent.h"
 #include "nsIAccessibleWin32Object.h"
 
 #include "Accessible2_i.c"
 #include "AccessibleStates.h"
 
@@ -188,68 +189,33 @@ STDMETHODIMP nsAccessibleWrap::NotifyWin
 
   return E_FAIL;
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accParent( IDispatch __RPC_FAR *__RPC_FAR *ppdispParent)
 {
 __try {
   *ppdispParent = NULL;
-  if (!mWeakShell)
-    return E_FAIL;  // We've been shut down
 
-  nsIFrame *frame = GetFrame();
-  HWND hwnd = 0;
-  if (frame) {
-    nsIView *view = frame->GetViewExternal();
-    if (view) {
-      // This code is essentially our implementation of WindowFromAccessibleObject,
-      // because MSAA iterates get_accParent() until it sees an object of ROLE_WINDOW
-      // to know where the window for a given accessible is. We must expose the native
-      // window accessible that MSAA creates for us. This must be done for the document
-      // object as well as any layout that creates its own window (e.g. via overflow: scroll)
-      nsIWidget *widget = view->GetWidget();
-      if (widget) {
-        hwnd = (HWND)widget->GetNativeData(NS_NATIVE_WINDOW);
-        NS_ASSERTION(hwnd, "No window handle for window");
-
-        nsIViewManager* viewManager = view->GetViewManager();
-        if (!viewManager)
-          return E_UNEXPECTED;
+  if (IsDefunct())
+    return E_FAIL;
 
-        nsIView *rootView;
-        viewManager->GetRootView(rootView);
-        if (rootView == view) {
-          // If the client accessible (OBJID_CLIENT) has a window but its window
-          // was created by an outer window then we want the native accessible
-          // for that outer window. If the accessible was created for outer
-          // window (if the outer window has inner windows then they share the
-          // same client accessible with it) then return native accessible for
-          // the outer window.
-          HWND parenthwnd = ::GetParent(hwnd);
-          if (parenthwnd)
-            hwnd = parenthwnd;
-
-          NS_ASSERTION(hwnd, "No window handle for window");
-        }
+  nsRefPtr<nsDocAccessible> doc(do_QueryObject(this));
+  if (doc) {
+    // Return window system accessible object for root document and tab document
+    // accessibles.
+    if (!doc->ParentDocument() ||
+        nsWinUtils::IsWindowEmulationEnabled() &&
+        nsWinUtils::IsTabDocument(doc->GetDocumentNode())) {
+      HWND hwnd = static_cast<HWND>(doc->GetNativeWindow());
+      if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW,
+                                                       IID_IAccessible,
+                                                       (void**)ppdispParent))) {
+        return S_OK;
       }
-      else {
-        // If a frame is a scrollable frame, then it has one window for the client area,
-        // not an extra parent window for just the scrollbars
-        nsIScrollableFrame *scrollFrame = do_QueryFrame(frame);
-        if (scrollFrame) {
-          hwnd = (HWND)scrollFrame->GetScrolledFrame()->GetNearestWidget()->GetNativeData(NS_NATIVE_WINDOW);
-          NS_ASSERTION(hwnd, "No window handle for window");
-        }
-      }
-    }
-
-    if (hwnd && SUCCEEDED(AccessibleObjectFromWindow(hwnd, OBJID_WINDOW, IID_IAccessible,
-                                              (void**)ppdispParent))) {
-      return S_OK;
     }
   }
 
   nsAccessible* xpParentAcc = GetParent();
   NS_ASSERTION(xpParentAcc,
                "No parent accessible where we're not direct child of window");
 
   if (!xpParentAcc)
@@ -277,34 +243,31 @@ STDMETHODIMP nsAccessibleWrap::get_accCh
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accChild(
       /* [in] */ VARIANT varChild,
       /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
 {
 __try {
   *ppdispChild = NULL;
-  if (!mWeakShell || varChild.vt != VT_I4)
+  if (IsDefunct())
     return E_FAIL;
 
-  if (varChild.lVal == CHILDID_SELF) {
-    *ppdispChild = static_cast<IDispatch*>(this);
-    AddRef();
-    return S_OK;
-  }
+  // 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 (!nsAccUtils::MustPrune(this)) {
-    nsAccessible* child = GetChildAt(varChild.lVal - 1);
-    if (child) {
-      *ppdispChild = NativeAccessible(child);
-    }
-  }
 } __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
 
-  return (*ppdispChild)? S_OK: E_FAIL;
+  return (*ppdispChild)? S_OK: E_INVALIDARG;
 }
 
 STDMETHODIMP nsAccessibleWrap::get_accName(
       /* [optional][in] */ VARIANT varChild,
       /* [retval][out] */ BSTR __RPC_FAR *pszName)
 {
 __try {
   *pszName = NULL;
@@ -385,38 +348,39 @@ 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;
+
   nsAccessible *xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_FAIL;
 
 #ifdef DEBUG_A11Y
   NS_ASSERTION(nsAccUtils::IsTextInterfaceSupportCorrect(xpAccessible),
                "Does not support nsIAccessibleText when it should");
 #endif
 
-  PRUint32 xpRole = 0, msaaRole = 0;
-  if (NS_FAILED(xpAccessible->GetRole(&xpRole)))
-    return E_FAIL;
-
-  msaaRole = gWindowsRoleMap[xpRole].msaaRole;
+  PRUint32 xpRole = xpAccessible->Role();
+  PRUint32 msaaRole = gWindowsRoleMap[xpRole].msaaRole;
   NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].msaaRole == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call the MSAA role
   // a ROLE_OUTLINEITEM for consistency and compatibility.
   // We need this because ARIA has a role of "row" for both grid and treegrid
   if (xpRole == nsIAccessibleRole::ROLE_ROW) {
-    if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
+    nsAccessible* xpParent = GetParent();
+    if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
       msaaRole = ROLE_SYSTEM_OUTLINEITEM;
   }
   
   // -- Try enumerated role
   if (msaaRole != USE_ROLE_STRING) {
     pvarRole->vt = VT_I4;
     pvarRole->lVal = msaaRole;  // Normal enumerated role
     return S_OK;
@@ -1187,30 +1151,30 @@ nsAccessibleWrap::get_relations(long aMa
 }
 
 STDMETHODIMP
 nsAccessibleWrap::role(long *aRole)
 {
 __try {
   *aRole = 0;
 
-  PRUint32 xpRole = 0;
-  nsresult rv = GetRole(&xpRole);
-  if (NS_FAILED(rv))
-    return GetHRESULT(rv);
+  if (IsDefunct())
+    return E_FAIL;
 
   NS_ASSERTION(gWindowsRoleMap[nsIAccessibleRole::ROLE_LAST_ENTRY].ia2Role == ROLE_WINDOWS_LAST_ENTRY,
                "MSAA role map skewed");
 
+  PRUint32 xpRole = Role();
   *aRole = gWindowsRoleMap[xpRole].ia2Role;
 
   // Special case, if there is a ROLE_ROW inside of a ROLE_TREE_TABLE, then call
   // the IA2 role a ROLE_OUTLINEITEM.
   if (xpRole == nsIAccessibleRole::ROLE_ROW) {
-    if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_TREE_TABLE)
+    nsAccessible* xpParent = GetParent();
+    if (xpParent && xpParent->Role() == nsIAccessibleRole::ROLE_TREE_TABLE)
       *aRole = ROLE_SYSTEM_OUTLINEITEM;
   }
 
   return S_OK;
 
 } __except(nsAccessNodeWrap::FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
   return E_FAIL;
 }
@@ -1665,55 +1629,21 @@ PRInt32 nsAccessibleWrap::GetChildIDFor(
   // Yes, this means we're only compatibible with 32 bit
   // MSAA is only available for 32 bit windows, so it's okay
   return - NS_PTR_TO_INT32(uniqueID);
 }
 
 HWND
 nsAccessibleWrap::GetHWNDFor(nsAccessible *aAccessible)
 {
-  HWND hWnd = 0;
   if (!aAccessible)
-    return hWnd;
+    return 0;
 
-  nsIFrame *frame = aAccessible->GetFrame();
-  if (frame) {
-    nsIWidget *window = frame->GetNearestWidget();
-    PRBool isVisible;
-    window->IsVisible(isVisible);
-    if (isVisible) {
-      // Short explanation:
-      // If HWND for frame is inside a hidden window, fire the event on the
-      // containing document's visible window.
-      //
-      // Long explanation:
-      // This is really just to fix combo boxes with JAWS. Window-Eyes already
-      // worked with combo boxes because they use the value change event in
-      // the closed combo box case. JAWS will only pay attention to the focus
-      // events on the list items. The JAWS developers haven't fixed that, so
-      // we'll use the focus events to make JAWS work. However, JAWS is
-      // ignoring events on a hidden window. So, in order to fix the bug where
-      // JAWS doesn't echo the current option as it changes in a closed
-      // combo box, we need to use an ensure that we never fire an event with
-      // an HWND for a hidden window.
-      hWnd = (HWND)frame->GetNearestWidget()->GetNativeData(NS_NATIVE_WINDOW);
-    }
-  }
-
-  if (!hWnd) {
-    void* handle = nsnull;
-    nsDocAccessible *accessibleDoc = aAccessible->GetDocAccessible();
-    if (!accessibleDoc)
-      return 0;
-
-    accessibleDoc->GetWindowHandle(&handle);
-    hWnd = (HWND)handle;
-  }
-
-  return hWnd;
+  nsDocAccessible* document = aAccessible->GetDocAccessible();
+  return document ? static_cast<HWND>(document->GetNativeWindow()) : 0;
 }
 
 HRESULT
 nsAccessibleWrap::ConvertToIA2Attributes(nsIPersistentProperties *aAttributes,
                                          BSTR *aIA2Attributes)
 {
   *aIA2Attributes = NULL;
 
@@ -1804,17 +1734,17 @@ nsAccessibleWrap::UnattachIEnumVariant()
 {
   if (mEnumVARIANTPosition > 0)
     mEnumVARIANTPosition = kIEnumVariantDisconnected;
 }
 
 nsAccessible*
 nsAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
 {
-  if (IsDefunct())
+  if (aVarChild.vt != VT_I4)
     return nsnull;
 
   // if its us real easy - this seems to always be the case
   if (aVarChild.lVal == CHILDID_SELF)
     return this;
 
   if (nsAccUtils::MustPrune(this))
     return nsnull;
--- a/accessible/src/msaa/nsDocAccessibleWrap.cpp
+++ b/accessible/src/msaa/nsDocAccessibleWrap.cpp
@@ -34,16 +34,19 @@
  * 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 "nsDocAccessibleWrap.h"
 #include "ISimpleDOMDocument_i.c"
 #include "nsIAccessibilityService.h"
+#include "nsRootAccessible.h"
+#include "nsWinUtils.h"
+
 #include "nsIDocShell.h"
 #include "nsIDocShellTreeNode.h"
 #include "nsIFrame.h"
 #include "nsIInterfaceRequestorUtils.h"
 #include "nsISelectionController.h"
 #include "nsIServiceManager.h"
 #include "nsIURI.h"
 #include "nsIViewManager.h"
@@ -55,17 +58,17 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsDocAccessibleWrap
 ////////////////////////////////////////////////////////////////////////////////
 
 nsDocAccessibleWrap::
   nsDocAccessibleWrap(nsIDocument *aDocument, nsIContent *aRootContent,
                       nsIWeakReference *aShell) :
-  nsDocAccessible(aDocument, aRootContent, aShell)
+  nsDocAccessible(aDocument, aRootContent, aShell), mHWND(NULL)
 {
 }
 
 nsDocAccessibleWrap::~nsDocAccessibleWrap()
 {
 }
 
 //-----------------------------------------------------
@@ -98,51 +101,25 @@ STDMETHODIMP nsDocAccessibleWrap::QueryI
 
 nsAccessible*
 nsDocAccessibleWrap::GetXPAccessibleFor(const VARIANT& aVarChild)
 {
   // If lVal negative then it is treated as child ID and we should look for
   // accessible through whole accessible subtree including subdocuments.
   // Otherwise we treat lVal as index in parent.
 
-  if (aVarChild.lVal < 0)
-    return IsDefunct() ? nsnull : GetXPAccessibleForChildID(aVarChild);
+  if (aVarChild.vt == VT_I4 && aVarChild.lVal < 0) {
+    // Convert child ID to unique ID.
+    void* uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
+    return GetCachedAccessibleInSubtree(uniqueID);
+  }
 
   return nsAccessibleWrap::GetXPAccessibleFor(aVarChild);
 }
 
-STDMETHODIMP
-nsDocAccessibleWrap::get_accChild(VARIANT varChild,
-                                  IDispatch __RPC_FAR *__RPC_FAR *ppdispChild)
-{
-__try {
-  *ppdispChild = NULL;
-
-  if (varChild.vt == VT_I4 && varChild.lVal < 0) {
-    // IAccessible::accChild can be used to get an accessible by child ID.
-    // It is used by AccessibleObjectFromEvent() called by AT when AT handles
-    // our MSAA event.
-
-    nsAccessible *xpAccessible = GetXPAccessibleForChildID(varChild);
-    if (!xpAccessible)
-      return E_FAIL;
-
-    IAccessible *msaaAccessible = NULL;
-    xpAccessible->GetNativeInterface((void**)&msaaAccessible);
-    *ppdispChild = static_cast<IDispatch*>(msaaAccessible);
-
-    return S_OK;
-  }
-
-  // Otherwise, the normal get_accChild() will do
-  return nsAccessibleWrap::get_accChild(varChild, ppdispChild);
-} __except(FilterA11yExceptions(::GetExceptionCode(), GetExceptionInformation())) { }
-  return E_FAIL;
-}
-
 STDMETHODIMP nsDocAccessibleWrap::get_URL(/* [out] */ BSTR __RPC_FAR *aURL)
 {
 __try {
   *aURL = NULL;
 
   nsAutoString URL;
   nsresult rv = GetURL(URL);
   if (NS_FAILED(rv))
@@ -257,28 +234,67 @@ STDMETHODIMP nsDocAccessibleWrap::get_ac
 {
   // For backwards-compat, we still support old MSAA hack to provide URL in accValue
   *pszValue = NULL;
   // Check for real value first
   HRESULT hr = nsAccessibleWrap::get_accValue(varChild, pszValue);
   if (FAILED(hr) || *pszValue || varChild.lVal != CHILDID_SELF)
     return hr;
   // If document is being used to create a widget, don't use the URL hack
-  PRUint32 role = nsAccUtils::Role(this);
+  PRUint32 role = Role();
   if (role != nsIAccessibleRole::ROLE_DOCUMENT &&
       role != nsIAccessibleRole::ROLE_APPLICATION &&
       role != nsIAccessibleRole::ROLE_DIALOG &&
       role != nsIAccessibleRole::ROLE_ALERT)
     return hr;
 
   return get_URL(pszValue);
 }
 
-nsAccessible*
-nsDocAccessibleWrap::GetXPAccessibleForChildID(const VARIANT& aVarChild)
+////////////////////////////////////////////////////////////////////////////////
+// nsAccessNode
+
+PRBool
+nsDocAccessibleWrap::Init()
 {
-  NS_PRECONDITION(aVarChild.vt == VT_I4 && aVarChild.lVal < 0,
-                  "Variant doesn't point to child ID!");
+  if (nsWinUtils::IsWindowEmulationEnabled()) {
+    // Create window for tab document.
+    if (nsWinUtils::IsTabDocument(mDocument)) {
+      nsRefPtr<nsRootAccessible> root = GetRootAccessible();
+      mHWND = nsWinUtils::CreateNativeWindow(kClassNameTabContent,
+                                             static_cast<HWND>(root->GetNativeWindow()));
+
+      nsAccessibleWrap::sHWNDCache.Put(mHWND, this);
+
+    } else {
+      nsDocAccessible* parentDocument = ParentDocument();
+      if (parentDocument)
+        mHWND = parentDocument->GetNativeWindow();
+    }
+  }
+
+  return nsDocAccessible::Init();
+}
 
-  // Convert child ID to unique ID.
-  void *uniqueID = reinterpret_cast<void*>(-aVarChild.lVal);
-  return GetAccService()->FindAccessibleInCache(uniqueID);
+void
+nsDocAccessibleWrap::Shutdown()
+{
+  if (nsWinUtils::IsWindowEmulationEnabled()) {
+    // Destroy window created for root document.
+    if (nsWinUtils::IsTabDocument(mDocument)) {
+      nsAccessibleWrap::sHWNDCache.Remove(mHWND);
+      ::DestroyWindow(static_cast<HWND>(mHWND));
+    }
+
+    mHWND = nsnull;
+  }
+
+  nsDocAccessible::Shutdown();
 }
+
+////////////////////////////////////////////////////////////////////////////////
+// nsDocAccessible
+
+void*
+nsDocAccessibleWrap::GetNativeWindow() const
+{
+  return mHWND ? mHWND : nsDocAccessible::GetNativeWindow();
+}
--- a/accessible/src/msaa/nsDocAccessibleWrap.h
+++ b/accessible/src/msaa/nsDocAccessibleWrap.h
@@ -78,32 +78,29 @@ public:
     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_nameSpaceURIForID( 
         /* [in] */ short nameSpaceID,
         /* [out] */ BSTR __RPC_FAR *nameSpaceURI);
 
     virtual /* [id] */ HRESULT STDMETHODCALLTYPE put_alternateViewMediaTypes( 
         /* [in] */ BSTR __RPC_FAR *commaSeparatedMediaTypes);
 
     // IAccessible
-    // Override get_accChild so that it can get any child via the unique ID
-    virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accChild( 
-        /* [in] */ VARIANT varChild,
-        /* [retval][out] */ IDispatch __RPC_FAR *__RPC_FAR *ppdispChild);
 
     // Override get_accValue to provide URL when no other value is available
     virtual /* [id][propget] */ HRESULT STDMETHODCALLTYPE get_accValue( 
         /* [optional][in] */ VARIANT varChild,
         /* [retval][out] */ BSTR __RPC_FAR *pszValue);
 
+  // nsAccessNode
+  virtual PRBool Init();
+  virtual void Shutdown();
+
   // nsAccessibleWrap
   virtual nsAccessible *GetXPAccessibleFor(const VARIANT& varChild);
 
-  // nsDocAccessibleWrap
+  // nsDocAccessible
+  virtual void* GetNativeWindow() const;
 
-  /**
-   * Find an accessible by the given child ID in cached documents.
-   *
-   * @param  aVarChild    [in] variant pointing to the child ID
-   */
-  static nsAccessible *GetXPAccessibleForChildID(const VARIANT& aVarChild);
+protected:
+  void* mHWND;
 };
 
 #endif
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.cpp
@@ -59,23 +59,20 @@ nsHTMLWin32ObjectOwnerAccessible::Shutdo
 {
   nsAccessibleWrap::Shutdown();
   mNativeAccessible = nsnull;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLWin32ObjectOwnerAccessible: nsAccessible implementation
 
-nsresult
-nsHTMLWin32ObjectOwnerAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsHTMLWin32ObjectOwnerAccessible::NativeRole()
 {
-  NS_ENSURE_ARG_POINTER(aRole);
-
-  *aRole = nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_EMBEDDED_OBJECT;
 }
 
 nsresult
 nsHTMLWin32ObjectOwnerAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
   if (rv == NS_OK_DEFUNCT_OBJECT)
--- a/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
+++ b/accessible/src/msaa/nsHTMLWin32ObjectAccessible.h
@@ -56,17 +56,17 @@ public:
   nsHTMLWin32ObjectOwnerAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell, void *aHwnd);
   virtual ~nsHTMLWin32ObjectOwnerAccessible() {}
 
   // nsAccessNode
   virtual void Shutdown();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 
   void* mHwnd;
--- a/accessible/src/msaa/nsWinUtils.cpp
+++ b/accessible/src/msaa/nsWinUtils.cpp
@@ -38,16 +38,17 @@
  *
  * ***** END LICENSE BLOCK ***** */
 
 #include "nsWinUtils.h"
 
 #include "nsAccessibleWrap.h"
 #include "nsIWinAccessNode.h"
 #include "nsArrayUtils.h"
+#include "nsIDocShellTreeItem.h"
 
 HRESULT
 nsWinUtils::ConvertToIA2Array(nsIArray *aGeckoArray, IUnknown ***aIA2Array,
                               long *aIA2ArrayLen)
 {
   *aIA2Array = NULL;
   *aIA2ArrayLen = 0;
 
@@ -91,8 +92,62 @@ nsWinUtils::ConvertToIA2Array(nsIArray *
 
     nsMemory::Free(*aIA2Array);
     return GetHRESULT(rv);
   }
 
   *aIA2ArrayLen = length;
   return S_OK;
 }
+
+void
+nsWinUtils::RegisterNativeWindow(LPCWSTR aWindowClass)
+{
+  WNDCLASSW wc;
+  wc.style = CS_GLOBALCLASS;
+  wc.lpfnWndProc = nsAccessNodeWrap::WindowProc;
+  wc.cbClsExtra = 0;
+  wc.cbWndExtra = 0;
+  wc.hInstance = GetModuleHandle(NULL);
+  wc.hIcon = NULL;
+  wc.hCursor = NULL;
+  wc.hbrBackground = NULL;
+  wc.lpszMenuName = NULL;
+  wc.lpszClassName = aWindowClass;
+  ::RegisterClassW(&wc);
+}
+
+HWND
+nsWinUtils::CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd)
+{
+  return ::CreateWindowW(aWindowClass,
+                         L"NetscapeDispatchWnd",
+                         WS_CHILD | WS_VISIBLE,
+                         CW_USEDEFAULT, CW_USEDEFAULT,
+                         0, 0,
+                         aParentWnd,
+                         NULL,
+                         GetModuleHandle(NULL),
+                         NULL);
+}
+
+bool
+nsWinUtils::IsWindowEmulationEnabled()
+{
+  return ::GetModuleHandleW(kJAWSModuleHandle) ||
+    ::GetModuleHandleW(kWEModuleHandle)  ||
+    ::GetModuleHandleW(kDolphnModuleHandle);
+}
+
+bool
+nsWinUtils::IsTabDocument(nsIDocument* aDocumentNode)
+{
+  nsCOMPtr<nsISupports> container = aDocumentNode->GetContainer();
+  nsCOMPtr<nsIDocShellTreeItem> treeItem(do_QueryInterface(container));
+
+  nsCOMPtr<nsIDocShellTreeItem> parentTreeItem;
+  treeItem->GetParent(getter_AddRefs(parentTreeItem));
+
+  nsCOMPtr<nsIDocShellTreeItem> rootTreeItem;
+  treeItem->GetRootTreeItem(getter_AddRefs(rootTreeItem));
+
+  return parentTreeItem == rootTreeItem;
+}
--- a/accessible/src/msaa/nsWinUtils.h
+++ b/accessible/src/msaa/nsWinUtils.h
@@ -39,22 +39,50 @@
  * ***** END LICENSE BLOCK ***** */
 
 #ifndef nsWinUtils_h_
 #define nsWinUtils_h_
 
 #include "Accessible2.h"
 
 #include "nsIArray.h"
+#include "nsIDocument.h"
+
+const LPCWSTR kClassNameRoot = L"MozillaUIWindowClass";
+const LPCWSTR kClassNameTabContent = L"MozillaContentWindowClass";
+
+const LPCWSTR kJAWSModuleHandle = L"jhook";
+const LPCWSTR kWEModuleHandle = L"gwm32inc";
+const LPCWSTR kDolphnModuleHandle = L"dolwinhk";
 
 class nsWinUtils
 {
 public:
   /**
    * Convert nsIArray array of accessible objects to an array of IUnknown*
    * objects used in IA2 methods.
    */
   static HRESULT ConvertToIA2Array(nsIArray *aCollection,
                                    IUnknown ***aAccessibles, long *aCount);
+
+  /**
+   * Helper to register window class.
+   */
+  static void RegisterNativeWindow(LPCWSTR aWindowClass);
+
+  /**
+   * Helper to create a window.
+   */
+  static HWND CreateNativeWindow(LPCWSTR aWindowClass, HWND aParentWnd);
+
+  /**
+   * Return true if window emulation is enabled.
+   */
+  static bool IsWindowEmulationEnabled();
+
+  /**
+   * Return true if the given document node is for tab document accessible.
+   */
+  static bool IsTabDocument(nsIDocument* aDocumentNode);
 };
 
 #endif
 
--- a/accessible/src/xforms/nsXFormsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsAccessible.cpp
@@ -239,21 +239,20 @@ nsXFormsAccessible::GetAllowsAnonChildAc
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsContainerAccessible::
   nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsContainerAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsContainerAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 PRBool
 nsXFormsContainerAccessible::GetAllowsAnonChildAccessibles()
 {
   return PR_TRUE;
 }
 
--- a/accessible/src/xforms/nsXFormsAccessible.h
+++ b/accessible/src/xforms/nsXFormsAccessible.h
@@ -123,17 +123,17 @@ protected:
  * 'pick up file' and 'clear file' buttons.
  */
 class nsXFormsContainerAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsContainerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
   // Allows accessible nodes in anonymous content of xforms element by
   // always returning PR_TRUE value.
   virtual PRBool GetAllowsAnonChildAccessibles();
 };
 
 
 /**
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.cpp
@@ -45,21 +45,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsLabelAccessible::
   nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsLabelAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsLabelAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LABEL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LABEL;
 }
 
 nsresult
 nsXFormsLabelAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX Correct name calculation for this, see bug 453594.
   return NS_OK;
 }
@@ -81,39 +80,37 @@ nsXFormsLabelAccessible::GetDescription(
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsOutputAccessible::
   nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsOutputAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsOutputAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_STATICTEXT;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_STATICTEXT;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsTriggerAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsTriggerAccessible::
   nsXFormsTriggerAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsTriggerAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsTriggerAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 NS_IMETHODIMP
 nsXFormsTriggerAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
   return NS_OK;
 }
@@ -155,21 +152,20 @@ nsXFormsTriggerAccessible::DoAction(PRUi
 nsXFormsInputAccessible::
   nsXFormsInputAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsEditableAccessible(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED3(nsXFormsInputAccessible, nsAccessible, nsHyperTextAccessible, nsIAccessibleText, nsIAccessibleEditableText)
 
-nsresult
-nsXFormsInputAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsInputAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_ENTRY;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_ENTRY;
 }
 
 NS_IMETHODIMP
 nsXFormsInputAccessible::GetNumActions(PRUint8* aCount)
 {
   NS_ENSURE_ARG_POINTER(aCount);
 
   *aCount = 1;
@@ -202,21 +198,20 @@ nsXFormsInputAccessible::DoAction(PRUint
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsInputBooleanAccessible::
   nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsInputBooleanAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsInputBooleanAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CHECKBUTTON;
 }
 
 nsresult
 nsXFormsInputBooleanAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -276,39 +271,37 @@ nsXFormsInputBooleanAccessible::DoAction
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsInputDateAccessible::
   nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsContainerAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsInputDateAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsInputDateAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_DROPLIST;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_DROPLIST;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsSecretAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSecretAccessible::
   nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsInputAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsSecretAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsSecretAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
 }
 
 nsresult
 nsXFormsSecretAccessible::GetStateInternal(PRUint32 *aState,
                                            PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsInputAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -329,21 +322,20 @@ nsXFormsSecretAccessible::GetValue(nsASt
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsRangeAccessible::
   nsXFormsRangeAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsRangeAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsRangeAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_SLIDER;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_SLIDER;
 }
 
 nsresult
 nsXFormsRangeAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -455,21 +447,20 @@ nsXFormsSelectAccessible::GetStateIntern
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsChoicesAccessible::
   nsXFormsChoicesAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsChoicesAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsChoicesAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 NS_IMETHODIMP
 nsXFormsChoicesAccessible::GetValue(nsAString& aValue)
 {
   aValue.Truncate();
   return NS_OK;
 }
@@ -486,21 +477,20 @@ nsXFormsChoicesAccessible::CacheChildren
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectFullAccessible::
   nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsSelectFullAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsSelectFullAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 void
 nsXFormsSelectFullAccessible::CacheChildren()
 {
   CacheSelectChildren();
 }
 
@@ -510,21 +500,20 @@ nsXFormsSelectFullAccessible::CacheChild
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemCheckgroupAccessible::
   nsXFormsItemCheckgroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsItemCheckgroupAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsItemCheckgroupAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CHECKBUTTON;
 }
 
 nsresult
 nsXFormsItemCheckgroupAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
                                                                    aExtraState);
@@ -556,21 +545,20 @@ nsXFormsItemCheckgroupAccessible::GetAct
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemRadiogroupAccessible::
   nsXFormsItemRadiogroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsItemRadiogroupAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsItemRadiogroupAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_RADIOBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_RADIOBUTTON;
 }
 
 nsresult
 nsXFormsItemRadiogroupAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
                                                                    aExtraState);
@@ -598,21 +586,20 @@ nsXFormsItemRadiogroupAccessible::GetAct
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsSelectComboboxAccessible::
   nsXFormsSelectComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsSelectComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsSelectComboboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_COMBOBOX;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_COMBOBOX;
 }
 
 nsresult
 nsXFormsSelectComboboxAccessible::GetStateInternal(PRUint32 *aState,
                                                    PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsSelectableAccessible::GetStateInternal(aState,
                                                                aExtraState);
@@ -645,21 +632,20 @@ nsXFormsSelectComboboxAccessible::GetAll
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsItemComboboxAccessible::
   nsXFormsItemComboboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXFormsSelectableItemAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsItemComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsItemComboboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LISTITEM;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LISTITEM;
 }
 
 nsresult
 nsXFormsItemComboboxAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
   nsresult rv = nsXFormsSelectableItemAccessible::GetStateInternal(aState,
                                                                    aExtraState);
--- a/accessible/src/xforms/nsXFormsFormControlsAccessible.h
+++ b/accessible/src/xforms/nsXFormsFormControlsAccessible.h
@@ -50,30 +50,30 @@ class nsXFormsLabelAccessible : public n
 public:
   nsXFormsLabelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetDescription(nsAString& aDescription);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Accessible object for xforms:output.
  */
 
 class nsXFormsOutputAccessible : public nsXFormsAccessible
 {
 public:
   nsXFormsOutputAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Accessible object for xforms:trigger and xforms:submit.
  */
 
 class nsXFormsTriggerAccessible : public nsXFormsAccessible
 {
@@ -83,17 +83,17 @@ public:
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Accessible object for xforms:input and xforms:textarea.
  */
 
 class nsXFormsInputAccessible : public nsXFormsEditableAccessible
 {
@@ -103,17 +103,17 @@ public:
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:boolean"].
  */
 
 class nsXFormsInputBooleanAccessible : public nsXFormsAccessible
 {
@@ -121,47 +121,47 @@ public:
   nsXFormsInputBooleanAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Accessible object for xforms:input[type="xsd:date"].
  */
 
 class nsXFormsInputDateAccessible : public nsXFormsContainerAccessible
 {
 public:
   nsXFormsInputDateAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Accessible object for xforms:secret.
  */
 
 class nsXFormsSecretAccessible : public nsXFormsInputAccessible
 {
 public:
   nsXFormsSecretAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:range.
  */
 
@@ -172,17 +172,17 @@ public:
 
   // nsIAccessibleValue
   NS_IMETHOD GetMaximumValue(double *aMaximumValue);
   NS_IMETHOD GetMinimumValue(double *aMinimumValue);
   NS_IMETHOD GetMinimumIncrement(double *aMinimumIncrement);
   NS_IMETHOD GetCurrentValue(double *aCurrentValue);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:select and xforms:select1 that are implemented
  * using host document's native widget.
  */
@@ -205,17 +205,17 @@ class nsXFormsChoicesAccessible : public
 {
 public:
   nsXFormsChoicesAccessible(nsIContent* aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 
 /**
@@ -224,17 +224,17 @@ protected:
  */
 
 class nsXFormsSelectFullAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectFullAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 
 /**
@@ -248,17 +248,17 @@ class nsXFormsItemCheckgroupAccessible :
 public:
   nsXFormsItemCheckgroupAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for a xforms:item when it is represented by a radiobutton.
  * This occurs when the item is contained in a xforms:select1 with full
  * appearance. Such a xforms:select1 is represented as a radiogroup.
@@ -269,34 +269,34 @@ class nsXFormsItemRadiogroupAccessible :
 public:
   nsXFormsItemRadiogroupAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for xforms:select1 of minimal appearance that is
  * represented by combobox.
  */
 
 class nsXFormsSelectComboboxAccessible : public nsXFormsSelectableAccessible
 {
 public:
   nsXFormsSelectComboboxAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual PRBool GetAllowsAnonChildAccessibles();
 };
 
 
 /**
  * Accessible object for xforms:item element when it is represented by a
  * listitem. This occurs when the item is contained in a xforms:select with
@@ -308,14 +308,14 @@ class nsXFormsItemComboboxAccessible : p
 public:
   nsXFormsItemComboboxAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.cpp
@@ -44,21 +44,20 @@
 
 nsXFormsDropmarkerWidgetAccessible::
   nsXFormsDropmarkerWidgetAccessible(nsIContent *aContent,
                                      nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsDropmarkerWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsDropmarkerWidgetAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsXFormsDropmarkerWidgetAccessible::GetStateInternal(PRUint32 *aState,
                                                      PRUint32 *aExtraState)
 {
   NS_ENSURE_ARG_POINTER(aState);
   *aState = 0;
@@ -129,40 +128,38 @@ nsXFormsDropmarkerWidgetAccessible::DoAc
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsCalendarWidgetAccessible::
 nsXFormsCalendarWidgetAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsCalendarWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsCalendarWidgetAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CALENDAR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CALENDAR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXFormsComboboxPopupWidgetAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXFormsComboboxPopupWidgetAccessible::
   nsXFormsComboboxPopupWidgetAccessible(nsIContent *aContent,
                                         nsIWeakReference *aShell) :
   nsXFormsAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXFormsComboboxPopupWidgetAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXFormsComboboxPopupWidgetAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LIST;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LIST;
 }
 
 nsresult
 nsXFormsComboboxPopupWidgetAccessible::GetStateInternal(PRUint32 *aState,
                                                         PRUint32 *aExtraState)
 {
   NS_ENSURE_ARG_POINTER(aState);
 
--- a/accessible/src/xforms/nsXFormsWidgetsAccessible.h
+++ b/accessible/src/xforms/nsXFormsWidgetsAccessible.h
@@ -55,32 +55,32 @@ public:
                                      nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Accessible object for calendar widget. It is used by xforms:input[xsd:date].
  */
 class nsXFormsCalendarWidgetAccessible : public nsAccessibleWrap
 {
 public:
   nsXFormsCalendarWidgetAccessible(nsIContent *aContent,
                                    nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 
 /**
  * Accessible object for popup menu of minimal xforms select1 element that is
  * represented by combobox.
  */
 class nsXFormsComboboxPopupWidgetAccessible : public nsXFormsAccessible
@@ -90,17 +90,17 @@ public:
                                         nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
   NS_IMETHOD GetDescription(nsAString& aDescription);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 };
 
 #endif
--- a/accessible/src/xul/nsXULAlertAccessible.cpp
+++ b/accessible/src/xul/nsXULAlertAccessible.cpp
@@ -45,21 +45,20 @@
 nsXULAlertAccessible::
   nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
 NS_IMPL_ISUPPORTS_INHERITED0(nsXULAlertAccessible, nsAccessible)
 
-nsresult
-nsXULAlertAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULAlertAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_ALERT;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_ALERT;
 }
 
 nsresult
 nsXULAlertAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
--- a/accessible/src/xul/nsXULAlertAccessible.h
+++ b/accessible/src/xul/nsXULAlertAccessible.h
@@ -50,13 +50,13 @@ public:
   nsXULAlertAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessible
   NS_IMETHOD GetName(nsAString& aName);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULColorPickerAccessible.cpp
+++ b/accessible/src/xul/nsXULColorPickerAccessible.cpp
@@ -68,21 +68,20 @@ nsXULColorPickerTileAccessible::GetValue
 
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::color, aValue);
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerTileAccessible: nsAccessible
 
-nsresult
-nsXULColorPickerTileAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULColorPickerTileAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsXULColorPickerTileAccessible::GetStateInternal(PRUint32 *aState,
                                                  PRUint32 *aExtraState)
 {
   // Possible states: focused, focusable, selected.
 
@@ -144,36 +143,33 @@ nsXULColorPickerAccessible::GetStateInte
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState |= nsIAccessibleStates::STATE_FOCUSABLE |
              nsIAccessibleStates::STATE_HASPOPUP;
 
   return NS_OK;
 }
 
-nsresult
-nsXULColorPickerAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULColorPickerAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_BUTTONDROPDOWNGRID;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULColorPickerAccessible: protected nsAccessible
 
 void
 nsXULColorPickerAccessible::CacheChildren()
 {
   nsAccTreeWalker walker(mWeakShell, mContent, PR_TRUE);
 
   nsRefPtr<nsAccessible> child;
   while ((child = walker.GetNextChild())) {
-    // XXX: do not call nsAccessible::GetRole() while accessible not in tree
-    // (bug 574588).
-    PRUint32 role = nsAccUtils::Role(child);
+    PRUint32 role = child->Role();
 
     // Get an accessbile for menupopup or panel elements.
     if (role == nsIAccessibleRole::ROLE_ALERT) {
       AppendChild(child);
       return;
     }
   }
 }
--- a/accessible/src/xul/nsXULColorPickerAccessible.h
+++ b/accessible/src/xul/nsXULColorPickerAccessible.h
@@ -50,34 +50,34 @@ class nsXULColorPickerTileAccessible : p
 public:
   nsXULColorPickerTileAccessible(nsIContent *aContent,
                                  nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Used for colorpicker button (xul:colorpicker@type="button").
  */
 class nsXULColorPickerAccessible : public nsXULColorPickerTileAccessible
 {
 public:
   nsXULColorPickerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessNode
   virtual PRBool Init();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 };
 
--- a/accessible/src/xul/nsXULComboboxAccessible.cpp
+++ b/accessible/src/xul/nsXULComboboxAccessible.cpp
@@ -61,30 +61,23 @@ nsXULComboboxAccessible::Init()
 {
   if (!nsAccessibleWrap::Init())
     return PR_FALSE;
 
   nsCoreUtils::GeneratePopupTree(mContent);
   return PR_TRUE;
 }
 
-nsresult
-nsXULComboboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULComboboxAccessible::NativeRole()
 {
-  if (IsDefunct())
-    return NS_ERROR_FAILURE;
-
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
-                            nsAccessibilityAtoms::autocomplete, eIgnoreCase)) {
-    *aRole = nsIAccessibleRole::ROLE_AUTOCOMPLETE;
-  } else {
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX;
-  }
-
-  return NS_OK;
+                            nsAccessibilityAtoms::autocomplete, eIgnoreCase))
+    return nsIAccessibleRole::ROLE_AUTOCOMPLETE;
+  return nsIAccessibleRole::ROLE_COMBOBOX;
 }
 
 nsresult
 nsXULComboboxAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   // As a nsComboboxAccessible we can have the following states:
   //     STATE_FOCUSED
--- a/accessible/src/xul/nsXULComboboxAccessible.h
+++ b/accessible/src/xul/nsXULComboboxAccessible.h
@@ -59,14 +59,14 @@ public:
   NS_IMETHOD DoAction(PRUint8 aIndex);
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
 
   // nsAccessNode
   virtual PRBool Init();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual PRBool GetAllowsAnonChildAccessibles();
 };
 
 #endif
--- a/accessible/src/xul/nsXULFormControlAccessible.cpp
+++ b/accessible/src/xul/nsXULFormControlAccessible.cpp
@@ -120,21 +120,20 @@ nsXULButtonAccessible::Init()
     nsCoreUtils::GeneratePopupTree(mContent);
 
   return PR_TRUE;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULButtonAccessible: nsAccessible
 
-nsresult
-nsXULButtonAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULButtonAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsXULButtonAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   // Possible states: focused, focusable, unavailable(disabled).
 
   // get focus and disable status from base class
@@ -207,19 +206,17 @@ nsXULButtonAccessible::CacheChildren()
 
   nsRefPtr<nsAccessible> menupopupAccessible;
   nsRefPtr<nsAccessible> buttonAccessible;
 
   nsAccTreeWalker walker(mWeakShell, mContent, PR_TRUE);
 
   nsRefPtr<nsAccessible> child;
   while ((child = walker.GetNextChild())) {
-    // XXX: do not call nsAccessible::GetRole() while accessible not in tree
-    // (bug 574588).
-    PRUint32 role = nsAccUtils::Role(child);
+    PRUint32 role = child->Role();
 
     if (role == nsIAccessibleRole::ROLE_MENUPOPUP) {
       // Get an accessbile for menupopup or panel elements.
       menupopupAccessible.swap(child);
 
     } else if (isMenuButton && role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
       // Button type="menu-button" contains a real button. Get an accessible
       // for it. Ignore dropmarker button what is placed as a last child.
@@ -314,24 +311,20 @@ NS_IMETHODIMP nsXULDropmarkerAccessible:
 {
   if (index == eAction_Click) {
     DropmarkerOpen(PR_TRUE); // Reverse the open attribute
     return NS_OK;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
-/**
-  * We are a pushbutton
-  */
-nsresult
-nsXULDropmarkerAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULDropmarkerAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PUSHBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PUSHBUTTON;
 }
 
 nsresult
 nsXULDropmarkerAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   *aState = 0;
 
@@ -357,21 +350,20 @@ nsXULDropmarkerAccessible::GetStateInter
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULCheckboxAccessible::
   nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsFormControlAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXULCheckboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULCheckboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CHECKBUTTON;
 }
 
 NS_IMETHODIMP nsXULCheckboxAccessible::GetNumActions(PRUint8 *_retval)
 {
   *_retval = 1;
   return NS_OK;
 }
 
@@ -445,21 +437,20 @@ nsXULCheckboxAccessible::GetStateInterna
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULGroupboxAccessible::
   nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULGroupboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULGroupboxAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 nsresult
 nsXULGroupboxAccessible::GetNameInternal(nsAString& aName)
 {
   // XXX: we use the first related accessible only.
   nsCOMPtr<nsIAccessible> label =
     nsRelUtils::GetRelatedAccessible(this, nsIAccessibleRelation::RELATION_LABELLED_BY);
@@ -480,17 +471,17 @@ nsXULGroupboxAccessible::GetRelationByTy
 
   if (aRelationType == nsIAccessibleRelation::RELATION_LABELLED_BY) {
     // The label for xul:groupbox is generated from xul:label that is
     // inside the anonymous content of the xul:caption.
     // The xul:label has an accessible object but the xul:caption does not
     PRInt32 childCount = GetChildCount();
     for (PRInt32 childIdx = 0; childIdx < childCount; childIdx++) {
       nsAccessible *childAcc = GetChildAt(childIdx);
-      if (nsAccUtils::Role(childAcc) == nsIAccessibleRole::ROLE_LABEL) {
+      if (childAcc->Role() == nsIAccessibleRole::ROLE_LABEL) {
         // Ensure that it's our label
         // XXX: we'll fail if group accessible expose more than one relation
         // targets.
         nsCOMPtr<nsIAccessible> testGroupboxAccessible =
           nsRelUtils::GetRelatedAccessible(childAcc,
                                            nsIAccessibleRelation::RELATION_LABEL_FOR);
 
         if (testGroupboxAccessible == this) {
@@ -516,21 +507,20 @@ nsXULProgressMeterAccessible::
 }
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULProgressMeterAccessible,
                              nsFormControlAccessible,
                              nsIAccessibleValue)
 
 // nsAccessible
 
-nsresult
-nsXULProgressMeterAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULProgressMeterAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PROGRESSBAR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PROGRESSBAR;
 }
 
 // nsIAccessibleValue
 
 NS_IMETHODIMP
 nsXULProgressMeterAccessible::GetValue(nsAString& aValue)
 {
   nsresult rv = nsFormControlAccessible::GetValue(aValue);
@@ -696,21 +686,20 @@ nsXULRadioButtonAccessible::GetPositionA
   */
 
 nsXULRadioGroupAccessible::
   nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXULSelectableAccessible(aContent, aShell)
 { 
 }
 
-nsresult
-nsXULRadioGroupAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULRadioGroupAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_GROUPING;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_GROUPING;
 }
 
 nsresult
 nsXULRadioGroupAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -730,21 +719,20 @@ nsXULRadioGroupAccessible::GetStateInter
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULStatusBarAccessible::
   nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULStatusBarAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULStatusBarAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_STATUSBAR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_STATUSBAR;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULToolbarButtonAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULToolbarButtonAccessible::
@@ -805,21 +793,20 @@ nsXULToolbarButtonAccessible::IsSeparato
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULToolbarAccessible::
   nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULToolbarAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULToolbarAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_TOOLBAR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_TOOLBAR;
 }
 
 nsresult
 nsXULToolbarAccessible::GetNameInternal(nsAString& aName)
 {
   nsAutoString name;
   if (mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::toolbarname,
                         name)) {
@@ -837,21 +824,20 @@ nsXULToolbarAccessible::GetNameInternal(
 
 nsXULToolbarSeparatorAccessible::
   nsXULToolbarSeparatorAccessible(nsIContent *aContent,
                                   nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXULToolbarSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULToolbarSeparatorAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_SEPARATOR;
 }
 
 nsresult
 nsXULToolbarSeparatorAccessible::GetStateInternal(PRUint32 *aState,
                                                   PRUint32 *aExtraState)
 {
   *aState = 0;  // no special state flags for toolbar separator
 
@@ -971,26 +957,23 @@ nsXULTextFieldAccessible::GetStateIntern
   }
   else {
     *aExtraState |= nsIAccessibleStates::EXT_STATE_SINGLE_LINE;
   }
 
   return NS_OK;
 }
 
-nsresult
-nsXULTextFieldAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTextFieldAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_ENTRY;
-
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
                             nsAccessibilityAtoms::password, eIgnoreCase))
-    *aRole = nsIAccessibleRole::ROLE_PASSWORD_TEXT;
-
-  return NS_OK;
+    return nsIAccessibleRole::ROLE_PASSWORD_TEXT;
+  return nsIAccessibleRole::ROLE_ENTRY;
 }
 
 
 /**
   * Only one actions available
   */
 NS_IMETHODIMP nsXULTextFieldAccessible::GetNumActions(PRUint8 *_retval)
 {
--- a/accessible/src/xul/nsXULFormControlAccessible.h
+++ b/accessible/src/xul/nsXULFormControlAccessible.h
@@ -65,17 +65,17 @@ public:
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessNode
   virtual PRBool Init();
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
 
   // nsAccessible
   virtual void CacheChildren();
 
   // nsXULButtonAccessible
@@ -93,17 +93,17 @@ public:
   nsXULCheckboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for XUL dropmarker element.
  */
 class nsXULDropmarkerAccessible : public nsFormControlAccessible
 {
@@ -112,17 +112,17 @@ public:
   nsXULDropmarkerAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 private:
   PRBool DropmarkerOpen(PRBool aToggleOpen);
 };
 
 /**
  * Used for XUL groupbox element.
@@ -132,34 +132,34 @@ class nsXULGroupboxAccessible : public n
 public:
   nsXULGroupboxAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
 };
 
 /**
  * Used for XUL progressmeter element.
  */
 class nsXULProgressMeterAccessible : public nsFormControlAccessible
 {
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLEVALUE
 
 public:
   nsXULProgressMeterAccessible(nsIContent *aContent, nsIWeakReference *aShell);
   NS_IMETHOD GetValue(nsAString &aValue);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Used for XUL radio element (radio button).
  */
 class nsXULRadioButtonAccessible : public nsRadioButtonAccessible
 {
 
@@ -176,30 +176,30 @@ public:
  * Used for XUL radiogroup element.
  */
 class nsXULRadioGroupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULRadioGroupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for XUL statusbar element.
  */
 class nsXULStatusBarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULStatusBarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 /**
  * Used for XUL toolbarbutton element.
  */
 class nsXULToolbarButtonAccessible : public nsXULButtonAccessible
 {
 public:
@@ -217,31 +217,31 @@ public:
  * Used for XUL toolbar element.
  */
 class nsXULToolbarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULToolbarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetNameInternal(nsAString& aName);
 };
 
 /**
  * Used for XUL toolbarseparator element.
  */
 class nsXULToolbarSeparatorAccessible : public nsLeafAccessible
 {
 public:
   nsXULToolbarSeparatorAccessible(nsIContent* aContent,
                                   nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for XUL textbox element.
  */
 class nsXULTextFieldAccessible : public nsHyperTextAccessibleWrap
 {
@@ -258,17 +258,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
 
   // nsIAccessibleEditableText
   NS_IMETHOD GetAssociatedEditor(nsIEditor **aEditor);
 
   // nsAccessible
   virtual nsresult GetARIAState(PRUint32 *aState, PRUint32 *aExtraState);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual PRBool GetAllowsAnonChildAccessibles();
 
 protected:
   // nsAccessible
   virtual void CacheChildren();
 
   // nsXULTextFieldAccessible
--- a/accessible/src/xul/nsXULListboxAccessible.cpp
+++ b/accessible/src/xul/nsXULListboxAccessible.cpp
@@ -52,21 +52,20 @@
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULColumnsAccessible::
   nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULColumnsAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULColumnsAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LIST;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LIST;
 }
 
 nsresult
 nsXULColumnsAccessible::GetStateInternal(PRUint32 *aState,
                                          PRUint32 *aExtraState)
 {
   NS_ENSURE_ARG_POINTER(aState);
   *aState = 0;
@@ -92,21 +91,20 @@ nsXULColumnsAccessible::GetStateInternal
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULColumnItemAccessible::
   nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsLeafAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXULColumnItemAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULColumnItemAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_COLUMNHEADER;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_COLUMNHEADER;
 }
 
 nsresult
 nsXULColumnItemAccessible::GetStateInternal(PRUint32 *aState,
                                             PRUint32 *aExtraState)
 {
   NS_ENSURE_ARG_POINTER(aState);
 
@@ -231,34 +229,29 @@ NS_IMETHODIMP nsXULListboxAccessible::Ge
     nsCOMPtr<nsIDOMXULSelectControlItemElement> selectedItem;
     select->GetSelectedItem(getter_AddRefs(selectedItem));
     if (selectedItem)
       return selectedItem->GetLabel(_retval);
   }
   return NS_ERROR_FAILURE;
 }
 
-nsresult
-nsXULListboxAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULListboxAccessible::NativeRole()
 {
   // A richlistbox is used with the new autocomplete URL bar, and has a parent
   // popup <panel>.
   nsCOMPtr<nsIDOMXULPopupElement> xulPopup =
     do_QueryInterface(mContent->GetParent());
-  if (xulPopup) {
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-    return NS_OK;
-  }
+  if (xulPopup)
+    return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
 
   if (IsMulticolumn())
-    *aRole = nsIAccessibleRole::ROLE_TABLE;
-  else
-    *aRole = nsIAccessibleRole::ROLE_LISTBOX;
-
-  return NS_OK;
+    return nsIAccessibleRole::ROLE_TABLE;
+  return nsIAccessibleRole::ROLE_LISTBOX;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListboxAccessible. nsIAccessibleTable
 
 NS_IMETHODIMP
 nsXULListboxAccessible::GetCaption(nsIAccessible **aCaption)
 {
@@ -644,17 +637,17 @@ nsXULListboxAccessible::GetSelectedCells
     nsCOMPtr<nsIContent> itemContent(do_QueryInterface(itemNode));
     nsAccessible *item =
       GetAccService()->GetAccessibleInWeakShell(itemContent, mWeakShell);
 
     if (item) {
       PRInt32 cellCount = item->GetChildCount();
       for (PRInt32 cellIdx = 0; cellIdx < cellCount; cellIdx++) {
         nsAccessible *cell = mChildren[cellIdx];
-        if (nsAccUtils::Role(cell) == nsIAccessibleRole::ROLE_CELL)
+        if (cell->Role() == nsIAccessibleRole::ROLE_CELL)
           selCells->AppendElement(static_cast<nsIAccessible*>(cell), PR_FALSE);
       }
     }
   }
 
   NS_ADDREF(*aCells = selCells);
   return NS_OK;
 }
@@ -918,34 +911,35 @@ nsXULListitemAccessible::GetNameInternal
                                   kNameSpaceID_XUL)) {
       child->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
       return NS_OK;
     }
   }
   return GetXULName(aName);
 }
 
-nsresult
-nsXULListitemAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULListitemAccessible::NativeRole()
 {
   nsAccessible *list = GetListAccessible();
-  NS_ENSURE_STATE(list);
-
-  if (nsAccUtils::Role(list) == nsIAccessibleRole::ROLE_TABLE) {
-    *aRole = nsIAccessibleRole::ROLE_ROW;
-    return NS_OK;
+  if (!list) {
+    NS_ERROR("No list accessible for listitem accessible!");
+    return nsIAccessibleRole::ROLE_NOTHING;
   }
 
+  if (list->Role() == nsIAccessibleRole::ROLE_TABLE)
+    return nsIAccessibleRole::ROLE_ROW;
+
   if (mIsCheckbox)
-    *aRole = nsIAccessibleRole::ROLE_CHECKBUTTON;
-  else if (nsAccUtils::Role(mParent) == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
-  else
-    *aRole = nsIAccessibleRole::ROLE_RICH_OPTION;
-  return NS_OK;
+    return nsIAccessibleRole::ROLE_CHECKBUTTON;
+
+  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+
+  return nsIAccessibleRole::ROLE_RICH_OPTION;
 }
 
 nsresult
 nsXULListitemAccessible::GetStateInternal(PRUint32 *aState,
                                           PRUint32 *aExtraState)
 {
   if (mIsCheckbox) {
     return nsXULMenuitemAccessible::GetStateInternal(aState, aExtraState);
@@ -1041,77 +1035,81 @@ NS_IMETHODIMP
 nsXULListCellAccessible::GetTable(nsIAccessibleTable **aTable)
 {
   NS_ENSURE_ARG_POINTER(aTable);
   *aTable = nsnull;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIAccessible> thisRow;
-  GetParent(getter_AddRefs(thisRow));
-  if (nsAccUtils::Role(thisRow) != nsIAccessibleRole::ROLE_ROW)
+  nsAccessible* thisRow = GetParent();
+  if (!thisRow || thisRow->Role() != nsIAccessibleRole::ROLE_ROW)
     return NS_OK;
 
-  nsCOMPtr<nsIAccessible> table;
-  thisRow->GetParent(getter_AddRefs(table));
-  if (nsAccUtils::Role(table) != nsIAccessibleRole::ROLE_TABLE)
+  nsAccessible* table = thisRow->GetParent();
+  if (!table || table->Role() != nsIAccessibleRole::ROLE_TABLE)
     return NS_OK;
 
   CallQueryInterface(table, aTable);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetColumnIndex(PRInt32 *aColumnIndex)
 {
   NS_ENSURE_ARG_POINTER(aColumnIndex);
   *aColumnIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
+  nsAccessible* row = GetParent();
+  if (!row)
+    return NS_OK;
+
   *aColumnIndex = 0;
 
-  nsCOMPtr<nsIAccessible> prevCell, tmpAcc;
-  GetPreviousSibling(getter_AddRefs(prevCell));
-
-  while (prevCell) {
-    PRUint32 role = nsAccUtils::Role(prevCell);
+  PRInt32 indexInRow = GetIndexInParent();
+  for (PRInt32 idx = 0; idx < indexInRow; idx++) {
+    nsAccessible* cell = row->GetChildAt(idx);
+    PRUint32 role = cell->Role();
     if (role == nsIAccessibleRole::ROLE_CELL ||
         role == nsIAccessibleRole::ROLE_GRID_CELL ||
         role == nsIAccessibleRole::ROLE_ROWHEADER ||
         role == nsIAccessibleRole::ROLE_COLUMNHEADER)
       (*aColumnIndex)++;
-
-    prevCell->GetPreviousSibling(getter_AddRefs(tmpAcc));
-    tmpAcc.swap(prevCell);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetRowIndex(PRInt32 *aRowIndex)
 {
   NS_ENSURE_ARG_POINTER(aRowIndex);
   *aRowIndex = -1;
 
   if (IsDefunct())
     return NS_ERROR_FAILURE;
 
-  nsCOMPtr<nsIAccessible> row, prevRow;
-  GetParent(getter_AddRefs(row));
+  nsAccessible* row = GetParent();
+  if (!row)
+    return NS_OK;
+
+  nsAccessible* table = row->GetParent();
+  if (!table)
+    return NS_OK;
 
-  while (row) {
-    if (nsAccUtils::Role(row) == nsIAccessibleRole::ROLE_ROW)
+  *aRowIndex = 0;
+
+  PRInt32 indexInTable = row->GetIndexInParent();
+  for (PRInt32 idx = 0; idx < indexInTable; idx++) {
+    row = table->GetChildAt(idx);
+    if (row->Role() == nsIAccessibleRole::ROLE_ROW)
       (*aRowIndex)++;
-
-    row->GetPreviousSibling(getter_AddRefs(prevRow));
-    row.swap(prevRow);
   }
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsXULListCellAccessible::GetColumnExtent(PRInt32 *aExtentCount)
 {
@@ -1153,17 +1151,17 @@ nsXULListCellAccessible::GetColumnHeader
 
   // Get column header cell from XUL listhead.
   nsAccessible *list = nsnull;
 
   nsRefPtr<nsAccessible> tableAcc(do_QueryObject(table));
   PRInt32 tableChildCount = tableAcc->GetChildCount();
   for (PRInt32 childIdx = 0; childIdx < tableChildCount; childIdx++) {
     nsAccessible *child = tableAcc->GetChildAt(childIdx);
-    if (nsAccUtils::Role(child) == nsIAccessibleRole::ROLE_LIST) {
+    if (child->Role() == nsIAccessibleRole::ROLE_LIST) {
       list = child;
       break;
     }
   }
 
   if (list) {
     PRInt32 colIdx = -1;
     GetColumnIndex(&colIdx);
@@ -1223,21 +1221,20 @@ nsXULListCellAccessible::IsSelected(PRBo
   GetRowIndex(&rowIdx);
 
   return table->IsRowSelected(rowIdx, aIsSelected);
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULListCellAccessible. nsAccessible implementation
 
-nsresult
-nsXULListCellAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULListCellAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_CELL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_CELL;
 }
 
 nsresult
 nsXULListCellAccessible::GetAttributesInternal(nsIPersistentProperties *aAttributes)
 {
   NS_ENSURE_ARG_POINTER(aAttributes);
 
   if (IsDefunct())
--- a/accessible/src/xul/nsXULListboxAccessible.h
+++ b/accessible/src/xul/nsXULListboxAccessible.h
@@ -53,17 +53,17 @@ class nsIWeakReference;
  * (xul:treecols and xul:listcols).
  */
 class nsXULColumnsAccessible : public nsAccessibleWrap
 {
 public:
   nsXULColumnsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * nsXULColumnAccessible are accessibles for list and tree column elements
  * (xul:listcol and xul:treecol).
  */
 class nsXULColumnItemAccessible : public nsLeafAccessible
@@ -72,17 +72,17 @@ public:
   nsXULColumnItemAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *aNumActions);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
   enum { eAction_Click = 0 };
 };
 
 /*
  * A class the represents the XUL Listbox widget.
  */
@@ -95,17 +95,17 @@ public:
 
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIACCESSIBLETABLE
 
   // nsIAccessible
   NS_IMETHOD GetValue(nsAString& aValue);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 
 protected:
   PRBool IsMulticolumn();
 };
 
 /**
   * Listitems -- used in listboxes 
@@ -122,17 +122,17 @@ public:
 
   // nsIAccessible
   NS_IMETHOD GetActionName(PRUint8 index, nsAString& aName);
   // Don't use XUL menuitems's description attribute
   NS_IMETHOD GetDescription(nsAString& aDesc) { return nsAccessibleWrap::GetDescription(aDesc); }
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
   virtual PRBool GetAllowsAnonChildAccessibles();
 
 protected:
   /**
    * Return listbox accessible for the listitem.
@@ -155,12 +155,12 @@ public:
   // nsISupports
   NS_DECL_ISUPPORTS_INHERITED
 
   // nsIAccessibleTableCell
   NS_DECL_NSIACCESSIBLETABLECELL
 
   // nsAccessible
   virtual nsresult GetAttributesInternal(nsIPersistentProperties *aAttributes);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 #endif
--- a/accessible/src/xul/nsXULMenuAccessible.cpp
+++ b/accessible/src/xul/nsXULMenuAccessible.cpp
@@ -324,18 +324,17 @@ nsXULMenuitemAccessible::GetStateInterna
 
     // Checked?
     if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::checked,
                               nsAccessibilityAtoms::_true, eCaseMatters))
       *aState |= nsIAccessibleStates::STATE_CHECKED;
   }
 
   // Combo box listitem
-  PRBool isComboboxOption =
-    (nsAccUtils::Role(this) == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
+  PRBool isComboboxOption = (Role() == nsIAccessibleRole::ROLE_COMBOBOX_OPTION);
   if (isComboboxOption) {
     // Is selected?
     PRBool isSelected = PR_FALSE;
     nsCOMPtr<nsIDOMXULSelectControlItemElement>
       item(do_QueryInterface(mContent));
     NS_ENSURE_TRUE(item, NS_ERROR_FAILURE);
     item->GetSelected(&isSelected);
 
@@ -348,17 +347,17 @@ nsXULMenuitemAccessible::GetStateInterna
     if (isSelected) {
       *aState |= nsIAccessibleStates::STATE_SELECTED;
 
       // Selected and collapsed?
       if (isCollapsed) {
         // Set selected option offscreen/invisible according to combobox state
         nsAccessible* grandParentAcc = parentAcc->GetParent();
         NS_ENSURE_TRUE(grandParentAcc, NS_ERROR_FAILURE);
-        NS_ASSERTION(nsAccUtils::Role(grandParentAcc) == nsIAccessibleRole::ROLE_COMBOBOX,
+        NS_ASSERTION(grandParentAcc->Role() == nsIAccessibleRole::ROLE_COMBOBOX,
                      "grandparent of combobox listitem is not combobox");
         PRUint32 grandParentState, grandParentExtState;
         grandParentAcc->GetState(&grandParentState, &grandParentExtState);
         *aState &= ~(nsIAccessibleStates::STATE_OFFSCREEN |
                      nsIAccessibleStates::STATE_INVISIBLE);
         *aState |= (grandParentState & nsIAccessibleStates::STATE_OFFSCREEN) |
                    (grandParentState & nsIAccessibleStates::STATE_INVISIBLE);
         if (aExtraState) {
@@ -423,17 +422,17 @@ nsXULMenuitemAccessible::GetKeyboardShor
   nsAutoString accesskey;
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::accesskey,
                     accesskey);
   if (accesskey.IsEmpty())
     return NS_OK;
 
   nsAccessible* parentAcc = GetParent();
   if (parentAcc) {
-    if (nsAccUtils::RoleInternal(parentAcc) == nsIAccessibleRole::ROLE_MENUBAR) {
+    if (parentAcc->NativeRole() == nsIAccessibleRole::ROLE_MENUBAR) {
       // If top level menu item, add Alt+ or whatever modifier text to string
       // No need to cache pref service, this happens rarely
       if (gMenuAccesskeyModifier == -1) {
         // Need to initialize cached global accesskey pref
         gMenuAccesskeyModifier = 0;
         nsCOMPtr<nsIPrefBranch> prefBranch(do_GetService(NS_PREFSERVICE_CONTRACTID));
         if (prefBranch)
           prefBranch->GetIntPref("ui.key.menuAccessKey", &gMenuAccesskeyModifier);
@@ -474,44 +473,38 @@ nsXULMenuitemAccessible::GetDefaultKeyBi
 
   nsAutoString accelText;
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::acceltext,
                     aKeyBinding);
 
   return NS_OK;
 }
 
-nsresult
-nsXULMenuitemAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULMenuitemAccessible::NativeRole()
 {
   nsCOMPtr<nsIDOMXULContainerElement> xulContainer(do_QueryInterface(mContent));
-  if (xulContainer) {
-    *aRole = nsIAccessibleRole::ROLE_PARENT_MENUITEM;
-    return NS_OK;
-  }
+  if (xulContainer)
+    return nsIAccessibleRole::ROLE_PARENT_MENUITEM;
 
-  if (nsAccUtils::Role(GetParent()) == nsIAccessibleRole::ROLE_COMBOBOX_LIST) {
-    *aRole = nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
-    return NS_OK;
+  if (mParent && mParent->Role() == nsIAccessibleRole::ROLE_COMBOBOX_LIST)
+    return nsIAccessibleRole::ROLE_COMBOBOX_OPTION;
+
+  if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
+                            nsAccessibilityAtoms::radio, eCaseMatters)) {
+    return nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
   }
 
   if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
-                            nsAccessibilityAtoms::radio, eCaseMatters)) {
-    *aRole = nsIAccessibleRole::ROLE_RADIO_MENU_ITEM;
-
-  } else if (mContent->AttrValueIs(kNameSpaceID_None, nsAccessibilityAtoms::type,
-                                   nsAccessibilityAtoms::checkbox,
-                                   eCaseMatters)) {
-    *aRole = nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
-
-  } else {
-    *aRole = nsIAccessibleRole::ROLE_MENUITEM;
+                            nsAccessibilityAtoms::checkbox,
+                            eCaseMatters)) {
+    return nsIAccessibleRole::ROLE_CHECK_MENU_ITEM;
   }
 
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_MENUITEM;
 }
 
 PRInt32
 nsXULMenuitemAccessible::GetLevelInternal()
 {
   return nsAccUtils::GetLevelForXULContainerItem(mContent);
 }
 
@@ -582,21 +575,20 @@ nsXULMenuSeparatorAccessible::GetStateIn
 }
 
 nsresult
 nsXULMenuSeparatorAccessible::GetNameInternal(nsAString& aName)
 {
   return NS_OK;
 }
 
-nsresult
-nsXULMenuSeparatorAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULMenuSeparatorAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_SEPARATOR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_SEPARATOR;
 }
 
 NS_IMETHODIMP nsXULMenuSeparatorAccessible::DoAction(PRUint8 index)
 {
   return NS_ERROR_NOT_IMPLEMENTED;
 }
 
 NS_IMETHODIMP nsXULMenuSeparatorAccessible::GetActionName(PRUint8 aIndex, nsAString& aName)
@@ -662,39 +654,38 @@ nsXULMenupopupAccessible::GetNameInterna
   while (content && aName.IsEmpty()) {
     content->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::label, aName);
     content = content->GetParent();
   }
 
   return NS_OK;
 }
 
-nsresult
-nsXULMenupopupAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULMenupopupAccessible::NativeRole()
 {
-  nsAccessible *parent = GetParent();
-  if (parent) {
-    PRUint32 role = nsAccUtils::Role(parent);
+  // If accessible is not bound to the tree (this happens while children are
+  // cached) return general role.
+  if (mParent) {
+    PRUint32 role = mParent->Role();
     if (role == nsIAccessibleRole::ROLE_COMBOBOX ||
         role == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
-      *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-      return NS_OK;
+      return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
+    }
 
-    } else if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
+    if (role == nsIAccessibleRole::ROLE_PUSHBUTTON) {
       // Some widgets like the search bar have several popups, owned by buttons.
-      nsAccessible *grandParent = parent->GetParent();
-      if (nsAccUtils::Role(grandParent) == nsIAccessibleRole::ROLE_AUTOCOMPLETE) {
-        *aRole = nsIAccessibleRole::ROLE_COMBOBOX_LIST;
-        return NS_OK;
-      }
+      nsAccessible* grandParent = mParent->GetParent();
+      if (grandParent &&
+          grandParent->Role() == nsIAccessibleRole::ROLE_AUTOCOMPLETE)
+        return nsIAccessibleRole::ROLE_COMBOBOX_LIST;
     }
   }
 
-  *aRole = nsIAccessibleRole::ROLE_MENUPOPUP;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_MENUPOPUP;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULMenubarAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULMenubarAccessible::
@@ -718,15 +709,14 @@ nsXULMenubarAccessible::GetStateInternal
 
 nsresult
 nsXULMenubarAccessible::GetNameInternal(nsAString& aName)
 {
   aName.AssignLiteral("Application");
   return NS_OK;
 }
 
-nsresult
-nsXULMenubarAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULMenubarAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_MENUBAR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_MENUBAR;
 }
 
--- a/accessible/src/xul/nsXULMenuAccessible.h
+++ b/accessible/src/xul/nsXULMenuAccessible.h
@@ -89,17 +89,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessNode
   virtual PRBool Init();
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual PRInt32 GetLevelInternal();
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
 
   virtual PRBool GetAllowsAnonChildAccessibles();
 };
 
@@ -113,42 +113,42 @@ public:
 
   // nsIAccessible
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * Used for XUL menupopup and panel.
  */
 class nsXULMenupopupAccessible : public nsXULSelectableAccessible
 {
 public:
   nsXULMenupopupAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for XUL menubar element.
  */
 class nsXULMenubarAccessible : public nsAccessibleWrap
 {
 public:
   nsXULMenubarAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 #endif  
--- a/accessible/src/xul/nsXULSliderAccessible.cpp
+++ b/accessible/src/xul/nsXULSliderAccessible.cpp
@@ -57,21 +57,20 @@ nsXULSliderAccessible::
 // nsISupports
 
 NS_IMPL_ISUPPORTS_INHERITED1(nsXULSliderAccessible,
                              nsAccessibleWrap,
                              nsIAccessibleValue)
 
 // nsAccessible
 
-nsresult
-nsXULSliderAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULSliderAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_SLIDER;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_SLIDER;
 }
 
 nsresult
 nsXULSliderAccessible::GetStateInternal(PRUint32 *aState,
                                         PRUint32 *aExtraState)
 {
   nsresult rv = nsAccessibleWrap::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -295,17 +294,17 @@ nsXULSliderAccessible::SetSliderAttr(nsI
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULThumbAccessible::
   nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-// nsIAccessible
+////////////////////////////////////////////////////////////////////////////////
+// nsXULThumbAccessible: nsAccessible
 
-nsresult
-nsXULThumbAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULThumbAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_INDICATOR;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_INDICATOR;
 }
 
--- a/accessible/src/xul/nsXULSliderAccessible.h
+++ b/accessible/src/xul/nsXULSliderAccessible.h
@@ -59,17 +59,17 @@ public:
   NS_IMETHOD GetNumActions(PRUint8 *aCount);
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 aIndex);
 
   // nsIAccessibleValue
   NS_DECL_NSIACCESSIBLEVALUE
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
   virtual PRBool GetAllowsAnonChildAccessibles();
 
 protected:
   already_AddRefed<nsIContent> GetSliderNode();
 
   nsresult GetSliderAttr(nsIAtom *aName, nsAString& aValue);
   nsresult SetSliderAttr(nsIAtom *aName, const nsAString& aValue);
@@ -86,13 +86,13 @@ private:
  * Used for slider's thumb element.
  */
 class nsXULThumbAccessible : public nsAccessibleWrap
 {
 public:
   nsXULThumbAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTabAccessible.cpp
+++ b/accessible/src/xul/nsXULTabAccessible.cpp
@@ -91,21 +91,20 @@ NS_IMETHODIMP nsXULTabAccessible::DoActi
     return NS_ERROR_FAILURE;
   }
   return NS_ERROR_INVALID_ARG;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTabAccessible: nsAccessible
 
-nsresult
-nsXULTabAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTabAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PAGETAB;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PAGETAB;
 }
 
 nsresult
 nsXULTabAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   // Possible states: focused, focusable, unavailable(disabled), offscreen.
 
   // get focus and disable status from base class
@@ -179,21 +178,20 @@ nsXULTabAccessible::GetPositionAndSizeIn
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabsAccessible::
   nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsXULSelectableAccessible(aContent, aShell)
 {
 }
 
-nsresult
-nsXULTabsAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTabsAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PAGETABLIST;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PAGETABLIST;
 }
 
 NS_IMETHODIMP
 nsXULTabsAccessible::GetNumActions(PRUint8 *aCount)
 {
   NS_ENSURE_ARG_POINTER(aCount);
   *aCount = 0;
 
@@ -219,39 +217,37 @@ nsXULTabsAccessible::GetNameInternal(nsA
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabpanelsAccessible::
   nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULTabpanelsAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTabpanelsAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PANE;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PANE;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULTabpanelAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULTabpanelAccessible::
   nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell) :
   nsAccessibleWrap(aContent, aShell)
 {
 }
 
-nsresult
-nsXULTabpanelAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTabpanelAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_PROPERTYPAGE;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_PROPERTYPAGE;
 }
 
 NS_IMETHODIMP
 nsXULTabpanelAccessible::GetRelationByType(PRUint32 aRelationType,
                                            nsIAccessibleRelation **aRelation)
 {
   nsresult rv = nsAccessibleWrap::GetRelationByType(aRelationType, aRelation);
   NS_ENSURE_SUCCESS(rv, rv);
--- a/accessible/src/xul/nsXULTabAccessible.h
+++ b/accessible/src/xul/nsXULTabAccessible.h
@@ -58,17 +58,17 @@ public:
   NS_IMETHOD GetActionName(PRUint8 aIndex, nsAString& aName);
   NS_IMETHOD DoAction(PRUint8 index);
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual void GetPositionAndSizeInternal(PRInt32 *aPosInSet,
                                           PRInt32 *aSetSize);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 
 /**
  * A container of tab objects, xul:tabs element.
  */
 class nsXULTabsAccessible : public nsXULSelectableAccessible
@@ -77,30 +77,30 @@ public:
   nsXULTabsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetNumActions(PRUint8 *_retval);
   NS_IMETHOD GetValue(nsAString& _retval);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 
 /** 
  * A container of tab panels, xul:tabpanels element.
  */
 class nsXULTabpanelsAccessible : public nsAccessibleWrap
 {
 public:
   nsXULTabpanelsAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 
 /**
  * A tabpanel object, child elements of xul:tabpanels element. Note,the object
  * is created from nsAccessibilityService::GetAccessibleForDeckChildren()
  * method and we do not use nsIAccessibleProvider interface here because
  * all children of xul:tabpanels element acts as xul:tabpanel element.
@@ -114,13 +114,13 @@ class nsXULTabpanelAccessible : public n
 public:
   nsXULTabpanelAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
 };
 
 #endif
 
--- a/accessible/src/xul/nsXULTextAccessible.cpp
+++ b/accessible/src/xul/nsXULTextAccessible.cpp
@@ -66,21 +66,20 @@ nsresult
 nsXULTextAccessible::GetNameInternal(nsAString& aName)
 {
   // if the value attr doesn't exist, the screen reader must get the accessible text
   // from the accessible text interface or from the children
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
   return NS_OK;
 }
 
-nsresult
-nsXULTextAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTextAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LABEL;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LABEL;
 }
 
 nsresult
 nsXULTextAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
@@ -98,21 +97,19 @@ nsXULTextAccessible::GetRelationByType(P
   nsresult rv =
     nsHyperTextAccessibleWrap::GetRelationByType(aRelationType, aRelation);
   NS_ENSURE_SUCCESS(rv, rv);
 
   if (aRelationType == nsIAccessibleRelation::RELATION_LABEL_FOR) {
     // Caption is the label for groupbox
     nsIContent *parent = mContent->GetParent();
     if (parent && parent->Tag() == nsAccessibilityAtoms::caption) {
-      nsCOMPtr<nsIAccessible> parentAccessible;
-      GetParent(getter_AddRefs(parentAccessible));
-      if (nsAccUtils::Role(parentAccessible) == nsIAccessibleRole::ROLE_GROUPING)
-        return nsRelUtils::
-          AddTarget(aRelationType, aRelation, parentAccessible);
+      nsAccessible* parent = GetParent();
+      if (parent && parent->Role() == nsIAccessibleRole::ROLE_GROUPING)
+        return nsRelUtils::AddTarget(aRelationType, aRelation, parent);
     }
   }
 
   return NS_OK;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -132,21 +129,20 @@ nsXULTooltipAccessible::GetStateInternal
   nsresult rv = nsLeafAccessible::GetStateInternal(aState, aExtraState);
   NS_ENSURE_A11Y_SUCCESS(rv, rv);
 
   *aState &= ~nsIAccessibleStates::STATE_FOCUSABLE;
   *aState |= nsIAccessibleStates::STATE_READONLY;
   return NS_OK;
 }
 
-nsresult
-nsXULTooltipAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULTooltipAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_TOOLTIP;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_TOOLTIP;
 }
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsXULLinkAccessible
 ////////////////////////////////////////////////////////////////////////////////
 
 nsXULLinkAccessible::
@@ -179,21 +175,20 @@ nsXULLinkAccessible::GetNameInternal(nsA
 {
   mContent->GetAttr(kNameSpaceID_None, nsAccessibilityAtoms::value, aName);
   if (!aName.IsEmpty())
     return NS_OK;
 
   return nsTextEquivUtils::GetNameFromSubtree(this, aName);
 }
 
-nsresult
-nsXULLinkAccessible::GetRoleInternal(PRUint32 *aRole)
+PRUint32
+nsXULLinkAccessible::NativeRole()
 {
-  *aRole = nsIAccessibleRole::ROLE_LINK;
-  return NS_OK;
+  return nsIAccessibleRole::ROLE_LINK;
 }
 
 
 nsresult
 nsXULLinkAccessible::GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState)
 {
   nsresult rv = nsHyperTextAccessibleWrap::GetStateInternal(aState,
                                                             aExtraState);
--- a/accessible/src/xul/nsXULTextAccessible.h
+++ b/accessible/src/xul/nsXULTextAccessible.h
@@ -53,31 +53,31 @@ public:
   nsXULTextAccessible(nsIContent *aContent, nsIWeakReference *aShell);
 
   // nsIAccessible
   NS_IMETHOD GetRelationByType(PRUint32 aRelationType,
                                nsIAccessibleRelation **aRelation);
 
   // nsAccessible
   virtual nsresult GetNameInternal(nsAString& aName);
-  virtual nsresult GetRoleInternal(PRUint32 *aRole);
+  virtual PRUint32 NativeRole();
   virtual nsresult GetStateInternal(PRUint32 *aState, PRUint32 *aExtraState);
 };
 
 /**
  * Used for XUL tooltip element.