Merge m-c -> cedar
authorJonathan Griffin <jgriffin@mozilla.com>
Tue, 27 Oct 2015 18:25:15 -0700
changeset 326856 9294941bdd4f4e47d90553174032810198b324ba
parent 326855 f91c57c9d31d6eb1486343adc61c001a5e9a3051 (current diff)
parent 303896 2b333a1d94e805a59c619ee41a6dec7fdcce505d (diff)
child 326857 681ae9e39d00d06e907b41475332dee7d9b8ff20
push id10169
push userdminor@mozilla.com
push dateThu, 28 Jan 2016 13:10:48 +0000
milestone44.0a1
Merge m-c -> cedar
CLOBBER
browser/components/extensions/test/browser/browser_ext_browserAction_icon.js
browser/components/loop/content/css/contacts.css
browser/components/loop/content/js/contacts.js
browser/components/loop/content/js/contacts.jsx
browser/components/loop/content/shared/img/empty_contacts.svg
browser/components/loop/modules/LoopCalls.jsm
browser/components/loop/test/desktop-local/contacts_test.js
browser/components/loop/test/mochitest/browser_mozLoop_pluralStrings.js
browser/components/loop/test/xpcshell/test_loopapi_hawk_request.js
browser/components/loop/test/xpcshell/test_loopservice_busy.js
browser/components/loop/test/xpcshell/test_loopservice_directcall.js
browser/components/loop/test/xpcshell/test_loopservice_notification.js
browser/locales/en-US/chrome/browser/devtools/app-manager.dtd
browser/locales/en-US/searchplugins/answers.xml
browser/locales/en-US/searchplugins/creativecommons.xml
browser/themes/windows/reload-stop-go-preWin10.png
browser/themes/windows/reload-stop-go-preWin10@2x.png
browser/themes/windows/urlbar-history-dropmarker-preWin10.png
browser/themes/windows/urlbar-history-dropmarker-preWin10@2x.png
devtools/client/app-manager/builtin-adb-store.js
devtools/client/app-manager/connection-store.js
devtools/client/app-manager/content/connection-footer.js
devtools/client/app-manager/content/connection-footer.xhtml
devtools/client/app-manager/content/device.js
devtools/client/app-manager/content/device.xhtml
devtools/client/app-manager/content/help.xhtml
devtools/client/app-manager/content/index.js
devtools/client/app-manager/content/index.xul
devtools/client/app-manager/content/manifest-editor.js
devtools/client/app-manager/content/projects.js
devtools/client/app-manager/content/projects.xhtml
devtools/client/app-manager/content/template.js
devtools/client/app-manager/content/utils.js
devtools/client/app-manager/device-store.js
devtools/client/app-manager/simulators-store.js
devtools/client/app-manager/test/browser.ini
devtools/client/app-manager/test/browser_manifest_editor.js
devtools/client/app-manager/test/chrome.ini
devtools/client/app-manager/test/head.js
devtools/client/app-manager/test/hosted_app.manifest
devtools/client/app-manager/test/manifest.webapp
devtools/client/app-manager/test/test_connection_store.html
devtools/client/app-manager/test/test_device_store.html
devtools/client/app-manager/test/test_projects_store.html
devtools/client/app-manager/test/test_remain_connected.html
devtools/client/app-manager/test/test_template.html
devtools/client/app-manager/webapps-store.js
devtools/client/inspector/test/browser_inspector_menu-05-other.js
devtools/client/jsonview/css/dark-theme.css
devtools/client/jsonview/css/light-theme.css
devtools/client/memory/controller.js
devtools/client/memory/reducers/snapshot.js
devtools/client/shared/Parser.jsm
devtools/client/shared/vendor/react-dev.js
devtools/client/themes/app-manager/connection-footer.css
devtools/client/themes/app-manager/device.css
devtools/client/themes/app-manager/help.css
devtools/client/themes/app-manager/images/add.svg
devtools/client/themes/app-manager/images/error.svg
devtools/client/themes/app-manager/images/index-icons.svg
devtools/client/themes/app-manager/images/plus.svg
devtools/client/themes/app-manager/images/remove.svg
devtools/client/themes/app-manager/images/warning.svg
devtools/client/themes/app-manager/index.css
devtools/client/themes/app-manager/manifest-editor.inc.css
devtools/client/themes/app-manager/projects.css
devtools/client/webide/test/chrome.ini
devtools/server/tests/mochitest/chrome.ini
devtools/shared/Console.jsm
devtools/shared/webconsole/test/chrome.ini
docshell/base/timeline/OTMTMarkerReceiver.h
dom/base/test/chrome.ini
dom/base/test/test_bug438519.html
dom/bindings/parser/tests/test_interface_maplikesetlike.py
dom/bluetooth/common/BluetoothCommon.h
dom/bluetooth/common/BluetoothInterface.cpp
dom/bluetooth/common/BluetoothInterface.h
dom/bluetooth/common/BluetoothUtils.cpp
dom/bluetooth/common/BluetoothUtils.h
dom/browser-element/mochitest/file_browserElement_LoadEvents.html
dom/imptests/failures/html/dom/nodes/test_Document-getElementsByTagName.html.json
dom/imptests/failures/html/dom/nodes/test_getElementsByClassName-10.xml.json
dom/push/PushService.jsm
dom/tests/mochitest/dom-level2-core/test_documenttypeinternalSubset01.html
dom/tests/mochitest/dom-level2-core/test_internalSubset01.html
dom/webidl/TestInterfaceJSMaplikeSetlike.webidl
dom/workers/test/WorkerDebugger.isFrozen_iframe1.html
dom/workers/test/WorkerDebugger.isFrozen_iframe2.html
dom/workers/test/WorkerDebugger.isFrozen_worker1.js
dom/workers/test/WorkerDebugger.isFrozen_worker2.js
dom/workers/test/chrome.ini
dom/workers/test/serviceworkers/fetch_event_client.js
dom/workers/test/serviceworkers/sw_clients/dummy.html
dom/workers/test/serviceworkers/test_fetch_event_client_postmessage.html
dom/workers/test/test_WorkerDebugger.isFrozen.xul
image/test/gtest/transparent.bmp
intl/locales/Makefile.in
js/src/jit-test/tests/auto-regress/bug475658.js
js/src/jit-test/tests/auto-regress/bug496251.js
js/src/jit-test/tests/basic/bug821470.js
js/src/jit-test/tests/basic/testBadLetBodyWithArguments.js
js/src/jit-test/tests/ion/inlining/TypedObject-TypeDescrIsArrayType-unknown.js
js/src/jit-test/tests/ion/inlining/TypedObject-TypeDescrIsArrayType.js
js/src/jit-test/tests/jaeger/chunk/bug712265.js
js/src/jit/mips-shared/Bailouts-mips-shared.h
js/src/tests/js1_7/block/browser.js
js/src/tests/js1_7/block/order-of-operation.js
js/src/tests/js1_7/block/regress-341939.js
js/src/tests/js1_7/block/regress-343765.js
js/src/tests/js1_7/block/regress-344139.js
js/src/tests/js1_7/block/regress-344370.js
js/src/tests/js1_7/block/regress-348685.js
js/src/tests/js1_7/block/regress-349283.js
js/src/tests/js1_7/block/regress-349298.js
js/src/tests/js1_7/block/regress-349507.js
js/src/tests/js1_7/block/regress-349962.js
js/src/tests/js1_7/block/regress-350279.js
js/src/tests/js1_7/block/regress-350730.js
js/src/tests/js1_7/block/regress-350793-01.js
js/src/tests/js1_7/block/regress-351606.js
js/src/tests/js1_7/block/regress-352092.js
js/src/tests/js1_7/block/regress-352267.js
js/src/tests/js1_7/block/regress-352422.js
js/src/tests/js1_7/block/regress-352609.js
js/src/tests/js1_7/block/regress-352624.js
js/src/tests/js1_7/block/regress-352786.js
js/src/tests/js1_7/block/regress-352907.js
js/src/tests/js1_7/block/regress-357754.js
js/src/tests/js1_7/block/regress-358508.js
js/src/tests/js1_7/block/regress-376410.js
js/src/tests/js1_7/block/regress-396900.js
js/src/tests/js1_7/block/shell.js
js/src/tests/js1_7/extensions/regress-349619.js
js/src/tests/js1_7/extensions/regress-366668-02.js
js/src/tests/js1_8_1/strict/let-block-eval-arguments.js
js/src/tests/js1_8_5/regress/regress-673070-1.js
js/src/tests/js1_8_5/regress/regress-673070-2.js
js/xpconnect/tests/chrome/chrome.ini
layout/base/nsRefreshDriver.cpp
layout/media/Makefile.in
layout/media/symbols.def.in
mfbt/nsRefPtr.h
mobile/android/base/LayoutInterceptor.java
mobile/android/base/OuterLayout.java
mobile/android/base/menu/MenuItemActionView.java
mobile/android/base/overlays/ui/OverlayToastHelper.java
mobile/android/base/resources/drawable-hdpi/firstrun_background_coffee.png
mobile/android/base/resources/drawable-hdpi/firstrun_background_devices.png
mobile/android/base/resources/drawable-xhdpi/firstrun_background_coffee.png
mobile/android/base/resources/drawable-xhdpi/firstrun_background_devices.png
mobile/android/base/resources/drawable-xxhdpi/firstrun_background_coffee.png
mobile/android/base/resources/drawable-xxhdpi/firstrun_background_devices.png
mobile/android/base/resources/layout-land/tabs_list_item_view.xml
mobile/android/base/resources/layout/menu_item_action_view.xml
mobile/android/base/resources/layout/tabs_panel_back_button.xml
mobile/android/base/sync/TabReceivedBroadcastReceiver.java
mobile/android/gradle/branding/AndroidManifest.xml
mobile/android/gradle/branding/build.gradle
mobile/android/gradle/preprocessed_code/AndroidManifest.xml
mobile/android/gradle/preprocessed_code/build.gradle
mobile/android/gradle/preprocessed_resources/AndroidManifest.xml
mobile/android/gradle/preprocessed_resources/build.gradle
mobile/android/gradle/thirdparty_adjust_sdk/AndroidManifest.xml
mobile/android/gradle/thirdparty_adjust_sdk/build.gradle
netwerk/protocol/websocket/WebSocketChannel.cpp
security/manager/pki/nsIPKIParamBlock.idl
security/manager/pki/nsPKIParamBlock.cpp
security/manager/pki/nsPKIParamBlock.h
security/manager/ssl/IntolerantFallbackList.inc
security/manager/tools/genIntolerantFallbackList.js
security/nss/tests/ssl_gtests/ssl_gtests.sh
services/sync/tests/unit/test_block_sync.js
services/sync/tests/unit/test_fxa_migration_sentinel.js
services/sync/tests/unit/test_healthreport_migration.js
testing/docker/desktop-test/bin/entrypoint
testing/docker/desktop-test/bin/pull_gaia.sh
testing/docker/desktop-test/mozharness_configs/emulator_override.py
testing/docker/desktop-test/mozharness_configs/gaia_integration_override.py
testing/docker/desktop-test/mozharness_configs/remove_executables.py
testing/docker/phone-builder/bin/validate_task.py
testing/docker/phone-builder/tests/public.yml
testing/mochitest/runtests.py
testing/mozharness/configs/android/androidarm_4_3.py
testing/mozharness/mozharness/mozilla/testing/firefox_media_tests.py
testing/mozharness/mozharness/mozilla/testing/testbase.py
testing/taskcluster/scripts/phone-builder/build-dolphin.sh
testing/taskcluster/scripts/phone-builder/build-phone-ota.sh
testing/taskcluster/scripts/phone-builder/build-phone.sh
testing/taskcluster/scripts/phone-builder/post-build.sh
testing/taskcluster/scripts/phone-builder/pre-build.sh
testing/web-platform/meta/MANIFEST.json
testing/web-platform/meta/XMLHttpRequest/XMLHttpRequest-withCredentials.html.ini
testing/web-platform/meta/XMLHttpRequest/XMLHttpRequest-withCredentials.worker.js.ini
testing/web-platform/meta/XMLHttpRequest/send-content-type-charset.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-content-type-string.htm.ini
testing/web-platform/meta/XMLHttpRequest/send-entity-body-document.htm.ini
testing/web-platform/meta/content-security-policy/blink-contrib/shared-worker-connect-src-allowed.sub.html.ini
testing/web-platform/meta/cors/redirect-userinfo.htm.ini
testing/web-platform/meta/dom/nodes/Document-getElementsByTagName.html.ini
testing/web-platform/meta/dom/nodes/Document-getElementsByTagName.xhtml.ini
testing/web-platform/meta/dom/nodes/Element-getElementsByTagName.html.ini
testing/web-platform/meta/dom/nodes/case.html.ini
testing/web-platform/meta/dom/ranges/Range-deleteContents.html.ini
testing/web-platform/meta/dom/ranges/Range-extractContents.html.ini
testing/web-platform/meta/fetch/nosniff/image.html.ini
testing/web-platform/meta/html/editing/dnd/the-draggable-attribute/draggable_attribute.html.ini
testing/web-platform/meta/html/infrastructure/common-dom-interfaces/collections/htmloptionscollection.html.ini
testing/web-platform/meta/html/semantics/embedded-content/the-img-element/relevant-mutations.html.ini
testing/web-platform/meta/microdata/microdata-dom-api/001.html.ini
testing/web-platform/meta/quirks-mode/percentage-height-calculation.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-add.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-delete.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-put.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-storage-keys.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-storage-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/serviceworker/cache-storage.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/window/cache-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/window/cache-put.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/window/cache-storage-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-add.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-delete.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-put.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-storage-keys.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-storage-match.https.html.ini
testing/web-platform/meta/service-workers/cache-storage/worker/cache-storage.https.html.ini
testing/web-platform/meta/url/a-element.xhtml.ini
testing/web-platform/meta/webvtt/rendering/cues-with-video/processing-model/align_middle_position_lt_50.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-canvas-tainting.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-cors-xhr.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-after-navigation-within-page.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event-network-error.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-event.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-html-imports.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/fetch-request-xhr.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/invalid-blobtype.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/referer.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/request-end-to-end.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/resources/fetch-request-resources-iframe.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/resources/fetch-request-xhr-iframe.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/resources/fetch-response-xhr-iframe.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/resources/invalid-blobtype-iframe.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/resources/invalid-header-iframe.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/stashed-ports.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/sync-xhr-doesnt-deadlock.https.html.ini
testing/web-platform/mozilla/meta/service-workers/service-worker/synced-state.https.html.ini
testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-html-imports.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-html-imports-iframe.sub.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-html-imports-worker.sub.js
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/stashed-ports-basics.js
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/sync-xhr-doesnt-deadlock-iframe.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/sync-xhr-doesnt-deadlock.data
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/sync-xhr-doesnt-deadlock.js
testing/web-platform/mozilla/tests/service-workers/service-worker/stashed-ports.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/sync-xhr-doesnt-deadlock.https.html
testing/web-platform/tests/html/semantics/forms/textfieldselection/selection.html
testing/web-platform/tests/microdata/microdata-dom-api/.gitkeep
testing/web-platform/tests/microdata/microdata-dom-api/001.html
testing/web-platform/tests/microdata/microdata-dom-api/htmlpropertiescollection/.gitkeep
testing/web-platform/tests/subresource-integrity/subresource-integrity.html
toolkit/components/extensions/ext-bookmarks.js
toolkit/themes/linux/global/alerts/notification-48.png
toolkit/themes/osx/global/alerts/notification-48.png
toolkit/themes/osx/global/notification/critical-bar-background.png
toolkit/themes/osx/global/notification/info-bar-background.png
toolkit/themes/osx/global/notification/warning-bar-background.png
toolkit/themes/windows/global/alerts/notification-48.png
webapprt/RemoteDebugger.jsm
webapprt/content/dbg-webapp-actors.js
webapprt/test/chrome/browser_debugger.js
widget/tests/chrome.ini
xpcom/glue/Logging.h
xpcom/tests/TestAtoms.cpp
--- a/.gitignore
+++ b/.gitignore
@@ -69,8 +69,20 @@ GPATH
 # Git clone directory for updating web-platform-tests
 testing/web-platform/sync/
 
 # Android Gradle artifacts.
 mobile/android/gradle/.gradle
 
 # Ignore node_modules from eslint-plugin-mozilla
 testing/eslint-plugin-mozilla/node_modules/
+
+# Ignore talos virtualenv and tp5n files.
+# The tp5n set is supposed to be decompressed at
+# testing/talos/talos/page_load_test/tp5n in order to run tests like tps
+# locally. Similarly, running talos requires a Python package virtual
+# environment. Both the virtual environment and tp5n files end up littering
+# the status command, so we ignore them.
+testing/talos/.Python
+testing/talos/bin/
+testing/talos/include/
+testing/talos/lib/
+testing/talos/talos/page_load_test/tp5n/
--- a/.hgignore
+++ b/.hgignore
@@ -47,18 +47,22 @@
 # SVN directories
 \.svn/
 
 # Ignore the files and directory that Eclipse IDE creates
 \.project$
 \.cproject$
 \.settings/
 
-# Ignore the directory that JetBrains IDEs create
+# Ignore the files and directory that JetBrains IDEs create.
 \.idea/
+\.iml$
+
+# Gradle cache.
+^.gradle/
 
 # Python stuff installed at build time.
 ^python/psutil/.*\.so
 ^python/psutil/.*\.pyd
 ^python/psutil/build/
 
 # Git repositories
 .git/
@@ -91,8 +95,20 @@ GPATH
 ^embedding/ios/GeckoEmbed/GeckoEmbed.xcodeproj/xcuserdata
 
 # Ignore mozharness execution files
 ^testing/mozharness/logs/
 ^testing/mozharness/build/
 
 # Ignore node_modules from eslint-plugin-mozilla
 ^testing/eslint-plugin-mozilla/node_modules/
+
+# Ignore talos virtualenv and tp5n files.
+# The tp5n set is supposed to be decompressed at
+# testing/talos/talos/page_load_test/tp5n in order to run tests like tps
+# locally. Similarly, running talos requires a Python package virtual
+# environment. Both the virtual environment and tp5n files end up littering
+# the status command, so we ignore them.
+^testing/talos/.Python
+^testing/talos/bin/
+^testing/talos/include/
+^testing/talos/lib/
+^testing/talos/talos/page_load_test/tp5n/
--- a/CLOBBER
+++ b/CLOBBER
@@ -17,9 +17,9 @@
 #
 # Modifying this file will now automatically clobber the buildbot machines \o/
 #
 
 # Are you updating CLOBBER because you think it's needed for your WebIDL
 # changes to stick? As of bug 928195, this shouldn't be necessary! Please
 # don't change CLOBBER for WebIDL changes any more.
 
-Bug 1182727 - Update the clang toolchain
+Bug 1217261 - Update mp4parse to v0.1.2
--- a/accessible/atk/AccessibleWrap.cpp
+++ b/accessible/atk/AccessibleWrap.cpp
@@ -1466,16 +1466,20 @@ a11y::ProxyEvent(ProxyAccessible* aTarge
     atk_focus_tracker_notify(wrapper); // fire extra focus event
     atk_object_notify_state_change(wrapper, ATK_STATE_VISIBLE, true);
     atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, true);
     break;
   case nsIAccessibleEvent::EVENT_MENUPOPUP_END:
     atk_object_notify_state_change(wrapper, ATK_STATE_VISIBLE, false);
     atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, false);
     break;
+  case nsIAccessibleEvent::EVENT_ALERT:
+    // A hack using state change showing events as alert events.
+    atk_object_notify_state_change(wrapper, ATK_STATE_SHOWING, true);
+    break;
   }
 }
 
 void
 a11y::ProxyStateChangeEvent(ProxyAccessible* aTarget, uint64_t aState,
                             bool aEnabled)
 {
   MaiAtkObject* atkObj = MAI_ATK_OBJECT(GetWrapperFor(aTarget));
--- a/accessible/atk/nsMaiInterfaceText.cpp
+++ b/accessible/atk/nsMaiInterfaceText.cpp
@@ -581,19 +581,18 @@ setCaretOffsetCB(AtkText *aText, gint aO
       return FALSE;
     }
 
     text->SetCaretOffset(aOffset);
     return TRUE;
   }
 
   if (ProxyAccessible* proxy = GetProxy(ATK_OBJECT(aText))) {
-    if (proxy->SetCaretOffset(aOffset)) {
-      return TRUE;
-    }
+    proxy->SetCaretOffset(aOffset);
+    return TRUE;
   }
 
   return FALSE;
 }
 }
 
 void
 textInterfaceInitCB(AtkTextIface* aIface)
--- a/accessible/base/AccCollector.cpp
+++ b/accessible/base/AccCollector.cpp
@@ -97,21 +97,23 @@ AccCollector::AppendObject(Accessible* a
 ////////////////////////////////////////////////////////////////////////////////
 
 int32_t
 EmbeddedObjCollector::GetIndexAt(Accessible* aAccessible)
 {
   if (aAccessible->mParent != mRoot)
     return -1;
 
-  if (aAccessible->mIndexOfEmbeddedChild != -1)
-    return aAccessible->mIndexOfEmbeddedChild;
+  MOZ_ASSERT(!aAccessible->IsProxy());
+  if (aAccessible->mInt.mIndexOfEmbeddedChild != -1)
+    return aAccessible->mInt.mIndexOfEmbeddedChild;
 
   return mFilterFunc(aAccessible) & filters::eMatch ?
     EnsureNGetIndex(aAccessible) : -1;
 }
 
 void
 EmbeddedObjCollector::AppendObject(Accessible* aAccessible)
 {
-  aAccessible->mIndexOfEmbeddedChild = mObjects.Length();
+  MOZ_ASSERT(!aAccessible->IsProxy());
+  aAccessible->mInt.mIndexOfEmbeddedChild = mObjects.Length();
   mObjects.AppendElement(aAccessible);
 }
--- a/accessible/base/AccEvent.h
+++ b/accessible/base/AccEvent.h
@@ -122,17 +122,17 @@ public:
   NS_DECL_CYCLE_COLLECTION_NATIVE_CLASS(AccEvent)
 
 protected:
   virtual ~AccEvent() {}
 
   bool mIsFromUserInput;
   uint32_t mEventType;
   EEventRule mEventRule;
-  nsRefPtr<Accessible> mAccessible;
+  RefPtr<Accessible> mAccessible;
 
   friend class EventQueue;
   friend class AccReorderEvent;
 };
 
 
 /**
  * Accessible state change event.
@@ -232,18 +232,18 @@ public:
   // MutationEvent
   bool IsShow() const { return mEventType == nsIAccessibleEvent::EVENT_SHOW; }
   bool IsHide() const { return mEventType == nsIAccessibleEvent::EVENT_HIDE; }
 
   Accessible* Parent() const { return mParent; }
 
 protected:
   nsCOMPtr<nsINode> mNode;
-  nsRefPtr<Accessible> mParent;
-  nsRefPtr<AccTextChangeEvent> mTextChangeEvent;
+  RefPtr<Accessible> mParent;
+  RefPtr<AccTextChangeEvent> mTextChangeEvent;
 
   friend class EventQueue;
 };
 
 
 /**
  * Accessible hide event.
  */
@@ -263,18 +263,18 @@ public:
   // AccHideEvent
   Accessible* TargetParent() const { return mParent; }
   Accessible* TargetNextSibling() const { return mNextSibling; }
   Accessible* TargetPrevSibling() const { return mPrevSibling; }
   bool NeedsShutdown() const { return mNeedsShutdown; }
 
 protected:
   bool mNeedsShutdown;
-  nsRefPtr<Accessible> mNextSibling;
-  nsRefPtr<Accessible> mPrevSibling;
+  RefPtr<Accessible> mNextSibling;
+  RefPtr<Accessible> mPrevSibling;
 
   friend class EventQueue;
 };
 
 
 /**
  * Accessible show event.
  */
@@ -392,17 +392,17 @@ public:
   // AccTextSelChangeEvent
 
   /**
    * Return true if the text selection change wasn't caused by pure caret move.
    */
   bool IsCaretMoveOnly() const;
 
 private:
-  nsRefPtr<dom::Selection> mSel;
+  RefPtr<dom::Selection> mSel;
   int32_t mReason;
 
   friend class EventQueue;
   friend class SelectionManager;
 };
 
 
 /**
@@ -427,18 +427,18 @@ public:
   {
     return AccEvent::GetEventGroups() | (1U << eSelectionChangeEvent);
   }
 
   // AccSelChangeEvent
   Accessible* Widget() const { return mWidget; }
 
 private:
-  nsRefPtr<Accessible> mWidget;
-  nsRefPtr<Accessible> mItem;
+  RefPtr<Accessible> mWidget;
+  RefPtr<Accessible> mItem;
   SelChangeType mSelChangeType;
   uint32_t mPreceedingCount;
   AccSelChangeEvent* mPackedEvent;
 
   friend class EventQueue;
 };
 
 
@@ -490,17 +490,17 @@ public:
 
   // AccTableChangeEvent
   Accessible* OldAccessible() const { return mOldAccessible; }
   int32_t OldStartOffset() const { return mOldStart; }
   int32_t OldEndOffset() const { return mOldEnd; }
   int32_t Reason() const { return mReason; }
 
 private:
-  nsRefPtr<Accessible> mOldAccessible;
+  RefPtr<Accessible> mOldAccessible;
   int32_t mOldStart;
   int32_t mOldEnd;
   int16_t mReason;
 };
 
 /**
  * Accessible object attribute changed event.
  */
--- a/accessible/base/AccIterator.cpp
+++ b/accessible/base/AccIterator.cpp
@@ -389,17 +389,17 @@ ARIAOwnsIterator::Next()
 
 ////////////////////////////////////////////////////////////////////////////////
 // SingleAccIterator
 ////////////////////////////////////////////////////////////////////////////////
 
 Accessible*
 SingleAccIterator::Next()
 {
-  nsRefPtr<Accessible> nextAcc;
+  RefPtr<Accessible> nextAcc;
   mAcc.swap(nextAcc);
   if (!nextAcc || nextAcc->IsDefunct()) {
     return nullptr;
   }
   return nextAcc;
 }
 
 
--- a/accessible/base/AccIterator.h
+++ b/accessible/base/AccIterator.h
@@ -301,17 +301,17 @@ public:
 
   virtual Accessible* Next() override;
 
 private:
   SingleAccIterator();
   SingleAccIterator(const SingleAccIterator&);
   SingleAccIterator& operator = (const SingleAccIterator&);
 
-  nsRefPtr<Accessible> mAcc;
+  RefPtr<Accessible> mAcc;
 };
 
 
 /**
  * Used to iterate items of the given item container.
  */
 class ItemIterator : public AccIterable
 {
--- a/accessible/base/DocManager.cpp
+++ b/accessible/base/DocManager.cpp
@@ -1,9 +1,10 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "DocManager.h"
 
 #include "ApplicationAccessible.h"
 #include "ARIAMap.h"
@@ -66,23 +67,29 @@ DocManager::GetDocAccessible(nsIDocument
     return docAcc;
 
   return CreateDocOrRootAccessible(aDocument);
 }
 
 Accessible*
 DocManager::FindAccessibleInCache(nsINode* aNode) const
 {
-  nsSearchAccessibleInCacheArg arg;
-  arg.mNode = aNode;
+  for (auto iter = mDocAccessibleCache.ConstIter(); !iter.Done(); iter.Next()) {
+    DocAccessible* docAccessible = iter.UserData();
+    NS_ASSERTION(docAccessible,
+                 "No doc accessible for the object in doc accessible cache!");
 
-  mDocAccessibleCache.EnumerateRead(SearchAccessibleInDocCache,
-                                    static_cast<void*>(&arg));
-
-  return arg.mAccessible;
+    if (docAccessible) {
+      Accessible* accessible = docAccessible->GetAccessible(aNode);
+      if (accessible) {
+        return accessible;
+      }
+    }
+  }
+  return nullptr;
 }
 
 void
 DocManager::NotifyOfDocumentShutdown(DocAccessible* aDocument,
                                      nsIDocument* aDOMDocument)
 {
   xpcAccessibleDocument* xpcDoc = mXPCDocumentCache.GetWeak(aDocument);
   if (xpcDoc) {
@@ -107,21 +114,27 @@ DocManager::GetXPCDocument(DocAccessible
   }
   return xpcDoc;
 }
 
 #ifdef DEBUG
 bool
 DocManager::IsProcessingRefreshDriverNotification() const
 {
-  bool isDocRefreshing = false;
-  mDocAccessibleCache.EnumerateRead(SearchIfDocIsRefreshing,
-                                    static_cast<void*>(&isDocRefreshing));
+  for (auto iter = mDocAccessibleCache.ConstIter(); !iter.Done(); iter.Next()) {
+    DocAccessible* docAccessible = iter.UserData();
+    NS_ASSERTION(docAccessible,
+                 "No doc accessible for the object in doc accessible cache!");
 
-  return isDocRefreshing;
+    if (docAccessible && docAccessible->mNotificationController &&
+        docAccessible->mNotificationController->IsUpdating()) {
+      return true;
+    }
+  }
+  return false;
 }
 #endif
 
 
 ////////////////////////////////////////////////////////////////////////////////
 // DocManager protected
 
 bool
@@ -172,21 +185,21 @@ DocManager::OnStateChange(nsIWebProgress
   if (nsAccessibilityService::IsShutdown() || !aWebProgress ||
       (aStateFlags & (STATE_START | STATE_STOP)) == 0)
     return NS_OK;
 
   nsCOMPtr<nsIDOMWindow> DOMWindow;
   aWebProgress->GetDOMWindow(getter_AddRefs(DOMWindow));
   NS_ENSURE_STATE(DOMWindow);
 
-  nsCOMPtr<nsIDOMDocument> DOMDocument;
-  DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
-  NS_ENSURE_STATE(DOMDocument);
+  nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(DOMWindow);
+  MOZ_ASSERT(piWindow);
 
-  nsCOMPtr<nsIDocument> document(do_QueryInterface(DOMDocument));
+  nsCOMPtr<nsIDocument> document = piWindow->GetDoc();
+  NS_ENSURE_STATE(document);
 
   // Document was loaded.
   if (aStateFlags & STATE_STOP) {
 #ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eDocLoad))
       logging::DocLoad("document loaded", aWebProgress, aRequest, aStateFlags);
 #endif
 
@@ -422,17 +435,17 @@ DocManager::CreateDocOrRootAccessible(ns
                  "Can't create an accessible for the document!");
     if (!parentDocAcc)
       return nullptr;
   }
 
   // We only create root accessibles for the true root, otherwise create a
   // doc accessible.
   nsIContent *rootElm = nsCoreUtils::GetRoleContent(aDocument);
-  nsRefPtr<DocAccessible> docAcc = isRootDoc ?
+  RefPtr<DocAccessible> docAcc = isRootDoc ?
     new RootAccessibleWrap(aDocument, rootElm, presShell) :
     new DocAccessibleWrap(aDocument, rootElm, presShell);
 
   // Cache the document accessible into document cache.
   mDocAccessibleCache.Put(aDocument, docAcc);
 
   // Initialize the document accessible.
   docAcc->Init();
@@ -483,76 +496,34 @@ DocManager::CreateDocOrRootAccessible(ns
 
   AddListeners(aDocument, isRootDoc);
   return docAcc;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // DocManager static
 
-PLDHashOperator
-DocManager::GetFirstEntryInDocCache(const nsIDocument* aKey,
-                                    DocAccessible* aDocAccessible,
-                                    void* aUserArg)
-{
-  NS_ASSERTION(aDocAccessible,
-               "No doc accessible for the object in doc accessible cache!");
-  *reinterpret_cast<DocAccessible**>(aUserArg) = aDocAccessible;
-
-  return PL_DHASH_STOP;
-}
-
 void
 DocManager::ClearDocCache()
 {
-  DocAccessible* docAcc = nullptr;
-  while (mDocAccessibleCache.EnumerateRead(GetFirstEntryInDocCache, static_cast<void*>(&docAcc))) {
-    if (docAcc)
+  // This unusual do-one-element-per-iterator approach is required because each
+  // DocAccessible is removed elsewhere upon its Shutdown() method being
+  // called, which invalidates the existing iterator.
+  while (mDocAccessibleCache.Count() > 0) {
+    auto iter = mDocAccessibleCache.Iter();
+    MOZ_ASSERT(!iter.Done());
+    DocAccessible* docAcc = iter.UserData();
+    NS_ASSERTION(docAcc,
+                 "No doc accessible for the object in doc accessible cache!");
+    if (docAcc) {
       docAcc->Shutdown();
+    }
   }
 }
 
-PLDHashOperator
-DocManager::SearchAccessibleInDocCache(const nsIDocument* aKey,
-                                       DocAccessible* aDocAccessible,
-                                       void* aUserArg)
-{
-  NS_ASSERTION(aDocAccessible,
-               "No doc accessible for the object in doc accessible cache!");
-
-  if (aDocAccessible) {
-    nsSearchAccessibleInCacheArg* arg =
-      static_cast<nsSearchAccessibleInCacheArg*>(aUserArg);
-    arg->mAccessible = aDocAccessible->GetAccessible(arg->mNode);
-    if (arg->mAccessible)
-      return PL_DHASH_STOP;
-  }
-
-  return PL_DHASH_NEXT;
-}
-
-#ifdef DEBUG
-PLDHashOperator
-DocManager::SearchIfDocIsRefreshing(const nsIDocument* aKey,
-                                    DocAccessible* aDocAccessible,
-                                    void* aUserArg)
-{
-  NS_ASSERTION(aDocAccessible,
-               "No doc accessible for the object in doc accessible cache!");
-
-  if (aDocAccessible && aDocAccessible->mNotificationController &&
-      aDocAccessible->mNotificationController->IsUpdating()) {
-    *(static_cast<bool*>(aUserArg)) = true;
-    return PL_DHASH_STOP;
-  }
-
-  return PL_DHASH_NEXT;
-}
-#endif
-
 void
 DocManager::RemoteDocAdded(DocAccessibleParent* aDoc)
 {
   if (!sRemoteDocuments) {
     sRemoteDocuments = new nsTArray<DocAccessibleParent*>;
     ClearOnShutdown(&sRemoteDocuments);
   }
 
--- a/accessible/base/DocManager.h
+++ b/accessible/base/DocManager.h
@@ -131,45 +131,20 @@ private:
   void RemoveListeners(nsIDocument* aDocument);
 
   /**
    * Create document or root accessible.
    */
   DocAccessible* CreateDocOrRootAccessible(nsIDocument* aDocument);
 
   /**
-   * Get first entry of the document accessible from cache.
-   */
-  static PLDHashOperator
-    GetFirstEntryInDocCache(const nsIDocument* aKey,
-                            DocAccessible* aDocAccessible,
-                            void* aUserArg);
-
-  /**
    * Clear the cache and shutdown the document accessibles.
    */
   void ClearDocCache();
 
-  struct nsSearchAccessibleInCacheArg
-  {
-    Accessible* mAccessible;
-    nsINode* mNode;
-  };
-
-  static PLDHashOperator
-    SearchAccessibleInDocCache(const nsIDocument* aKey,
-                               DocAccessible* aDocAccessible,
-                               void* aUserArg);
-
-#ifdef DEBUG
-  static PLDHashOperator
-    SearchIfDocIsRefreshing(const nsIDocument* aKey,
-                            DocAccessible* aDocAccessible, void* aUserArg);
-#endif
-
   typedef nsRefPtrHashtable<nsPtrHashKey<const nsIDocument>, DocAccessible>
     DocAccessibleHashtable;
   DocAccessibleHashtable mDocAccessibleCache;
 
   typedef nsRefPtrHashtable<nsPtrHashKey<const DocAccessible>, xpcAccessibleDocument>
     XPCDocumentHashtable;
   XPCDocumentHashtable mXPCDocumentCache;
 
--- a/accessible/base/EventQueue.cpp
+++ b/accessible/base/EventQueue.cpp
@@ -56,17 +56,17 @@ EventQueue::PushEvent(AccEvent* aEvent)
     while (parent &&
            nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeIfReqRule)) {
       // Test possible name dependent parent.
       if (nsTextEquivUtils::HasNameRule(parent, eNameFromSubtreeRule)) {
         nsAutoString name;
         ENameValueFlag nameFlag = parent->Name(name);
         // If name is obtained from subtree, fire name change event.
         if (nameFlag == eNameFromSubtree) {
-          nsRefPtr<AccEvent> nameChangeEvent =
+          RefPtr<AccEvent> nameChangeEvent =
             new AccEvent(nsIAccessibleEvent::EVENT_NAME_CHANGE, parent);
           PushEvent(nameChangeEvent);
         }
         break;
       }
       parent = parent->Parent();
     }
   }
@@ -477,17 +477,17 @@ EventQueue::CreateTextChangeEventFor(Acc
 
 ////////////////////////////////////////////////////////////////////////////////
 // EventQueue: event queue
 
 void
 EventQueue::ProcessEventQueue()
 {
   // Process only currently queued events.
-  nsTArray<nsRefPtr<AccEvent> > events;
+  nsTArray<RefPtr<AccEvent> > events;
   events.SwapElements(mEvents);
 
   uint32_t eventCount = events.Length();
 #ifdef A11Y_LOG
   if (eventCount > 0 && logging::IsEnabled(logging::eEvents)) {
     logging::MsgBegin("EVENTS", "events processing");
     logging::Address("document", mDocument);
     logging::MsgEnd();
--- a/accessible/base/EventQueue.h
+++ b/accessible/base/EventQueue.h
@@ -74,15 +74,15 @@ protected:
    * The document accessible reference owning this queue.
    */
   DocAccessible* mDocument;
 
   /**
    * Pending events array. Don't make this an nsAutoTArray; we use
    * SwapElements() on it.
    */
-  nsTArray<nsRefPtr<AccEvent> > mEvents;
+  nsTArray<RefPtr<AccEvent> > mEvents;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif // mozilla_a11y_EventQueue_h_
--- a/accessible/base/FocusManager.cpp
+++ b/accessible/base/FocusManager.cpp
@@ -213,17 +213,17 @@ FocusManager::ForceFocusEvent()
 }
 
 void
 FocusManager::DispatchFocusEvent(DocAccessible* aDocument,
                                  Accessible* aTarget)
 {
   NS_PRECONDITION(aDocument, "No document for focused accessible!");
   if (aDocument) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, aTarget,
                    eAutoDetect, AccEvent::eCoalesceOfSameType);
     aDocument->FireDelayedEvent(event);
 
 #ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::FocusDispatched(aTarget);
 #endif
@@ -326,35 +326,35 @@ FocusManager::ProcessFocusEvent(AccEvent
 
       parent = ARIAOwnedByIterator(child).Next();
       tryOwnsParent = false;
     }
 
     if (ARIAMenubar != mActiveARIAMenubar) {
       // Leaving ARIA menu. Fire menu_end event on current menubar.
       if (mActiveARIAMenubar) {
-        nsRefPtr<AccEvent> menuEndEvent =
+        RefPtr<AccEvent> menuEndEvent =
           new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
                        aEvent->FromUserInput());
         nsEventShell::FireEvent(menuEndEvent);
       }
 
       mActiveARIAMenubar = ARIAMenubar;
 
       // Entering ARIA menu. Fire menu_start event.
       if (mActiveARIAMenubar) {
-        nsRefPtr<AccEvent> menuStartEvent =
+        RefPtr<AccEvent> menuStartEvent =
           new AccEvent(nsIAccessibleEvent::EVENT_MENU_START,
                        mActiveARIAMenubar, aEvent->FromUserInput());
         nsEventShell::FireEvent(menuStartEvent);
       }
     }
   } else if (mActiveARIAMenubar) {
     // Focus left a menu. Fire menu_end event.
-    nsRefPtr<AccEvent> menuEndEvent =
+    RefPtr<AccEvent> menuEndEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_MENU_END, mActiveARIAMenubar,
                    aEvent->FromUserInput());
     nsEventShell::FireEvent(menuEndEvent);
 
     mActiveARIAMenubar = nullptr;
   }
 
 #ifdef A11Y_LOG
@@ -362,17 +362,17 @@ FocusManager::ProcessFocusEvent(AccEvent
     logging::FocusNotificationTarget("fire focus event", "Target", target);
 #endif
 
   // Reset cached caret value. The cache will be updated upon processing the
   // next caret move event. This ensures that we will return the correct caret
   // offset before the caret move event is handled.
   SelectionMgr()->ResetCaretOffset();
 
-  nsRefPtr<AccEvent> focusEvent =
+  RefPtr<AccEvent> focusEvent =
     new AccEvent(nsIAccessibleEvent::EVENT_FOCUS, target, aEvent->FromUserInput());
   nsEventShell::FireEvent(focusEvent);
 
   // Fire scrolling_start event when the document receives the focus if it has
   // an anchor jump. If an accessible within the document receive the focus
   // then null out the anchor jump because it no longer applies.
   DocAccessible* targetDocument = target->Document();
   Accessible* anchorJump = targetDocument->AnchorJump();
--- a/accessible/base/FocusManager.h
+++ b/accessible/base/FocusManager.h
@@ -119,16 +119,16 @@ private:
   nsINode* FocusedDOMNode() const;
 
   /**
    * Return DOM document having DOM focus.
    */
   nsIDocument* FocusedDOMDocument() const;
 
 private:
-  nsRefPtr<Accessible> mActiveItem;
-  nsRefPtr<Accessible> mActiveARIAMenubar;
+  RefPtr<Accessible> mActiveItem;
+  RefPtr<Accessible> mActiveARIAMenubar;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/base/NotificationController.cpp
+++ b/accessible/base/NotificationController.cpp
@@ -96,17 +96,17 @@ NotificationController::ScheduleChildDoc
   ScheduleProcessing();
 }
 
 void
 NotificationController::ScheduleContentInsertion(Accessible* aContainer,
                                                  nsIContent* aStartChildNode,
                                                  nsIContent* aEndChildNode)
 {
-  nsRefPtr<ContentInsertion> insertion = new ContentInsertion(mDocument,
+  RefPtr<ContentInsertion> insertion = new ContentInsertion(mDocument,
                                                               aContainer);
   if (insertion && insertion->InitChildList(aStartChildNode, aEndChildNode) &&
       mContentInsertions.AppendElement(insertion)) {
     ScheduleProcessing();
   }
 }
 
 void
@@ -188,17 +188,17 @@ NotificationController::WillRefresh(mozi
   // notifications are queued during this processing then they will be processed
   // on next refresh. If notification processing queues up new events then they
   // are processed in this refresh. If events processing queues up new events
   // then new events are processed on next refresh.
   // Note: notification processing or event handling may shut down the owning
   // document accessible.
 
   // Process only currently queued content inserted notifications.
-  nsTArray<nsRefPtr<ContentInsertion> > contentInsertions;
+  nsTArray<RefPtr<ContentInsertion> > contentInsertions;
   contentInsertions.SwapElements(mContentInsertions);
 
   uint32_t insertionCount = contentInsertions.Length();
   for (uint32_t idx = 0; idx < insertionCount; idx++) {
     contentInsertions[idx]->Process();
     if (!mDocument)
       return;
   }
@@ -286,17 +286,17 @@ NotificationController::WillRefresh(mozi
         mDocument->ProcessContentInserted(container, &insertedContents);
       }
     }
   }
   mTextHash.Clear();
 
   // Bind hanging child documents.
   uint32_t hangingDocCnt = mHangingChildDocuments.Length();
-  nsTArray<nsRefPtr<DocAccessible>> newChildDocs;
+  nsTArray<RefPtr<DocAccessible>> newChildDocs;
   for (uint32_t idx = 0; idx < hangingDocCnt; idx++) {
     DocAccessible* childDoc = mHangingChildDocuments[idx];
     if (childDoc->IsDefunct())
       continue;
 
     nsIContent* ownerContent = mDocument->DocumentNode()->
       FindContentForSubDocument(childDoc->DocumentNode());
     if (ownerContent) {
@@ -332,17 +332,17 @@ NotificationController::WillRefresh(mozi
     if (childDocIdx == childDocCnt) {
       mDocument->ProcessLoad();
       if (!mDocument)
         return;
     }
   }
 
   // Process only currently queued generic notifications.
-  nsTArray < nsRefPtr<Notification> > notifications;
+  nsTArray < RefPtr<Notification> > notifications;
   notifications.SwapElements(mNotifications);
 
   uint32_t notificationCount = notifications.Length();
   for (uint32_t idx = 0; idx < notificationCount; idx++) {
     notifications[idx]->Process();
     if (!mDocument)
       return;
   }
--- a/accessible/base/NotificationController.h
+++ b/accessible/base/NotificationController.h
@@ -76,17 +76,17 @@ private:
   template <size_t... Indices>
     void ProcessHelper(IndexSequence<Indices...>)
   {
      (mInstance->*mCallback)(Get<Indices>(mArgs)...);
   }
 
   Class* mInstance;
   Callback mCallback;
-  Tuple<nsRefPtr<Args> ...> mArgs;
+  Tuple<RefPtr<Args> ...> mArgs;
 };
 
 /**
  * Used to process notifications from core for the document accessible.
  */
 class NotificationController final : public EventQueue,
                                      public nsARefreshObserver
 {
@@ -156,33 +156,33 @@ public:
 #ifdef A11Y_LOG
       if (mozilla::a11y::logging::IsEnabled(mozilla::a11y::logging::eNotifications))
         mozilla::a11y::logging::Text("sync notification processing");
 #endif
       (aInstance->*aMethod)(aArg);
       return;
     }
 
-    nsRefPtr<Notification> notification =
+    RefPtr<Notification> notification =
       new TNotification<Class, Arg>(aInstance, aMethod, aArg);
     if (notification && mNotifications.AppendElement(notification))
       ScheduleProcessing();
   }
 
   /**
    * Schedule the generic notification to process asynchronously.
    *
    * @note  The caller must guarantee that the given instance still exists when
    *        the notification is processed.
    */
   template<class Class>
   inline void ScheduleNotification(Class* aInstance,
                                    typename TNotification<Class>::Callback aMethod)
   {
-    nsRefPtr<Notification> notification =
+    RefPtr<Notification> notification =
       new TNotification<Class>(aInstance, aMethod);
     if (notification && mNotifications.AppendElement(notification))
       ScheduleProcessing();
   }
 
 #ifdef DEBUG
   bool IsUpdating() const
     { return mObservingState == eRefreshProcessingForUpdate; }
@@ -222,17 +222,17 @@ private:
   /**
    * The presshell of the document accessible.
    */
   nsIPresShell* mPresShell;
 
   /**
    * Child documents that needs to be bound to the tree.
    */
-  nsTArray<nsRefPtr<DocAccessible> > mHangingChildDocuments;
+  nsTArray<RefPtr<DocAccessible> > mHangingChildDocuments;
 
   /**
    * Storage for content inserted notification information.
    */
   class ContentInsertion
   {
   public:
     ContentInsertion(DocAccessible* aDocument, Accessible* aContainer);
@@ -252,27 +252,27 @@ private:
     ContentInsertion& operator = (const ContentInsertion&);
 
     // The document used to process content insertion, matched to document of
     // the notification controller that this notification belongs to, therefore
     // it's ok to keep it as weak ref.
     DocAccessible* mDocument;
 
     // The container accessible that content insertion occurs within.
-    nsRefPtr<Accessible> mContainer;
+    RefPtr<Accessible> mContainer;
 
     // Array of inserted contents.
     nsTArray<nsCOMPtr<nsIContent> > mInsertedContent;
   };
 
   /**
    * A pending accessible tree update notifications for content insertions.
    * Don't make this an nsAutoTArray; we use SwapElements() on it.
    */
-  nsTArray<nsRefPtr<ContentInsertion> > mContentInsertions;
+  nsTArray<RefPtr<ContentInsertion> > mContentInsertions;
 
   template<class T>
   class nsCOMPtrHashKey : public PLDHashEntryHdr
   {
   public:
     typedef T* KeyType;
     typedef const T* KeyTypePointer;
 
@@ -297,15 +297,15 @@ private:
    * A pending accessible tree update notifications for rendered text changes.
    */
   nsTHashtable<nsCOMPtrHashKey<nsIContent> > mTextHash;
 
   /**
    * Other notifications like DOM events. Don't make this an nsAutoTArray; we
    * use SwapElements() on it.
    */
-  nsTArray<nsRefPtr<Notification> > mNotifications;
+  nsTArray<RefPtr<Notification> > mNotifications;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif // mozilla_a11y_NotificationController_h_
--- a/accessible/base/SelectionManager.cpp
+++ b/accessible/base/SelectionManager.cpp
@@ -24,17 +24,17 @@ using namespace mozilla;
 using namespace mozilla::a11y;
 using mozilla::dom::Selection;
 
 struct mozilla::a11y::SelData final
 {
   SelData(Selection* aSel, int32_t aReason) :
     mSel(aSel), mReason(aReason) {}
 
-  nsRefPtr<Selection> mSel;
+  RefPtr<Selection> mSel;
   int16_t mReason;
 
   NS_INLINE_DECL_REFCOUNTING(SelData)
 
 private:
   // Private destructor, to discourage deletion outside of Release():
   ~SelData() {}
 };
@@ -159,17 +159,17 @@ SelectionManager::ProcessTextSelChangeEv
   // event->mSel is correct.
   if (!selection)
     selection = event->mSel;
 
   mCaretOffset = caretCntr->DOMPointToOffset(selection->GetFocusNode(),
                                              selection->FocusOffset());
   mAccWithCaret = caretCntr;
   if (mCaretOffset != -1) {
-    nsRefPtr<AccCaretMoveEvent> caretMoveEvent =
+    RefPtr<AccCaretMoveEvent> caretMoveEvent =
       new AccCaretMoveEvent(caretCntr, mCaretOffset, aEvent->FromUserInput());
     nsEventShell::FireEvent(caretMoveEvent);
   }
 }
 
 NS_IMETHODIMP
 SelectionManager::NotifySelectionChanged(nsIDOMDocument* aDOMDocument,
                                          nsISelection* aSelection,
@@ -184,17 +184,17 @@ SelectionManager::NotifySelectionChanged
   if (logging::IsEnabled(logging::eSelection))
     logging::SelChange(aSelection, document, aReason);
 #endif
 
   if (document) {
     // Selection manager has longer lifetime than any document accessible,
     // so that we are guaranteed that the notification is processed before
     // the selection manager is destroyed.
-    nsRefPtr<SelData> selData =
+    RefPtr<SelData> selData =
       new SelData(static_cast<Selection*>(aSelection), aReason);
     document->HandleNotification<SelectionManager, SelData>
       (this, &SelectionManager::ProcessSelectionChanged, selData);
   }
 
   return NS_OK;
 }
 
@@ -221,17 +221,17 @@ SelectionManager::ProcessSelectionChange
 
   HyperTextAccessible* text = nsAccUtils::GetTextContainer(cntrNode);
   if (!text) {
     NS_NOTREACHED("We must reach document accessible implementing text interface!");
     return;
   }
 
   if (selection->GetType() == nsISelectionController::SELECTION_NORMAL) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccTextSelChangeEvent(text, selection, aSelData->mReason);
     text->Document()->FireDelayedEvent(event);
 
   } else if (selection->GetType() == nsISelectionController::SELECTION_SPELLCHECK) {
     // XXX: fire an event for container accessible of the focus/anchor range
     // of the spelcheck selection.
     text->Document()->FireDelayedEvent(nsIAccessibleEvent::EVENT_TEXT_ATTRIBUTE_CHANGED,
                                        text);
--- a/accessible/base/StyleInfo.h
+++ b/accessible/base/StyleInfo.h
@@ -34,15 +34,15 @@ public:
 private:
   StyleInfo() = delete;
   StyleInfo(const StyleInfo&) = delete;
   StyleInfo& operator = (const StyleInfo&) = delete;
 
   void Margin(Side aSide, nsAString& aValue);
 
   dom::Element* mElement;
-  nsRefPtr<nsStyleContext> mStyleContext;
+  RefPtr<nsStyleContext> mStyleContext;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/base/TextAttrs.cpp
+++ b/accessible/base/TextAttrs.cpp
@@ -455,17 +455,17 @@ TextAttrsMgr::FontFamilyTextAttr::
 {
   nsAccUtils::SetAccAttr(aAttributes, nsGkAtoms::font_family, aValue);
 }
 
 bool
 TextAttrsMgr::FontFamilyTextAttr::
   GetFontFamily(nsIFrame* aFrame, nsString& aFamily)
 {
-  nsRefPtr<nsFontMetrics> fm;
+  RefPtr<nsFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
 
   gfxFontGroup* fontGroup = fm->GetThebesFontGroup();
   gfxFont* font = fontGroup->GetFirstValidFont();
   gfxFontEntry* fontEntry = font->GetFontEntry();
   aFamily = fontEntry->FamilyName();
   return true;
 }
@@ -613,17 +613,17 @@ TextAttrsMgr::FontWeightTextAttr::
 }
 
 int32_t
 TextAttrsMgr::FontWeightTextAttr::
   GetFontWeight(nsIFrame* aFrame)
 {
   // nsFont::width isn't suitable here because it's necessary to expose real
   // value of font weight (used font might not have some font weight values).
-  nsRefPtr<nsFontMetrics> fm;
+  RefPtr<nsFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(aFrame, getter_AddRefs(fm));
 
   gfxFontGroup *fontGroup = fm->GetThebesFontGroup();
   gfxFont *font = fontGroup->GetFirstValidFont();
 
   // When there doesn't exist a bold font in the family and so the rendering of
   // a non-bold font face is changed so that the user sees what looks like a
   // bold font, i.e. synthetic bolding is used. IsSyntheticBold method is only
--- a/accessible/base/TextRange.h
+++ b/accessible/base/TextRange.h
@@ -238,19 +238,19 @@ private:
   bool TextInternal(nsAString& aText, Accessible* aCurrent,
                     uint32_t aStartIntlOffset) const;
 
   void MoveInternal(ETextUnit aUnit, int32_t aCount,
                     HyperTextAccessible& aContainer, int32_t aOffset,
                     HyperTextAccessible* aStopContainer = nullptr,
                     int32_t aStopOffset = 0);
 
-  nsRefPtr<HyperTextAccessible> mRoot;
-  nsRefPtr<HyperTextAccessible> mStartContainer;
-  nsRefPtr<HyperTextAccessible> mEndContainer;
+  RefPtr<HyperTextAccessible> mRoot;
+  RefPtr<HyperTextAccessible> mStartContainer;
+  RefPtr<HyperTextAccessible> mEndContainer;
   int32_t mStartOffset;
   int32_t mEndOffset;
 };
 
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/base/TextUpdater.cpp
+++ b/accessible/base/TextUpdater.cpp
@@ -76,24 +76,24 @@ TextUpdater::DoUpdate(const nsAString& a
 
   // It could be single insertion or removal or the case of long strings. Do not
   // calculate the difference between long strings and prefer to fire pair of
   // insert/remove events as the old string was replaced on the new one.
   if (strLen1 == 0 || strLen2 == 0 ||
       strLen1 > kMaxStrLen || strLen2 > kMaxStrLen) {
     if (strLen1 > 0) {
       // Fire text change event for removal.
-      nsRefPtr<AccEvent> textRemoveEvent =
+      RefPtr<AccEvent> textRemoveEvent =
         new AccTextChangeEvent(mHyperText, mTextOffset, str1, false);
       mDocument->FireDelayedEvent(textRemoveEvent);
     }
 
     if (strLen2 > 0) {
       // Fire text change event for insertion.
-      nsRefPtr<AccEvent> textInsertEvent =
+      RefPtr<AccEvent> textInsertEvent =
         new AccTextChangeEvent(mHyperText, mTextOffset, str2, true);
       mDocument->FireDelayedEvent(textInsertEvent);
     }
 
     mDocument->MaybeNotifyOfValueChange(mHyperText);
 
     // Update the text.
     mTextLeaf->SetText(aNewText);
@@ -124,17 +124,17 @@ TextUpdater::DoUpdate(const nsAString& a
         row[colIdx] = std::min(upleft, std::min(left, up)) + 1;
       } else {
         row[colIdx] = prevRow[colIdx - 1];
       }
     }
   }
 
   // Compute events based on the difference.
-  nsTArray<nsRefPtr<AccEvent> > events;
+  nsTArray<RefPtr<AccEvent> > events;
   ComputeTextChangeEvents(str1, str2, entries, events);
 
   delete [] entries;
 
   // Fire events.
   for (int32_t idx = events.Length() - 1; idx >= 0; idx--)
     mDocument->FireDelayedEvent(events[idx]);
 
@@ -143,17 +143,17 @@ TextUpdater::DoUpdate(const nsAString& a
   // Update the text.
   mTextLeaf->SetText(aNewText);
 }
 
 void
 TextUpdater::ComputeTextChangeEvents(const nsAString& aStr1,
                                      const nsAString& aStr2,
                                      uint32_t* aEntries,
-                                     nsTArray<nsRefPtr<AccEvent> >& aEvents)
+                                     nsTArray<RefPtr<AccEvent> >& aEvents)
 {
   int32_t colIdx = aStr1.Length(), rowIdx = aStr2.Length();
 
   // Point at which strings last matched.
   int32_t colEnd = colIdx;
   int32_t rowEnd = rowIdx;
 
   int32_t colLen = colEnd + 1;
--- a/accessible/base/TextUpdater.h
+++ b/accessible/base/TextUpdater.h
@@ -46,37 +46,37 @@ private:
   TextUpdater& operator=(const TextUpdater&);
 
   /**
    * Fire text change events based on difference between strings.
    */
   void ComputeTextChangeEvents(const nsAString& aStr1,
                                const nsAString& aStr2,
                                uint32_t* aEntries,
-                               nsTArray<nsRefPtr<AccEvent> >& aEvents);
+                               nsTArray<RefPtr<AccEvent> >& aEvents);
 
   /**
    * Helper to create text change events for inserted text.
    */
   inline void FireInsertEvent(const nsAString& aText, uint32_t aAddlOffset,
-                              nsTArray<nsRefPtr<AccEvent> >& aEvents)
+                              nsTArray<RefPtr<AccEvent> >& aEvents)
   {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccTextChangeEvent(mHyperText, mTextOffset + aAddlOffset,
                              aText, true);
     aEvents.AppendElement(event);
   }
 
   /**
    * Helper to create text change events for removed text.
    */
   inline void FireDeleteEvent(const nsAString& aText, uint32_t aAddlOffset,
-                              nsTArray<nsRefPtr<AccEvent> >& aEvents)
+                              nsTArray<RefPtr<AccEvent> >& aEvents)
   {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccTextChangeEvent(mHyperText, mTextOffset + aAddlOffset,
                              aText, false);
     aEvents.AppendElement(event);
   }
 
   /**
    * The constant used to skip string difference calculation in case of long
    * strings.
--- a/accessible/base/nsAccCache.h
+++ b/accessible/base/nsAccCache.h
@@ -12,28 +12,28 @@
 // Accessible cache utils
 ////////////////////////////////////////////////////////////////////////////////
 
 /**
  * Shutdown and removes the accessible from cache.
  */
 template <class T>
 static PLDHashOperator
-ClearCacheEntry(const void* aKey, nsRefPtr<T>& aAccessible, void* aUserArg)
+ClearCacheEntry(const void* aKey, RefPtr<T>& aAccessible, void* aUserArg)
 {
   NS_ASSERTION(aAccessible, "Calling ClearCacheEntry with a nullptr pointer!");
   if (aAccessible && !aAccessible->IsDefunct())
     aAccessible->Shutdown();
 
   return PL_DHASH_REMOVE;
 }
 
 template <class T>
 static PLDHashOperator
-UnbindCacheEntryFromDocument(const void* aKey, nsRefPtr<T>& aAccessible,
+UnbindCacheEntryFromDocument(const void* aKey, RefPtr<T>& aAccessible,
                              void* aUserArg)
 {
   MOZ_ASSERT(aAccessible && !aAccessible->IsDefunct());
   aAccessible->Document()->UnbindFromDocument(aAccessible);
 
   return PL_DHASH_REMOVE;
 }
 
--- a/accessible/base/nsAccessibilityService.cpp
+++ b/accessible/base/nsAccessibilityService.cpp
@@ -451,57 +451,57 @@ nsAccessibilityService::CreatePluginAcce
                                                Accessible* aContext)
 {
   // nsPluginFrame means a plugin, so we need to use the accessibility support
   // of the plugin.
   if (aFrame->GetRect().IsEmpty())
     return nullptr;
 
 #if defined(XP_WIN) || defined(MOZ_ACCESSIBILITY_ATK)
-  nsRefPtr<nsNPAPIPluginInstance> pluginInstance;
+  RefPtr<nsNPAPIPluginInstance> pluginInstance;
   if (NS_SUCCEEDED(aFrame->GetPluginInstance(getter_AddRefs(pluginInstance))) &&
       pluginInstance) {
 #ifdef XP_WIN
     if (!sPendingPlugins->Contains(aContent) &&
         (Preferences::GetBool("accessibility.delay_plugins") ||
          Compatibility::IsJAWS() || Compatibility::IsWE())) {
       nsCOMPtr<nsITimer> timer = do_CreateInstance(NS_TIMER_CONTRACTID);
-      nsRefPtr<PluginTimerCallBack> cb = new PluginTimerCallBack(aContent);
+      RefPtr<PluginTimerCallBack> cb = new PluginTimerCallBack(aContent);
       timer->InitWithCallback(cb, Preferences::GetUint("accessibility.delay_plugin_time"),
                               nsITimer::TYPE_ONE_SHOT);
       sPluginTimers->AppendElement(timer);
       sPendingPlugins->AppendElement(aContent);
       return nullptr;
     }
 
     // We need to remove aContent from the pending plugins here to avoid
     // reentrancy.  When the timer fires it calls
     // DocAccessible::ContentInserted() which does the work async.
     sPendingPlugins->RemoveElement(aContent);
 
     // Note: pluginPort will be null if windowless.
     HWND pluginPort = nullptr;
     aFrame->GetPluginPort(&pluginPort);
 
-    nsRefPtr<Accessible> accessible =
+    RefPtr<Accessible> accessible =
       new HTMLWin32ObjectOwnerAccessible(aContent, aContext->Document(),
                                          pluginPort);
     return accessible.forget();
 
 #elif MOZ_ACCESSIBILITY_ATK
     if (!AtkSocketAccessible::gCanEmbed)
       return nullptr;
 
     // Note this calls into the plugin, so crazy things may happen and aFrame
     // may go away.
     nsCString plugId;
     nsresult rv = pluginInstance->GetValueFromPlugin(
       NPPVpluginNativeAccessibleAtkPlugId, &plugId);
     if (NS_SUCCEEDED(rv) && !plugId.IsEmpty()) {
-      nsRefPtr<AtkSocketAccessible> socketAccessible =
+      RefPtr<AtkSocketAccessible> socketAccessible =
         new AtkSocketAccessible(aContent, aContext->Document(), plugId);
 
       return socketAccessible.forget();
     }
 #endif
   }
 #endif
 
@@ -782,17 +782,17 @@ nsAccessibilityService::GetStringRole(ui
 
 #undef ROLE
 }
 
 NS_IMETHODIMP
 nsAccessibilityService::GetStringStates(uint32_t aState, uint32_t aExtraState,
                                         nsISupports **aStringStates)
 {
-  nsRefPtr<DOMStringList> stringStates = new DOMStringList();
+  RefPtr<DOMStringList> stringStates = new DOMStringList();
 
   uint64_t state = nsAccUtils::To64State(aState, aExtraState);
 
   // states
   if (state & states::UNAVAILABLE)
     stringStates->Add(NS_LITERAL_STRING("unavailable"));
   if (state & states::SELECTED)
     stringStates->Add(NS_LITERAL_STRING("selected"));
@@ -1082,17 +1082,17 @@ nsAccessibilityService::GetOrCreateAcces
 
 #ifdef DEBUG
   nsImageFrame* imageFrame = do_QueryFrame(frame);
   NS_ASSERTION(!imageFrame || !content->IsHTMLElement(nsGkAtoms::area),
                "Image map manages the area accessible creation!");
 #endif
 
   // Attempt to create an accessible based on what we know.
-  nsRefPtr<Accessible> newAcc;
+  RefPtr<Accessible> newAcc;
 
   // Create accessible for visible text frames.
   if (content->IsNodeOfType(nsINode::eTEXT)) {
     nsAutoString text;
     frame->GetRenderedText(&text, nullptr, nullptr, 0, UINT32_MAX);
     // Ignore not rendered text nodes and whitespace text nodes between table
     // cells.
     if (text.IsEmpty() ||
@@ -1419,21 +1419,21 @@ nsAccessibilityService::CreateAccessible
     if (!role.IsEmpty())
       break;
   }
 
   if (role.IsEmpty() || role.EqualsLiteral("none"))
     return nullptr;
 
   if (role.EqualsLiteral("outerdoc")) {
-    nsRefPtr<Accessible> accessible = new OuterDocAccessible(aContent, aDoc);
+    RefPtr<Accessible> accessible = new OuterDocAccessible(aContent, aDoc);
     return accessible.forget();
   }
 
-  nsRefPtr<Accessible> accessible;
+  RefPtr<Accessible> accessible;
 #ifdef MOZ_XUL
   // XUL controls
   if (role.EqualsLiteral("xul:alert")) {
     accessible = new XULAlertAccessible(aContent, aDoc);
 
   } else if (role.EqualsLiteral("xul:button")) {
     accessible = new XULButtonAccessible(aContent, aDoc);
 
@@ -1595,17 +1595,17 @@ nsAccessibilityService::CreateAccessible
 
 already_AddRefed<Accessible>
 nsAccessibilityService::CreateAccessibleByFrameType(nsIFrame* aFrame,
                                                     nsIContent* aContent,
                                                     Accessible* aContext)
 {
   DocAccessible* document = aContext->Document();
 
-  nsRefPtr<Accessible> newAcc;
+  RefPtr<Accessible> newAcc;
   switch (aFrame->AccessibleType()) {
     case eNoType:
       return nullptr;
     case eHTMLBRType:
       newAcc = new HTMLBRAccessible(aContent, document);
       break;
     case eHTMLButtonType:
       newAcc = new HTMLButtonAccessible(aContent, document);
@@ -1657,17 +1657,20 @@ nsAccessibilityService::CreateAccessible
       break;
     case eHTMLRangeType:
       newAcc = new HTMLRangeAccessible(aContent, document);
       break;
     case eHTMLSpinnerType:
       newAcc = new HTMLSpinnerAccessible(aContent, document);
       break;
     case eHTMLTableType:
-      newAcc = new HTMLTableAccessibleWrap(aContent, document);
+      if (aContent->IsHTMLElement(nsGkAtoms::table))
+        newAcc = new HTMLTableAccessibleWrap(aContent, document);
+      else
+        newAcc = new HyperTextAccessibleWrap(aContent, document);
       break;
     case eHTMLTableCellType:
       // Accessible HTML table cell should be a child of accessible HTML table
       // or its row (CSS HTML tables are polite to the used markup at
       // certain degree).
       // Otherwise create a generic text accessible to avoid text jamming
       // when reading by AT.
       if (aContext->IsHTMLTableRow() || aContext->IsHTMLTable())
@@ -1822,17 +1825,17 @@ NS_GetAccessibilityService(nsIAccessibil
   NS_ENSURE_TRUE(aResult, NS_ERROR_NULL_POINTER);
   *aResult = nullptr;
 
   if (nsAccessibilityService::gAccessibilityService) {
     NS_ADDREF(*aResult = nsAccessibilityService::gAccessibilityService);
     return NS_OK;
   }
 
-  nsRefPtr<nsAccessibilityService> service = new nsAccessibilityService();
+  RefPtr<nsAccessibilityService> service = new nsAccessibilityService();
   NS_ENSURE_TRUE(service, NS_ERROR_OUT_OF_MEMORY);
 
   if (!service->Init()) {
     service->Shutdown();
     return NS_ERROR_FAILURE;
   }
 
   statistics::A11yInitialized();
@@ -1855,29 +1858,29 @@ nsAccessibilityService::CreateAccessible
                                                       nsGkAtoms::treechildren);
   if (!child)
     return nullptr;
 
   nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
   if (!treeFrame)
     return nullptr;
 
-  nsRefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
+  RefPtr<nsTreeColumns> treeCols = treeFrame->Columns();
   int32_t count = 0;
   treeCols->GetCount(&count);
 
   // Outline of list accessible.
   if (count == 1) {
-    nsRefPtr<Accessible> accessible =
+    RefPtr<Accessible> accessible =
       new XULTreeAccessible(aContent, aDoc, treeFrame);
     return accessible.forget();
   }
 
   // Table or tree table accessible.
-  nsRefPtr<Accessible> accessible =
+  RefPtr<Accessible> accessible =
     new XULTreeGridAccessibleWrap(aContent, aDoc, treeFrame);
   return accessible.forget();
 }
 #endif
 
 ////////////////////////////////////////////////////////////////////////////////
 // Services
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/base/nsAccessiblePivot.cpp
+++ b/accessible/base/nsAccessiblePivot.cpp
@@ -84,17 +84,17 @@ nsAccessiblePivot::GetPosition(nsIAccess
   NS_IF_ADDREF(*aPosition = ToXPC(mPosition));
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 nsAccessiblePivot::SetPosition(nsIAccessible* aPosition)
 {
-  nsRefPtr<Accessible> position = nullptr;
+  RefPtr<Accessible> position = nullptr;
 
   if (aPosition) {
     position = aPosition->ToInternalAccessible();
     if (!position || !IsDescendantOf(position, GetActiveRoot()))
       return NS_ERROR_INVALID_ARG;
   }
 
   // Swap old position with new position, saves us an AddRef/Release.
@@ -163,17 +163,17 @@ nsAccessiblePivot::SetTextRange(nsIAcces
   // smaller than 0, both should be -1.
   NS_ENSURE_TRUE(aStartOffset <= aEndOffset &&
                  (aStartOffset >= 0 || (aStartOffset != -1 && aEndOffset != -1)),
                  NS_ERROR_INVALID_ARG);
 
   nsCOMPtr<nsIAccessible> xpcAcc = do_QueryInterface(aTextAccessible);
   NS_ENSURE_ARG(xpcAcc);
 
-  nsRefPtr<Accessible> acc = xpcAcc->ToInternalAccessible();
+  RefPtr<Accessible> acc = xpcAcc->ToInternalAccessible();
   NS_ENSURE_ARG(acc);
 
   HyperTextAccessible* position = acc->AsHyperText();
   if (!position || !IsDescendantOf(position, GetActiveRoot()))
     return NS_ERROR_INVALID_ARG;
 
   // Make sure the given offsets don't exceed the character count.
   if (aEndOffset > static_cast<int32_t>(position->CharacterCount()))
@@ -638,17 +638,17 @@ nsAccessiblePivot::IsDescendantOf(Access
   return false;
 }
 
 bool
 nsAccessiblePivot::MovePivotInternal(Accessible* aPosition,
                                      PivotMoveReason aReason,
                                      bool aIsFromUserInput)
 {
-  nsRefPtr<Accessible> oldPosition = mPosition.forget();
+  RefPtr<Accessible> oldPosition = mPosition.forget();
   mPosition = aPosition;
   int32_t oldStart = mStartOffset, oldEnd = mEndOffset;
   mStartOffset = mEndOffset = -1;
 
   return NotifyOfPivotChange(oldPosition, oldStart, oldEnd, aReason,
                              aIsFromUserInput);
 }
 
--- a/accessible/base/nsAccessiblePivot.h
+++ b/accessible/base/nsAccessiblePivot.h
@@ -109,27 +109,27 @@ private:
    *
    */
   Accessible* AdjustStartPosition(Accessible* aAccessible, RuleCache& aCache,
                                   uint16_t* aFilterResult, nsresult* aResult);
 
   /*
    * The root accessible.
    */
-  nsRefPtr<Accessible> mRoot;
+  RefPtr<Accessible> mRoot;
 
   /*
    * The temporary modal root accessible.
    */
-  nsRefPtr<Accessible> mModalRoot;
+  RefPtr<Accessible> mModalRoot;
 
   /*
    * The current pivot position.
    */
-  nsRefPtr<Accessible> mPosition;
+  RefPtr<Accessible> mPosition;
 
   /*
    * The text start offset ofthe pivot.
    */
   int32_t mStartOffset;
 
   /*
    * The text end offset ofthe pivot.
--- a/accessible/base/nsCoreUtils.cpp
+++ b/accessible/base/nsCoreUtils.cpp
@@ -97,17 +97,17 @@ nsCoreUtils::DispatchClickEvent(nsITreeB
   // Dispatch mouse events.
   nsWeakFrame tcFrame = tcContent->GetPrimaryFrame();
   nsIFrame* rootFrame = presShell->GetRootFrame();
 
   nsPoint offset;
   nsIWidget *rootWidget =
     rootFrame->GetViewExternal()->GetNearestWidget(&offset);
 
-  nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
+  RefPtr<nsPresContext> presContext = presShell->GetPresContext();
 
   int32_t cnvdX = presContext->CSSPixelsToDevPixels(tcX + x + 1) +
     presContext->AppUnitsToDevPixels(offset.x);
   int32_t cnvdY = presContext->CSSPixelsToDevPixels(tcY + y + 1) +
     presContext->AppUnitsToDevPixels(offset.y);
 
   // XUL is just desktop, so there is no real reason for senfing touch events.
   DispatchMouseEvent(eMouseDown, cnvdX, cnvdY,
@@ -144,17 +144,17 @@ nsCoreUtils::DispatchTouchEvent(EventMes
   if (!dom::TouchEvent::PrefEnabled())
     return;
 
   WidgetTouchEvent event(true, aMessage, aRootWidget);
 
   event.time = PR_IntervalNow();
 
   // XXX: Touch has an identifier of -1 to hint that it is synthesized.
-  nsRefPtr<dom::Touch> t = new dom::Touch(-1, LayoutDeviceIntPoint(aX, aY),
+  RefPtr<dom::Touch> t = new dom::Touch(-1, LayoutDeviceIntPoint(aX, aY),
                                           nsIntPoint(1, 1), 0.0f, 1.0f);
   t->SetTarget(aContent);
   event.touches.AppendElement(t);
   nsEventStatus status = nsEventStatus_eIgnore;
   aPresShell->HandleEventWithTarget(&event, aFrame, aContent, &status);
 }
 
 uint32_t
--- a/accessible/base/nsEventShell.cpp
+++ b/accessible/base/nsEventShell.cpp
@@ -37,17 +37,17 @@ nsEventShell::FireEvent(AccEvent* aEvent
 }
 
 void
 nsEventShell::FireEvent(uint32_t aEventType, Accessible* aAccessible,
                         EIsFromUserInput aIsFromUserInput)
 {
   NS_ENSURE_TRUE_VOID(aAccessible);
 
-  nsRefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
+  RefPtr<AccEvent> event = new AccEvent(aEventType, aAccessible,
                                           aIsFromUserInput);
 
   FireEvent(event);
 }
 
 void 
 nsEventShell::GetEventAttributes(nsINode *aNode,
                                  nsIPersistentProperties *aAttributes)
--- a/accessible/base/nsEventShell.h
+++ b/accessible/base/nsEventShell.h
@@ -36,17 +36,17 @@ public:
                         mozilla::a11y::EIsFromUserInput aIsFromUserInput = mozilla::a11y::eAutoDetect);
 
   /**
    * Fire state change event.
    */
   static void FireEvent(mozilla::a11y::Accessible* aTarget, uint64_t aState,
                         bool aIsEnabled, bool aIsFromUserInput)
   {
-    nsRefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent =
+    RefPtr<mozilla::a11y::AccStateChangeEvent> stateChangeEvent =
       new mozilla::a11y::AccStateChangeEvent(aTarget, aState, aIsEnabled,
                                              (aIsFromUserInput ?
                                                mozilla::a11y::eFromUserInput :
                                                mozilla::a11y::eNoUserInput));
     FireEvent(stateChangeEvent);
   }
 
   /**
--- a/accessible/generic/Accessible.cpp
+++ b/accessible/generic/Accessible.cpp
@@ -102,19 +102,20 @@ NS_INTERFACE_MAP_END
 
 NS_IMPL_CYCLE_COLLECTING_ADDREF(Accessible)
 NS_IMPL_CYCLE_COLLECTING_RELEASE_WITH_DESTROY(Accessible, LastRelease())
 
 Accessible::Accessible(nsIContent* aContent, DocAccessible* aDoc) :
   mContent(aContent), mDoc(aDoc),
   mParent(nullptr), mIndexInParent(-1), mChildrenFlags(eChildrenUninitialized),
   mStateFlags(0), mContextFlags(0), mType(0), mGenericTypes(0),
-  mIndexOfEmbeddedChild(-1), mRoleMapEntry(nullptr)
+  mRoleMapEntry(nullptr)
 {
   mBits.groupInfo = nullptr;
+  mInt.mIndexOfEmbeddedChild = -1;
 }
 
 Accessible::~Accessible()
 {
   NS_ASSERTION(!mDoc, "LastRelease was never called!?!");
 }
 
 ENameValueFlag
@@ -1781,17 +1782,17 @@ Accessible::DoCommand(nsIContent *aConte
 
     void Revoke()
     {
       mAcc = nullptr;
       mContent = nullptr;
     }
 
   private:
-    nsRefPtr<Accessible> mAcc;
+    RefPtr<Accessible> mAcc;
     nsCOMPtr<nsIContent> mContent;
     uint32_t mIdx;
   };
 
   nsIContent* content = aContent ? aContent : mContent.get();
   nsCOMPtr<nsIRunnable> runnable = new Runnable(this, content, aActionIndex);
   NS_DispatchToMainThread(runnable);
 }
@@ -1817,17 +1818,17 @@ Accessible::DispatchClickEvent(nsIConten
   // Compute x and y coordinates.
   nsPoint point;
   nsCOMPtr<nsIWidget> widget = frame->GetNearestWidget(point);
   if (!widget)
     return;
 
   nsSize size = frame->GetSize();
 
-  nsRefPtr<nsPresContext> presContext = presShell->GetPresContext();
+  RefPtr<nsPresContext> presContext = presShell->GetPresContext();
   int32_t x = presContext->AppUnitsToDevPixels(point.x + size.width / 2);
   int32_t y = presContext->AppUnitsToDevPixels(point.y + size.height / 2);
 
   // Simulate a touch interaction by dispatching touch events with mouse events.
   nsCoreUtils::DispatchTouchEvent(eTouchStart, x, y, aContent, frame,
                                   presShell, widget);
   nsCoreUtils::DispatchMouseEvent(eMouseDown, x, y, aContent, frame,
                                   presShell, widget);
@@ -1996,17 +1997,17 @@ Accessible::BindToParent(Accessible* aPa
 void
 Accessible::UnbindFromParent()
 {
 #ifdef DEBUG
   AssertInMutatingSubtree();
 #endif
   mParent = nullptr;
   mIndexInParent = -1;
-  mIndexOfEmbeddedChild = -1;
+  mInt.mIndexOfEmbeddedChild = -1;
   if (IsProxy())
     MOZ_CRASH("this should never be called on proxy wrappers");
 
   delete mBits.groupInfo;
   mBits.groupInfo = nullptr;
   mContextFlags &= ~eHasNameDependentParent;
 }
 
--- a/accessible/generic/Accessible.h
+++ b/accessible/generic/Accessible.h
@@ -529,21 +529,16 @@ public:
   virtual nsRect RelativeBounds(nsIFrame** aRelativeFrame) const;
 
   /**
    * Selects the accessible within its container if applicable.
    */
   virtual void SetSelected(bool aSelect);
 
   /**
-   * Extend selection to this accessible.
-   */
-  void ExtendSelection() { };
-
-  /**
    * Select the accessible within its container.
    */
   void TakeSelection();
 
   /**
    * Focus the accessible.
    */
   virtual void TakeFocus();
@@ -618,16 +613,26 @@ public:
   bool IsMenuPopup() const { return mType == eMenuPopupType; }
 
   bool IsProxy() const { return mType == eProxyType; }
   ProxyAccessible* Proxy() const
   {
     MOZ_ASSERT(IsProxy());
     return mBits.proxy;
   }
+  uint32_t ProxyInterfaces() const
+  {
+    MOZ_ASSERT(IsProxy());
+    return mInt.mProxyInterfaces;
+  }
+  void SetProxyInterfaces(uint32_t aInterfaces)
+  {
+    MOZ_ASSERT(IsProxy());
+    mInt.mProxyInterfaces = aInterfaces;
+  }
 
   bool IsOuterDoc() const { return mType == eOuterDocType; }
   OuterDocAccessible* AsOuterDoc();
 
   bool IsProgress() const { return mType == eProgressType; }
 
   bool IsRoot() const { return mType == eRootType; }
   a11y::RootAccessible* AsRoot();
@@ -1111,18 +1116,18 @@ protected:
    * Flag all children group info as needing to be updated.
    */
   void InvalidateChildrenGroupInfo();
 
   // Data Members
   nsCOMPtr<nsIContent> mContent;
   DocAccessible* mDoc;
 
-  nsRefPtr<Accessible> mParent;
-  nsTArray<nsRefPtr<Accessible> > mChildren;
+  RefPtr<Accessible> mParent;
+  nsTArray<RefPtr<Accessible> > mChildren;
   int32_t mIndexInParent;
 
   static const uint8_t kChildrenFlagsBits = 2;
   static const uint8_t kStateFlagsBits = 10;
   static const uint8_t kContextFlagsBits = 2;
   static const uint8_t kTypeBits = 6;
   static const uint8_t kGenericTypesBits = 14;
 
@@ -1138,17 +1143,21 @@ protected:
   void StaticAsserts() const;
   void AssertInMutatingSubtree() const;
 
   friend class DocAccessible;
   friend class xpcAccessible;
   friend class AutoTreeMutation;
 
   nsAutoPtr<mozilla::a11y::EmbeddedObjCollector> mEmbeddedObjCollector;
-  int32_t mIndexOfEmbeddedChild;
+  union {
+    int32_t mIndexOfEmbeddedChild;
+    uint32_t mProxyInterfaces;
+  } mInt;
+
   friend class EmbeddedObjCollector;
 
   union
   {
     AccGroupInfo* groupInfo;
     ProxyAccessible* proxy;
   } mBits;
   friend class AccGroupInfo;
--- a/accessible/generic/ApplicationAccessible.cpp
+++ b/accessible/generic/ApplicationAccessible.cpp
@@ -1,10 +1,10 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/* vim:expandtab:shiftwidth=4:tabstop=4:
+/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim:expandtab:shiftwidth=2:tabstop=2:
  */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "ApplicationAccessible.h"
 
 #include "nsAccessibilityService.h"
@@ -188,22 +188,20 @@ ApplicationAccessible::CacheChildren()
   if (NS_FAILED(rv))
     return;
 
   bool hasMore = false;
   windowEnumerator->HasMoreElements(&hasMore);
   while (hasMore) {
     nsCOMPtr<nsISupports> window;
     windowEnumerator->GetNext(getter_AddRefs(window));
-    nsCOMPtr<nsIDOMWindow> DOMWindow = do_QueryInterface(window);
+    nsCOMPtr<nsPIDOMWindow> DOMWindow = do_QueryInterface(window);
     if (DOMWindow) {
-      nsCOMPtr<nsIDOMDocument> DOMDocument;
-      DOMWindow->GetDocument(getter_AddRefs(DOMDocument));
-      if (DOMDocument) {
-        nsCOMPtr<nsIDocument> docNode(do_QueryInterface(DOMDocument));
+      nsCOMPtr<nsIDocument> docNode = DOMWindow->GetDoc();
+      if (docNode) {
         GetAccService()->GetDocAccessible(docNode); // ensure creation
       }
     }
     windowEnumerator->HasMoreElements(&hasMore);
   }
 }
 
 Accessible*
--- a/accessible/generic/DocAccessible-inl.h
+++ b/accessible/generic/DocAccessible-inl.h
@@ -40,17 +40,17 @@ DocAccessible::FireDelayedEvent(AccEvent
 #endif
 
   mNotificationController->QueueEvent(aEvent);
 }
 
 inline void
 DocAccessible::FireDelayedEvent(uint32_t aEventType, Accessible* aTarget)
 {
-  nsRefPtr<AccEvent> event = new AccEvent(aEventType, aTarget);
+  RefPtr<AccEvent> event = new AccEvent(aEventType, aTarget);
   FireDelayedEvent(event);
 }
 
 inline void
 DocAccessible::BindChildDocument(DocAccessible* aDocument)
 {
   mNotificationController->ScheduleChildDocBinding(aDocument);
 }
@@ -108,17 +108,17 @@ inline void
 DocAccessible::NotifyOfLoad(uint32_t aLoadEventType)
 {
   mLoadState |= eDOMLoaded;
   mLoadEventType = aLoadEventType;
 
   // If the document is loaded completely then network activity was presumingly
   // caused by file loading. Fire busy state change event.
   if (HasLoadState(eCompletelyLoaded) && IsLoadEventTarget()) {
-    nsRefPtr<AccEvent> stateEvent =
+    RefPtr<AccEvent> stateEvent =
       new AccStateChangeEvent(this, states::BUSY, false);
     FireDelayedEvent(stateEvent);
   }
 }
 
 inline void
 DocAccessible::MaybeNotifyOfValueChange(Accessible* aAccessible)
 {
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1,9 +1,10 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* vim: set ts=8 sts=2 et sw=2 tw=80: */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "Accessible-inl.h"
 #include "AccIterator.h"
 #include "DocAccessible-inl.h"
 #include "DocAccessibleChild.h"
@@ -108,17 +109,30 @@ DocAccessible::~DocAccessible()
 // nsISupports
 
 NS_IMPL_CYCLE_COLLECTION_CLASS(DocAccessible)
 
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(DocAccessible, Accessible)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotificationController)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVirtualCursor)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChildDocuments)
-  tmp->mDependentIDsHash.EnumerateRead(CycleCollectorTraverseDepIDsEntry, &cb);
+  for (auto iter = tmp->mDependentIDsHash.Iter(); !iter.Done(); iter.Next()) {
+    AttrRelProviderArray* providers = iter.UserData();
+
+    for (int32_t jdx = providers->Length() - 1; jdx >= 0; jdx--) {
+      NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(
+        cb, "content of dependent ids hash entry of document accessible");
+
+      AttrRelProvider* provider = (*providers)[jdx];
+      cb.NoteXPCOMChild(provider->mContent);
+
+      NS_ASSERTION(provider->mContent->IsInDoc(),
+                   "Referred content is not in document!");
+    }
+  }
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAccessibleCache)
   NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAnchorJumpElm)
   for (uint32_t i = 0; i < tmp->mARIAOwnsInvalidationList.Length(); ++i) {
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mARIAOwnsInvalidationList[i].mOwner)
     NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mARIAOwnsInvalidationList[i].mChild)
   }
 NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
 
@@ -656,17 +670,17 @@ NS_IMETHODIMP
 DocAccessible::Observe(nsISupports* aSubject, const char* aTopic,
                        const char16_t* aData)
 {
   if (!nsCRT::strcmp(aTopic,"obs_documentCreated")) {    
     // State editable will now be set, readonly is now clear
     // Normally we only fire delayed events created from the node, not an
     // accessible object. See the AccStateChangeEvent constructor for details
     // about this exceptional case.
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(this, states::EDITABLE, true);
     FireDelayedEvent(event);
   }
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
@@ -674,17 +688,17 @@ DocAccessible::Observe(nsISupports* aSub
 
 NS_IMETHODIMP
 DocAccessible::OnPivotChanged(nsIAccessiblePivot* aPivot,
                               nsIAccessible* aOldAccessible,
                               int32_t aOldStart, int32_t aOldEnd,
                               PivotMoveReason aReason,
                               bool aIsFromUserInput)
 {
-  nsRefPtr<AccEvent> event =
+  RefPtr<AccEvent> event =
     new AccVCChangeEvent(
       this, (aOldAccessible ? aOldAccessible->ToInternalAccessible() : nullptr),
       aOldStart, aOldEnd, aReason,
       aIsFromUserInput ? eFromUserInput : eNoUserInput);
   nsEventShell::FireEvent(event);
 
   return NS_OK;
 }
@@ -818,21 +832,21 @@ DocAccessible::AttributeChangedImpl(Acce
   // ARIA's aria-disabled does not affect the disabled state bit.
   if (aAttribute == nsGkAtoms::disabled ||
       aAttribute == nsGkAtoms::aria_disabled) {
     // Do nothing if state wasn't changed (like @aria-disabled was removed but
     // @disabled is still presented).
     if (aAccessible->Unavailable() == mStateBitWasOn)
       return;
 
-    nsRefPtr<AccEvent> enabledChangeEvent =
+    RefPtr<AccEvent> enabledChangeEvent =
       new AccStateChangeEvent(aAccessible, states::ENABLED, mStateBitWasOn);
     FireDelayedEvent(enabledChangeEvent);
 
-    nsRefPtr<AccEvent> sensitiveChangeEvent =
+    RefPtr<AccEvent> sensitiveChangeEvent =
       new AccStateChangeEvent(aAccessible, states::SENSITIVE, mStateBitWasOn);
     FireDelayedEvent(sensitiveChangeEvent);
     return;
   }
 
   // Check for namespaced ARIA attribute
   if (aNameSpaceID == kNameSpaceID_None) {
     // Check for hyphenated aria-foo property?
@@ -881,43 +895,43 @@ DocAccessible::AttributeChangedImpl(Acce
       FireDelayedEvent(nsIAccessibleEvent::EVENT_DESCRIPTION_CHANGE, aAccessible);
 
     return;
   }
 
   if (aAttribute == nsGkAtoms::aria_busy) {
     bool isOn = elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true,
                                  eCaseMatters);
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::BUSY, isOn);
     FireDelayedEvent(event);
     return;
   }
 
   // ARIA or XUL selection
   if ((aAccessible->GetContent()->IsXULElement() &&
        aAttribute == nsGkAtoms::selected) ||
       aAttribute == nsGkAtoms::aria_selected) {
     Accessible* widget =
       nsAccUtils::GetSelectableContainer(aAccessible, aAccessible->State());
     if (widget) {
       AccSelChangeEvent::SelChangeType selChangeType =
         elm->AttrValueIs(aNameSpaceID, aAttribute, nsGkAtoms::_true, eCaseMatters) ?
           AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
 
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccSelChangeEvent(widget, aAccessible, selChangeType);
       FireDelayedEvent(event);
     }
 
     return;
   }
 
   if (aAttribute == nsGkAtoms::contenteditable) {
-    nsRefPtr<AccEvent> editableChangeEvent =
+    RefPtr<AccEvent> editableChangeEvent =
       new AccStateChangeEvent(aAccessible, states::EDITABLE);
     FireDelayedEvent(editableChangeEvent);
     return;
   }
 
   if (aAttribute == nsGkAtoms::value) {
     if (aAccessible->IsProgress())
       FireDelayedEvent(nsIAccessibleEvent::EVENT_VALUE_CHANGE, aAccessible);
@@ -927,24 +941,24 @@ DocAccessible::AttributeChangedImpl(Acce
 // DocAccessible protected member
 void
 DocAccessible::ARIAAttributeChanged(Accessible* aAccessible, nsIAtom* aAttribute)
 {
   // Note: For universal/global ARIA states and properties we don't care if
   // there is an ARIA role present or not.
 
   if (aAttribute == nsGkAtoms::aria_required) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::REQUIRED);
     FireDelayedEvent(event);
     return;
   }
 
   if (aAttribute == nsGkAtoms::aria_invalid) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::INVALID);
     FireDelayedEvent(event);
     return;
   }
 
   // The activedescendant universal property redirects accessible focus events
   // to the element with the id that activedescendant points to. Make sure
   // the tree up to date before processing.
@@ -952,70 +966,70 @@ DocAccessible::ARIAAttributeChanged(Acce
     mNotificationController->HandleNotification<DocAccessible, Accessible>
       (this, &DocAccessible::ARIAActiveDescendantChanged, aAccessible);
 
     return;
   }
 
   // We treat aria-expanded as a global ARIA state for historical reasons
   if (aAttribute == nsGkAtoms::aria_expanded) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::EXPANDED);
     FireDelayedEvent(event);
     return;
   }
 
   // For aria attributes like drag and drop changes we fire a generic attribute
   // change event; at least until native API comes up with a more meaningful event.
   uint8_t attrFlags = aria::AttrCharacteristicsFor(aAttribute);
   if (!(attrFlags & ATTR_BYPASSOBJ)) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccObjectAttrChangedEvent(aAccessible, aAttribute);
     FireDelayedEvent(event);
   }
 
   nsIContent* elm = aAccessible->GetContent();
 
   // Update aria-hidden flag for the whole subtree iff aria-hidden is changed
   // on the root, i.e. ignore any affiliated aria-hidden changes in the subtree
   // of top aria-hidden.
   if (aAttribute == nsGkAtoms::aria_hidden) {
     bool isDefined = aria::HasDefinedARIAHidden(elm);
     if (isDefined != aAccessible->IsARIAHidden() &&
         !aAccessible->Parent()->IsARIAHidden()) {
       aAccessible->SetARIAHidden(isDefined);
 
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccObjectAttrChangedEvent(aAccessible, aAttribute);
       FireDelayedEvent(event);
     }
     return;
   }
 
   if (aAttribute == nsGkAtoms::aria_checked ||
       (aAccessible->IsButton() &&
        aAttribute == nsGkAtoms::aria_pressed)) {
     const uint64_t kState = (aAttribute == nsGkAtoms::aria_checked) ?
                             states::CHECKED : states::PRESSED;
-    nsRefPtr<AccEvent> event = new AccStateChangeEvent(aAccessible, kState);
+    RefPtr<AccEvent> event = new AccStateChangeEvent(aAccessible, kState);
     FireDelayedEvent(event);
 
     bool wasMixed = (mARIAAttrOldValue == nsGkAtoms::mixed);
     bool isMixed = elm->AttrValueIs(kNameSpaceID_None, aAttribute,
                                     nsGkAtoms::mixed, eCaseMatters);
     if (isMixed != wasMixed) {
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccStateChangeEvent(aAccessible, states::MIXED, isMixed);
       FireDelayedEvent(event);
     }
     return;
   }
 
   if (aAttribute == nsGkAtoms::aria_readonly) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(aAccessible, states::READONLY);
     FireDelayedEvent(event);
     return;
   }
 
   // Fire value change event whenever aria-valuetext is changed, or
   // when aria-valuenow is changed and aria-valuetext is empty
   if (aAttribute == nsGkAtoms::aria_valuetext ||
@@ -1069,36 +1083,36 @@ DocAccessible::ContentStateChanged(nsIDo
     return;
 
   if (aStateMask.HasState(NS_EVENT_STATE_CHECKED)) {
     Accessible* widget = accessible->ContainerWidget();
     if (widget && widget->IsSelect()) {
       AccSelChangeEvent::SelChangeType selChangeType =
         aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED) ?
           AccSelChangeEvent::eSelectionAdd : AccSelChangeEvent::eSelectionRemove;
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccSelChangeEvent(widget, accessible, selChangeType);
       FireDelayedEvent(event);
       return;
     }
 
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(accessible, states::CHECKED,
                               aContent->AsElement()->State().HasState(NS_EVENT_STATE_CHECKED));
     FireDelayedEvent(event);
   }
 
   if (aStateMask.HasState(NS_EVENT_STATE_INVALID)) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(accessible, states::INVALID, true);
     FireDelayedEvent(event);
   }
 
   if (aStateMask.HasState(NS_EVENT_STATE_VISITED)) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(accessible, states::TRAVERSED, true);
     FireDelayedEvent(event);
   }
 }
 
 void
 DocAccessible::DocumentStatesChanged(nsIDocument* aDocument,
                                      EventStates aStateMask)
@@ -1368,18 +1382,18 @@ DocAccessible::ProcessInvalidationList()
     if (!oldParent) {
       NS_ERROR("The accessible is in document but doesn't have a parent");
       continue;
     }
     int32_t idxInParent = child->IndexInParent();
 
     // XXX: update context flags
     {
-      nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(oldParent);
-      nsRefPtr<AccMutationEvent> hideEvent =
+      RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(oldParent);
+      RefPtr<AccMutationEvent> hideEvent =
         new AccHideEvent(child, child->GetContent(), false);
       FireDelayedEvent(hideEvent);
       reorderEvent->AddSubMutationEvent(hideEvent);
 
       AutoTreeMutation mut(oldParent);
       oldParent->RemoveChild(child);
 
       MaybeNotifyOfValueChange(oldParent);
@@ -1394,18 +1408,18 @@ DocAccessible::ProcessInvalidationList()
 
     Accessible* newParent = owner;
     if (!isReinserted) {
       AutoTreeMutation mut(oldParent);
       oldParent->InsertChildAt(idxInParent, child);
       newParent = oldParent;
     }
 
-    nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(newParent);
-    nsRefPtr<AccMutationEvent> showEvent =
+    RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(newParent);
+    RefPtr<AccMutationEvent> showEvent =
       new AccShowEvent(child, child->GetContent());
     FireDelayedEvent(showEvent);
     reorderEvent->AddSubMutationEvent(showEvent);
 
     MaybeNotifyOfValueChange(newParent);
     FireDelayedEvent(reorderEvent);
 
     child->SetRepositioned(isReinserted);
@@ -1480,24 +1494,24 @@ DocAccessible::NotifyOfLoading(bool aIsR
 
   if (!IsLoadEventTarget())
     return;
 
   if (aIsReloading) {
     // Fire reload and state busy events on existing document accessible while
     // event from user input flag can be calculated properly and accessible
     // is alive. When new document gets loaded then this one is destroyed.
-    nsRefPtr<AccEvent> reloadEvent =
+    RefPtr<AccEvent> reloadEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, this);
     nsEventShell::FireEvent(reloadEvent);
   }
 
   // Fire state busy change event. Use delayed event since we don't care
   // actually if event isn't delivered when the document goes away like a shot.
-  nsRefPtr<AccEvent> stateEvent =
+  RefPtr<AccEvent> stateEvent =
     new AccStateChangeEvent(this, states::BUSY, true);
   FireDelayedEvent(stateEvent);
 }
 
 void
 DocAccessible::DoInitialUpdate()
 {
   if (nsCoreUtils::IsTabDocument(mDocumentNode))
@@ -1519,24 +1533,24 @@ DocAccessible::DoInitialUpdate()
   AutoTreeMutation mut(this, false);
   CacheChildrenInSubtree(this);
 
   // Fire reorder event after the document tree is constructed. Note, since
   // this reorder event is processed by parent document then events targeted to
   // this document may be fired prior to this reorder event. If this is
   // a problem then consider to keep event processing per tab document.
   if (!IsRoot()) {
-    nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
+    RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(Parent());
     ParentDocument()->FireDelayedEvent(reorderEvent);
   }
 
   uint32_t childCount = ChildCount();
   for (uint32_t i = 0; i < childCount; i++) {
     Accessible* child = GetChildAt(i);
-    nsRefPtr<AccShowEvent> event = new AccShowEvent(child, child->GetContent());
+    RefPtr<AccShowEvent> event = new AccShowEvent(child, child->GetContent());
   FireDelayedEvent(event);
   }
 }
 
 void
 DocAccessible::ProcessLoad()
 {
   mLoadState |= eCompletelyLoaded;
@@ -1552,24 +1566,24 @@ DocAccessible::ProcessLoad()
   // documents
   // b) document load event on sub documents causes screen readers to act is if
   // entire page is reloaded.
   if (!IsLoadEventTarget())
     return;
 
   // Fire complete/load stopped if the load event type is given.
   if (mLoadEventType) {
-    nsRefPtr<AccEvent> loadEvent = new AccEvent(mLoadEventType, this);
+    RefPtr<AccEvent> loadEvent = new AccEvent(mLoadEventType, this);
     FireDelayedEvent(loadEvent);
 
     mLoadEventType = 0;
   }
 
   // Fire busy state change event.
-  nsRefPtr<AccEvent> stateEvent =
+  RefPtr<AccEvent> stateEvent =
     new AccStateChangeEvent(this, states::BUSY, false);
   FireDelayedEvent(stateEvent);
 }
 
 void
 DocAccessible::AddDependentIDsFor(Accessible* aRelProvider, nsIAtom* aRelAttr)
 {
   dom::Element* relProviderEl = aRelProvider->Elm();
@@ -1697,25 +1711,25 @@ DocAccessible::RemoveDependentIDsFor(Acc
 
     // aria-owns has gone, put the children back.
     if (relAttr == nsGkAtoms::aria_owns) {
       nsTArray<nsIContent*>* children = mARIAOwnsHash.Get(aRelProvider);
       if (children) {
         nsTArray<Accessible*> containers;
 
         // Remove ARIA owned elements from where they belonged.
-        nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aRelProvider);
+        RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aRelProvider);
         {
           AutoTreeMutation mut(aRelProvider);
           for (uint32_t idx = 0; idx < children->Length(); idx++) {
             nsIContent* childEl = children->ElementAt(idx);
             Accessible* child = GetAccessible(childEl);
             if (child && child->IsRepositioned()) {
               {
-                nsRefPtr<AccMutationEvent> hideEvent =
+                RefPtr<AccMutationEvent> hideEvent =
                   new AccHideEvent(child, childEl, false);
                 FireDelayedEvent(hideEvent);
                 reorderEvent->AddSubMutationEvent(hideEvent);
 
                 aRelProvider->RemoveChild(child);
               }
 
               // Collect DOM-order containers to update their trees.
@@ -1895,17 +1909,17 @@ DocAccessible::UpdateTreeOnInsertion(Acc
     Accessible* child = aContainer->ContentChildAt(idx);
     child->SetSurvivingInUpdate(true);
    }
 
   AutoTreeMutation mut(aContainer);
   aContainer->InvalidateChildren();
   aContainer->EnsureChildren();
 
-  nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
 
   uint32_t updateFlags = eNoAccessible;
   for (uint32_t idx = 0; idx < aContainer->ContentChildCount(); idx++) {
     Accessible* child = aContainer->ContentChildAt(idx);
     if (child->IsSurvivingInUpdate()) {
       child->SetSurvivingInUpdate(false);
       continue;
     }
@@ -1967,17 +1981,17 @@ DocAccessible::UpdateTreeOnRemoval(Acces
     else
       logging::MsgEntry("child accessible: null");
 
     logging::MsgEnd();
   }
 #endif
 
   uint32_t updateFlags = eNoAccessible;
-  nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(aContainer);
   AutoTreeMutation mut(aContainer);
 
   if (child) {
     updateFlags |= UpdateTreeInternal(child, false, reorderEvent);
   } else {
     // aChildNode may not coorespond to a particular accessible, to handle
     // this we go through all the children of aContainer.  Then if a child
     // has aChildNode as an ancestor, or does not have the node for
@@ -2049,17 +2063,17 @@ DocAccessible::UpdateTreeInternal(Access
     // the changes before our processing and we may miss some menupopup
     // events. Now we just want to be consistent in content insertion/removal
     // handling.
     if (aChild->ARIARole() == roles::MENUPOPUP)
       FireDelayedEvent(nsIAccessibleEvent::EVENT_MENUPOPUP_END, aChild);
   }
 
   // Fire show/hide event.
-  nsRefPtr<AccMutationEvent> event;
+  RefPtr<AccMutationEvent> event;
   if (aIsInsert)
     event = new AccShowEvent(aChild, node);
   else
     event = new AccHideEvent(aChild, node);
 
   FireDelayedEvent(event);
   aReorderEvent->AddSubMutationEvent(event);
 
@@ -2212,30 +2226,8 @@ DocAccessible::IsLoadEventTarget() const
     DocAccessible* parentDoc = ParentDocument();
     return parentDoc && parentDoc->HasLoadState(eCompletelyLoaded);
   }
 
   // It's content (not chrome) root document.
   return (treeItem->ItemType() == nsIDocShellTreeItem::typeContent);
 }
 
-PLDHashOperator
-DocAccessible::CycleCollectorTraverseDepIDsEntry(const nsAString& aKey,
-                                                 AttrRelProviderArray* aProviders,
-                                                 void* aUserArg)
-{
-  nsCycleCollectionTraversalCallback* cb =
-    static_cast<nsCycleCollectionTraversalCallback*>(aUserArg);
-
-  for (int32_t jdx = aProviders->Length() - 1; jdx >= 0; jdx--) {
-    NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(*cb,
-                                       "content of dependent ids hash entry of document accessible");
-
-    AttrRelProvider* provider = (*aProviders)[jdx];
-    cb->NoteXPCOMChild(provider->mContent);
-
-    NS_ASSERTION(provider->mContent->IsInDoc(),
-                 "Referred content is not in document!");
-  }
-
-  return PL_DHASH_NEXT;
-}
-
--- a/accessible/generic/DocAccessible.h
+++ b/accessible/generic/DocAccessible.h
@@ -619,22 +619,22 @@ protected:
   union {
     // ARIA attribute value
     nsIAtom* mARIAAttrOldValue;
 
     // True if the accessible state bit was on
     bool mStateBitWasOn;
   };
 
-  nsTArray<nsRefPtr<DocAccessible> > mChildDocuments;
+  nsTArray<RefPtr<DocAccessible> > mChildDocuments;
 
   /**
    * The virtual cursor of the document.
    */
-  nsRefPtr<nsAccessiblePivot> mVirtualCursor;
+  RefPtr<nsAccessiblePivot> mVirtualCursor;
 
   /**
    * A storage class for pairing content with one of its relation attributes.
    */
   class AttrRelProvider
   {
   public:
     AttrRelProvider(nsIAtom* aRelAttr, nsIContent* aContent) :
@@ -653,21 +653,16 @@ protected:
   typedef nsClassHashtable<nsStringHashKey, AttrRelProviderArray>
     DependentIDsHashtable;
 
   /**
    * The cache of IDs pointed by relation attributes.
    */
   DependentIDsHashtable mDependentIDsHash;
 
-  static PLDHashOperator
-    CycleCollectorTraverseDepIDsEntry(const nsAString& aKey,
-                                      AttrRelProviderArray* aProviders,
-                                      void* aUserArg);
-
   friend class RelatedAccIterator;
 
   /**
    * Used for our caching algorithm. We store the list of nodes that should be
    * invalidated.
    *
    * @see ProcessInvalidationList
    */
@@ -682,25 +677,25 @@ protected:
   struct ARIAOwnsPair {
     ARIAOwnsPair(Accessible* aOwner, nsIContent* aChild) :
       mOwner(aOwner), mChild(aChild) { }
     ARIAOwnsPair(const ARIAOwnsPair& aPair) :
       mOwner(aPair.mOwner), mChild(aPair.mChild) { }
     ARIAOwnsPair& operator =(const ARIAOwnsPair& aPair)
       { mOwner = aPair.mOwner; mChild = aPair.mChild; return *this; }
 
-    nsRefPtr<Accessible> mOwner;
+    RefPtr<Accessible> mOwner;
     nsCOMPtr<nsIContent> mChild;
   };
   nsTArray<ARIAOwnsPair> mARIAOwnsInvalidationList;
 
   /**
    * Used to process notification from core and accessible events.
    */
-  nsRefPtr<NotificationController> mNotificationController;
+  RefPtr<NotificationController> mNotificationController;
   friend class EventQueue;
   friend class NotificationController;
 
 private:
 
   nsIPresShell* mPresShell;
 
   // Exclusively owned by IPDL so don't manually delete it!
--- a/accessible/generic/HyperTextAccessible-inl.h
+++ b/accessible/generic/HyperTextAccessible-inl.h
@@ -148,32 +148,32 @@ HyperTextAccessible::AdjustCaretOffset(u
     return aOffset - 1;
 
   return aOffset;
 }
 
 inline bool
 HyperTextAccessible::IsCaretAtEndOfLine() const
 {
-  nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
+  RefPtr<nsFrameSelection> frameSelection = FrameSelection();
   return frameSelection &&
     frameSelection->GetHint() == CARET_ASSOCIATE_BEFORE;
 }
 
 inline already_AddRefed<nsFrameSelection>
 HyperTextAccessible::FrameSelection() const
 {
   nsIFrame* frame = GetFrame();
   return frame ? frame->GetFrameSelection() : nullptr;
 }
 
 inline dom::Selection*
 HyperTextAccessible::DOMSelection() const
 {
-  nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
+  RefPtr<nsFrameSelection> frameSelection = FrameSelection();
   return frameSelection ?
     frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL) :
     nullptr;
 }
 
 } // namespace a11y
 } // namespace mozilla
 
--- a/accessible/generic/HyperTextAccessible.cpp
+++ b/accessible/generic/HyperTextAccessible.cpp
@@ -1425,17 +1425,17 @@ HyperTextAccessible::CaretOffset() const
   return DOMPointToOffset(focusNode, focusOffset);
 }
 
 int32_t
 HyperTextAccessible::CaretLineNumber()
 {
   // Provide the line number for the caret, relative to the
   // currently focused node. Use a 1-based index
-  nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
+  RefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection)
     return -1;
 
   dom::Selection* domSel =
     frameSelection->GetSelection(nsISelectionController::SELECTION_NORMAL);
   if (!domSel)
     return - 1;
 
@@ -1494,17 +1494,17 @@ HyperTextAccessible::CaretLineNumber()
   return lineNumber;
 }
 
 nsIntRect
 HyperTextAccessible::GetCaretRect(nsIWidget** aWidget)
 {
   *aWidget = nullptr;
 
-  nsRefPtr<nsCaret> caret = mDoc->PresShell()->GetCaret();
+  RefPtr<nsCaret> caret = mDoc->PresShell()->GetCaret();
   NS_ENSURE_TRUE(caret, nsIntRect());
 
   bool isVisible = caret->IsVisible();
   if (!isVisible)
     return nsIntRect();
 
   nsRect rect;
   nsIFrame* frame = caret->GetGeometry(&rect);
@@ -1536,17 +1536,17 @@ HyperTextAccessible::GetCaretRect(nsIWid
   return caretRect;
 }
 
 void
 HyperTextAccessible::GetSelectionDOMRanges(int16_t aType,
                                            nsTArray<nsRange*>* aRanges)
 {
   // Ignore selection if it is not visible.
-  nsRefPtr<nsFrameSelection> frameSelection = FrameSelection();
+  RefPtr<nsFrameSelection> frameSelection = FrameSelection();
   if (!frameSelection ||
       frameSelection->GetDisplaySelection() <= nsISelectionController::SELECTION_HIDDEN)
     return;
 
   dom::Selection* domSel = frameSelection->GetSelection(aType);
   if (!domSel)
     return;
 
@@ -1644,17 +1644,17 @@ HyperTextAccessible::SetSelectionBoundsA
     NS_ERROR("Wrong in offset");
     return false;
   }
 
   dom::Selection* domSel = DOMSelection();
   if (!domSel)
     return false;
 
-  nsRefPtr<nsRange> range;
+  RefPtr<nsRange> range;
   uint32_t rangeCount = domSel->RangeCount();
   if (aSelectionNum == static_cast<int32_t>(rangeCount))
     range = new nsRange(mContent);
   else
     range = domSel->GetRangeAt(aSelectionNum);
 
   if (!range)
     return false;
@@ -1684,17 +1684,17 @@ HyperTextAccessible::RemoveFromSelection
   domSel->RemoveRange(domSel->GetRangeAt(aSelectionNum));
   return true;
 }
 
 void
 HyperTextAccessible::ScrollSubstringTo(int32_t aStartOffset, int32_t aEndOffset,
                                        uint32_t aScrollType)
 {
-  nsRefPtr<nsRange> range = new nsRange(mContent);
+  RefPtr<nsRange> range = new nsRange(mContent);
   if (OffsetsToDOMRange(aStartOffset, aEndOffset, range))
     nsCoreUtils::ScrollSubstringTo(GetFrame(), range, aScrollType);
 }
 
 void
 HyperTextAccessible::ScrollSubstringToPoint(int32_t aStartOffset,
                                             int32_t aEndOffset,
                                             uint32_t aCoordinateType,
@@ -1702,17 +1702,17 @@ HyperTextAccessible::ScrollSubstringToPo
 {
   nsIFrame *frame = GetFrame();
   if (!frame)
     return;
 
   nsIntPoint coords = nsAccUtils::ConvertToScreenCoords(aX, aY, aCoordinateType,
                                                         this);
 
-  nsRefPtr<nsRange> range = new nsRange(mContent);
+  RefPtr<nsRange> range = new nsRange(mContent);
   if (!OffsetsToDOMRange(aStartOffset, aEndOffset, range))
     return;
 
   nsPresContext* presContext = frame->PresContext();
   nsPoint coordsInAppUnits =
     ToAppUnits(coords, presContext->AppUnitsPerDevPixel());
 
   bool initialScrolled = false;
@@ -2148,17 +2148,17 @@ HyperTextAccessible::GetDOMPointByFrameO
 // HyperTextAccessible
 void
 HyperTextAccessible::GetSpellTextAttr(nsINode* aNode,
                                       int32_t aNodeOffset,
                                       uint32_t* aStartOffset,
                                       uint32_t* aEndOffset,
                                       nsIPersistentProperties* aAttributes)
 {
-  nsRefPtr<nsFrameSelection> fs = FrameSelection();
+  RefPtr<nsFrameSelection> fs = FrameSelection();
   if (!fs)
     return;
 
   dom::Selection* domSel = fs->GetSelection(nsISelectionController::SELECTION_SPELLCHECK);
   if (!domSel)
     return;
 
   int32_t rangeCount = domSel->RangeCount();
--- a/accessible/generic/ImageAccessible.cpp
+++ b/accessible/generic/ImageAccessible.cpp
@@ -128,23 +128,22 @@ ImageAccessible::DoAction(uint8_t aIndex
     return false;
 
   nsAutoCString utf8spec;
   uri->GetSpec(utf8spec);
   NS_ConvertUTF8toUTF16 spec(utf8spec);
 
   nsIDocument* document = mContent->OwnerDoc();
   nsCOMPtr<nsPIDOMWindow> piWindow = document->GetWindow();
-  nsCOMPtr<nsIDOMWindow> win = do_QueryInterface(piWindow);
-  if (!win)
+  if (!piWindow)
     return false;
 
-  nsCOMPtr<nsIDOMWindow> tmp;
-  return NS_SUCCEEDED(win->Open(spec, EmptyString(), EmptyString(),
-                                getter_AddRefs(tmp)));
+  nsCOMPtr<nsPIDOMWindow> tmp;
+  return NS_SUCCEEDED(piWindow->Open(spec, EmptyString(), EmptyString(),
+                                     getter_AddRefs(tmp)));
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // ImageAccessible
 
 nsIntPoint
 ImageAccessible::Position(uint32_t aCoordType)
 {
--- a/accessible/generic/OuterDocAccessible.cpp
+++ b/accessible/generic/OuterDocAccessible.cpp
@@ -187,15 +187,10 @@ OuterDocAccessible::CacheChildren()
 
 ProxyAccessible*
 OuterDocAccessible::RemoteChildDoc() const
 {
   dom::TabParent* tab = dom::TabParent::GetFrom(GetContent());
   if (!tab)
     return nullptr;
 
-  if (DocAccessibleParent* doc = tab->GetTopLevelDocAccessible()) {
-    return doc;
-  }
-
-  MOZ_ASSERT(false, "no top level tab document?");
-  return nullptr;
+  return tab->GetTopLevelDocAccessible();
 }
--- a/accessible/generic/RootAccessible.cpp
+++ b/accessible/generic/RootAccessible.cpp
@@ -306,17 +306,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
   }
 #endif
 
   if (eventType.EqualsLiteral("RadioStateChange")) {
     uint64_t state = accessible->State();
     bool isEnabled = (state & (states::CHECKED | states::SELECTED)) != 0;
 
     if (accessible->NeedsDOMUIEvent()) {
-      nsRefPtr<AccEvent> accEvent =
+      RefPtr<AccEvent> accEvent =
         new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
       nsEventShell::FireEvent(accEvent);
     }
 
     if (isEnabled) {
       FocusMgr()->ActiveItemChanged(accessible);
 #ifdef A11Y_LOG
       if (logging::IsEnabled(logging::eFocus))
@@ -327,17 +327,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
     return;
   }
 
   if (eventType.EqualsLiteral("CheckboxStateChange")) {
     if (accessible->NeedsDOMUIEvent()) {
       uint64_t state = accessible->State();
       bool isEnabled = !!(state & states::CHECKED);
 
-      nsRefPtr<AccEvent> accEvent =
+      RefPtr<AccEvent> accEvent =
         new AccStateChangeEvent(accessible, states::CHECKED, isEnabled);
       nsEventShell::FireEvent(accEvent);
     }
     return;
   }
 
   Accessible* treeItemAcc = nullptr;
 #ifdef MOZ_XUL
@@ -347,17 +347,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
     if (treeItemAcc)
       accessible = treeItemAcc;
   }
 
   if (treeItemAcc && eventType.EqualsLiteral("OpenStateChange")) {
     uint64_t state = accessible->State();
     bool isEnabled = (state & states::EXPANDED) != 0;
 
-    nsRefPtr<AccEvent> accEvent =
+    RefPtr<AccEvent> accEvent =
       new AccStateChangeEvent(accessible, states::EXPANDED, isEnabled);
     nsEventShell::FireEvent(accEvent);
     return;
   }
 
   nsINode* targetNode = accessible->GetNode();
   if (treeItemAcc && eventType.EqualsLiteral("select")) {
     // XXX: We shouldn't be based on DOM select event which doesn't provide us
@@ -373,17 +373,17 @@ RootAccessible::ProcessDOMEvent(nsIDOMEv
         // for each tree item. Perhaps each tree item will need to cache its
         // selection state and fire an event after a DOM "select" event when
         // that state changes. XULTreeAccessible::UpdateTreeSelection();
         nsEventShell::FireEvent(nsIAccessibleEvent::EVENT_SELECTION_WITHIN,
                                 accessible);
         return;
       }
 
-      nsRefPtr<AccSelChangeEvent> selChangeEvent =
+      RefPtr<AccSelChangeEvent> selChangeEvent =
         new AccSelChangeEvent(treeAcc, treeItemAcc,
                               AccSelChangeEvent::eSelectionAdd);
       nsEventShell::FireEvent(selChangeEvent);
       return;
     }
   }
   else
 #endif
@@ -481,21 +481,19 @@ Relation
 RootAccessible::RelationByType(RelationType aType)
 {
   if (!mDocumentNode || aType != RelationType::EMBEDS)
     return DocAccessibleWrap::RelationByType(aType);
 
   nsPIDOMWindow* rootWindow = mDocumentNode->GetWindow();
   if (rootWindow) {
     nsCOMPtr<nsIDOMWindow> contentWindow = nsGlobalWindow::Cast(rootWindow)->GetContent();
-    if (contentWindow) {
-      nsCOMPtr<nsIDOMDocument> contentDOMDocument;
-      contentWindow->GetDocument(getter_AddRefs(contentDOMDocument));
-      nsCOMPtr<nsIDocument> contentDocumentNode =
-        do_QueryInterface(contentDOMDocument);
+    nsCOMPtr<nsPIDOMWindow> piWindow = do_QueryInterface(contentWindow);
+    if (piWindow) {
+      nsCOMPtr<nsIDocument> contentDocumentNode = piWindow->GetDoc();
       if (contentDocumentNode) {
         DocAccessible* contentDocument =
           GetAccService()->GetDocAccessible(contentDocumentNode);
         if (contentDocument)
           return Relation(contentDocument);
       }
     }
   }
@@ -531,17 +529,17 @@ RootAccessible::HandlePopupShownEvent(Ac
     // Fire expanded state change event for comboboxes and autocompeletes.
     Accessible* combobox = aAccessible->Parent();
     if (!combobox)
       return;
 
     roles::Role comboboxRole = combobox->Role();
     if (comboboxRole == roles::COMBOBOX || 
 	comboboxRole == roles::AUTOCOMPLETE) {
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccStateChangeEvent(combobox, states::EXPANDED, true);
       if (event)
         nsEventShell::FireEvent(event);
     }
   }
 }
 
 void
@@ -640,17 +638,17 @@ RootAccessible::HandlePopupHidingEvent(n
 #ifdef A11Y_LOG
     if (logging::IsEnabled(logging::eFocus))
       logging::ActiveItemChangeCausedBy("popuphiding", popup);
 #endif
   }
 
   // Fire expanded state change event.
   if (notifyOf & kNotifyOfState) {
-    nsRefPtr<AccEvent> event =
+    RefPtr<AccEvent> event =
       new AccStateChangeEvent(widget, states::EXPANDED, false);
     document->FireDelayedEvent(event);
   }
 }
 
 #ifdef MOZ_XUL
 void
 RootAccessible::HandleTreeRowCountChangedEvent(nsIDOMEvent* aEvent,
--- a/accessible/html/HTMLElementAccessibles.cpp
+++ b/accessible/html/HTMLElementAccessibles.cpp
@@ -63,17 +63,17 @@ HTMLLabelAccessible::NativeName(nsString
   return aName.IsEmpty() ? eNameOK : eNameFromSubtree;
 }
 
 Relation
 HTMLLabelAccessible::RelationByType(RelationType aType)
 {
   Relation rel = AccessibleWrap::RelationByType(aType);
   if (aType == RelationType::LABEL_FOR) {
-    nsRefPtr<dom::HTMLLabelElement> label = dom::HTMLLabelElement::FromContent(mContent);
+    RefPtr<dom::HTMLLabelElement> label = dom::HTMLLabelElement::FromContent(mContent);
     rel.AppendTarget(mDoc, label->GetControl());
   }
 
   return rel;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // nsHTMLOuputAccessible
--- a/accessible/html/HTMLFormControlAccessible.cpp
+++ b/accessible/html/HTMLFormControlAccessible.cpp
@@ -129,17 +129,17 @@ HTMLRadioButtonAccessible::GetPositionAn
   nsAutoString tagName;
   mContent->NodeInfo()->GetName(tagName);
 
   nsAutoString type;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::type, type);
   nsAutoString name;
   mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, name);
 
-  nsRefPtr<nsContentList> inputElms;
+  RefPtr<nsContentList> inputElms;
 
   nsCOMPtr<nsIFormControl> formControlNode(do_QueryInterface(mContent));
   dom::Element* formElm = formControlNode->GetFormElement();
   if (formElm)
     inputElms = NS_GetContentList(formElm, namespaceId, tagName);
   else
     inputElms = NS_GetContentList(mContent->OwnerDoc(), namespaceId, tagName);
   NS_ENSURE_TRUE_VOID(inputElms);
@@ -524,17 +524,17 @@ HTMLFileInputAccessible::HandleAccEvent(
   AccStateChangeEvent* event = downcast_accEvent(aEvent);
   if (event &&
       (event->GetState() == states::BUSY ||
        event->GetState() == states::REQUIRED ||
        event->GetState() == states::HASPOPUP ||
        event->GetState() == states::INVALID)) {
     Accessible* button = GetChildAt(0);
     if (button && button->Role() == roles::PUSHBUTTON) {
-      nsRefPtr<AccStateChangeEvent> childEvent =
+      RefPtr<AccStateChangeEvent> childEvent =
         new AccStateChangeEvent(button, event->GetState(),
                                 event->IsStateEnabled(), event->FromUserInput());
       nsEventShell::FireEvent(childEvent);
     }
   }
 
   return NS_OK;
 }
--- a/accessible/html/HTMLImageMapAccessible.cpp
+++ b/accessible/html/HTMLImageMapAccessible.cpp
@@ -82,51 +82,51 @@ HTMLImageMapAccessible::UpdateChildAreas
 
   // If image map is not initialized yet then we trigger one time more later.
   nsImageMap* imageMapObj = imageFrame->GetExistingImageMap();
   if (!imageMapObj)
     return;
 
   bool treeChanged = false;
   AutoTreeMutation mut(this);
-  nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
 
   // Remove areas that are not a valid part of the image map anymore.
   for (int32_t childIdx = mChildren.Length() - 1; childIdx >= 0; childIdx--) {
     Accessible* area = mChildren.ElementAt(childIdx);
     if (area->GetContent()->GetPrimaryFrame())
       continue;
 
     if (aDoFireEvents) {
-      nsRefPtr<AccHideEvent> event = new AccHideEvent(area, area->GetContent());
+      RefPtr<AccHideEvent> event = new AccHideEvent(area, area->GetContent());
       mDoc->FireDelayedEvent(event);
       reorderEvent->AddSubMutationEvent(event);
     }
 
     RemoveChild(area);
     treeChanged = true;
   }
 
   // Insert new areas into the tree.
   uint32_t areaElmCount = imageMapObj->AreaCount();
   for (uint32_t idx = 0; idx < areaElmCount; idx++) {
     nsIContent* areaContent = imageMapObj->GetAreaAt(idx);
 
     Accessible* area = mChildren.SafeElementAt(idx);
     if (!area || area->GetContent() != areaContent) {
-      nsRefPtr<Accessible> area = new HTMLAreaAccessible(areaContent, mDoc);
+      RefPtr<Accessible> area = new HTMLAreaAccessible(areaContent, mDoc);
       mDoc->BindToDocument(area, aria::GetRoleMap(areaContent));
 
       if (!InsertChildAt(idx, area)) {
         mDoc->UnbindFromDocument(area);
         break;
       }
 
       if (aDoFireEvents) {
-        nsRefPtr<AccShowEvent> event = new AccShowEvent(area, areaContent);
+        RefPtr<AccShowEvent> event = new AccShowEvent(area, areaContent);
         mDoc->FireDelayedEvent(event);
         reorderEvent->AddSubMutationEvent(event);
       }
 
       treeChanged = true;
     }
   }
 
--- a/accessible/html/HTMLListAccessible.cpp
+++ b/accessible/html/HTMLListAccessible.cpp
@@ -97,30 +97,30 @@ HTMLLIAccessible::Bounds() const
 void
 HTMLLIAccessible::UpdateBullet(bool aHasBullet)
 {
   if (aHasBullet == !!mBullet) {
     NS_NOTREACHED("Bullet and accessible are in sync already!");
     return;
   }
 
-  nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
   AutoTreeMutation mut(this);
 
   DocAccessible* document = Document();
   if (aHasBullet) {
     mBullet = new HTMLListBulletAccessible(mContent, mDoc);
     document->BindToDocument(mBullet, nullptr);
     InsertChildAt(0, mBullet);
 
-    nsRefPtr<AccShowEvent> event = new AccShowEvent(mBullet, mBullet->GetContent());
+    RefPtr<AccShowEvent> event = new AccShowEvent(mBullet, mBullet->GetContent());
     mDoc->FireDelayedEvent(event);
     reorderEvent->AddSubMutationEvent(event);
   } else {
-    nsRefPtr<AccHideEvent> event = new AccHideEvent(mBullet, mBullet->GetContent());
+    RefPtr<AccHideEvent> event = new AccHideEvent(mBullet, mBullet->GetContent());
     mDoc->FireDelayedEvent(event);
     reorderEvent->AddSubMutationEvent(event);
 
     RemoveChild(mBullet);
     mBullet = nullptr;
   }
 
   mDoc->FireDelayedEvent(reorderEvent);
--- a/accessible/html/HTMLListAccessible.h
+++ b/accessible/html/HTMLListAccessible.h
@@ -59,17 +59,17 @@ public:
 
 protected:
   virtual ~HTMLLIAccessible() { }
 
   // Accessible
   virtual void CacheChildren() override;
 
 private:
-  nsRefPtr<HTMLListBulletAccessible> mBullet;
+  RefPtr<HTMLListBulletAccessible> mBullet;
 };
 
 
 /**
  * Used for bullet of HTML list item element (for example, HTML li).
  */
 class HTMLListBulletAccessible : public LeafAccessible
 {
--- a/accessible/html/HTMLSelectAccessible.cpp
+++ b/accessible/html/HTMLSelectAccessible.cpp
@@ -129,17 +129,17 @@ HTMLSelectListAccessible::CacheChildren(
     if (!childContent->IsHTMLElement()) {
       continue;
     }
 
     if (childContent->IsAnyOfHTMLElements(nsGkAtoms::option,
                                           nsGkAtoms::optgroup)) {
 
       // Get an accessible for option or optgroup and cache it.
-      nsRefPtr<Accessible> accessible =
+      RefPtr<Accessible> accessible =
         GetAccService()->GetOrCreateAccessible(childContent, this);
       if (accessible)
         AppendChild(accessible);
     }
   }
 }
 
 
--- a/accessible/html/HTMLSelectAccessible.h
+++ b/accessible/html/HTMLSelectAccessible.h
@@ -191,17 +191,17 @@ protected:
   virtual void CacheChildren() override;
 
   /**
    * Return selected option.
    */
   Accessible* SelectedOption() const;
 
 private:
-  nsRefPtr<HTMLComboboxListAccessible> mListAccessible;
+  RefPtr<HTMLComboboxListAccessible> mListAccessible;
 };
 
 /*
  * A class that represents the window that lives to the right
  * of the drop down button inside the Select. This is the window
  * that is made visible when the button is pressed.
  */
 class HTMLComboboxListAccessible : public HTMLSelectListAccessible
--- a/accessible/html/HTMLTableAccessible.cpp
+++ b/accessible/html/HTMLTableAccessible.cpp
@@ -807,17 +807,17 @@ HTMLTableAccessible::AddRowOrColumnToSel
 
   uint32_t count = 0;
   if (doSelectRow)
     count = ColCount();
   else
     count = RowCount();
 
   nsIPresShell* presShell(mDoc->PresShell());
-  nsRefPtr<nsFrameSelection> tableSelection =
+  RefPtr<nsFrameSelection> tableSelection =
     const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
 
   for (uint32_t idx = 0; idx < count; idx++) {
     int32_t rowIdx = doSelectRow ? aIndex : idx;
     int32_t colIdx = doSelectRow ? idx : aIndex;
     nsTableCellFrame* cellFrame = tableFrame->GetCellFrameAt(rowIdx, colIdx);
     if (cellFrame && !cellFrame->IsSelected()) {
       nsresult rv = tableSelection->SelectCellElement(cellFrame->GetContent());
@@ -833,17 +833,17 @@ HTMLTableAccessible::RemoveRowsOrColumns
                                                       uint32_t aTarget,
                                                       bool aIsOuter)
 {
   nsTableOuterFrame* tableFrame = do_QueryFrame(mContent->GetPrimaryFrame());
   if (!tableFrame)
     return NS_OK;
 
   nsIPresShell* presShell(mDoc->PresShell());
-  nsRefPtr<nsFrameSelection> tableSelection =
+  RefPtr<nsFrameSelection> tableSelection =
     const_cast<nsFrameSelection*>(presShell->ConstFrameSelection());
 
   bool doUnselectRow = (aTarget == nsISelectionPrivate::TABLESELECTION_ROW);
   uint32_t count = doUnselectRow ? ColCount() : RowCount();
 
   int32_t startRowIdx = doUnselectRow ? aIndex : 0;
   int32_t endRowIdx = doUnselectRow ? aIndex : count - 1;
   int32_t startColIdx = doUnselectRow ? 0 : aIndex;
@@ -964,18 +964,18 @@ HTMLTableAccessible::IsProbablyLayoutTab
 
   if (mContent->HasAttr(kNameSpaceID_None, nsGkAtoms::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.
     RETURN_LAYOUT_ANSWER(false, "Has role attribute, weak role, and role is table");
   }
 
-  if (!mContent->IsHTMLElement(nsGkAtoms::table))
-    RETURN_LAYOUT_ANSWER(true, "table built by CSS display:table style");
+  NS_ASSERTION(mContent->IsHTMLElement(nsGkAtoms::table),
+    "table should not be built by CSS display:table style");
 
   // Check if datatable attribute has "0" value.
   if (mContent->AttrValueIs(kNameSpaceID_None, nsGkAtoms::datatable,
                             NS_LITERAL_STRING("0"), eCaseMatters)) {
     RETURN_LAYOUT_ANSWER(true, "Has datatable = 0 attribute, it's for layout");
   }
 
   // Check for legitimate data table attributes.
--- a/accessible/interfaces/nsIAccessible.idl
+++ b/accessible/interfaces/nsIAccessible.idl
@@ -25,17 +25,17 @@ class Accessible;
  * accessibility APIs like MSAA and ATK. Contains the sum of what's needed
  * to support IAccessible as well as ATK's generic accessibility objects.
  * Can also be used by in-process accessibility clients to get information
  * about objects in the accessible tree. The accessible tree is a subset of 
  * nodes in the DOM tree -- such as documents, focusable elements and text.
  * Mozilla creates the implementations of nsIAccessible on demand.
  * See http://www.mozilla.org/projects/ui/accessibility for more information.
  */
-[scriptable, uuid(66b110b0-c25a-4784-8623-f6ba40c7cfee)]
+[scriptable, uuid(de2869d9-563c-4943-996b-31a4daa4d097)]
 interface nsIAccessible : nsISupports
 {
   /**
    * Parent node in accessible tree.
    */
   readonly attribute nsIAccessible parent;
 
   /**
@@ -227,22 +227,16 @@ interface nsIAccessible : nsISupports
   void getBounds(out long x, out long y, out long width, out long height);
 
   /**
    * Add or remove this accessible to the current selection
    */
   void setSelected(in boolean isSelected);
 
   /**
-   * Extend the current selection from its current accessible anchor node
-   * to this accessible
-   */
-  void extendSelection();
-
-  /**
    * Select this accessible node only
    */
   void takeSelection();
 
   /**
    * Focus this accessible node,
    * The state STATE_FOCUSABLE indicates whether this node is normally focusable.
    * It is the callers responsibility to determine whether this node is focusable.
--- a/accessible/ipc/DocAccessibleChild.cpp
+++ b/accessible/ipc/DocAccessibleChild.cpp
@@ -385,23 +385,20 @@ DocAccessibleChild::RecvCaretOffset(cons
 {
   HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
   *aOffset = acc && acc->IsTextRole() ? acc->CaretOffset() : 0;
   return true;
 }
 
 bool
 DocAccessibleChild::RecvSetCaretOffset(const uint64_t& aID,
-                                       const int32_t& aOffset,
-                                       bool* aRetVal)
+                                       const int32_t& aOffset)
 {
   HyperTextAccessible* acc = IdToHyperTextAccessible(aID);
-  *aRetVal = false;
   if (acc && acc->IsTextRole() && acc->IsValidOffset(aOffset)) {
-    *aRetVal = true;
     acc->SetCaretOffset(aOffset);
   }
   return true;
 }
 
 bool
 DocAccessibleChild::RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
 {
@@ -1617,16 +1614,38 @@ DocAccessibleChild::RecvUnselectAll(cons
   if (acc) {
     *aSuccess = acc->UnselectAll();
   }
 
   return true;
 }
 
 bool
+DocAccessibleChild::RecvTakeSelection(const uint64_t& aID)
+{
+  Accessible* acc = IdToAccessible(aID);
+  if (acc) {
+    acc->TakeSelection();
+  }
+
+  return true;
+}
+
+bool
+DocAccessibleChild::RecvSetSelected(const uint64_t& aID, const bool& aSelect)
+{
+  Accessible* acc = IdToAccessible(aID);
+  if (acc) {
+    acc->SetSelected(aSelect);
+  }
+
+  return true;
+}
+
+bool
 DocAccessibleChild::RecvDoAction(const uint64_t& aID,
                                  const uint8_t& aIndex,
                                  bool* aSuccess)
 {
   *aSuccess = false;
   Accessible* acc = IdToAccessible(aID);
   if (acc) {
     *aSuccess = acc->DoAction(aIndex);
--- a/accessible/ipc/DocAccessibleChild.h
+++ b/accessible/ipc/DocAccessibleChild.h
@@ -98,18 +98,18 @@ public:
 
   virtual bool RecvAttributes(const uint64_t& aID,
                               nsTArray<Attribute> *aAttributes) override;
 
   virtual bool RecvCaretLineNumber(const uint64_t& aID, int32_t* aLineNumber)
     override;
   virtual bool RecvCaretOffset(const uint64_t& aID, int32_t* aOffset)
     override;
-  virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset,
-                                  bool* aValid) override;
+  virtual bool RecvSetCaretOffset(const uint64_t& aID, const int32_t& aOffset)
+    override;
 
   virtual bool RecvCharacterCount(const uint64_t& aID, int32_t* aCount)
      override;
   virtual bool RecvSelectionCount(const uint64_t& aID, int32_t* aCount)
      override;
 
   virtual bool RecvTextSubstring(const uint64_t& aID,
                                  const int32_t& aStartOffset,
@@ -396,16 +396,20 @@ public:
                                            bool* aSuccess) override;
 
   virtual bool RecvSelectAll(const uint64_t& aID,
                              bool* aSuccess) override;
 
   virtual bool RecvUnselectAll(const uint64_t& aID,
                                bool* aSuccess) override;
 
+  virtual bool RecvTakeSelection(const uint64_t& aID) override;
+  virtual bool RecvSetSelected(const uint64_t& aID,
+                               const bool& aSelect) override;
+
   virtual bool RecvDoAction(const uint64_t& aID,
                             const uint8_t& aIndex,
                             bool* aSuccess) override;
 
   virtual bool RecvActionCount(const uint64_t& aID,
                                uint8_t* aCount) override;
 
   virtual bool RecvActionDescriptionAt(const uint64_t& aID,
--- a/accessible/ipc/DocAccessibleParent.cpp
+++ b/accessible/ipc/DocAccessibleParent.cpp
@@ -257,16 +257,17 @@ DocAccessibleParent::Destroy()
   MOZ_ASSERT(!mShutdown);
   mShutdown = true;
 
   uint32_t childDocCount = mChildDocs.Length();
   for (uint32_t i = childDocCount - 1; i < childDocCount; i--)
     mChildDocs[i]->Destroy();
 
   for (auto iter = mAccessibles.Iter(); !iter.Done(); iter.Next()) {
+    MOZ_ASSERT(iter.Get()->mProxy != this);
     ProxyDestroyed(iter.Get()->mProxy);
     iter.Remove();
   }
   ProxyDestroyed(this);
   if (mParentDoc)
     mParentDoc->RemoveChildDoc(this);
   else if (IsTopLevel())
     GetAccService()->RemoteDocShutdown(this);
--- a/accessible/ipc/PDocAccessible.ipdl
+++ b/accessible/ipc/PDocAccessible.ipdl
@@ -87,17 +87,17 @@ child:
   prio(high) sync ARIARoleAtom(uint64_t aID) returns(nsString role);
   prio(high) sync GetLevelInternal(uint64_t aID) returns(int32_t aLevel);
 
   // AccessibleText
 
   // TextSubstring is getText in IDL.
   prio(high) sync CaretLineNumber(uint64_t aID) returns(int32_t aLineNumber);
   prio(high) sync CaretOffset(uint64_t aID) returns(int32_t aOffset);
-  prio(high) sync SetCaretOffset(uint64_t aID, int32_t aOffset) returns (bool aValid);
+   async SetCaretOffset(uint64_t aID, int32_t aOffset);
   prio(high) sync CharacterCount(uint64_t aID) returns(int32_t aCount);
   prio(high) sync SelectionCount(uint64_t aID) returns(int32_t aCount);
   prio(high) sync TextSubstring(uint64_t aID, int32_t aStartOffset, int32_t
                                 aEndOffset) returns(nsString aText, bool aValid);
   prio(high) sync GetTextAfterOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
     returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
   prio(high) sync GetTextAtOffset(uint64_t aID, int32_t aOffset, int32_t aBoundaryType)
     returns(nsString aText, int32_t aStartOffset, int32_t aEndOffset);
@@ -211,16 +211,19 @@ child:
   prio(high) sync SelectedItemCount(uint64_t aID) returns(uint32_t aCount);
   prio(high) sync GetSelectedItem(uint64_t aID, uint32_t aIndex) returns(uint64_t aSelected, bool aOk);
   prio(high) sync IsItemSelected(uint64_t aID, uint32_t aIndex) returns(bool aSelected);
   prio(high) sync AddItemToSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
   prio(high) sync RemoveItemFromSelection(uint64_t aID, uint32_t aIndex) returns(bool aSuccess);
   prio(high) sync SelectAll(uint64_t aID) returns(bool aSuccess);
   prio(high) sync UnselectAll(uint64_t aID) returns(bool aSuccess);
 
+  async TakeSelection(uint64_t aID);
+  async SetSelected(uint64_t aID, bool aSelected);
+
   prio(high) sync DoAction(uint64_t aID, uint8_t aIndex) returns(bool aSuccess);
   prio(high) sync ActionCount(uint64_t aID) returns(uint8_t aCount);
   prio(high) sync ActionDescriptionAt(uint64_t aID, uint8_t aIndex) returns(nsString aDescription);
   prio(high) sync ActionNameAt(uint64_t aID, uint8_t aIndex) returns(nsString aName);
   prio(high) sync AccessKey(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
   prio(high) sync KeyboardShortcut(uint64_t aID) returns(uint32_t aKey, uint32_t aModifierMask);
   prio(high) sync AtkKeyBinding(uint64_t aID) returns(nsString aResult);
 
--- a/accessible/ipc/ProxyAccessible.cpp
+++ b/accessible/ipc/ProxyAccessible.cpp
@@ -211,22 +211,20 @@ ProxyAccessible::CaretLineNumber()
 int32_t
 ProxyAccessible::CaretOffset()
 {
   int32_t offset = 0;
   unused << mDoc->SendCaretOffset(mID, &offset);
   return offset;
 }
 
-bool
+void
 ProxyAccessible::SetCaretOffset(int32_t aOffset)
 {
-  bool valid = false;
-  unused << mDoc->SendSetCaretOffset(mID, aOffset, &valid);
-  return valid;
+  unused << mDoc->SendSetCaretOffset(mID, aOffset);
 }
 
 int32_t
 ProxyAccessible::CharacterCount()
 {
   int32_t count = 0;
   unused << mDoc->SendCharacterCount(mID, &count);
   return count;
@@ -901,16 +899,28 @@ ProxyAccessible::SelectAll()
 bool
 ProxyAccessible::UnselectAll()
 {
   bool success = false;
   unused << mDoc->SendUnselectAll(mID, &success);
   return success;
 }
 
+void
+ProxyAccessible::TakeSelection()
+{
+  unused << mDoc->SendTakeSelection(mID);
+}
+
+void
+ProxyAccessible::SetSelected(bool aSelect)
+{
+  unused << mDoc->SendSetSelected(mID, aSelect);
+}
+
 bool
 ProxyAccessible::DoAction(uint8_t aIndex)
 {
   bool success = false;
   unused << mDoc->SendDoAction(mID, aIndex, &success);
   return success;
 }
 
--- a/accessible/ipc/ProxyAccessible.h
+++ b/accessible/ipc/ProxyAccessible.h
@@ -127,17 +127,17 @@ public:
   nsIAtom* LandmarkRole() const;
 
   nsIAtom* ARIARoleAtom() const;
 
   int32_t GetLevelInternal();
 
   int32_t CaretLineNumber();
   int32_t CaretOffset();
-  bool SetCaretOffset(int32_t aOffset);
+  void SetCaretOffset(int32_t aOffset);
 
   int32_t CharacterCount();
   int32_t SelectionCount();
 
   /**
    * Get the text between the given offsets.
    */
   bool TextSubstring(int32_t aStartOffset, int32_t aEndOfset,
@@ -304,16 +304,19 @@ public:
   uint32_t SelectedItemCount();
   ProxyAccessible* GetSelectedItem(uint32_t aIndex);
   bool IsItemSelected(uint32_t aIndex);
   bool AddItemToSelection(uint32_t aIndex);
   bool RemoveItemFromSelection(uint32_t aIndex);
   bool SelectAll();
   bool UnselectAll();
 
+  void TakeSelection();
+  void SetSelected(bool aSelect);
+
   bool DoAction(uint8_t aIndex);
   uint8_t ActionCount();
   void ActionDescriptionAt(uint8_t aIndex, nsString& aDescription);
   void ActionNameAt(uint8_t aIndex, nsString& aName);
   KeyBinding AccessKey();
   KeyBinding KeyboardShortcut();
   void AtkKeyBinding(nsString& aBinding);
 
--- a/accessible/jsat/AccessFu.css
+++ b/accessible/jsat/AccessFu.css
@@ -5,16 +5,17 @@
 #virtual-cursor-box {
   position: fixed;
   border: 1px solid orange;
   pointer-events: none;
   display: none;
   border-radius: 2px;
   box-shadow: 1px 1px 1px #444;
   display: none;
+  z-index: 10;
 }
 
 #virtual-cursor-box.show {
   display: block;
 }
 
 #virtual-cursor-box > div {
   border-radius: 1px;
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -517,42 +517,45 @@ var Output = {
   },
 
   start: function start() {
     Cu.import('resource://gre/modules/Geometry.jsm');
   },
 
   stop: function stop() {
     if (this.highlightBox) {
-      Utils.win.document.documentElement.removeChild(this.highlightBox.get());
+      let doc = Utils.win.document;
+      (doc.body || doc.documentElement).documentElement.removeChild(
+        this.highlightBox.get());
       delete this.highlightBox;
     }
   },
 
   B2G: function B2G(aDetails) {
     Utils.dispatchChromeEvent('accessibility-output', aDetails);
   },
 
   Visual: function Visual(aDetail, aBrowser) {
     switch (aDetail.eventType) {
       case 'viewport-change':
       case 'vc-change':
       {
         let highlightBox = null;
         if (!this.highlightBox) {
+          let doc = Utils.win.document;
           // Add highlight box
           highlightBox = Utils.win.document.
             createElementNS('http://www.w3.org/1999/xhtml', 'div');
-          Utils.win.document.documentElement.appendChild(highlightBox);
+          let parent = doc.body || doc.documentElement;
+          parent.appendChild(highlightBox);
           highlightBox.id = 'virtual-cursor-box';
 
           // Add highlight inset for inner shadow
           highlightBox.appendChild(
-            Utils.win.document.createElementNS(
-              'http://www.w3.org/1999/xhtml', 'div'));
+            doc.createElementNS('http://www.w3.org/1999/xhtml', 'div'));
 
           this.highlightBox = Cu.getWeakReference(highlightBox);
         } else {
           highlightBox = this.highlightBox.get();
         }
 
         let padding = aDetail.padding;
         let r = AccessFu.adjustContentBounds(aDetail.bounds, aBrowser, true);
--- a/accessible/jsat/EventManager.jsm
+++ b/accessible/jsat/EventManager.jsm
@@ -282,18 +282,22 @@ this.EventManager.prototype = {
        if (this.inTest) {
         this.sendMsgFunc("AccessFu:Focused");
        }
        break;
       }
       case Events.DOCUMENT_LOAD_COMPLETE:
       {
         let position = this.contentControl.vc.position;
+        // Check if position is in the subtree of the DOCUMENT_LOAD_COMPLETE
+        // event's dialog accesible or accessible document
+        let subtreeRoot = aEvent.accessible.role === Roles.DIALOG ?
+          aEvent.accessible : aEvent.accessibleDocument;
         if (aEvent.accessible === aEvent.accessibleDocument ||
-            (position && Utils.isInSubtree(position, aEvent.accessible))) {
+            (position && Utils.isInSubtree(position, subtreeRoot))) {
           // Do not automove into the document if the virtual cursor is already
           // positioned inside it.
           break;
         }
         this._preDialogPosition.set(aEvent.accessible.DOMNode, position);
         this.contentControl.autoMove(aEvent.accessible, { delay: 500 });
         break;
       }
--- a/accessible/jsat/Gestures.jsm
+++ b/accessible/jsat/Gestures.jsm
@@ -912,28 +912,28 @@ Swipe.prototype.compile = function Swipe
   let type = this.type;
   let detail = compileDetail(type, this.points,
     {x1: 'startX', y1: 'startY', x2: 'x', y2: 'y'});
   let deltaX = detail.deltaX;
   let deltaY = detail.deltaY;
   let edge = EDGE * Utils.dpi;
   if (Math.abs(deltaX) > Math.abs(deltaY)) {
     // Horizontal swipe.
-    let startPoints = [touch.x1 for (touch of detail.touches)];
+    let startPoints = detail.touches.map(touch => touch.x1);
     if (deltaX > 0) {
       detail.type = type + 'right';
       detail.edge = Math.min.apply(null, startPoints) <= edge;
     } else {
       detail.type = type + 'left';
       detail.edge =
         Utils.win.screen.width - Math.max.apply(null, startPoints) <= edge;
     }
   } else {
     // Vertical swipe.
-    let startPoints = [touch.y1 for (touch of detail.touches)];
+    let startPoints = detail.touches.map(touch => touch.y1);
     if (deltaY > 0) {
       detail.type = type + 'down';
       detail.edge = Math.min.apply(null, startPoints) <= edge;
     } else {
       detail.type = type + 'up';
       detail.edge =
         Utils.win.screen.height - Math.max.apply(null, startPoints) <= edge;
     }
--- a/accessible/jsat/OutputGenerator.jsm
+++ b/accessible/jsat/OutputGenerator.jsm
@@ -62,23 +62,38 @@ var OutputGenerator = {
                !(nameRule & IGNORE_EXPLICIT_NAME))));
     };
 
     let contextStart = this._getContextStart(aContext);
 
     if (this.outputOrder === OUTPUT_DESC_FIRST) {
       contextStart.forEach(addOutput);
       addOutput(aContext.accessible);
-      [addOutput(node) for // jshint ignore:line
-        (node of aContext.subtreeGenerator(true, ignoreSubtree))]; // jshint ignore:line
+      for (let node of aContext.subtreeGenerator(true, ignoreSubtree)) {
+        addOutput(node);
+      }
     } else {
-      [addOutput(node) for // jshint ignore:line
-        (node of aContext.subtreeGenerator(false, ignoreSubtree))]; // jshint ignore:line
+      for (let node of aContext.subtreeGenerator(false, ignoreSubtree)) {
+        addOutput(node);
+      }
       addOutput(aContext.accessible);
+
+      // If there are any documents in new ancestry, find a first one and place
+      // it in the beginning of the utterance.
+      let doc, docIndex = contextStart.findIndex(
+        ancestor => ancestor.role === Roles.DOCUMENT);
+
+      if (docIndex > -1) {
+        doc = contextStart.splice(docIndex, 1)[0];
+      }
+
       contextStart.reverse().forEach(addOutput);
+      if (doc) {
+        output.unshift.apply(output, self.genForObject(doc, aContext));
+      }
     }
 
     return output;
   },
 
 
   /**
    * Generates output for an object.
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -679,92 +679,89 @@ BraillePresenter.prototype.textSelection
 this.Presentation = { // jshint ignore:line
   get presenters() {
     delete this.presenters;
     let presenterMap = {
       'mobile/android': [VisualPresenter, AndroidPresenter],
       'b2g': [VisualPresenter, B2GPresenter],
       'browser': [VisualPresenter, B2GPresenter, AndroidPresenter]
     };
-    this.presenters = [new P() for (P of presenterMap[Utils.MozBuildApp])]; // jshint ignore:line
+    this.presenters = presenterMap[Utils.MozBuildApp].map(P => new P());
     return this.presenters;
   },
 
   get displayedAccessibles() {
     delete this.displayedAccessibles;
     this.displayedAccessibles = new WeakMap();
     return this.displayedAccessibles;
   },
 
   pivotChanged: function Presentation_pivotChanged(
     aPosition, aOldPosition, aReason, aStartOffset, aEndOffset, aIsUserInput) {
     let context = new PivotContext(
       aPosition, aOldPosition, aStartOffset, aEndOffset);
     this.displayedAccessibles.set(context.accessible.document.window, context);
 
-    return [p.pivotChanged(context, aReason, aIsUserInput)
-      for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.pivotChanged(context, aReason, aIsUserInput));
   },
 
   actionInvoked: function Presentation_actionInvoked(aObject, aActionName) {
-    return [p.actionInvoked(aObject, aActionName) // jshint ignore:line
-      for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.actionInvoked(aObject, aActionName));
   },
 
   textChanged: function Presentation_textChanged(aAccessible, aIsInserted,
                                     aStartOffset, aLength, aText,
                                     aModifiedText) {
-    return [p.textChanged(aAccessible, aIsInserted, aStartOffset, aLength, // jshint ignore:line
-      aText, aModifiedText) for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.textChanged(aAccessible, aIsInserted,
+                                                  aStartOffset, aLength,
+                                                  aText, aModifiedText));
   },
 
   textSelectionChanged: function textSelectionChanged(aText, aStart, aEnd,
                                                       aOldStart, aOldEnd,
                                                       aIsFromUserInput) {
-    return [p.textSelectionChanged(aText, aStart, aEnd, aOldStart, aOldEnd, // jshint ignore:line
-      aIsFromUserInput) for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.textSelectionChanged(aText, aStart, aEnd,
+                                                           aOldStart, aOldEnd,
+                                                           aIsFromUserInput));
   },
 
   nameChanged: function nameChanged(aAccessible) {
-    return [ p.nameChanged(aAccessible) for (p of this.presenters) ]; // jshint ignore:line
+    return this.presenters.map(p => p.nameChanged(aAccessible));
   },
 
   valueChanged: function valueChanged(aAccessible) {
-    return [ p.valueChanged(aAccessible) for (p of this.presenters) ]; // jshint ignore:line
+    return this.presenters.map(p => p.valueChanged(aAccessible));
   },
 
   tabStateChanged: function Presentation_tabStateChanged(aDocObj, aPageState) {
-    return [p.tabStateChanged(aDocObj, aPageState) // jshint ignore:line
-      for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.tabStateChanged(aDocObj, aPageState));
   },
 
   viewportChanged: function Presentation_viewportChanged(aWindow) {
     let context = this.displayedAccessibles.get(aWindow);
-    return [p.viewportChanged(aWindow, context) // jshint ignore:line
-      for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.viewportChanged(aWindow, context));
   },
 
   editingModeChanged: function Presentation_editingModeChanged(aIsEditing) {
-    return [p.editingModeChanged(aIsEditing) for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.editingModeChanged(aIsEditing));
   },
 
   announce: function Presentation_announce(aAnnouncement) {
     // XXX: Typically each presenter uses the UtteranceGenerator,
     // but there really isn't a point here.
-    return [p.announce(UtteranceGenerator.genForAnnouncement(aAnnouncement)) // jshint ignore:line
-      for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.announce(UtteranceGenerator.genForAnnouncement(aAnnouncement)));
   },
 
   noMove: function Presentation_noMove(aMoveMethod) {
-    return [p.noMove(aMoveMethod) for each (p in this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.noMove(aMoveMethod));
   },
 
   liveRegion: function Presentation_liveRegion(aAccessible, aIsPolite, aIsHide,
     aModifiedText) {
     let context;
     if (!aModifiedText) {
       context = new PivotContext(aAccessible, null, -1, -1, true,
         aIsHide ? true : false);
     }
-    return [p.liveRegion(context, aIsPolite, aIsHide, aModifiedText) // jshint ignore:line
-      for (p of this.presenters)]; // jshint ignore:line
+    return this.presenters.map(p => p.liveRegion(context, aIsPolite, aIsHide,
+                                                 aModifiedText));
   }
 };
--- a/accessible/jsat/Utils.jsm
+++ b/accessible/jsat/Utils.jsm
@@ -206,21 +206,20 @@ this.Utils = { // jshint ignore:line
     this.isContentProcess =
       Services.appinfo.processType == Services.appinfo.PROCESS_TYPE_CONTENT;
     return this.isContentProcess;
   },
 
   localize: function localize(aOutput) {
     let outputArray = Array.isArray(aOutput) ? aOutput : [aOutput];
     let localized =
-      [this.stringBundle.get(details) for (details of outputArray)]; // jshint ignore:line
+      outputArray.map(details => this.stringBundle.get(details));
     // Clean up the white space.
-    let trimmed;
-    return [trimmed for (word of localized) if (word && // jshint ignore:line
-      (trimmed = word.trim()))]; // jshint ignore:line
+    return localized.filter(word => word).map(word => word.trim()).
+      filter(trimmed => trimmed);
   },
 
   get stringBundle() {
     delete this.stringBundle;
     let bundle = Services.strings.createBundle(
       'chrome://global/locale/AccessFu.properties');
     this.stringBundle = {
       get: function stringBundle_get(aDetails = {}) {
@@ -340,16 +339,31 @@ this.Utils = { // jshint ignore:line
   get dpi() {
     delete this.dpi;
     this.dpi = this.winUtils.displayDPI;
     return this.dpi;
   },
 
   isInSubtree: function isInSubtree(aAccessible, aSubTreeRoot) {
     let acc = aAccessible;
+
+    // If aSubTreeRoot is an accessible document, we will only walk up the
+    // ancestry of documents and skip everything else.
+    if (aSubTreeRoot instanceof Ci.nsIAccessibleDocument) {
+      while (acc) {
+        let parentDoc = acc instanceof Ci.nsIAccessibleDocument ?
+          acc.parentDocument : acc.document;
+        if (parentDoc === aSubTreeRoot) {
+          return true;
+        }
+        acc = parentDoc;
+      }
+      return false;
+    }
+
     while (acc) {
       if (acc == aSubTreeRoot) {
         return true;
       }
 
       try {
         acc = acc.parent;
       } catch (x) {
@@ -814,19 +828,19 @@ PivotContext.prototype = {
 
   /*
    * This is a list of the accessible's ancestry up to the common ancestor
    * of the accessible and the old accessible. It is useful for giving the
    * user context as to where they are in the heirarchy.
    */
   get newAncestry() {
     if (!this._newAncestry) {
-      this._newAncestry = this._ignoreAncestry ? [] : [currentAncestor for ( // jshint ignore:line
-        [index, currentAncestor] of Iterator(this.currentAncestry)) if ( // jshint ignore:line
-          currentAncestor !== this.oldAncestry[index])]; // jshint ignore:line
+      this._newAncestry = this._ignoreAncestry ? [] :
+        this.currentAncestry.filter(
+          (currentAncestor, i) => currentAncestor !== this.oldAncestry[i]);
     }
     return this._newAncestry;
   },
 
   /*
    * Traverse the accessible's subtree in pre or post order.
    * It only includes the accessible's visible chidren.
    * Note: needSubtree is a function argument that can be used to determine
@@ -842,19 +856,23 @@ PivotContext.prototype = {
       if (this._includeInvisible) {
         include = true;
       } else {
         include = !Utils.isHidden(child);
       }
       if (include) {
         if (aPreorder) {
           yield child;
-          [yield node for (node of this._traverse(child, aPreorder, aStop))]; // jshint ignore:line
+          for (let node of this._traverse(child, aPreorder, aStop)) {
+            yield node;
+          }
         } else {
-          [yield node for (node of this._traverse(child, aPreorder, aStop))]; // jshint ignore:line
+          for (let node of this._traverse(child, aPreorder, aStop)) {
+            yield node;
+          }
           yield child;
         }
       }
       child = child.nextSibling;
     }
   },
 
   /**
@@ -966,25 +984,23 @@ PivotContext.prototype = {
     cellInfo.rowExtent = cellInfo.current.rowExtent;
     cellInfo.columnExtent = cellInfo.current.columnExtent;
     cellInfo.columnIndex = cellInfo.current.columnIndex;
     cellInfo.rowIndex = cellInfo.current.rowIndex;
 
     cellInfo.columnHeaders = [];
     if (cellInfo.columnChanged && cellInfo.current.role !==
       Roles.COLUMNHEADER) {
-      cellInfo.columnHeaders = [headers for (headers of getHeaders( // jshint ignore:line
-        cellInfo.current.columnHeaderCells))];
+      cellInfo.columnHeaders = [...getHeaders(cellInfo.current.columnHeaderCells)];
     }
     cellInfo.rowHeaders = [];
     if (cellInfo.rowChanged &&
         (cellInfo.current.role === Roles.CELL ||
          cellInfo.current.role === Roles.MATHML_CELL)) {
-      cellInfo.rowHeaders = [headers for (headers of getHeaders( // jshint ignore:line
-        cellInfo.current.rowHeaderCells))];
+      cellInfo.rowHeaders = [...getHeaders(cellInfo.current.rowHeaderCells)];
     }
 
     this._cells.set(domNode, cellInfo);
     return cellInfo;
   },
 
   get bounds() {
     if (!this._bounds) {
new file mode 100644
--- /dev/null
+++ b/accessible/tests/crashtests/448064.xhtml
@@ -0,0 +1,73 @@
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+</head>
+<body>
+<div id="mw_b">
+<div id="mw_f">
+<div id="mw_g" style="display: none;"/>
+</div>
+</div>
+
+<div id="mw_c" style="display: none;">
+<div id="mw_d">
+<div id="mw_e"></div>
+</div>
+</div>
+
+<input id="mw_a"/>
+
+
+<script>
+function dumpAccessibleNode(aNode, level) {
+	var msg = "";
+	
+	try {
+		msg += "name=\"" + aNode.name + "\" ";
+	} catch (e) {
+		msg += " noName ";
+	}
+	
+	dump(msg + '\n');
+}
+
+
+function dumpAccessibleTree(aNode, level) {
+netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+	level = level || 0;
+
+	dumpAccessibleNode(aNode, level);
+	try {	
+		var child = aNode.firstChild;
+		while (child) {
+			dumpAccessibleTree(child, level + 1);
+			child = child.nextSibling;
+		}
+	} catch (e) {
+		dump("Error visiting child nodes: " + e + '\n');
+	}
+}
+
+function A(o) { 
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  var acc = Components.classes['@mozilla.org/accessibleRetrieval;1']
+                         .getService(Components.interfaces.nsIAccessibleRetrieval);
+  return acc.getAccessibleFor(o);
+}
+
+function beginAccessible() {
+  netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
+  dumpAccessibleTree(A(document),0);
+}
+setTimeout(beginAccessible, 100);
+
+
+setTimeout(doe, 200);
+function doe() {
+   document.getElementById('mw_a').appendChild(document.getElementById('mw_b'));
+   document.getElementById('mw_c').appendChild(document.getElementById('mw_d'));
+   document.getElementById('mw_e').appendChild(document.getElementById('mw_f')); 
+   document.getElementById('mw_g').appendChild(document.getElementById('mw_b')); 
+}
+</script>
+</body>
+</html>
\ No newline at end of file
--- a/accessible/tests/crashtests/crashtests.list
+++ b/accessible/tests/crashtests/crashtests.list
@@ -1,2 +1,3 @@
-# Disabled because it causes assertions/crashes in later crashtests, see bug 918246
+# Disabled because they cause assertions/crashes in later crashtests, see bug 918246
+skip load 448064.xhtml
 skip load 471493.xul
--- a/accessible/tests/mochitest/jsat/jsatcommon.js
+++ b/accessible/tests/mochitest/jsat/jsatcommon.js
@@ -161,17 +161,17 @@ var AccessFuTest = {
     prefs.push.apply(prefs, aAdditionalPrefs);
 
     SpecialPowers.pushPrefEnv({ 'set': prefs }, function () {
       if (AccessFuTest._waitForExplicitFinish) {
         // Run all test functions asynchronously.
         AccessFuTest.nextTest();
       } else {
         // Run all test functions synchronously.
-        [testFunc() for (testFunc of gTestFuncs)]; // jshint ignore:line
+        gTestFuncs.forEach(testFunc => testFunc());
         AccessFuTest.finish();
       }
     });
   }
 };
 
 function AccessFuContentTest(aFuncResultPairs) {
   this.queue = aFuncResultPairs;
--- a/accessible/tests/mochitest/jsat/test_content_integration.html
+++ b/accessible/tests/mochitest/jsat/test_content_integration.html
@@ -27,23 +27,23 @@
       iframe.id = 'iframe';
       iframe.mozbrowser = true;
       iframe.addEventListener('mozbrowserloadend', function () {
       var contentTest = new AccessFuContentTest(
         [
           // Simple traversal forward
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(
-            ['Phone status bar', 'Traversal Rule test document'],
+            ['Traversal Rule test document', 'Phone status bar'],
             { focused: 'body' })],
           [ContentMessages.simpleMovePrevious, new ExpectedNoMove()],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext, new ExpectedCursorChange(
-            ['wow', {'string': 'headingLevel', 'args': [1]} ,'such app'],
+            ['such app', 'wow', {'string': 'headingLevel', 'args': [1]}],
             { focused: 'iframe' })],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'},
             {'string': 'checkbutton'}, {'string': 'listStart'},
             {'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
 
           // check checkbox
           [ContentMessages.activateCurrent(),
@@ -74,17 +74,17 @@
           [ContentMessages.activateCurrent(),
            new ExpectedClickAction({ no_android: true }),
            new ExpectedSwitchAction(false)],
           [ContentMessages.simpleMovePrevious,
            new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
           [ContentMessages.simpleMovePrevious,
            new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
           [ContentMessages.simpleMovePrevious,
-           new ExpectedCursorChange(['much range', '6', {'string': 'slider'}, 'such app'])],
+           new ExpectedCursorChange(['such app', 'much range', '6', {'string': 'slider'}])],
           [ContentMessages.moveOrAdjustDown(), new ExpectedValueChange('5')],
           [ContentMessages.androidScrollForward(), new ExpectedValueChange('6')],
           [ContentMessages.androidScrollBackward(), new ExpectedValueChange('5')],
           [ContentMessages.simpleMovePrevious,
            new ExpectedCursorChange(['much range', {'string': 'label'}])],
           [ContentMessages.simpleMovePrevious,
            new ExpectedCursorChange(['many option', {'string': 'stateChecked'},
             {'string': 'checkbutton'}, {'string': 'listStart'},
@@ -101,32 +101,32 @@
            new ExpectedCursorChange(['Phone status bar'])],
 
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           // Moving to the absolute last item from an embedded document
           // fails. Bug 972035.
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(
-            ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+            ['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
           // Move from an inner frame to the last element in the parent doc
           [ContentMessages.simpleMoveLast,
             new ExpectedCursorChange(
               ['slider', '0', {'string': 'slider'}], { b2g_todo: true })],
 
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.moveOrAdjustDown('FormElement'),
            new ExpectedCursorChange(['Back', {"string": "pushbutton"}])],
           [ContentMessages.moveOrAdjustDown('FormElement'),
-           new ExpectedCursorChange(['many option', {'string': 'stateNotChecked'},
+           new ExpectedCursorChange(['such app', 'many option', {'string': 'stateNotChecked'},
             {'string': 'checkbutton'}, {'string': 'listStart'},
-            {'string': 'list'}, {'string': 'listItemsCount', 'count': 1}, 'such app'])],
+            {'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
           [ContentMessages.moveOrAdjustDown('FormElement'),
            new ExpectedCursorChange(['much range', '5', {'string': 'slider'}])],
           // Calling AdjustOrMove should adjust the range.
           [ContentMessages.moveOrAdjustDown('FormElement'),
            new ExpectedValueChange('4')],
           [ContentMessages.moveOrAdjustUp('FormElement'),
            new ExpectedValueChange('5')],
           [ContentMessages.simpleMovePrevious,
@@ -138,165 +138,167 @@
           [ContentMessages.moveOrAdjustUp('FormElement'),
            new ExpectedCursorChange(['Back', {"string": "pushbutton"}])],
 
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Moving to the absolute first item from an embedded document
           // fails. Bug 972035.
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+           new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
           [ContentMessages.simpleMoveNext, new ExpectedCursorChange(
             ['many option', {'string': 'stateNotChecked'},
              {'string': 'checkbutton'}, {'string': 'listStart'},
              {'string': 'list'}, {'string': 'listItemsCount', 'count': 1}])],
           [ContentMessages.simpleMoveFirst,
             new ExpectedCursorChange(['Phone status bar'], { b2g_todo: true })],
 
           // Reset cursors
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Current virtual cursor's position's name changes
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.focusSelector('button#fruit', false),
            new ExpectedCursorChange(['apple', {'string': 'pushbutton'}])],
           [doc.defaultView.renameFruit, new ExpectedNameChange('banana')],
 
           // Name and value changes inside a live-region (no cursor present)
           [doc.defaultView.renameSlider,
             new ExpectedNameChange('mover')],
           [doc.defaultView.changeSliderValue,
             new ExpectedValueChange('medium')],
 
           // Blur button and reset cursor
           [ContentMessages.focusSelector('button#fruit', true), null],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Move cursor with focus in outside document
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.focusSelector('button#home', false),
            new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
 
           // Blur button and reset cursor
           [ContentMessages.focusSelector('button#home', true), null],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Set focus on element outside of embedded frame while
           // cursor is in frame
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+           new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
           [ContentMessages.focusSelector('button#home', false),
            new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
 
           // Blur button and reset cursor
           [ContentMessages.focusSelector('button#home', true), null],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // XXX: Set focus on iframe itself.
           // XXX: Set focus on element in iframe when cursor is outside of it.
           // XXX: Set focus on element in iframe when cursor is in iframe.
 
           // aria-hidden element that the virtual cursor is positioned on
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [doc.defaultView.ariaHideBack,
            new ExpectedCursorChange(
-            ["wow", {"string": "headingLevel","args": [1]}, "such app"])],
+            ["such app", "wow", {"string": "headingLevel","args": [1]}])],
           // Changing aria-hidden attribute twice and making sure that the event
           // is fired only once when the actual change happens.
           [doc.defaultView.ariaHideBack],
           [doc.defaultView.ariaShowBack],
           [ContentMessages.simpleMovePrevious,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // aria-hidden on the iframe that has the vc.
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+           new ExpectedCursorChange(['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
           [doc.defaultView.ariaHideIframe,
            new ExpectedCursorChange(['Home', {'string': 'pushbutton'}])],
           [doc.defaultView.ariaShowIframe],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // aria-hidden element and auto Move
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [doc.defaultView.ariaHideBack],
           [ContentMessages.focusSelector('button#back', false),
             // Must not speak Back button as it is aria-hidden
            new ExpectedCursorChange(
-             ["wow", {"string": "headingLevel","args": [1]}, "such app"])],
+             ["such app", "wow", {"string": "headingLevel","args": [1]}])],
           [doc.defaultView.ariaShowBack],
           [ContentMessages.focusSelector('button#back', true), null],
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Open dialog in outer doc, while cursor is also in outer doc
           [ContentMessages.simpleMoveLast,
-           new ExpectedCursorChange(['mover'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'mover',
+             'medium', {'string': 'slider'}])],
           [doc.defaultView.showAlert,
             new ExpectedCursorChange(['This is an alert!',
               {'string': 'headingLevel', 'args': [1]},
               {'string': 'dialog'}])],
 
           [doc.defaultView.hideAlert,
-           new ExpectedCursorChange(['mover'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'mover',
+             'medium', {'string': 'slider'}])],
 
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Open dialog in outer doc, while cursor is in inner frame
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(["Back", {"string": "pushbutton"}])],
           [ContentMessages.simpleMoveNext,
            new ExpectedCursorChange(
-            ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+            ['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
           [doc.defaultView.showAlert, new ExpectedCursorChange(['This is an alert!',
                     {'string': 'headingLevel', 'args': [1]},
                     {'string': 'dialog'}])],
 
           [ContentMessages.simpleMoveNext,
             new ExpectedCursorChange(['Do you agree?'])],
           [ContentMessages.simpleMoveNext,
             new ExpectedCursorChange(['Yes', {'string': 'pushbutton'}])],
           [ContentMessages.activateCurrent(),
            new ExpectedClickAction(),
            new ExpectedCursorChange(
-            ['wow', {'string': 'headingLevel', 'args': [1]}, 'such app'])],
+            ['such app', 'wow', {'string': 'headingLevel', 'args': [1]}])],
 
           [ContentMessages.clearCursor, 'AccessFu:CursorCleared'],
 
           // Open dialog, then focus on something when closing
           [ContentMessages.simpleMoveNext,
-           new ExpectedCursorChange(['Phone status bar', 'Traversal Rule test document'])],
+           new ExpectedCursorChange(['Traversal Rule test document', 'Phone status bar'])],
           [doc.defaultView.showAlert,
            new ExpectedCursorChange(['This is an alert!',
             {'string': 'headingLevel', 'args': [1]}, {'string': 'dialog'}])],
 
           [function hideAlertAndFocusHomeButton() {
             doc.defaultView.hideAlert();
             doc.querySelector('button#home').focus();
-          }, new ExpectedCursorChange(['Home', {'string': 'pushbutton'},
-            'Traversal Rule test document'])],
+          }, new ExpectedCursorChange(['Traversal Rule test document',
+            'Home', {'string': 'pushbutton'}])],
           [ContentMessages.simpleMoveNext,
             new ExpectedCursorChange(['banana', {'string': 'pushbutton'}])]
           [ContentMessages.simpleMoveNext, new ExpectedNoMove()]
         ]);
 
         addA11yLoadEvent(function() {
           contentTest.start(function () {
             closeBrowserWindow();
--- a/accessible/tests/mochitest/jsat/test_content_text.html
+++ b/accessible/tests/mochitest/jsat/test_content_text.html
@@ -26,19 +26,19 @@
   <script type="application/javascript">
     function doTest() {
       var doc = currentTabDocument();
       var textTest = new AccessFuContentTest(
         [
           // Read-only text tests
           [ContentMessages.simpleMoveFirst,
            new ExpectedCursorChange(
-            ['These are my awards, Mother. From Army. The seal is for ' +
-             'marksmanship, and the gorilla is for sand racing.',
-             'Text content test document'])],
+            ['Text content test document', 'These are my awards, Mother. ' +
+             'From Army. The seal is for marksmanship, and the gorilla is ' +
+             'for sand racing.'])],
           [ContentMessages.moveNextBy('word'),
            new ExpectedCursorTextChange('These', 0, 5)],
           [ContentMessages.moveNextBy('word'),
            new ExpectedCursorTextChange('are', 6, 9)],
           [ContentMessages.moveNextBy('word'),
            new ExpectedCursorTextChange('my', 10, 12)],
           [ContentMessages.moveNextBy('word'),
            new ExpectedCursorTextChange('awards,', 13, 20)],
--- a/accessible/tests/mochitest/jsat/test_live_regions.html
+++ b/accessible/tests/mochitest/jsat/test_live_regions.html
@@ -60,100 +60,98 @@
       expected: {
         "eventType": "liveregion-change",
         "data": [{"string": "hidden"}, "I will be hidden"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [hide(id) for (id of ["to_hide1", "to_hide2", "to_hide3", "to_hide4"])];
+        ["to_hide1", "to_hide2", "to_hide3", "to_hide4"].forEach(id => hide(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": [{"string": "hidden"}, "I will be hidden"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [hide(id) for (id of ["to_hide_descendant1", "to_hide_descendant2",
-          "to_hide_descendant3", "to_hide_descendant4"])];
+        ["to_hide_descendant1", "to_hide_descendant2",
+         "to_hide_descendant3", "to_hide_descendant4"].forEach(id => hide(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [show(id) for (id of ["to_show1", "to_show2", "to_show3", "to_show4"])];
+        ["to_show1", "to_show2", "to_show3", "to_show4"].forEach(id => show(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [show(id) for (id of ["to_show_descendant1", "to_show_descendant2",
-          "to_show_descendant3", "to_show_descendant4"])];
+        ["to_show_descendant1", "to_show_descendant2",
+         "to_show_descendant3", "to_show_descendant4"].forEach(id => show(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": [{"string": "hidden"}, "I will be hidden"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [ariaHide(id) for (id of ["to_hide5", "to_hide6", "to_hide7",
-          "to_hide8", "to_hide9"])];
+        ["to_hide5", "to_hide6", "to_hide7", "to_hide8", "to_hide9"].forEach(id => ariaHide(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": [{"string": "hidden"}, "I will be hidden"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [ariaHide(id) for (id of ["to_hide_descendant5", "to_hide_descendant6",
-          "to_hide_descendant7", "to_hide_descendant8"])];
+        ["to_hide_descendant5", "to_hide_descendant6",
+         "to_hide_descendant7", "to_hide_descendant8"].forEach(id => ariaHide(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [ariaShow(id) for (id of ["to_show5", "to_show6", "to_show7",
-          "to_show8", "to_show9"])];
+        ["to_show5", "to_show6", "to_show7", "to_show8", "to_show9"].forEach(id => ariaShow(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": true
         }
       },
       action: function action() {
-        [ariaShow(id) for (id of ["to_show_descendant5", "to_show_descendant6",
-          "to_show_descendant7", "to_show_descendant8"])];
+        ["to_show_descendant5", "to_show_descendant6",
+         "to_show_descendant7", "to_show_descendant8"].forEach(id => ariaShow(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": [{"string": "hidden"}, "I will be hidden"],
         "options": {
           "enqueue": false
         }
@@ -176,29 +174,28 @@
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": false
         }
       },
       action: function action() {
-        [show(id) for (id of ["to_show_live_off", "to_show_live_assertive"])];
+        ["to_show_live_off", "to_show_live_assertive"].forEach(id => show(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["I will be shown"],
         "options": {
           "enqueue": false
         }
       },
       action: function action() {
-        [ariaShow(id) for (id of ["to_show_live_off2",
-          "to_show_live_assertive2"])];
+        ["to_show_live_off2", "to_show_live_assertive2"].forEach(id => ariaShow(id));
       }
     }, {
       expected: {
         "eventType": "liveregion-change",
         "data": ["Text Added"],
         "options": {
           "enqueue": false
         }
@@ -467,9 +464,9 @@
     <div aria-live="assertive" aria-relevant="text">
       <p id="text_add_descendant2"></p>
     </div>
     <div aria-live="polite" aria-relevant="all">
       <p id="text_remove_descendant2">Descendant Text Removed</p>
     </div>
   </div>
 </body>
-</html>
\ No newline at end of file
+</html>
--- a/accessible/tests/mochitest/table/a11y.ini
+++ b/accessible/tests/mochitest/table/a11y.ini
@@ -1,10 +1,11 @@
 [DEFAULT]
 
+[test_css_tables.html]
 [test_headers_ariagrid.html]
 [test_headers_ariatable.html]
 [test_headers_listbox.xul]
 [test_headers_table.html]
 [test_headers_tree.xul]
 [test_indexes_ariagrid.html]
 [test_indexes_listbox.xul]
 [test_indexes_table.html]
new file mode 100644
--- /dev/null
+++ b/accessible/tests/mochitest/table/test_css_tables.html
@@ -0,0 +1,116 @@
+<!DOCTYPE HTML PUBLIC "-//w3c//dtd html 4.0 transitional//en">
+<html>
+<head>
+  <title>CSS display:table is not a table</title>
+  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
+  <link rel="stylesheet" type="text/css"
+        href="chrome://mochikit/content/tests/SimpleTest/test.css" />
+
+  <script type="application/javascript"
+          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
+
+  <script type="application/javascript"
+          src="../common.js"></script>
+  <script type="application/javascript"
+          src="../role.js"></script>
+
+  <script type="application/javascript">
+
+    function doTest()
+    {
+      //////////////////////////////////////////////////////////////////////////
+      // elements with display:table
+
+      // only display:table
+      var accTree =
+        { SECTION: [
+          { TEXT_LEAF: [ ] }
+        ] };
+      testAccessibleTree("table1", accTree);
+
+      // only display:table and display:table-cell
+      accTree =
+        { SECTION: [
+          { SECTION: [
+            { TEXT_LEAF: [ ] }
+	        ] }
+      ] };
+      testAccessibleTree("table2", accTree);
+
+      // display:table, display:table-row, and display:table-cell
+      accTree =
+        { SECTION: [
+          { SECTION: [
+            { TEXT_LEAF: [ ] }
+          ] }
+      ] };
+      testAccessibleTree("table3", accTree);
+
+      // display:table, display:table-row-group, display:table-row, and display:table-cell
+      accTree =
+        { SECTION: [
+          { SECTION: [
+            { TEXT_LEAF: [ ] }
+          ] }
+        ] };
+      testAccessibleTree("table4", accTree);
+
+      // display:inline-table
+      accTree =
+        { TEXT_CONTAINER: [
+          { TEXT_CONTAINER: [
+            { TEXT_LEAF: [ ] }
+          ] }
+        ] };
+      testAccessibleTree("table5", accTree);
+
+      SimpleTest.finish();
+    }
+
+    SimpleTest.waitForExplicitFinish();
+    addA11yLoadEvent(doTest);
+  </script>
+</head>
+
+<body>
+  <a target="_blank"
+     title=" div with display:table exposes table semantics"
+     href="https://bugzilla.mozilla.org/show_bug.cgi?id=1007975">Mozilla Bug 1007975</a>
+
+  <p id="display"></p>
+  <div id="content" style="display: none"></div>
+  <pre id="test">
+  </pre>
+
+  <div id="table1" style="display:table">
+    table1
+  </div>
+
+  <div id="table2" style="display:table">
+    <div style="display:table-cell">table2</div>
+  </div>
+
+  <div id="table3" style="display:table">
+    <div style="display:table-row">
+      <div style="display:table-cell">table3</div>
+    </div>
+  </div>
+
+  <div id="table4" style="display:table">
+    <div style="display:table-row-group">
+      <div style="display:table-row">
+        <div style="display:table-cell">table4</div>
+      </div>
+    </div>
+  </div>
+
+  <div>
+    <span id="table5" style="display:inline-table">
+      <span style="display:table-row">
+        <span style="display:table-cell">table5</div>
+      </span>
+    </span>
+  </div>
+      
+</body>
+</html>
--- a/accessible/tests/mochitest/table/test_indexes_table.html
+++ b/accessible/tests/mochitest/table/test_indexes_table.html
@@ -123,43 +123,30 @@ https://bugzilla.mozilla.org/show_bug.cg
         [-1, -1, -1, -1, -1],
         [ 3,  4,  5, -1, -1],
         [ 6,  6,  7, -1, -1],
         [ 8,  9,  7, -1, -1],
         [ 10, 9,  7, 11, 12]
       ];
       testTableIndexes("tableinsane6", idxes);
 
-      //////////////////////////////////////////////////////////////////////////
-      // csstablecrazy1 (no rows)
-      idxes = [
-        [0,  1]
-      ];
-
-      testTableIndexes("csstablecrazy1", idxes);
-
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 <body>
 
   <a target="_blank"
      title="GetIndexAt and GetRowAtIndex and GetColumnAtIndex on HTML tables are inconsistent"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=410052">
    Bug 410052
   </a>
-  <a target="_blank"
-     title="Table cell accessibles not exposed for CSS table without table-row "
-     href="https://bugzilla.mozilla.org/show_bug.cgi?id=834120">
-   Bug 834120
-  </a>
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
   </pre>
 
   <!--
     If you change the structure of the table please make sure to change
     the indexes count in 'for' statement in the script above.
@@ -414,16 +401,10 @@ https://bugzilla.mozilla.org/show_bug.cg
       <tr>
         <td colspan="3">10</td>
         <td>11</td>
         <td>12</td>
       </tr>
     </tbody>
   </table>
 
-  <div id="csstablecrazy1"
-       style="width: 100%; border: 1px solid red; display:table;">
-    <div style="display:table-cell;">cell1</div>
-    <div style="display:table-cell;">cell2</div>
-  </div>
-
 </body>
 </html>
--- a/accessible/tests/mochitest/table/test_layoutguess.html
+++ b/accessible/tests/mochitest/table/test_layoutguess.html
@@ -111,19 +111,16 @@
       testAttrs("table21.3", attr, true);
       testAttrs("table21.4", attr, true);
       testAttrs("table21.5", attr, true);
       testAttrs("table21.6", attr, true);
 
       // layout table having datatable="0" attribute and containing data table structure (tfoot element)
       testAttrs("table22", attr, true);
 
-      // css table with non-table tag
-      testAttrs("table23", attr, true);
-
       SimpleTest.finish();
     }
 
     SimpleTest.waitForExplicitFinish();
     addA11yLoadEvent(doTest);
   </script>
 </head>
 <body>
@@ -134,21 +131,16 @@
     Mozilla Bug 495388
   </a>
   <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=690222"
      title="Data table elements used to determine layout-guess attribute shouldn't be picked from nested tables">
     Mozilla Bug 690222
   </a>
   <a target="_blank"
-     href="https://bugzilla.mozilla.org/show_bug.cgi?id=693948"
-     title="Expose layout-guess: true object attribute on CSS table accessible">
-    Mozilla Bug 693948
-  </a>
-  <a target="_blank"
      href="https://bugzilla.mozilla.org/show_bug.cgi?id=696975"
      title="Extend the list of legitimate data table structures">
     Mozilla Bug 696975
   </a>
 
   <p id="display"></p>
   <div id="content" style="display: none"></div>
   <pre id="test">
@@ -339,38 +331,38 @@
   <table id="table12">
     <tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
     <tr><td>Col1</td><td>Col2</td><td>Col3</td><td>Col4</td><td>Col5</td></tr>
   </table>
 
   <!-- table with a bordered cell -->
   <table id="table13" border="1" width="100%" bordercolor="#0000FF">
     <tr>
-      <td bordercolor="#000000"></td>
-      <td bordercolor="#000000"></td>
-      <td bordercolor="#000000"></td>
+      <td bordercolor="#000000"> </td>
+      <td bordercolor="#000000"> </td>
+      <td bordercolor="#000000"> </td>
     </tr>
     <tr>
-      <td bordercolor="#000000"></td>
-      <td bordercolor="#000000"></td>
-      <td bordercolor="#000000"></td>
+      <td bordercolor="#000000"> </td>
+      <td bordercolor="#000000"> </td>
+      <td bordercolor="#000000"> </td>
     </tr>
   </table> 
 
   <!-- table with alternating row background colors -->
   <table id="table14" width="100%">
     <tr style="background-color: #0000FF;">
-      <td></td>
-      <td></td>
-      <td></td>
+      <td> </td>
+      <td> </td>
+      <td> </td>
     </tr>
     <tr style="background-color: #00FF00;">
-      <td></td>
-      <td></td>
-      <td></td>
+      <td> </td>
+      <td> </td>
+      <td> </td>
     </tr>
   </table> 
 
   <!-- table with 3 columns and 21 rows -->
   <table id="table15" border="0">
     <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
     <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
     <tr><td>Col1</td><td>Col2</td><td>Col3</td></tr>
@@ -505,18 +497,10 @@
   <table id="table22" datatable="0">
     <tfoot>
       <tr>
         <td>Cell1</td><td>cell2</td>
       </tr>
     </tfoot>
   </table>
 
-  <!-- css table with noon-table tag -->
-  <div id="table23" style="display:table;">
-    <div style="display:table-row;">
-      <div style="display:table-cell;">Row 1, column 1</div>
-      <div style="display:table-cell;">Row 1, column 2</div>
-      <div style="display:table-cell;">Row 1, column 3</div>
-    </div>
-  </div>
 </body>
 </html>
--- a/accessible/tests/mochitest/table/test_table_2.html
+++ b/accessible/tests/mochitest/table/test_table_2.html
@@ -44,21 +44,16 @@ function doTest()
     testRole(accTable4, ROLE_TABLE);
 
     is(accTable4.getCellAt(0,0).firstChild.name, "cell0", "wrong cell");
     is(accTable4.getCellAt(0,1).firstChild.name, "cell1", "wrong cell");
     is(accTable4.getCellAt(1,0).firstChild.name, "cell2", "wrong cell");
     is(accTable4.getCellAt(1,1).firstChild.name, "cell3", "wrong cell");
   }
 
-  // test crazy table
-  var table6 = getAccessible("table6", [nsIAccessibleTable]);
-  ok(!table6.getCellAt(0, 0),
-     "We don't expect cell accessible for crazy table 6!");
-
   SimpleTest.finish();
 }
 SimpleTest.waitForExplicitFinish();
 addA11yLoadEvent(doTest);
   </script>
  </head>
 
  <body >
@@ -84,16 +79,11 @@ addA11yLoadEvent(doTest);
      <td>cell1</td>
     </tr>
     <tr>
      <td>cell2</td>
      <td>cell3</td>
     </tr>
    </table>
 
-  <div style="display:table;" id="table6">
-    <input type="checkbox">
-    <a href="bar">Bad checkbox</a>
-  </div>
-
   </center>
  </body>
 </html>
--- a/accessible/windows/ProxyWrappers.h
+++ b/accessible/windows/ProxyWrappers.h
@@ -21,30 +21,35 @@ class ProxyAccessibleWrap : public Acces
   {
     mType = eProxyType;
     mBits.proxy = aProxy;
   }
 
   virtual void Shutdown() override
   {
     mBits.proxy = nullptr;
+    mStateFlags |= eIsDefunct;
   }
 };
 
 class HyperTextProxyAccessibleWrap : public HyperTextAccessibleWrap
 {
 public:
   HyperTextProxyAccessibleWrap(ProxyAccessible* aProxy) :
     HyperTextAccessibleWrap(nullptr, nullptr)
   {
     mType = eProxyType;
     mBits.proxy = aProxy;
   }
 
-  virtual void Shutdown() override { mBits.proxy = nullptr; }
+  virtual void Shutdown() override
+  {
+    mBits.proxy = nullptr;
+ mStateFlags |= eIsDefunct;
+  }
 };
 
 class DocProxyAccessibleWrap : public HyperTextProxyAccessibleWrap
 {
 public:
   DocProxyAccessibleWrap(ProxyAccessible* aProxy) :
     HyperTextProxyAccessibleWrap(aProxy)
   { mGenericTypes |= eDocument; }
--- a/accessible/windows/ia2/ia2Accessible.cpp
+++ b/accessible/windows/ia2/ia2Accessible.cpp
@@ -113,39 +113,39 @@ ia2Accessible::get_relation(long aRelati
     size_t targetSetCount = targetSets.Length();
     for (size_t i = 0; i < targetSetCount; i++) {
       uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
       MOZ_ASSERT(sRelationTypePairs[relTypeIdx].first == types[i]);
       if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
         continue;
 
       if (static_cast<size_t>(aRelationIndex) == i) {
-        nsTArray<nsRefPtr<Accessible>> targets;
+        nsTArray<RefPtr<Accessible>> targets;
         size_t targetCount = targetSets[i].Length();
         for (size_t j = 0; j < targetCount; j++)
           targets.AppendElement(WrapperFor(targetSets[i][j]));
 
-        nsRefPtr<ia2AccessibleRelation> rel =
+        RefPtr<ia2AccessibleRelation> rel =
           new ia2AccessibleRelation(types[i], Move(targets));
         rel.forget(aRelation);
         return S_OK;
       }
     }
 
     return E_INVALIDARG;
   }
 
   long relIdx = 0;
   for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs); idx++) {
     if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
       continue;
 
     RelationType relationType = sRelationTypePairs[idx].first;
     Relation rel = acc->RelationByType(relationType);
-    nsRefPtr<ia2AccessibleRelation> ia2Relation =
+    RefPtr<ia2AccessibleRelation> ia2Relation =
       new ia2AccessibleRelation(relationType, &rel);
     if (ia2Relation->HasTargets()) {
       if (relIdx == aRelationIndex) {
         ia2Relation.forget(aRelation);
         return S_OK;
       }
 
       relIdx++;
@@ -181,38 +181,38 @@ ia2Accessible::get_relations(long aMaxRe
                             static_cast<size_t>(aMaxRelations));
     size_t i = 0;
     while (i < count) {
       uint32_t relTypeIdx = static_cast<uint32_t>(types[i]);
       if (sRelationTypePairs[relTypeIdx].second == IA2_RELATION_NULL)
         continue;
 
       size_t targetCount = targetSets[i].Length();
-      nsTArray<nsRefPtr<Accessible>> targets(targetCount);
+      nsTArray<RefPtr<Accessible>> targets(targetCount);
       for (size_t j = 0; j < targetCount; j++)
         targets.AppendElement(WrapperFor(targetSets[i][j]));
 
-      nsRefPtr<ia2AccessibleRelation> rel =
+      RefPtr<ia2AccessibleRelation> rel =
         new ia2AccessibleRelation(types[i], Move(targets));
       rel.forget(aRelation + i);
       i++;
     }
 
     *aNRelations = i;
     return S_OK;
   }
 
   for (uint32_t idx = 0; idx < ArrayLength(sRelationTypePairs) &&
        *aNRelations < aMaxRelations; idx++) {
     if (sRelationTypePairs[idx].second == IA2_RELATION_NULL)
       continue;
 
     RelationType relationType = sRelationTypePairs[idx].first;
     Relation rel = acc->RelationByType(relationType);
-    nsRefPtr<ia2AccessibleRelation> ia2Rel =
+    RefPtr<ia2AccessibleRelation> ia2Rel =
       new ia2AccessibleRelation(relationType, &rel);
     if (ia2Rel->HasTargets()) {
       ia2Rel.forget(aRelation + (*aNRelations));
       (*aNRelations)++;
     }
   }
   return S_OK;
 
--- a/accessible/windows/ia2/ia2AccessibleHyperlink.cpp
+++ b/accessible/windows/ia2/ia2AccessibleHyperlink.cpp
@@ -21,17 +21,20 @@ STDMETHODIMP
 ia2AccessibleHyperlink::QueryInterface(REFIID iid, void** ppv)
 {
   if (!ppv)
     return E_INVALIDARG;
 
   *ppv = nullptr;
 
   if (IID_IAccessibleHyperlink == iid) {
-    if (!static_cast<AccessibleWrap*>(this)->IsLink())
+    auto accWrap = static_cast<AccessibleWrap*>(this);
+    if (accWrap->IsProxy() ?
+        !(accWrap->ProxyInterfaces() & Interfaces::HYPERLINK) :
+        !accWrap->IsLink())
       return E_NOINTERFACE;
 
     *ppv = static_cast<IAccessibleHyperlink*>(this);
     (reinterpret_cast<IUnknown*>(*ppv))->AddRef();
     return S_OK;
   }
 
   return ia2AccessibleAction::QueryInterface(iid, ppv);
--- a/accessible/windows/ia2/ia2AccessibleRelation.h
+++ b/accessible/windows/ia2/ia2AccessibleRelation.h
@@ -20,17 +20,17 @@ namespace mozilla {
 namespace a11y {
 
 class ia2AccessibleRelation final : public IAccessibleRelation
 {
 public:
   ia2AccessibleRelation(RelationType aType, Relation* aRel);
 
   ia2AccessibleRelation(RelationType aType,
-                        nsTArray<nsRefPtr<Accessible>>&& aTargets) :
+                        nsTArray<RefPtr<Accessible>>&& aTargets) :
     mType(aType), mTargets(Move(aTargets)) {}
 
   // IUnknown
   DECL_IUNKNOWN
 
   // IAccessibleRelation
   virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_relationType(
       /* [retval][out] */ BSTR *relationType);
@@ -54,17 +54,17 @@ public:
     { return mTargets.Length(); }
 
 private:
   ia2AccessibleRelation();
   ia2AccessibleRelation(const ia2AccessibleRelation&);
   ia2AccessibleRelation& operator = (const ia2AccessibleRelation&);
 
   RelationType mType;
-  nsTArray<nsRefPtr<Accessible> > mTargets;
+  nsTArray<RefPtr<Accessible> > mTargets;
 };
 
 
 /**
  * Gecko to IAccessible2 relation types map.
  */
 
 const WCHAR *const IA2_RELATION_NULL = L"";
--- a/accessible/windows/ia2/ia2AccessibleText.cpp
+++ b/accessible/windows/ia2/ia2AccessibleText.cpp
@@ -429,17 +429,18 @@ ia2AccessibleText::removeSelection(long 
 }
 
 STDMETHODIMP
 ia2AccessibleText::setCaretOffset(long aOffset)
 {
   A11Y_TRYBLOCK_BEGIN
 
     if (ProxyAccessible* proxy = HyperTextProxyFor(this)) {
-      return proxy->SetCaretOffset(aOffset) ? S_OK : E_INVALIDARG;
+      proxy->SetCaretOffset(aOffset);
+      return S_OK;
     }
 
   HyperTextAccessible* textAcc = static_cast<HyperTextAccessibleWrap*>(this);
   if (textAcc->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   if (!textAcc->IsValidOffset(aOffset))
     return E_INVALIDARG;
--- a/accessible/windows/msaa/AccessibleWrap.cpp
+++ b/accessible/windows/msaa/AccessibleWrap.cpp
@@ -118,17 +118,17 @@ AccessibleWrap::QueryInterface(REFIID ii
   else if (IID_IDispatch == iid || IID_IAccessible == iid)
     *ppv = static_cast<IAccessible*>(this);
   else if (IID_IEnumVARIANT == iid && !IsProxy()) {
     // Don't support this interface for leaf elements.
     if (!HasChildren() || nsAccUtils::MustPrune(this))
       return E_NOINTERFACE;
 
     *ppv = static_cast<IEnumVARIANT*>(new ChildrenEnumVariant(this));
-  } else if (IID_IServiceProvider == iid && !IsProxy())
+  } else if (IID_IServiceProvider == iid)
     *ppv = new ServiceProvider(this);
   else if (IID_ISimpleDOMNode == iid && !IsProxy()) {
     if (IsDefunct() || (!HasOwnContent() && !IsDoc()))
       return E_NOINTERFACE;
 
     *ppv = static_cast<ISimpleDOMNode*>(new sdnAccessible(GetNode()));
   }
 
@@ -653,22 +653,25 @@ AccessibleWrap::get_accFocus(
   //              and does not contain a child that has the keyboard focus.
   // VT_I4:       lVal is CHILDID_SELF. The object itself has the keyboard focus.
   // VT_I4:       lVal contains the child ID of the child element with the keyboard focus.
   // VT_DISPATCH: pdispVal member is the address of the IDispatch interface
   //              for the child object with the keyboard focus.
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (IsProxy())
-    return E_NOTIMPL;
+  // Return the current IAccessible child that has focus
+  Accessible* focusedAccessible;
+  if (IsProxy()) {
+    ProxyAccessible* proxy = Proxy()->FocusedChild();
+    focusedAccessible = proxy ? WrapperFor(proxy) : nullptr;
+  } else {
+    focusedAccessible = FocusedChild();
+  }
 
-  // Return the current IAccessible child that has focus
-  Accessible* focusedAccessible = FocusedChild();
   if (focusedAccessible == this) {
     pvarChild->vt = VT_I4;
     pvarChild->lVal = CHILDID_SELF;
   }
   else if (focusedAccessible) {
     pvarChild->vt = VT_DISPATCH;
     pvarChild->pdispVal = NativeAccessible(focusedAccessible);
   }
@@ -825,20 +828,30 @@ AccessibleWrap::get_accSelection(VARIANT
     return CO_E_OBJNOTCONNECTED;
 
   // TODO make this work with proxies.
   if (IsProxy())
     return E_NOTIMPL;
 
   if (IsSelect()) {
     nsAutoTArray<Accessible*, 10> selectedItems;
-    SelectedItems(&selectedItems);
+    if (IsProxy()) {
+      nsTArray<ProxyAccessible*> proxies;
+      Proxy()->SelectedItems(&proxies);
+
+      uint32_t selectedCount = proxies.Length();
+      for (uint32_t i = 0; i < selectedCount; i++) {
+        selectedItems.AppendElement(WrapperFor(proxies[i]));
+      }
+    } else {
+      SelectedItems(&selectedItems);
+    }
 
     // 1) Create and initialize the enumeration
-    nsRefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
+    RefPtr<AccessibleEnumerator> pEnum = new AccessibleEnumerator(selectedItems);
     pvarChildren->vt = VT_UNKNOWN;    // this must be VT_UNKNOWN for an IEnumVARIANT
     NS_ADDREF(pvarChildren->punkVal = pEnum);
   }
   return S_OK;
 
   A11Y_TRYBLOCK_END
 }
 
@@ -859,22 +872,23 @@ AccessibleWrap::get_accDefaultAction(
 
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (xpAccessible->IsProxy())
-    return E_NOTIMPL;
+  nsAutoString defaultAction;
+  if (xpAccessible->IsProxy()) {
+    xpAccessible->Proxy()->ActionNameAt(0, defaultAction);
+  } else {
+    xpAccessible->ActionNameAt(0, defaultAction);
+  }
 
-  nsAutoString defaultAction;
-  xpAccessible->ActionNameAt(0, defaultAction);
   *pszDefaultAction = ::SysAllocStringLen(defaultAction.get(),
                                           defaultAction.Length());
   return *pszDefaultAction ? S_OK : E_OUTOFMEMORY;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
@@ -890,36 +904,52 @@ AccessibleWrap::accSelect(
   // currently only handle focus and selection
   Accessible* xpAccessible = GetXPAccessibleFor(varChild);
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (xpAccessible->IsProxy())
-    return E_NOTIMPL;
+  if (flagsSelect & SELFLAG_TAKEFOCUS) {
+    if (xpAccessible->IsProxy()) {
+      xpAccessible->Proxy()->TakeFocus();
+    } else {
+      xpAccessible->TakeFocus();
+    }
 
-  if (flagsSelect & (SELFLAG_TAKEFOCUS|SELFLAG_TAKESELECTION|SELFLAG_REMOVESELECTION))
-  {
-    if (flagsSelect & SELFLAG_TAKEFOCUS)
-      xpAccessible->TakeFocus();
+    return S_OK;
+  }
+
+  if (flagsSelect & SELFLAG_TAKESELECTION) {
+    if (xpAccessible->IsProxy()) {
+      xpAccessible->Proxy()->TakeSelection();
+    } else {
+      xpAccessible->TakeSelection();
+    }
 
-    if (flagsSelect & SELFLAG_TAKESELECTION)
-      xpAccessible->TakeSelection();
+    return S_OK;
+  }
 
-    if (flagsSelect & SELFLAG_ADDSELECTION)
+  if (flagsSelect & SELFLAG_ADDSELECTION) {
+    if (xpAccessible->IsProxy()) {
+      xpAccessible->Proxy()->SetSelected(true);
+    } else {
       xpAccessible->SetSelected(true);
+    }
 
-    if (flagsSelect & SELFLAG_REMOVESELECTION)
-      xpAccessible->SetSelected(false);
+    return S_OK;
+  }
 
-    if (flagsSelect & SELFLAG_EXTENDSELECTION)
-      xpAccessible->ExtendSelection();
+  if (flagsSelect & SELFLAG_REMOVESELECTION) {
+    if (xpAccessible->IsProxy()) {
+      xpAccessible->Proxy()->SetSelected(false);
+    } else {
+      xpAccessible->SetSelected(false);
+    }
 
     return S_OK;
   }
 
   return E_FAIL;
 
   A11Y_TRYBLOCK_END
 }
@@ -1061,21 +1091,25 @@ AccessibleWrap::accHitTest(
   if (!pvarChild)
     return E_INVALIDARG;
 
   VariantInit(pvarChild);
 
   if (IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  // TODO make this work with proxies.
-  if (IsProxy())
-    return E_NOTIMPL;
-
-  Accessible* accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
+  Accessible* accessible = nullptr;
+  if (IsProxy()) {
+    ProxyAccessible* proxy = Proxy()->ChildAtPoint(xLeft, yTop, eDirectChild);
+    if (proxy) {
+      accessible = WrapperFor(proxy);
+    }
+  } else {
+    accessible = ChildAtPoint(xLeft, yTop, eDirectChild);
+  }
 
   // if we got a child
   if (accessible) {
     // if the child is us
     if (accessible == this) {
       pvarChild->vt = VT_I4;
       pvarChild->lVal = CHILDID_SELF;
     } else { // its not create an Accessible for it.
@@ -1105,17 +1139,17 @@ AccessibleWrap::accDoDefaultAction(
   if (!xpAccessible)
     return E_INVALIDARG;
 
   if (xpAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   // TODO make this work with proxies.
   if (xpAccessible->IsProxy())
-    return E_NOTIMPL;
+    return xpAccessible->Proxy()->DoAction(0) ? S_OK : E_INVALIDARG;
 
   return xpAccessible->DoAction(0) ? S_OK : E_INVALIDARG;
 
   A11Y_TRYBLOCK_END
 }
 
 STDMETHODIMP
 AccessibleWrap::put_accName(
@@ -1475,17 +1509,17 @@ AccessibleWrap::GetXPAccessibleFor(const
     Accessible* child =
 #ifdef _WIN64
       GetAccessibleInSubtree(document, static_cast<uint32_t>(aVarChild.lVal));
 #else
       document->GetAccessibleByUniqueIDInSubtree(uniqueID);
 #endif
 
     // If it is a document then just return an accessible.
-    if (IsDoc())
+    if (child && IsDoc())
       return child;
 
     // Otherwise check whether the accessible is a child (this path works for
     // ARIA documents and popups).
     Accessible* parent = child;
     while (parent && parent != document) {
       if (parent == this)
         return child;
@@ -1495,18 +1529,25 @@ AccessibleWrap::GetXPAccessibleFor(const
   }
 
   // Now see about the case that both this accessible and the target one are
   // proxied.
   uint32_t id = aVarChild.lVal;
   if (IsProxy()) {
     DocAccessibleParent* proxyDoc = Proxy()->Document();
     AccessibleWrap* wrapper = GetProxiedAccessibleInSubtree(proxyDoc, id);
+    if (!wrapper)
+      return nullptr;
+
     MOZ_ASSERT(wrapper->IsProxy());
 
+    if (proxyDoc == this->Proxy()) {
+      return wrapper;
+    }
+
     ProxyAccessible* parent = wrapper->Proxy();
     while (parent && parent != proxyDoc) {
       if (parent == this->Proxy()) {
         return wrapper;
       }
 
       parent = parent->Parent();
     }
@@ -1531,16 +1572,26 @@ AccessibleWrap::GetXPAccessibleFor(const
     if (!outerDoc) {
       continue;
     }
 
     if (outerDoc->Document() != doc) {
       continue;
     }
 
+    if (doc == this) {
+      AccessibleWrap* proxyWrapper =
+        GetProxiedAccessibleInSubtree(remoteDocs->ElementAt(i), id);
+      if (proxyWrapper) {
+        return proxyWrapper;
+      }
+
+      continue;
+    }
+
     Accessible* parent = outerDoc;
     while (parent && parent != doc) {
       if (parent == this) {
         AccessibleWrap* proxyWrapper =
           GetProxiedAccessibleInSubtree(remoteDocs->ElementAt(i), id);
         if (proxyWrapper) {
           return proxyWrapper;
         }
--- a/accessible/windows/msaa/EnumVariant.h
+++ b/accessible/windows/msaa/EnumVariant.h
@@ -44,17 +44,17 @@ private:
   ChildrenEnumVariant& operator =(const ChildrenEnumVariant&) = delete;
 
   ChildrenEnumVariant(const ChildrenEnumVariant& aEnumVariant) :
     mAnchorAcc(aEnumVariant.mAnchorAcc), mCurAcc(aEnumVariant.mCurAcc),
     mCurIndex(aEnumVariant.mCurIndex) { }
   virtual ~ChildrenEnumVariant() { }
 
 protected:
-  nsRefPtr<AccessibleWrap> mAnchorAcc;
+  RefPtr<AccessibleWrap> mAnchorAcc;
   Accessible* mCurAcc;
   uint32_t mCurIndex;
 };
 
 } // a11y namespace
 } // mozilla namespace
 
 #endif
--- a/accessible/windows/msaa/HTMLWin32ObjectAccessible.h
+++ b/accessible/windows/msaa/HTMLWin32ObjectAccessible.h
@@ -32,17 +32,17 @@ public:
   virtual bool NativelyUnavailable() const;
 
 protected:
 
   // Accessible
   virtual void CacheChildren();
 
   void* mHwnd;
-  nsRefPtr<Accessible> mNativeAccessible;
+  RefPtr<Accessible> mNativeAccessible;
 };
 
 /**
   * This class is used only internally, we never! send out an IAccessible linked
   *   back to this object. This class is used to represent a plugin object when
   *   referenced as a child or sibling of another Accessible node. We need only
   *   a limited portion of the Accessible interface implemented here. The
   *   in depth accessible information will be returned by the actual IAccessible
--- a/accessible/windows/msaa/Platform.cpp
+++ b/accessible/windows/msaa/Platform.cpp
@@ -41,39 +41,43 @@ a11y::ProxyCreated(ProxyAccessible* aPro
   if (aInterfaces & Interfaces::DOCUMENT) {
     wrapper = new DocProxyAccessibleWrap(aProxy);
   } else if (aInterfaces & Interfaces::HYPERTEXT) {
     wrapper = new HyperTextProxyAccessibleWrap(aProxy);
   } else {
     wrapper = new ProxyAccessibleWrap(aProxy);
   }
 
+  wrapper->SetProxyInterfaces(aInterfaces);
   wrapper->AddRef();
   aProxy->SetWrapper(reinterpret_cast<uintptr_t>(wrapper));
 }
 
 void
 a11y::ProxyDestroyed(ProxyAccessible* aProxy)
 {
   AccessibleWrap* wrapper =
     reinterpret_cast<AccessibleWrap*>(aProxy->GetWrapper());
   MOZ_ASSERT(wrapper);
   if (!wrapper)
     return;
 
   auto doc =
     static_cast<DocProxyAccessibleWrap*>(WrapperFor(aProxy->Document()));
+  MOZ_ASSERT(doc);
+  if (doc) {
 #ifdef _WIN64
-  uint32_t id = wrapper->GetExistingID();
-  if (id != AccessibleWrap::kNoID) {
-    doc->RemoveID(id);
+    uint32_t id = wrapper->GetExistingID();
+    if (id != AccessibleWrap::kNoID) {
+      doc->RemoveID(id);
+    }
+#else
+    doc->RemoveID(-reinterpret_cast<int32_t>(wrapper));
+#endif
   }
-#else
-  doc->RemoveID(-reinterpret_cast<int32_t>(wrapper));
-#endif
 
   wrapper->Shutdown();
   aProxy->SetWrapper(0);
   wrapper->Release();
 }
 
 void
 a11y::ProxyEvent(ProxyAccessible* aTarget, uint32_t aEventType)
--- a/accessible/windows/msaa/ServiceProvider.h
+++ b/accessible/windows/msaa/ServiceProvider.h
@@ -24,15 +24,15 @@ public:
   DECL_IUNKNOWN
 
   // IServiceProvider
   virtual HRESULT STDMETHODCALLTYPE QueryService(REFGUID aGuidService,
                                                  REFIID aIID,
                                                  void** aInstancePtr);
 
 private:
-  nsRefPtr<AccessibleWrap> mAccessible;
+  RefPtr<AccessibleWrap> mAccessible;
 };
 
 }
 }
 
 #endif
--- a/accessible/windows/msaa/moz.build
+++ b/accessible/windows/msaa/moz.build
@@ -51,16 +51,17 @@ LOCAL_INCLUDES += [
     '/accessible/html',
     '/accessible/windows',
     '/accessible/windows/ia2',
     '/accessible/windows/sdn',
     '/accessible/windows/uia',
     '/accessible/xpcom',
     '/accessible/xul',
     '/dom/base',
+    '/layout/style',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 if CONFIG['GNU_CXX']:
     CXXFLAGS += ['-Wshadow']
--- a/accessible/windows/msaa/nsWinUtils.cpp
+++ b/accessible/windows/msaa/nsWinUtils.cpp
@@ -10,23 +10,25 @@
 #include "Compatibility.h"
 #include "DocAccessible.h"
 #include "nsAccessibilityService.h"
 #include "nsCoreUtils.h"
 
 #include "mozilla/Preferences.h"
 #include "nsArrayUtils.h"
 #include "nsIArray.h"
+#include "nsICSSDeclaration.h"
 #include "nsIDocument.h"
 #include "nsIDocShellTreeItem.h"
-#include "nsIDOMElement.h"
+#include "mozilla/dom/Element.h"
 #include "nsXULAppAPI.h"
 
 using namespace mozilla;
 using namespace mozilla::a11y;
+using mozilla::dom::Element;
 
 // Window property used by ipc related code in identifying accessible
 // tab windows.
 const wchar_t* kPropNameTabContent = L"AccessibleTabWindow";
 
 /**
  * WindowProc to process WM_GETOBJECT messages, used in windows emulation mode.
  */
@@ -38,25 +40,28 @@ nsRefPtrHashtable<nsPtrHashKey<void>, Do
 already_AddRefed<nsIDOMCSSStyleDeclaration>
 nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
 {
   nsIContent* elm = nsCoreUtils::GetDOMElementFor(aContent);
   if (!elm)
     return nullptr;
 
   // Returns number of items in style declaration
-  nsCOMPtr<nsIDOMWindow> window =
+  nsCOMPtr<nsPIDOMWindow> window =
     do_QueryInterface(elm->OwnerDoc()->GetWindow());
   if (!window)
     return nullptr;
 
-  nsCOMPtr<nsIDOMCSSStyleDeclaration> cssDecl;
-  nsCOMPtr<nsIDOMElement> domElement(do_QueryInterface(elm));
-  window->GetComputedStyle(domElement, EmptyString(), getter_AddRefs(cssDecl));
-  return cssDecl.forget();
+  ErrorResult dummy;
+  nsCOMPtr<nsICSSDeclaration> cssDecl;
+  nsCOMPtr<Element> domElement(do_QueryInterface(elm));
+  cssDecl = window->GetComputedStyle(*domElement, EmptyString(), dummy);
+  nsCOMPtr<nsIDOMCSSStyleDeclaration> domDecl = do_QueryInterface(cssDecl);
+  dummy.SuppressException();
+  return domDecl.forget();
 }
 
 bool
 nsWinUtils::MaybeStartWindowEmulation()
 {
   // Register window class that'll be used for document accessibles associated
   // with tabs.
   if (IPCAccessibilityActive())
--- a/accessible/windows/sdn/sdnDocAccessible.h
+++ b/accessible/windows/sdn/sdnDocAccessible.h
@@ -39,15 +39,15 @@ 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);
 
 protected:
-  nsRefPtr<DocAccessibleWrap> mAccessible;
+  RefPtr<DocAccessibleWrap> mAccessible;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/windows/sdn/sdnTextAccessible.cpp
+++ b/accessible/windows/sdn/sdnTextAccessible.cpp
@@ -143,17 +143,17 @@ STDMETHODIMP
 sdnTextAccessible::scrollToSubstring(unsigned int aStartIndex,
                                      unsigned int aEndIndex)
 {
   A11Y_TRYBLOCK_BEGIN
 
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
-  nsRefPtr<nsRange> range = new nsRange(mAccessible->GetContent());
+  RefPtr<nsRange> range = new nsRange(mAccessible->GetContent());
   if (NS_FAILED(range->SetStart(mAccessible->GetContent(), aStartIndex)))
     return E_FAIL;
 
   if (NS_FAILED(range->SetEnd(mAccessible->GetContent(), aEndIndex)))
     return E_FAIL;
 
   nsresult rv =
     nsCoreUtils::ScrollSubstringTo(mAccessible->GetFrame(), range,
@@ -174,17 +174,17 @@ sdnTextAccessible::get_fontFamily(BSTR _
 
   if (mAccessible->IsDefunct())
     return CO_E_OBJNOTCONNECTED;
 
   nsIFrame* frame = mAccessible->GetFrame();
   if (!frame)
     return E_FAIL;
 
-  nsRefPtr<nsFontMetrics> fm;
+  RefPtr<nsFontMetrics> fm;
   nsLayoutUtils::GetFontMetricsForFrame(frame, getter_AddRefs(fm));
 
   const nsString& name =
     fm->GetThebesFontGroup()->GetFirstValidFont()->GetName();
   if (name.IsEmpty())
     return S_FALSE;
 
   *aFontFamily = ::SysAllocStringLen(name.get(), name.Length());
--- a/accessible/windows/sdn/sdnTextAccessible.h
+++ b/accessible/windows/sdn/sdnTextAccessible.h
@@ -57,15 +57,15 @@ public:
 private:
   /**
    *  Return child frame containing offset on success.
    */
   nsIFrame* GetPointFromOffset(nsIFrame* aContainingFrame,
                                int32_t aOffset, bool aPreferNext,
                                nsPoint& aOutPoint);
 
-  nsRefPtr<AccessibleWrap> mAccessible;
+  RefPtr<AccessibleWrap> mAccessible;
 };
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif
--- a/accessible/windows/uia/uiaRawElmProvider.h
+++ b/accessible/windows/uia/uiaRawElmProvider.h
@@ -61,15 +61,15 @@ public:
     /* [retval][out] */ __RPC__deref_out_opt IRawElementProviderSimple** aRawElmProvider);
 
 private:
   uiaRawElmProvider() = delete;
   uiaRawElmProvider& operator =(const uiaRawElmProvider&) = delete;
   uiaRawElmProvider(const uiaRawElmProvider&) = delete;
 
 protected:
-  nsRefPtr<AccessibleWrap> mAcc;
+  RefPtr<AccessibleWrap> mAcc;
 };
 
 } // a11y namespace
 } // mozilla namespace
 
 #endif
--- a/accessible/xpcom/xpcAccessible.cpp
+++ b/accessible/xpcom/xpcAccessible.cpp
@@ -494,26 +494,16 @@ xpcAccessible::SetSelected(bool aSelect)
   if (!Intl())
     return NS_ERROR_FAILURE;
 
   Intl()->SetSelected(aSelect);
   return NS_OK;
 }
 
 NS_IMETHODIMP
-xpcAccessible::ExtendSelection()
-{
-  if (!Intl())
-    return NS_ERROR_FAILURE;
-
-  Intl()->ExtendSelection();
-  return NS_OK;
-}
-
-NS_IMETHODIMP
 xpcAccessible::TakeSelection()
 {
   if (!Intl())
     return NS_ERROR_FAILURE;
 
   Intl()->TakeSelection();
   return NS_OK;
 }
--- a/accessible/xpcom/xpcAccessible.h
+++ b/accessible/xpcom/xpcAccessible.h
@@ -68,17 +68,16 @@ public:
   NS_IMETHOD GetFocusedChild(nsIAccessible** aChild) final override;
   NS_IMETHOD GetChildAtPoint(int32_t aX, int32_t aY,
                              nsIAccessible** aAccessible) final override;
   NS_IMETHOD GetDeepestChildAtPoint(int32_t aX, int32_t aY,
                                     nsIAccessible** aAccessible)
     final override;
 
   NS_IMETHOD SetSelected(bool aSelect) final override;
-  NS_IMETHOD ExtendSelection() final override;
   NS_IMETHOD TakeSelection() final override;
   NS_IMETHOD TakeFocus() final override;
 
   NS_IMETHOD GetActionCount(uint8_t* aActionCount) final override;
   NS_IMETHOD GetActionName(uint8_t aIndex, nsAString& aName) final override;
   NS_IMETHOD GetActionDescription(uint8_t aIndex, nsAString& aDescription)
     final override;
   NS_IMETHOD DoAction(uint8_t aIndex) final override;
--- a/accessible/xpcom/xpcAccessibleDocument.cpp
+++ b/accessible/xpcom/xpcAccessibleDocument.cpp
@@ -191,17 +191,17 @@ xpcAccessibleDocument::GetAccessible(Acc
   else
     xpcAcc = new xpcAccessibleGeneric(aAccessible);
 
   mCache.Put(aAccessible, xpcAcc);
   return xpcAcc;
 }
 
 static PLDHashOperator
-ShutdownAndRemove(const Accessible* aKey, nsRefPtr<xpcAccessibleGeneric>& aValue,
+ShutdownAndRemove(const Accessible* aKey, RefPtr<xpcAccessibleGeneric>& aValue,
                   void* aUnused)
 {
   aValue->Shutdown();
   return PL_DHASH_REMOVE;
 }
 
 void
 xpcAccessibleDocument::Shutdown()
--- a/accessible/xpcom/xpcAccessibleHyperLink.cpp
+++ b/accessible/xpcom/xpcAccessibleHyperLink.cpp
@@ -54,17 +54,17 @@ xpcAccessibleHyperLink::GetURI(int32_t a
   NS_ENSURE_ARG_POINTER(aURI);
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
   if (aIndex < 0 || aIndex >= static_cast<int32_t>(Intl()->AnchorCount()))
     return NS_ERROR_INVALID_ARG;
 
-  nsRefPtr<nsIURI>(Intl()->AnchorURIAt(aIndex)).forget(aURI);
+  RefPtr<nsIURI>(Intl()->AnchorURIAt(aIndex)).forget(aURI);
   return NS_OK;
 }
 
 
 NS_IMETHODIMP
 xpcAccessibleHyperLink::GetAnchor(int32_t aIndex, nsIAccessible** aAccessible)
 {
   NS_ENSURE_ARG_POINTER(aAccessible);
--- a/accessible/xpcom/xpcAccessibleHyperText.cpp
+++ b/accessible/xpcom/xpcAccessibleHyperText.cpp
@@ -342,17 +342,17 @@ NS_IMETHODIMP
 xpcAccessibleHyperText::GetEnclosingRange(nsIAccessibleTextRange** aRange)
 {
   NS_ENSURE_ARG_POINTER(aRange);
   *aRange = nullptr;
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
-  nsRefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
+  RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
   Intl()->EnclosingRange(range->mRange);
   NS_ASSERTION(range->mRange.IsValid(),
                "Should always have an enclosing range!");
 
   range.forget(aRange);
 
   return NS_OK;
 }
@@ -414,17 +414,17 @@ xpcAccessibleHyperText::GetRangeByChild(
   NS_ENSURE_ARG_POINTER(aRange);
   *aRange = nullptr;
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
   Accessible* child = aChild->ToInternalAccessible();
   if (child) {
-    nsRefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
+    RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
     Intl()->RangeByChild(child, range->mRange);
     if (range->mRange.IsValid())
       range.forget(aRange);
   }
 
   return NS_OK;
 }
 
@@ -433,17 +433,17 @@ xpcAccessibleHyperText::GetRangeAtPoint(
                                         nsIAccessibleTextRange** aRange)
 {
   NS_ENSURE_ARG_POINTER(aRange);
   *aRange = nullptr;
 
   if (!Intl())
     return NS_ERROR_FAILURE;
 
-  nsRefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
+  RefPtr<xpcAccessibleTextRange> range = new xpcAccessibleTextRange;
   Intl()->RangeAtPoint(aX, aY, range->mRange);
   if (range->mRange.IsValid())
     range.forget(aRange);
 
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
--- a/accessible/xpcom/xpcAccessibleTextRange.cpp
+++ b/accessible/xpcom/xpcAccessibleTextRange.cpp
@@ -94,31 +94,31 @@ xpcAccessibleTextRange::GetEmbeddedChild
   return NS_OK;
 }
 
 NS_IMETHODIMP
 xpcAccessibleTextRange::Compare(nsIAccessibleTextRange* aOtherRange,
                                 bool* aResult)
 {
 
-  nsRefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
+  RefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
   if (!xpcRange || !aResult)
     return NS_ERROR_INVALID_ARG;
 
   *aResult = (mRange == xpcRange->mRange);
   return NS_OK;
 }
 
 NS_IMETHODIMP
 xpcAccessibleTextRange::CompareEndPoints(uint32_t aEndPoint,
                                          nsIAccessibleTextRange* aOtherRange,
                                          uint32_t aOtherRangeEndPoint,
                                          int32_t* aResult)
 {
-  nsRefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
+  RefPtr<xpcAccessibleTextRange> xpcRange(do_QueryObject(aOtherRange));
   if (!xpcRange || !aResult)
     return NS_ERROR_INVALID_ARG;
 
   TextPoint p = (aEndPoint == EndPoint_Start) ?
     mRange.StartPoint() : mRange.EndPoint();
   TextPoint otherPoint = (aOtherRangeEndPoint == EndPoint_Start) ?
     xpcRange->mRange.StartPoint() : xpcRange->mRange.EndPoint();
 
--- a/accessible/xul/XULElementAccessibles.h
+++ b/accessible/xul/XULElementAccessibles.h
@@ -31,17 +31,17 @@ public:
   void UpdateLabelValue(const nsString& aValue);
 
 protected:
   // Accessible
   virtual ENameValueFlag NativeName(nsString& aName) override;
   virtual void CacheChildren() override;
 
 private:
-  nsRefPtr<XULLabelTextLeafAccessible> mValueTextLeaf;
+  RefPtr<XULLabelTextLeafAccessible> mValueTextLeaf;
 };
 
 inline XULLabelAccessible*
 Accessible::AsXULLabel()
 {
   return IsXULLabel() ? static_cast<XULLabelAccessible*>(this) : nullptr;
 }
 
--- a/accessible/xul/XULFormControlAccessible.cpp
+++ b/accessible/xul/XULFormControlAccessible.cpp
@@ -219,32 +219,37 @@ XULDropmarkerAccessible::ActionCount()
   return 1;
 }
 
 bool
 XULDropmarkerAccessible::DropmarkerOpen(bool aToggleOpen) const
 {
   bool isOpen = false;
 
-  nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement =
-    do_QueryInterface(mContent->GetFlattenedTreeParent());
+  nsIContent* parent = mContent->GetFlattenedTreeParent();
 
-  if (parentButtonElement) {
-    parentButtonElement->GetOpen(&isOpen);
-    if (aToggleOpen)
-      parentButtonElement->SetOpen(!isOpen);
-  }
-  else {
+  while (parent) {
+    nsCOMPtr<nsIDOMXULButtonElement> parentButtonElement =
+      do_QueryInterface(parent);
+    if (parentButtonElement) {
+      parentButtonElement->GetOpen(&isOpen);
+      if (aToggleOpen)
+        parentButtonElement->SetOpen(!isOpen);
+      return isOpen;
+    }
+
     nsCOMPtr<nsIDOMXULMenuListElement> parentMenuListElement =
-      do_QueryInterface(parentButtonElement);
+      do_QueryInterface(parent);
     if (parentMenuListElement) {
       parentMenuListElement->GetOpen(&isOpen);
       if (aToggleOpen)
         parentMenuListElement->SetOpen(!isOpen);
+      return isOpen;
     }
+    parent = parent->GetFlattenedTreeParent();
   }
 
   return isOpen;
 }
 
 void
 XULDropmarkerAccessible::ActionNameAt(uint8_t aIndex, nsAString& aName)
 {
--- a/accessible/xul/XULTreeAccessible.cpp
+++ b/accessible/xul/XULTreeAccessible.cpp
@@ -162,17 +162,17 @@ XULTreeAccessible::NativeRole()
 
   nsIContent* child = nsTreeUtils::GetDescendantChild(mContent, nsGkAtoms::treechildren);
   NS_ASSERTION(child, "tree without treechildren!");
   nsTreeBodyFrame* treeFrame = do_QueryFrame(child->GetPrimaryFrame());
   NS_ASSERTION(treeFrame, "xul tree accessible for tree without a frame!");
   if (!treeFrame)
     return roles::LIST;
 
-  nsRefPtr<nsTreeColumns> cols = treeFrame->Columns();
+  RefPtr<nsTreeColumns> cols = treeFrame->Columns();
   nsCOMPtr<nsITreeColumn> primaryCol;
   cols->GetPrimaryColumn(getter_AddRefs(primaryCol));
 
   return primaryCol ? roles::OUTLINE : roles::LIST;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: Accessible implementation (DON'T put methods here)
@@ -205,17 +205,17 @@ XULTreeAccessible::ChildAtPoint(int32_t 
   // If we failed to find tree cell for the given point then it might be
   // tree columns.
   if (row == -1 || !column)
     return AccessibleWrap::ChildAtPoint(aX, aY, aWhichChild);
 
   Accessible* child = GetTreeItemAccessible(row);
   if (aWhichChild == eDeepestChild && child) {
     // Look for accessible cell for the found item accessible.
-    nsRefPtr<XULTreeItemAccessibleBase> treeitem = do_QueryObject(child);
+    RefPtr<XULTreeItemAccessibleBase> treeitem = do_QueryObject(child);
 
     Accessible* cell = treeitem->GetCellAccessible(column);
     if (cell)
       child = cell;
   }
 
   return child;
 }
@@ -528,17 +528,17 @@ XULTreeAccessible::GetTreeItemAccessible
   if (NS_FAILED(rv) || aRow >= rowCount)
     return nullptr;
 
   void *key = reinterpret_cast<void*>(aRow);
   Accessible* cachedTreeItem = mAccessibleCache.GetWeak(key);
   if (cachedTreeItem)
     return cachedTreeItem;
 
-  nsRefPtr<Accessible> treeItem = CreateTreeItemAccessible(aRow);
+  RefPtr<Accessible> treeItem = CreateTreeItemAccessible(aRow);
   if (treeItem) {
     mAccessibleCache.Put(key, treeItem);
     Document()->BindToDocument(treeItem, nullptr);
     return treeItem;
   }
 
   return nullptr;
 }
@@ -563,17 +563,17 @@ XULTreeAccessible::InvalidateCache(int32
 
   // Fire destroy event for removed tree items and delete them from caches.
   for (int32_t rowIdx = aRow; rowIdx < aRow - aCount; rowIdx++) {
 
     void* key = reinterpret_cast<void*>(rowIdx);
     Accessible* treeItem = mAccessibleCache.GetWeak(key);
 
     if (treeItem) {
-      nsRefPtr<AccEvent> event =
+      RefPtr<AccEvent> event =
         new AccEvent(nsIAccessibleEvent::EVENT_HIDE, treeItem);
       nsEventShell::FireEvent(event);
 
       // Unbind from document, shutdown and remove from tree cache.
       document->UnbindFromDocument(treeItem);
       mAccessibleCache.Remove(key);
     }
   }
@@ -643,50 +643,50 @@ XULTreeAccessible::TreeViewInvalidated(i
   }
 
   for (int32_t rowIdx = aStartRow; rowIdx <= endRow; ++rowIdx) {
 
     void *key = reinterpret_cast<void*>(rowIdx);
     Accessible* accessible = mAccessibleCache.GetWeak(key);
 
     if (accessible) {
-      nsRefPtr<XULTreeItemAccessibleBase> treeitemAcc = do_QueryObject(accessible);
+      RefPtr<XULTreeItemAccessibleBase> treeitemAcc = do_QueryObject(accessible);
       NS_ASSERTION(treeitemAcc, "Wrong accessible at the given key!");
 
       treeitemAcc->RowInvalidated(aStartCol, endCol);
     }
   }
 }
 
 void
 XULTreeAccessible::TreeViewChanged(nsITreeView* aView)
 {
   if (IsDefunct())
     return;
 
   // Fire reorder event on tree accessible on accessible tree (do not fire
   // show/hide events on tree items because it can be expensive to fire them for
   // each tree item.
-  nsRefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
+  RefPtr<AccReorderEvent> reorderEvent = new AccReorderEvent(this);
   Document()->FireDelayedEvent(reorderEvent);
 
   // Clear cache.
   mAccessibleCache.Enumerate(UnbindCacheEntryFromDocument<Accessible>,
                              nullptr);
 
   mTreeView = aView;
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeAccessible: protected implementation
 
 already_AddRefed<Accessible>
 XULTreeAccessible::CreateTreeItemAccessible(int32_t aRow) const
 {
-  nsRefPtr<Accessible> accessible =
+  RefPtr<Accessible> accessible =
     new XULTreeItemAccessible(mContent, mDoc, const_cast<XULTreeAccessible*>(this),
                               mTree, mTreeView, aRow);
 
   return accessible.forget();
 }
                              
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeItemAccessibleBase
--- a/accessible/xul/XULTreeGridAccessible.cpp
+++ b/accessible/xul/XULTreeGridAccessible.cpp
@@ -123,17 +123,17 @@ XULTreeGridAccessible::CellAt(uint32_t a
   if (!row)
     return nullptr;
 
   nsCOMPtr<nsITreeColumn> column =
     nsCoreUtils::GetSensibleColumnAt(mTree, aColumnIndex);
   if (!column)
     return nullptr;
 
-  nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(row);
+  RefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(row);
   if (!rowAcc)
     return nullptr;
 
   return rowAcc->GetCellAccessible(column);
 }
 
 void
 XULTreeGridAccessible::ColDescription(uint32_t aColIdx, nsString& aDescription)
@@ -223,17 +223,17 @@ XULTreeGridAccessible::NativeRole()
 }
 
 ////////////////////////////////////////////////////////////////////////////////
 // XULTreeGridAccessible: XULTreeAccessible implementation
 
 already_AddRefed<Accessible>
 XULTreeGridAccessible::CreateTreeItemAccessible(int32_t aRow) const
 {
-  nsRefPtr<Accessible> accessible =
+  RefPtr<Accessible> accessible =
     new XULTreeGridRowAccessible(mContent, mDoc,
                                  const_cast<XULTreeGridAccessible*>(this),
                                  mTree, mTreeView, aRow);
 
   return accessible.forget();
 }
 
 
@@ -371,17 +371,17 @@ XULTreeGridRowAccessible::GetCellAccessi
 {
   NS_PRECONDITION(aColumn, "No tree column!");
 
   void* key = static_cast<void*>(aColumn);
   XULTreeGridCellAccessible* cachedCell = mAccessibleCache.GetWeak(key);
   if (cachedCell)
     return cachedCell;
 
-  nsRefPtr<XULTreeGridCellAccessible> cell =
+  RefPtr<XULTreeGridCellAccessible> cell =
     new XULTreeGridCellAccessibleWrap(mContent, mDoc,
                                       const_cast<XULTreeGridRowAccessible*>(this),
                                       mTree, mTreeView, mRow, aColumn);
   mAccessibleCache.Put(key, cell);
   Document()->BindToDocument(cell, nullptr);
   return cell;
 }
 
@@ -732,17 +732,17 @@ XULTreeGridCellAccessible::CellInvalidat
   nsAutoString textEquiv;
 
   int16_t type;
   mColumn->GetType(&type);
   if (type == nsITreeColumn::TYPE_CHECKBOX) {
     mTreeView->GetCellValue(mRow, mColumn, textEquiv);
     if (mCachedTextEquiv != textEquiv) {
       bool isEnabled = textEquiv.EqualsLiteral("true");
-      nsRefPtr<AccEvent> accEvent =
+      RefPtr<AccEvent> accEvent =
         new AccStateChangeEvent(this, states::CHECKED, isEnabled);
       nsEventShell::FireEvent(accEvent);
 
       mCachedTextEquiv = textEquiv;
       return true;
     }
 
     return false;
@@ -779,17 +779,17 @@ XULTreeGridCellAccessible::GetSiblingAtO
       column = nsCoreUtils::GetNextSensibleColumn(columnAtOffset);
       column.swap(columnAtOffset);
     }
   }
 
   if (!columnAtOffset)
     return nullptr;
 
-  nsRefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
+  RefPtr<XULTreeItemAccessibleBase> rowAcc = do_QueryObject(Parent());
   return rowAcc->GetCellAccessible(columnAtOffset);
 }
 
 void
 XULTreeGridCellAccessible::DispatchClickEvent(nsIContent* aContent,
                                               uint32_t aActionIndex)
 {
   if (IsDefunct())
--- a/addon-sdk/source/CONTRIBUTING.md
+++ b/addon-sdk/source/CONTRIBUTING.md
@@ -32,17 +32,16 @@ There is a list of [good first bugs here
 
 ## Reviewers
 
 All changes need a review by someone on the Jetpack review crew:
 
 - [@mossop]
 - [@gozala]
 - [@ZER0]
-- [@erikvold]
 - [@jsantell]
 - [@zombie]
 
 For review of Mozilla platform usage and best practices, ask [@autonome],
 [@0c0w3], or [@mossop] to find the domain expert.
 
 For API and developer ergonomics review, ask [@gozala].
 
@@ -56,11 +55,10 @@ For API and developer ergonomics review,
 [coding style guide]:https://github.com/mozilla/addon-sdk/wiki/Coding-style-guide
 [Add-on SDK repo]:https://github.com/mozilla/addon-sdk
 [GitHub]:https://github.com/
 [good first bugs]:https://bugzilla.mozilla.org/buglist.cgi?list_id=7345714&columnlist=bug_severity%2Cpriority%2Cassigned_to%2Cbug_status%2Ctarget_milestone%2Cresolution%2Cshort_desc%2Cchangeddate&query_based_on=jetpack-good-1st-bugs&status_whiteboard_type=allwordssubstr&query_format=advanced&status_whiteboard=[good%20first%20bug]&bug_status=UNCONFIRMED&bug_status=NEW&bug_status=ASSIGNED&bug_status=REOPENED&bug_status=VERIFIED&product=Add-on%20SDK&known_name=jetpack-good-1st-bugs
 
 [@mossop]:https://github.com/mossop/
 [@gozala]:https://github.com/Gozala/
 [@ZER0]:https://github.com/ZER0/
-[@erikvold]:https://github.com/erikvold/
 [@jsantell]:https://github.com/jsantell
 [@zombie]:https://github.com/zombie
--- a/addon-sdk/source/bin/node-scripts/words.txt
+++ b/addon-sdk/source/bin/node-scripts/words.txt
@@ -1,12 +1,11 @@
 addon-sdk
 github
 stackoverflow
 bugzilla
 irc
-erikvold
 jsantell
 mossop
 gozala
 zer0
 autonome
 0c0w3
--- a/addon-sdk/source/lib/dev/debuggee.js
+++ b/addon-sdk/source/lib/dev/debuggee.js
@@ -6,17 +6,17 @@
 
 module.metadata = {
   "stability": "experimental"
 };
 
 const { Cu } = require("chrome");
 const { Class } = require("../sdk/core/heritage");
 const { MessagePort, MessageChannel } = require("../sdk/messaging");
-const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 
 const outputs = new WeakMap();
 const inputs = new WeakMap();
 const targets = new WeakMap();
 const transports = new WeakMap();
 
 const inputFor = port => inputs.get(port);
--- a/addon-sdk/source/lib/dev/toolbox.js
+++ b/addon-sdk/source/lib/dev/toolbox.js
@@ -10,17 +10,17 @@ module.metadata = {
 
 const { Cu, Cc, Ci } = require("chrome");
 const { Class } = require("../sdk/core/heritage");
 const { Disposable, setup } = require("../sdk/core/disposable");
 const { contract, validate } = require("../sdk/util/contract");
 const { each, pairs, values } = require("../sdk/util/sequence");
 const { onEnable, onDisable } = require("../dev/theme/hooks");
 
-const { gDevTools } = Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm", {});
+const { gDevTools } = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
 
 // This is temporary workaround to allow loading of the developer tools client - volcan
 // into a toolbox panel, this hack won't be necessary as soon as devtools patch will be
 // shipped in nightly, after which it can be removed. Bug 1038517
 const registerSDKURI = () => {
   const ioService = Cc['@mozilla.org/network/io-service;1']
                       .getService(Ci.nsIIOService);
   const resourceHandler = ioService.getProtocolHandler("resource")
--- a/addon-sdk/source/lib/dev/utils.js
+++ b/addon-sdk/source/lib/dev/utils.js
@@ -1,17 +1,17 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 "use strict";
 
 const { Cu } = require("chrome");
-const { gDevTools } = Cu.import("resource:///modules/devtools/client/framework/gDevTools.jsm", {});
-const { devtools } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
+const { gDevTools } = Cu.import("resource://devtools/client/framework/gDevTools.jsm", {});
+const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 
 const { getActiveTab } = require("../sdk/tabs/utils");
 const { getMostRecentBrowserWindow } = require("../sdk/window/utils");
 
 const targetFor = target => {
   target = target || getActiveTab(getMostRecentBrowserWindow());
   return devtools.TargetFactory.forTab(target);
 };
--- a/addon-sdk/source/lib/sdk/addon/bootstrap.js
+++ b/addon-sdk/source/lib/sdk/addon/bootstrap.js
@@ -112,17 +112,17 @@ Bootstrap.prototype = {
         id,
         isNative: true,
         checkCompatibility: true,
         prefixURI: baseURI,
         rootURI: baseURI,
         name: metadata.name,
         paths: Object.assign({
           "": "resource://gre/modules/commonjs/",
-          "devtools/": "resource://gre/modules/devtools/",
+          "devtools/": "resource://devtools/",
           "./": baseURI
         }, readPaths(id)),
         manifest: metadata,
         metadata: metadata,
         modules: {
           "@test/options": {}
         },
         noQuit: prefs.get(`extensions.${id}.sdk.test.no-quit`, false)
--- a/addon-sdk/source/lib/sdk/addon/events.js
+++ b/addon-sdk/source/lib/sdk/addon/events.js
@@ -46,9 +46,11 @@ function send (eventName, data) {
   return deferred.promise;
 }
 exports.send = send;
 
 /*
  * Implement internal structured cloning algorithm in the future?
  * http://www.whatwg.org/specs/web-apps/current-work/multipage/common-dom-interfaces.html#internal-structured-cloning-algorithm
  */
-function clone (obj) JSON.parse(JSON.stringify(obj || {}))
+function clone (obj) {
+  return JSON.parse(JSON.stringify(obj || {}));
+}
--- a/addon-sdk/source/lib/sdk/addon/runner.js
+++ b/addon-sdk/source/lib/sdk/addon/runner.js
@@ -19,17 +19,17 @@ const { get } = require('../preferences/
 const appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
                         getService(Ci.nsIAppShellService);
 const { preferences } = metadata;
 
 const Startup = Cu.import("resource://gre/modules/sdk/system/Startup.js", {}).exports;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 XPCOMUtils.defineLazyGetter(this, "BrowserToolboxProcess", function () {
-  return Cu.import("resource:///modules/devtools/client/framework/ToolboxProcess.jsm", {}).
+  return Cu.import("resource://devtools/client/framework/ToolboxProcess.jsm", {}).
          BrowserToolboxProcess;
 });
 
 // Initializes default preferences
 function setDefaultPrefs(prefsURI) {
   const prefs = Cc['@mozilla.org/preferences-service;1'].
                 getService(Ci.nsIPrefService).
                 QueryInterface(Ci.nsIPrefBranch2);
@@ -57,41 +57,43 @@ function setDefaultPrefs(prefsURI) {
   evaluate(sandbox, prefsURI);
 }
 
 function definePseudo(loader, id, exports) {
   let uri = resolveURI(id, loader.mapping);
   loader.modules[uri] = { exports: exports };
 }
 
-function startup(reason, options) Startup.onceInitialized.then(() => {
-  // Inject globals ASAP in order to have console API working ASAP
-  Object.defineProperties(options.loader.globals, descriptor(globals));
+function startup(reason, options) {
+  return Startup.onceInitialized.then(() => {
+    // Inject globals ASAP in order to have console API working ASAP
+    Object.defineProperties(options.loader.globals, descriptor(globals));
 
-  // NOTE: Module is intentionally required only now because it relies
-  // on existence of hidden window, which does not exists until startup.
-  let { ready } = require('../addon/window');
-  // Load localization manifest and .properties files.
-  // Run the addon even in case of error (best effort approach)
-  require('../l10n/loader').
-    load(rootURI).
-    then(null, function failure(error) {
-      if (!isNative)
-        console.info("Error while loading localization: " + error.message);
-    }).
-    then(function onLocalizationReady(data) {
-      // Exports data to a pseudo module so that api-utils/l10n/core
-      // can get access to it
-      definePseudo(options.loader, '@l10n/data', data ? data : null);
-      return ready;
-    }).then(function() {
-      run(options);
-    }).then(null, console.exception);
+    // NOTE: Module is intentionally required only now because it relies
+    // on existence of hidden window, which does not exists until startup.
+    let { ready } = require('../addon/window');
+    // Load localization manifest and .properties files.
+    // Run the addon even in case of error (best effort approach)
+    require('../l10n/loader').
+      load(rootURI).
+      then(null, function failure(error) {
+        if (!isNative)
+          console.info("Error while loading localization: " + error.message);
+      }).
+      then(function onLocalizationReady(data) {
+        // Exports data to a pseudo module so that api-utils/l10n/core
+        // can get access to it
+        definePseudo(options.loader, '@l10n/data', data ? data : null);
+        return ready;
+      }).then(function() {
+        run(options);
+      }).then(null, console.exception);
     return void 0; // otherwise we raise a warning, see bug 910304
-});
+  });
+}
 
 function run(options) {
   try {
     // Try initializing HTML localization before running main module. Just print
     // an exception in case of error, instead of preventing addon to be run.
     try {
       // Do not enable HTML localization while running test as it is hard to
       // disable. Because unit tests are evaluated in a another Loader who
--- a/addon-sdk/source/lib/sdk/browser/events.js
+++ b/addon-sdk/source/lib/sdk/browser/events.js
@@ -12,9 +12,9 @@ const { filter } = require("../event/uti
 const { isBrowser } = require("../window/utils");
 
 // TODO: `isBrowser` detects weather window is a browser by checking
 // `windowtype` attribute, which means that all 'open' events will be
 // filtered out since document is not loaded yet. Maybe we can find a better
 // implementation for `isBrowser`. Either way it's not really needed yet
 // neither window tracker provides this event.
 
-exports.events = filter(events, function({target}) isBrowser(target));
+exports.events = filter(events, ({target}) => isBrowser(target));
--- a/addon-sdk/source/lib/sdk/console/plain-text.js
+++ b/addon-sdk/source/lib/sdk/console/plain-text.js
@@ -7,17 +7,17 @@
 module.metadata = {
   "stability": "unstable"
 };
 
 const { Cc, Ci, Cu, Cr } = require("chrome");
 const self = require("../self");
 const prefs = require("../preferences/service");
 const { merge } = require("../util/object");
-const { ConsoleAPI } = Cu.import("resource://gre/modules/devtools/shared/Console.jsm", {});
+const { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm", {});
 
 const DEFAULT_LOG_LEVEL = "error";
 const ADDON_LOG_LEVEL_PREF = "extensions." + self.id + ".sdk.console.logLevel";
 const SDK_LOG_LEVEL_PREF = "extensions.sdk.console.logLevel";
 
 var logLevel = DEFAULT_LOG_LEVEL;
 function setLogLevel() {
   logLevel = prefs.get(ADDON_LOG_LEVEL_PREF,
--- a/addon-sdk/source/lib/sdk/content/context-menu.js
+++ b/addon-sdk/source/lib/sdk/content/context-menu.js
@@ -133,17 +133,17 @@ CONTEXTS.PageContext = Class({
   getState: function(popupNode) {
     // If there is a selection in the window then this context does not match
     if (!popupNode.ownerDocument.defaultView.getSelection().isCollapsed)
       return false;
 
     // If the clicked node or any of its ancestors is one of the blocked
     // NON_PAGE_CONTEXT_ELTS then this context does not match
     while (!(popupNode instanceof Ci.nsIDOMDocument)) {
-      if (NON_PAGE_CONTEXT_ELTS.some(function(type) popupNode instanceof type))
+      if (NON_PAGE_CONTEXT_ELTS.some(type => popupNode instanceof type))
         return false;
 
       popupNode = popupNode.parentNode;
     }
 
     return true;
   }
 });
--- a/addon-sdk/source/lib/sdk/content/events.js
+++ b/addon-sdk/source/lib/sdk/content/events.js
@@ -44,14 +44,14 @@ function streamEventsFrom({document}) {
   })
 }
 exports.streamEventsFrom = streamEventsFrom;
 
 var opened = windows(null, { includePrivate: true });
 var state = merge(opened.map(streamEventsFrom));
 
 
-var futureReady = filter(windowEvents, function({type})
+var futureReady = filter(windowEvents, ({type}) =>
                                         type === "DOMContentLoaded");
-var futureWindows = map(futureReady, function({target}) target);
+var futureWindows = map(futureReady, ({target}) => target);
 var futureState = expand(futureWindows, streamEventsFrom);
 
 exports.events = merge([insert, create, state, futureState]);
--- a/addon-sdk/source/lib/sdk/content/loader.js
+++ b/addon-sdk/source/lib/sdk/content/loader.js
@@ -58,19 +58,27 @@ exports.validationAttributes = valid;
 
 /**
  * Shortcut function to validate property with validation.
  * @param {Object|Number|String} suspect
  *    value to validate
  * @param {Object} validation
  *    validation rule passed to `api-utils`
  */
-function validate(suspect, validation) validateOptions(
-  { $: suspect },
-  { $: validation }
-).$
+function validate(suspect, validation) {
+  return validateOptions(
+    { $: suspect },
+    { $: validation }
+  ).$;
+}
 
-function Allow(script) ({
-  get script() script,
-  set script(value) script = !!value
-})
+function Allow(script) {
+  return {
+    get script() {
+      return script;
+    },
+    set script(value) {
+      script = !!value;
+    }
+  };
+}
 
 exports.contract = contract(valid);
--- a/addon-sdk/source/lib/sdk/content/sandbox.js
+++ b/addon-sdk/source/lib/sdk/content/sandbox.js
@@ -157,19 +157,25 @@ const WorkerSandbox = Class({
 
     // We have to ensure that window.top and window.parent are the exact same
     // object than window object, i.e. the sandbox global object. But not
     // always, in case of iframes, top and parent are another window object.
     let top = window.top === window ? content : content.top;
     let parent = window.parent === window ? content : content.parent;
     merge(content, {
       // We need 'this === window === top' to be true in toplevel scope:
-      get window() content,
-      get top() top,
-      get parent() parent
+      get window() {
+        return content;
+      },
+      get top() {
+        return top;
+      },
+      get parent() {
+        return parent;
+      }
     });
 
     // Use the Greasemonkey naming convention to provide access to the
     // unwrapped window object so the content script can access document
     // JavaScript values.
     // NOTE: this functionality is experimental and may change or go away
     // at any time!
     //
--- a/addon-sdk/source/lib/sdk/context-menu.js
+++ b/addon-sdk/source/lib/sdk/context-menu.js
@@ -155,26 +155,26 @@ exports.SelectorContext = SelectorContex
 var URLContext = Class({
   extends: Context,
 
   initialize: function initialize(patterns) {
     Context.prototype.initialize.call(this);
     patterns = Array.isArray(patterns) ? patterns : [patterns];
 
     try {
-      internal(this).patterns = patterns.map(function (p) new MatchPattern(p));
+      internal(this).patterns = patterns.map(p => new MatchPattern(p));
     }
     catch (err) {
       throw new Error("Patterns must be a string, regexp or an array of " +
                       "strings or regexps: " + err);
     }
   },
 
   isCurrent: function isCurrent(url) {
-    return internal(this).patterns.some(function (p) p.test(url));
+    return internal(this).patterns.some(p => p.test(url));
   },
 
   serialize: function() {
     return {
       id: internal(this).id,
       type: "URLContext",
       args: []
     }
@@ -207,21 +207,23 @@ var PredicateContext = Class({
       type: "PredicateContext",
       args: []
     }
   }
 });
 exports.PredicateContext = PredicateContext;
 
 function removeItemFromArray(array, item) {
-  return array.filter(function(i) i !== item);
+  return array.filter(i => i !== item);
 }
 
 // Converts anything that isn't false, null or undefined into a string
-function stringOrNull(val) val ? String(val) : val;
+function stringOrNull(val) {
+  return val ? String(val) : val;
+}
 
 // Shared option validation rules for Item, Menu, and Separator
 var baseItemRules = {
   parentMenu: {
     is: ["object", "undefined"],
     ok: function (v) {
       if (!v)
         return true;
@@ -230,33 +232,33 @@ var baseItemRules = {
     msg: "parentMenu must be a Menu or not specified."
   },
   context: {
     is: ["undefined", "object", "array"],
     ok: function (v) {
       if (!v)
         return true;
       let arr = Array.isArray(v) ? v : [v];
-      return arr.every(function (o) o instanceof Context);
+      return arr.every(o => o instanceof Context);
     },
     msg: "The 'context' option must be a Context object or an array of " +
          "Context objects."
   },
   onMessage: {
     is: ["function", "undefined"]
   },
   contentScript: loaderContract.rules.contentScript,
   contentScriptFile: loaderContract.rules.contentScriptFile
 };
 
 var labelledItemRules =  mix(baseItemRules, {
   label: {
     map: stringOrNull,
     is: ["string"],
-    ok: function (v) !!v,
+    ok: v => !!v,
     msg: "The item must have a non-empty string label."
   },
   accesskey: {
     map: stringOrNull,
     is: ["string", "undefined", "null"],
     ok: (v) => {
       if (!v) {
         return true;
--- a/addon-sdk/source/lib/sdk/core/promise.js
+++ b/addon-sdk/source/lib/sdk/core/promise.js
@@ -27,24 +27,26 @@ var promised = (function() {
   // slower property accesses and unnecessary closure creations on each
   // call of this popular function.
 
   var call = Function.call;
   var concat = Array.prototype.concat;
 
   // Utility function that does following:
   // execute([ f, self, args...]) => f.apply(self, args)
-  function execute (args) call.apply(call, args)
+  function execute (args) {
+    return call.apply(call, args);
+  }
 
   // Utility function that takes promise of `a` array and maybe promise `b`
   // as arguments and returns promise for `a.concat(b)`.
   function promisedConcat(promises, unknown) {
     return promises.then(function (values) {
       return resolve(unknown)
-        .then(function (value) values.concat([value]));
+        .then(value => values.concat([value]));
     });
   }
 
   return function promised(f, prototype) {
     /**
     Returns a wrapped `f`, which when called returns a promise that resolves to
     `f(...)` passing all the given arguments to it, which by the way may be
     promises. Optionally second `prototype` argument may be provided to be used
--- a/addon-sdk/source/lib/sdk/deprecated/unit-test.js
+++ b/addon-sdk/source/lib/sdk/deprecated/unit-test.js
@@ -49,17 +49,19 @@ const TestRunner = function TestRunner(o
   this.passed = 0;
   this.failed = 0;
   this.testRunSummary = [];
   this.expectFailNesting = 0;
   this.done = TestRunner.prototype.done.bind(this);
 };
 
 TestRunner.prototype = {
-  toString: function toString() "[object TestRunner]",
+  toString: function toString() {
+    return "[object TestRunner]";
+  },
 
   DEFAULT_PAUSE_TIMEOUT: (cfxArgs.parseable ? 300000 : 15000), //Five minutes (5*60*1000ms)
   PAUSE_DELAY: 500,
 
   _logTestFailed: function _logTestFailed(why) {
     if (!(why in this.test.errors))
       this.test.errors[why] = 0;
     this.test.errors[why]++;
--- a/addon-sdk/source/lib/sdk/deprecated/window-utils.js
+++ b/addon-sdk/source/lib/sdk/deprecated/window-utils.js
@@ -16,17 +16,19 @@ const { ignoreWindow } = require('sdk/pr
 const { isPrivateBrowsingSupported } = require('../self');
 
 const windowWatcher = Cc['@mozilla.org/embedcomp/window-watcher;1'].
                        getService(Ci.nsIWindowWatcher);
 const appShellService = Cc['@mozilla.org/appshell/appShellService;1'].
                         getService(Ci.nsIAppShellService);
 
 // Bug 834961: ignore private windows when they are not supported
-function getWindows() windows(null, { includePrivate: isPrivateBrowsingSupported });
+function getWindows() {
+  return windows(null, { includePrivate: isPrivateBrowsingSupported });
+}
 
 /**
  * An iterator for XUL windows currently in the application.
  *
  * @return A generator that yields XUL windows exposing the
  *         nsIDOMWindow interface.
  */
 function windowIterator() {
--- a/addon-sdk/source/lib/sdk/frame/hidden-frame.js
+++ b/addon-sdk/source/lib/sdk/frame/hidden-frame.js
@@ -43,17 +43,17 @@ function FrameOptions(options) {
   return validateOptions(options, FrameOptions.validator);
 }
 FrameOptions.validator = {
   onReady: {
     is: ["undefined", "function", "array"],
     ok: function(v) {
       if (getTypeOf(v) === "array") {
         // make sure every item is a function
-        return v.every(function (item) typeof(item) === "function")
+        return v.every(item => typeof(item) === "function")
       }
       return true;
     }
   },
   onUnload: {
     is: ["undefined", "function"]
   }
 };
@@ -107,9 +107,9 @@ function removeHiddenFrame(frame) {
   // Remove from cache before calling in order to avoid loop
   cache.delete(frame);
   emit(frame, "unload")
   let element = frame.element
   if (element) element.parentNode.removeChild(element)
 }
 exports.remove = removeHiddenFrame;
 
-unload(function() fromIterator(cache).forEach(removeHiddenFrame));
+unload(() => fromIterator(cache).forEach(removeHiddenFrame));
--- a/addon-sdk/source/lib/sdk/frame/utils.js
+++ b/addon-sdk/source/lib/sdk/frame/utils.js
@@ -90,11 +90,12 @@ function create(target, options) {
     if ("allowWindowControl" in docShell && "allowWindowControl" in options)
       docShell.allowWindowControl = !!options.allowWindowControl;
   }
 
   return frame;
 }
 exports.create = create;
 
-function swapFrameLoaders(from, to)
-  from.QueryInterface(Ci.nsIFrameLoaderOwner).swapFrameLoaders(to)
+function swapFrameLoaders(from, to) {
+  return from.QueryInterface(Ci.nsIFrameLoaderOwner).swapFrameLoaders(to);
+}
 exports.swapFrameLoaders = swapFrameLoaders;
--- a/addon-sdk/source/lib/sdk/io/buffer.js
+++ b/addon-sdk/source/lib/sdk/io/buffer.js
@@ -318,17 +318,19 @@ Object.defineProperties(Buffer.prototype
  ['readInt32BE', 'getInt32', false],
  ['readFloatLE', 'getFloat32', true],
  ['readFloatBE', 'getFloat32', false],
  ['readDoubleLE', 'getFloat64', true],
  ['readDoubleBE', 'getFloat64', false],
  ['readUInt8', 'getUint8'],
  ['readInt8', 'getInt8']].forEach(([alias, name, littleEndian]) => {
   Object.defineProperty(Buffer.prototype, alias, {
-    value: function(offset) this.view[name](offset, littleEndian)
+    value: function(offset) {
+      return this.view[name](offset, littleEndian);
+    }
   });
 });
 
 [['writeUInt16LE', 'setUint16', true],
  ['writeUInt16BE', 'setUint16', false],
  ['writeInt16LE', 'setInt16', true],
  ['writeInt16BE', 'setInt16', false],
  ['writeUInt32LE', 'setUint32', true],
@@ -337,11 +339,13 @@ Object.defineProperties(Buffer.prototype
  ['writeInt32BE', 'setInt32', false],
  ['writeFloatLE', 'setFloat32', true],
  ['writeFloatBE', 'setFloat32', false],
  ['writeDoubleLE', 'setFloat64', true],
  ['writeDoubleBE', 'setFloat64', false],
  ['writeUInt8', 'setUint8'],
  ['writeInt8', 'setInt8']].forEach(([alias, name, littleEndian]) => {
   Object.defineProperty(Buffer.prototype, alias, {
-    value: function(value, offset) this.view[name](offset, value, littleEndian)
+    value: function(value, offset) {
+      return this.view[name](offset, value, littleEndian);
+    }
   });
 });
--- a/addon-sdk/source/lib/sdk/io/fs.js
+++ b/addon-sdk/source/lib/sdk/io/fs.js
@@ -77,30 +77,40 @@ var nsIFileInputStream = accessor();
 var nsIFileOutputStream = accessor();
 var nsIBinaryInputStream = accessor();
 var nsIBinaryOutputStream = accessor();
 
 // Just a contstant object used to signal that all of the file
 // needs to be read.
 const ALL = new String("Read all of the file");
 
-function isWritable(mode) !!(mode & PR_WRONLY || mode & PR_RDWR)
-function isReadable(mode) !!(mode & PR_RDONLY || mode & PR_RDWR)
+function isWritable(mode) {
+  return !!(mode & PR_WRONLY || mode & PR_RDWR);
+}
+function isReadable(mode) {
+  return !!(mode & PR_RDONLY || mode & PR_RDWR);
+}
 
-function isString(value) typeof(value) === "string"
-function isFunction(value) typeof(value) === "function"
+function isString(value) {
+  return typeof(value) === "string";
+}
+function isFunction(value) {
+  return typeof(value) === "function";
+}
 
 function toArray(enumerator) {
   let value = [];
   while(enumerator.hasMoreElements())
     value.push(enumerator.getNext())
   return value
 }
 
-function getFileName(file) file.QueryInterface(Ci.nsIFile).leafName
+function getFileName(file) {
+  return file.QueryInterface(Ci.nsIFile).leafName;
+}
 
 
 function remove(path, recursive) {
   let fd = new nsILocalFile(path)
   if (fd.exists()) {
     fd.remove(recursive || false);
   }
   else {
@@ -244,43 +254,77 @@ exports.createWriteStream = function cre
 };
 
 const Stats = Class({
   initialize: function initialize(path) {
     let file = new nsILocalFile(path);
     if (!file.exists()) throw FSError("stat", "ENOENT", 34, path);
     nsIFile(this, file);
   },
-  isDirectory: function() nsIFile(this).isDirectory(),
-  isFile: function() nsIFile(this).isFile(),
-  isSymbolicLink: function() nsIFile(this).isSymlink(),
-  get mode() nsIFile(this).permissions,
-  get size() nsIFile(this).fileSize,
-  get mtime() nsIFile(this).lastModifiedTime,
-  isBlockDevice: function() nsIFile(this).isSpecial(),
-  isCharacterDevice: function() nsIFile(this).isSpecial(),
-  isFIFO: function() nsIFile(this).isSpecial(),
-  isSocket: function() nsIFile(this).isSpecial(),
+  isDirectory: function() {
+    return nsIFile(this).isDirectory();
+  },
+  isFile: function() {
+    return nsIFile(this).isFile();
+  },
+  isSymbolicLink: function() {
+    return nsIFile(this).isSymlink();
+  },
+  get mode() {
+    return nsIFile(this).permissions;
+  },
+  get size() {
+    return nsIFile(this).fileSize;
+  },
+  get mtime() {
+    return nsIFile(this).lastModifiedTime;
+  },
+  isBlockDevice: function() {
+    return nsIFile(this).isSpecial();
+  },
+  isCharacterDevice: function() {
+    return nsIFile(this).isSpecial();
+  },
+  isFIFO: function() {
+    return nsIFile(this).isSpecial();
+  },
+  isSocket: function() {
+    return nsIFile(this).isSpecial();
+  },
   // non standard
-  get exists() nsIFile(this).exists(),
-  get hidden() nsIFile(this).isHidden(),
-  get writable() nsIFile(this).isWritable(),
-  get readable() nsIFile(this).isReadable()
+  get exists() {
+    return nsIFile(this).exists();
+  },
+  get hidden() {
+    return nsIFile(this).isHidden();
+  },
+  get writable() {
+    return nsIFile(this).isWritable();
+  },
+  get readable() {
+    return nsIFile(this).isReadable();
+  }
 });
 exports.Stats = Stats;
 
 const LStats = Class({
   extends: Stats,
-  get size() this.isSymbolicLink() ? nsIFile(this).fileSizeOfLink :
-                                     nsIFile(this).fileSize,
-  get mtime() this.isSymbolicLink() ? nsIFile(this).lastModifiedTimeOfLink :
-                                      nsIFile(this).lastModifiedTime,
+  get size() {
+    return this.isSymbolicLink() ? nsIFile(this).fileSizeOfLink :
+                                   nsIFile(this).fileSize;
+  },
+  get mtime() {
+    return this.isSymbolicLink() ? nsIFile(this).lastModifiedTimeOfLink :
+                                   nsIFile(this).lastModifiedTime;
+  },
   // non standard
-  get permissions() this.isSymbolicLink() ? nsIFile(this).permissionsOfLink :
-                                            nsIFile(this).permissions
+  get permissions() {
+    return this.isSymbolicLink() ? nsIFile(this).permissionsOfLink :
+                                   nsIFile(this).permissions;
+  }
 });
 
 const FStat = Class({
   extends: Stats,
   initialize: function initialize(fd) {
     nsIFile(this, nsIFile(fd));
   }
 });
--- a/addon-sdk/source/lib/sdk/io/stream.js
+++ b/addon-sdk/source/lib/sdk/io/stream.js
@@ -176,17 +176,19 @@ const InputStream = Class({
     nsIInputStreamPump(this, inputStreamPump);
     nsIBinaryInputStream(this, binaryInputStream);
     nsIStreamListener(this, streamListener);
 
     this.asyncInputStream = asyncInputStream;
     this.inputStreamPump = inputStreamPump;
     this.binaryInputStream = binaryInputStream;
   },
-  get status() nsIInputStreamPump(this).status,
+  get status() {
+    return nsIInputStreamPump(this).status;
+  },
   read: function() {
     nsIInputStreamPump(this).asyncRead(nsIStreamListener(this), null);
   },
   pause: function pause() {
     this.paused = true;
     nsIInputStreamPump(this).suspend();
     emit(this, "paused");
   },
--- a/addon-sdk/source/lib/sdk/l10n/plural-rules.js
+++ b/addon-sdk/source/lib/sdk/l10n/plural-rules.js
@@ -180,18 +180,22 @@ const LOCALES_TO_RULES = {
   "xh": 3, 
   "xog": 3, 
   "yo": 0, 
   "zh": 0, 
   "zu": 3
 };
 
 // Utility functions for plural rules methods
-function isIn(n, list) list.indexOf(n) !== -1;
-function isBetween(n, start, end) start <= n && n <= end;
+function isIn(n, list) {
+  return list.indexOf(n) !== -1;
+}
+function isBetween(n, start, end) {
+  return start <= n && n <= end;
+}
 
 // List of all plural rules methods, that maps an integer to the plural form name to use
 const RULES = {
   "0": function (n) {
     
     return "other"
   },
   "1": function (n) {
--- a/addon-sdk/source/lib/sdk/l10n/properties/core.js
+++ b/addon-sdk/source/lib/sdk/l10n/properties/core.js
@@ -75,9 +75,9 @@ function get(key, n, locales) {
   }
 
   // try next locale
   if (locales.length)
     return get(key, n, locales);
 
   return undefined;
 }
-exports.get = function(k, n) get(k, n, Array.slice(preferedLocales));
+exports.get = (k, n) => get(k, n, Array.slice(preferedLocales));
--- a/addon-sdk/source/lib/sdk/loader/sandbox.js
+++ b/addon-sdk/source/lib/sdk/loader/sandbox.js
@@ -10,17 +10,17 @@ module.metadata = {
 const { Cc, Ci, CC, Cu } = require('chrome');
 const systemPrincipal = CC('@mozilla.org/systemprincipal;1', 'nsIPrincipal')();
 const scriptLoader = Cc['@mozilla.org/moz/jssubscript-loader;1'].
                      getService(Ci.mozIJSSubScriptLoader);
 const self = require('sdk/self');
 const { getTabId, getTabForContentWindow } = require('../tabs/utils');
 const { getInnerId } = require('../window/utils');
 
-const { devtools } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
+const { devtools } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { require: devtoolsRequire } = devtools;
 const { addContentGlobal, removeContentGlobal } = devtoolsRequire("devtools/server/content-globals");
 
 /**
  * Make a new sandbox that inherits given `source`'s principals. Source can be
  * URI string, DOMWindow or `null` for system principals.
  */
 function sandbox(target, options) {
--- a/addon-sdk/source/lib/sdk/notifications.js
+++ b/addon-sdk/source/lib/sdk/notifications.js
@@ -65,17 +65,17 @@ exports.notify = function notifications_
       notifyWithOpts(notifyUsingConsole);
     }
   }
 };
 
 function notifyUsingConsole(iconURL, title, text) {
   title = title ? "[" + title + "]" : "";
   text = text || "";
-  let str = [title, text].filter(function (s) s).join(" ");
+  let str = [title, text].filter(s => s).join(" ");
   console.log(str);
 }
 
 function validateOptions(options) {
   return apiUtils.validateOptions(options, {
     data: {
       is: ["string", "undefined"]
     },
--- a/addon-sdk/source/lib/sdk/page-worker.js
+++ b/addon-sdk/source/lib/sdk/page-worker.js
@@ -34,20 +34,28 @@ const workers = new WeakMap();
 const pages = new WeakMap();
 
 const readyEventNames = [
   'DOMContentLoaded',
   'document-element-inserted',
   'load'
 ];
 
-function workerFor(page) workers.get(page)
-function pageFor(view) pages.get(view)
-function viewFor(page) views.get(page)
-function isDisposed (page) !views.get(page, false)
+function workerFor(page) {
+  return workers.get(page);
+}
+function pageFor(view) {
+  return pages.get(view);
+}
+function viewFor(page) {
+  return views.get(page);
+}
+function isDisposed (page) {
+  return !views.get(page, false);
+}
 
 var pageContract = contract(merge({
   allow: {
     is: ['object', 'undefined', 'null'],
     map: function (allow) { return { script: !allow || allow.script !== false }}
   },
   onMessage: {
     is: ['function', 'undefined']
@@ -77,17 +85,19 @@ function Allow (page) {
 
 function injectWorker ({page}) {
   let worker = workerFor(page);
   let view = viewFor(page);
   if (isValidURL(page, view.contentDocument.URL))
     attach(worker, view.contentWindow);
 }
 
-function isValidURL(page, url) !page.rules || page.rules.matchesAny(url)
+function isValidURL(page, url) {
+  return !page.rules || page.rules.matchesAny(url);
+}
 
 const Page = Class({
   implements: [
     EventTarget,
     Disposable,
     WeakReference
   ],
   extends: WorkerHost(workerFor),
--- a/addon-sdk/source/lib/sdk/panel.js
+++ b/addon-sdk/source/lib/sdk/panel.js
@@ -90,17 +90,19 @@ function Allow(panel) {
 
 function setScriptState(panel, value) {
   let view = viewFor(panel);
   getDocShell(view.backgroundFrame).allowJavascript = value;
   getDocShell(view.viewFrame).allowJavascript = value;
   view.setAttribute("sdkscriptenabled", "" + value);
 }
 
-function isDisposed(panel) !views.has(panel);
+function isDisposed(panel) {
+  return !views.has(panel);
+}
 
 var panels = new WeakMap();
 var models = new WeakMap();
 var views = new WeakMap();
 var workers = new WeakMap();
 var styles = new WeakMap();
 
 const viewFor = (panel) => views.get(panel);
@@ -196,54 +198,72 @@ const Panel = Class({
     domPanel.dispose(viewFor(this));
 
     // Release circular reference between view and panel instance. This
     // way view will be GC-ed. And panel as well once all the other refs
     // will be removed from it.
     views.delete(this);
   },
   /* Public API: Panel.width */
-  get width() modelFor(this).width,
-  set width(value) this.resize(value, this.height),
+  get width() {
+    return modelFor(this).width;
+  },
+  set width(value) {
+    this.resize(value, this.height);
+  },
   /* Public API: Panel.height */
-  get height() modelFor(this).height,
-  set height(value) this.resize(this.width, value),
+  get height() {
+    return modelFor(this).height;
+  },
+  set height(value) {
+    this.resize(this.width, value);
+  },
 
   /* Public API: Panel.focus */
-  get focus() modelFor(this).focus,
+  get focus() {
+    return modelFor(this).focus;
+  },
 
   /* Public API: Panel.position */
-  get position() modelFor(this).position,
+  get position() {
+    return modelFor(this).position;
+  },
 
   /* Public API: Panel.contextMenu */
-  get contextMenu() modelFor(this).contextMenu,
+  get contextMenu() {
+    return modelFor(this).contextMenu;
+  },
   set contextMenu(allow) {
     let model = modelFor(this);
     model.contextMenu = panelContract({ contextMenu: allow }).contextMenu;
     domPanel.allowContextMenu(viewFor(this), model.contextMenu);
   },
 
-  get contentURL() modelFor(this).contentURL,
+  get contentURL() {
+    return modelFor(this).contentURL;
+  },
   set contentURL(value) {
     let model = modelFor(this);
     model.contentURL = panelContract({ contentURL: value }).contentURL;
     domPanel.setURL(viewFor(this), model.contentURL);
     // Detach worker so that messages send will be queued until it's
     // reatached once panel content is ready.
     workerFor(this).detach();
   },
 
   get allow() { return Allow(this); },
   set allow(value) {
     let allowJavascript = panelContract({ allow: value }).allow.script;
     return setScriptState(this, value);
   },
 
   /* Public API: Panel.isShowing */
-  get isShowing() !isDisposed(this) && domPanel.isOpen(viewFor(this)),
+  get isShowing() {
+    return !isDisposed(this) && domPanel.isOpen(viewFor(this));
+  },
 
   /* Public API: Panel.show */
   show: function show(options={}, anchor) {
     if (options instanceof Ci.nsIDOMElement) {
       [anchor, options] = [options, null];
     }
 
     if (anchor instanceof Ci.nsIDOMElement) {
--- a/addon-sdk/source/lib/sdk/panel/events.js
+++ b/addon-sdk/source/lib/sdk/panel/events.js
@@ -11,16 +11,17 @@ module.metadata = {
   "stability": "experimental"
 };
 
 const events = require("../system/events");
 const { emit } = require("../event/core");
 
 var channel = {};
 
-function forward({ subject, type, data })
-  emit(channel, "data", { target: subject, type: type, data: data });
+function forward({ subject, type, data }) {
+  return emit(channel, "data", { target: subject, type: type, data: data });
+}
 
 ["popupshowing", "popuphiding", "popupshown", "popuphidden",
 "document-element-inserted", "DOMContentLoaded", "load"
-].forEach(function(type) events.on(type, forward));
+].forEach(type => events.on(type, forward));
 
 exports.events = channel;
--- a/addon-sdk/source/lib/sdk/panel/utils.js
+++ b/addon-sdk/source/lib/sdk/panel/utils.js
@@ -424,17 +424,19 @@ function style(panel) {
 exports.style = style;
 
 var getContentFrame = panel =>
     (isOpen(panel) || isOpening(panel)) ?
     panel.firstChild :
     panel.backgroundFrame
 exports.getContentFrame = getContentFrame;
 
-function getContentDocument(panel) getContentFrame(panel).contentDocument
+function getContentDocument(panel) {
+  return getContentFrame(panel).contentDocument;
+}
 exports.getContentDocument = getContentDocument;
 
 function setURL(panel, url) {
   getContentFrame(panel).setAttribute("src", url ? data.url(url) : url);
 }
 
 exports.setURL = setURL;
 
--- a/addon-sdk/source/lib/sdk/passwords/utils.js
+++ b/addon-sdk/source/lib/sdk/passwords/utils.js
@@ -11,18 +11,19 @@ module.metadata = {
 const { Cc, Ci, CC } = require("chrome");
 const { uri: ADDON_URI } = require("../self");
 const loginManager = Cc["@mozilla.org/login-manager;1"].
                      getService(Ci.nsILoginManager);
 const { URL: parseURL } = require("../url");
 const LoginInfo = CC("@mozilla.org/login-manager/loginInfo;1",
                      "nsILoginInfo", "init");
 
-function filterMatchingLogins(loginInfo)
-  Object.keys(this).every(function(key) loginInfo[key] === this[key], this);
+function filterMatchingLogins(loginInfo) {
+  return Object.keys(this).every(key => loginInfo[key] === this[key], this);
+}
 
 /**
  * Removes `user`, `password` and `path` fields from the given `url` if it's
  * 'http', 'https' or 'ftp'. All other URLs are returned unchanged.
  * @example
  * http://user:pass@www.site.com/foo/?bar=baz#bang -> http://www.site.com
  */
 function normalizeURL(url) {
@@ -65,17 +66,19 @@ Login.prototype.toJSON = function toJSON
 Login.prototype.toLoginInfo = function toLoginInfo() {
   let { url, realm, formSubmitURL, username, password, usernameField,
         passwordField } = this.toJSON();
 
   return new LoginInfo(url, formSubmitURL, realm, username, password,
                        usernameField, passwordField);
 };
 
-function loginToJSON(value) Login(value).toJSON()
+function loginToJSON(value) {
+  return Login(value).toJSON();
+}
 
 /**
  * Returns array of `nsILoginInfo` objects that are stored in the login manager
  * and have all the properties with matching values as a given `options` object.
  * @param {Object} options
  * @returns {nsILoginInfo[]}
  */
 exports.search = function search(options) {
--- a/addon-sdk/source/lib/sdk/places/bookmarks.js
+++ b/addon-sdk/source/lib/sdk/places/bookmarks.js
@@ -57,45 +57,45 @@ const BOOKMARK_QUERY = 1;
 const Bookmark = Class({
   extends: [
     bookmarkContract.properties(identity)
   ],
   initialize: function initialize (options) {
     merge(this, bookmarkContract(extend(defaults, options)));
   },
   type: 'bookmark',
-  toString: function () '[object Bookmark]'
+  toString: () => '[object Bookmark]'
 });
 exports.Bookmark = Bookmark;
 
 const Group = Class({
   extends: [
     groupContract.properties(identity)
   ],
   initialize: function initialize (options) {
     // Don't validate if root group
     if (isRootGroup(options))
       merge(this, options);
     else
       merge(this, groupContract(extend(defaults, options)));
   },
   type: 'group',
-  toString: function () '[object Group]'
+  toString: () => '[object Group]'
 });
 exports.Group = Group;
 
 const Separator = Class({
   extends: [
     separatorContract.properties(identity)
   ],
   initialize: function initialize (options) {
     merge(this, separatorContract(extend(defaults, options)));
   },
   type: 'separator',
-  toString: function () '[object Separator]'
+  toString: () => '[object Separator]'
 });
 exports.Separator = Separator;
 
 /*
  * Functions
  */
 
 function save (items, options) {
--- a/addon-sdk/source/lib/sdk/places/contract.js
+++ b/addon-sdk/source/lib/sdk/places/contract.js
@@ -24,17 +24,17 @@ const validItem = {
         (value.toString && value.toString() === '[object Group]') ||
         typeof value === 'number' ||
         value.type === 'group';
     },
     msg: 'The `group` property must be a valid Group object'
   },
   index: {
     is: ['undefined', 'null', 'number'],
-    map: function (value) value == null ? -1 : value,
+    map: value => value == null ? -1 : value,
     msg: 'The `index` property must be a number.'
   },
   updated: {
     is: ['number', 'undefined']
   }
 };
 
 const validTitle = {
@@ -50,17 +50,17 @@ const validURL = {
     ok: isValidURI,
     msg: 'The `url` property must be a valid URL.'
   }
 };
 
 const validTags = {
   tags: {
     is: ['object'],
-    ok: function (tags) tags instanceof Set,
+    ok: tags => tags instanceof Set,
     map: function (tags) {
       if (Array.isArray(tags))
         return new Set(tags);
       if (tags == null)
         return new Set();
       return tags;
     },
     msg: 'The `tags` property must be a Set, or an array'
--- a/addon-sdk/source/lib/sdk/places/host/host-bookmarks.js
+++ b/addon-sdk/source/lib/sdk/places/host/host-bookmarks.js
@@ -58,18 +58,19 @@ function typeMap (type) {
     if (bmsrv.TYPE_SEPARATOR === type) return 'separator';
   } else {
     if ('bookmark' === type) return bmsrv.TYPE_BOOKMARK;
     if ('group' === type) return bmsrv.TYPE_FOLDER;
     if ('separator' === type) return bmsrv.TYPE_SEPARATOR;
   }
 }
 
-function getBookmarkLastUpdated ({id})
-  resolve(bmsrv.getItemLastModified(id))
+function getBookmarkLastUpdated ({id}) {
+  return resolve(bmsrv.getItemLastModified(id));
+}
 exports.getBookmarkLastUpdated;
 
 function createBookmarkItem (data) {
   let error;
 
   if (data.group == null) data.group = UNSORTED_ID;
   if (data.index == null) data.index = DEFAULT_INDEX;
 
--- a/addon-sdk/source/lib/sdk/places/host/host-query.js
+++ b/addon-sdk/source/lib/sdk/places/host/host-query.js
@@ -150,16 +150,16 @@ function normalize (historyObj) {
     return obj;
   }, {});
 }
 
 /*
  * Hook into host
  */
 
-var reqStream = filter(request, function (data) /sdk-places-query/.test(data.event));
+var reqStream = filter(request, data => /sdk-places-query/.test(data.event));
 on(reqStream, 'data', function (e) {
   if (EVENT_MAP[e.event]) EVENT_MAP[e.event](e);
 });
 
 function respond (data) {
   emit(response, 'data', data);
 }
--- a/addon-sdk/source/lib/sdk/places/host/host-tags.js
+++ b/addon-sdk/source/lib/sdk/places/host/host-tags.js
@@ -55,17 +55,17 @@ function untag (message) {
 function getURLsByTag (message) {
   let data = message.data;
   let resData = {
     id: message.id,
     event: message.event
   };
 
   resData.data = taggingService
-    .getURIsForTag(data.tag).map(function (uri) uri.spec);
+    .getURIsForTag(data.tag).map(uri => uri.spec);
   respond(resData);
 }
 
 function getTagsByURL (message) {
   let data = message.data;
   let resData = {
     id: message.id,
     event: message.event
--- a/addon-sdk/source/lib/sdk/places/utils.js
+++ b/addon-sdk/source/lib/sdk/places/utils.js
@@ -39,17 +39,17 @@ var TreeNode = Class({
   get length () {
     let count = 0;
     this.walk(() => count++);
     // Do not count the current node
     return --count;
   },
   get: method(get),
   walk: method(walk),
-  toString: function () '[object TreeNode]'
+  toString: () => '[object TreeNode]'
 });
 exports.TreeNode = TreeNode;
 
 /*
  * Descends down from `node` applying `fn` to each in order.
  * `fn` can return values or promises -- if promise returned,
  * children are not processed until resolved. `fn` is passed
  * one argument, the current node, `curr`.
@@ -98,18 +98,19 @@ function constructTree (items) {
   return root;
 }
 exports.constructTree = constructTree;
 
 /*
  * Shortcut for converting an id, or an object with an id, into
  * an object with corresponding bookmark data
  */
-function fetchItem (item)
-  send('sdk-places-bookmarks-get', { id: item.id || item })
+function fetchItem (item) {
+  return send('sdk-places-bookmarks-get', { id: item.id || item });
+}
 exports.fetchItem = fetchItem;
 
 /*
  * Takes an ID or an object with ID and checks it against
  * the root bookmark folders
  */
 function isRootGroup (id) {
   id = id && id.id;
--- a/addon-sdk/source/lib/sdk/platform/xpcom.js
+++ b/addon-sdk/source/lib/sdk/platform/xpcom.js
@@ -16,18 +16,18 @@ const { merge } = require('../util/objec
 const { Class, extend, mix } = require('../core/heritage');
 const { uuid } = require('../util/uuid');
 
 // This is a base prototype, that provides bare bones of XPCOM. JS based
 // components can be easily implement by extending it.
 const Unknown = new function() {
   function hasInterface(component, iid) {
     return component && component.interfaces &&
-      ( component.interfaces.some(function(id) iid.equals(Ci[id])) ||
-        component.implements.some(function($) hasInterface($, iid)) ||
+      ( component.interfaces.some(id => iid.equals(Ci[id])) ||
+        component.implements.some($ => hasInterface($, iid)) ||
         hasInterface(Object.getPrototypeOf(component), iid));
   }
 
   return Class({
     /**
      * The `QueryInterface` method provides runtime type discovery used by XPCOM.
      * This method return queried instance of `this` if given `iid` is listed in
      * the `interfaces` property or in equivalent properties of objects in it's
@@ -80,17 +80,19 @@ const Factory = Class({
    * human-readable description for the given class and does not needs to be
    * globally unique.
    */
   description: 'Jetpack generated factory',
   /**
    * This method is required by `nsIFactory` interfaces, but as in most
    * implementations it does nothing interesting.
    */
-  lockFactory: function lockFactory(lock) undefined,
+  lockFactory: function lockFactory(lock) {
+    return undefined;
+  },
   /**
    * If property is `true` XPCOM service / factory will be registered
    * automatically on creation.
    */
   register: true,
   /**
    * If property is `true` XPCOM factory will be unregistered prior to add-on
    * unload.
@@ -126,38 +128,44 @@ const Factory = Class({
       if (outer)
         throw Cr.NS_ERROR_NO_AGGREGATION;
       return this.create().QueryInterface(iid);
     }
     catch (error) {
       throw error instanceof Ci.nsIException ? error : Cr.NS_ERROR_FAILURE;
     }
   },
-  create: function create() this.Component()
+  create: function create() {
+    return this.Component();
+  }
 });
 exports.Factory = Factory;
 
 // Exemplar for creating services that implement `nsIFactory` interface, that
 // can be registered into runtime via call to `register`. This services return
 // enclosed `component` on `getService`.
 const Service = Class({
   extends: Factory,
   initialize: function initialize(options) {
     this.component = options.Component();
     Factory.prototype.initialize.call(this, options);
   },
   description: 'Jetpack generated service',
   /**
    * Creates an instance of the class associated with this factory.
    */
-  create: function create() this.component
+  create: function create() {
+    return this.component;
+  }
 });
 exports.Service = Service;
 
-function isRegistered({ id }) isCIDRegistered(id)
+function isRegistered({ id }) {
+  return isCIDRegistered(id);
+}
 exports.isRegistered = isRegistered;
 
 /**
  * Registers given `component` object to be used to instantiate a particular
  * class identified by `component.id`, and creates an association of class
  * name and `component.contract` with the class.
  */
 function register(factory) {
@@ -211,19 +219,23 @@ function autoRegister(path) {
   Cm.QueryInterface(Ci.nsIComponentRegistrar);
   Cm.autoRegister(file);
 }
 exports.autoRegister = autoRegister;
 
 /**
  * Returns registered factory that has a given `id` or `null` if not found.
  */
-function factoryByID(id) classesByID[id] || null
+function factoryByID(id) {
+  return classesByID[id] || null;
+}
 exports.factoryByID = factoryByID;
 
 /**
  * Returns factory registered with a given `contract` or `null` if not found.
  * In contrast to `Cc[contract]` that does ignores new factory registration
  * with a given `contract` this will return a factory currently associated
  * with a `contract`.
  */
-function factoryByContract(contract) factoryByID(Cm.contractIDToCID(contract))
+function factoryByContract(contract) {
+  return factoryByID(Cm.contractIDToCID(contract));
+}
 exports.factoryByContract = factoryByContract;
--- a/addon-sdk/source/lib/sdk/request.js
+++ b/addon-sdk/source/lib/sdk/request.js
@@ -21,37 +21,37 @@ const { isValidURI } = require("./url.js
 const response = ns();
 const request = ns();
 
 // Instead of creating a new validator for each request, just make one and
 // reuse it.
 const { validateOptions, validateSingleOption } = new OptionsValidator({
   url: {
     // Also converts a URL instance to string, bug 857902
-    map: function (url) url.toString(),
+    map: url => url.toString(),
     ok: isValidURI
   },
   headers: {
-    map: function (v) v || {},
+    map: v => v || {},
     is:  ["object"],
   },
   content: {
-    map: function (v) v || null,
+    map: v => v || null,
     is:  ["string", "object", "null"],
   },
   contentType: {
-    map: function (v) v || "application/x-www-form-urlencoded",
+    map: v => v || "application/x-www-form-urlencoded",
     is:  ["string"],
   },
   overrideMimeType: {
-    map: function(v) v || null,
+    map: v => v || null,
     is: ["string", "null"],
   },
   anonymous: {
-    map: function(v) v || false,
+    map: v => v || false,
     is: ["boolean", "null"],
   }
 });
 
 const REUSE_ERROR = "This request object has been used already. You must " +
                     "create a new one to make a new request."
 
 // Utility function to prep the request since it's the same between
@@ -160,24 +160,32 @@ const Request = Class({
 });
 exports.Request = Request;
 
 const Response = Class({
   initialize: function initialize(request) {
     response(this).request = request;
   },
   // more about responseURL: https://bugzilla.mozilla.org/show_bug.cgi?id=998076
-  get url() response(this).request.responseURL,
-  get text() response(this).request.responseText,
+  get url() {
+    return response(this).request.responseURL;
+  },
+  get text() {
+    return response(this).request.responseText;
+  },
   get xml() {
     throw new Error("Sorry, the 'xml' property is no longer available. " +
                     "see bug 611042 for more information.");
   },
-  get status() response(this).request.status,
-  get statusText() response(this).request.statusText,
+  get status() {
+    return response(this).request.status;
+  },
+  get statusText() {
+    return response(this).request.statusText;
+  },
   get json() {
     try {
       return JSON.parse(this.text);
     } catch(error) {
       return null;
     }
   },
   get headers() {
@@ -207,17 +215,19 @@ const Response = Class({
         lastKey = key;
       }
       else {
         headers[lastKey] += "\n" + val;
       }
     });
     return headers;
   },
-  get anonymous() response(this).request.mozAnon
+  get anonymous() {
+    return response(this).request.mozAnon;
+  }
 });
 
 // apiUtils.validateOptions doesn't give the ability to easily validate single
 // options, so this is a wrapper that provides that ability.
 function OptionsValidator(rules) {
   return {
     validateOptions: function (options) {
       return apiUtils.validateOptions(options, rules);
--- a/addon-sdk/source/lib/sdk/selection.js
+++ b/addon-sdk/source/lib/sdk/selection.js
@@ -75,17 +75,17 @@ const Selection = Class({
         break;
 
     return count === 1;
   }
 });
 
 const selectionListener = {
   notifySelectionChanged: function (document, selection, reason) {
-    if (!["SELECTALL", "KEYPRESS", "MOUSEUP"].some(function(type) reason &
+    if (!["SELECTALL", "KEYPRESS", "MOUSEUP"].some(type => reason &
       Ci.nsISelectionListener[type + "_REASON"]) || selection.toString() == "")
         return;
 
     this.onSelect();
   },
 
   onSelect: function() {
     emit(module.exports, "select");
--- a/addon-sdk/source/lib/sdk/system/environment.js
+++ b/addon-sdk/source/lib/sdk/system/environment.js
@@ -10,51 +10,55 @@ module.metadata = {
 
 const { Cc, Ci } = require('chrome');
 const { get, set, exists } = Cc['@mozilla.org/process/environment;1'].
                              getService(Ci.nsIEnvironment);
 
 exports.env = Proxy.create({
   // XPCOM does not provides a way to enumerate environment variables, so we
   // just don't support enumeration.
-  getPropertyNames: function() [],
-  getOwnPropertyNames: function() [],
-  enumerate: function() [],
-  keys: function() [],
+  getPropertyNames: () => [],
+  getOwnPropertyNames: () => [],
+  enumerate: () => [],
+  keys: () => [],
   // We do not support freezing, cause it would make it impossible to set new
   // environment variables.
-  fix: function() undefined,
+  fix: () => undefined,
   // We present all environment variables as own properties of this object,
   // so we just delegate this call to `getOwnPropertyDescriptor`.
-  getPropertyDescriptor: function(name) this.getOwnPropertyDescriptor(name),
+  getPropertyDescriptor: function(name) {
+    return this.getOwnPropertyDescriptor(name);
+  },
   // If environment variable with this name is defined, we generate proprety
   // descriptor for it, otherwise fall back to `undefined` so that for consumer
   // this property does not exists.
   getOwnPropertyDescriptor: function(name) {
     return !exists(name) ? undefined : {
       value: get(name),
       enumerable: false,    // Non-enumerable as we don't support enumeration.
       configurable: true,   // Configurable as it may be deleted.
       writable: true        // Writable as we do support set.
     }
   },
 
   // New environment variables can be defined just by defining properties
   // on this object.
-  defineProperty: function(name, { value }) set(name, value),
+  defineProperty: (name, { value }) => set(name, value),
   delete: function(name) {
     set(name, null);
     return true;
   },
 
   // We present all properties as own, there for we just delegate to `hasOwn`.
-  has: function(name) this.hasOwn(name),
+  has: function(name) {
+    return this.hasOwn(name);
+  },
   // We do support checks for existence of an environment variable, via `in`
   // operator on this object.
-  hasOwn: function(name) exists(name),
+  hasOwn: name => exists(name),
 
   // On property get / set we do read / write appropriate environment variables,
   // please note though, that variables with names of standard object properties
   // intentionally (so that this behaves as normal object) can not be
   // read / set.
-  get: function(proxy, name) Object.prototype[name] || get(name) || undefined,
-  set: function(proxy, name, value) Object.prototype[name] || set(name, value)
+  get: (proxy, name) => Object.prototype[name] || get(name) || undefined,
+  set: (proxy, name, value) => Object.prototype[name] || set(name, value)
 });
--- a/addon-sdk/source/lib/sdk/tab/events.js
+++ b/addon-sdk/source/lib/sdk/tab/events.js
@@ -30,24 +30,24 @@ const TYPES = ["TabOpen","TabClose","Tab
                "TabUnpinned"];
 
 // Utility function that given a browser `window` returns stream of above
 // defined tab events for all tabs on the given window.
 function tabEventsFor(window) {
   // Map supported event types to a streams of those events on the given
   // `window` and than merge these streams into single form stream off
   // all events.
-  let channels = TYPES.map(function(type) open(window, type));
+  let channels = TYPES.map(type => open(window, type));
   return merge(channels);
 }
 
 // Filter DOMContentLoaded events from all the browser events.
-var readyEvents = filter(events, function(e) e.type === "DOMContentLoaded");
+var readyEvents = filter(events, e => e.type === "DOMContentLoaded");
 // Map DOMContentLoaded events to it's target browser windows.
-var futureWindows = map(readyEvents, function(e) e.target);
+var futureWindows = map(readyEvents, e => e.target);
 // Expand all browsers that will become interactive to supported tab events
 // on these windows. Result will be a tab events from all tabs of all windows
 // that will become interactive.
 var eventsFromFuture = expand(futureWindows, tabEventsFor);
 
 // Above covers only windows that will become interactive in a future, but some
 // windows may already be interactive so we pick those and expand to supported
 // tab events for them too.
--- a/addon-sdk/source/lib/sdk/tabs/tab-fennec.js
+++ b/addon-sdk/source/lib/sdk/tabs/tab-fennec.js
@@ -53,28 +53,34 @@ const Tab = Class({
     unload(cleanupTab.bind(null, this));
   },
 
   /**
    * The title of the page currently loaded in the tab.
    * Changing this property changes an actual title.
    * @type {String}
    */
-  get title() getTabTitle(tabNS(this).tab),
-  set title(title) setTabTitle(tabNS(this).tab, title),
+  get title() {
+    return getTabTitle(tabNS(this).tab);
+  },
+  set title(title) {
+    setTabTitle(tabNS(this).tab, title);
+  },
 
   /**
    * Location of the page currently loaded in this tab.
    * Changing this property will loads page under under the specified location.
    * @type {String}
    */
   get url() {
     return tabNS(this).closed ? undefined : getTabURL(tabNS(this).tab);
   },
-  set url(url) setTabURL(tabNS(this).tab, url),
+  set url(url) {
+    setTabURL(tabNS(this).tab, url);
+  },
 
   getThumbnail: function() {
     // TODO: implement!
     console.error(ERR_FENNEC_MSG);
 
     // return 80x45 blank default
     return BLANK;
   },
@@ -126,17 +132,19 @@ const Tab = Class({
     console.error(ERR_FENNEC_MSG); // TODO
   },
 
   /**
    * Returns the MIME type that the document loaded in the tab is being
    * rendered as.
    * @type {String}
    */
-  get contentType() getTabContentType(tabNS(this).tab),
+  get contentType() {
+    return getTabContentType(tabNS(this).tab);
+  },
 
   /**
    * Create a worker for this tab, first argument is options given to Worker.
    * @type {Worker}
    */
   attach: function attach(options) {
     // BUG 792946 https://bugzilla.mozilla.org/show_bug.cgi?id=792946
     // TODO: fix this circular dependency
--- a/addon-sdk/source/lib/sdk/tabs/tab-firefox.js
+++ b/addon-sdk/source/lib/sdk/tabs/tab-firefox.js
@@ -210,17 +210,17 @@ const Tab = Class({
     if (frame) {
       attach(frame);
     }
     else {
       let listener = (frame) => {
         if (frame.frameElement != browser(this))
           return;
 
-        listener.off("attach", listener);
+        frames.off("attach", listener);
         attach(frame);
       };
       frames.on("attach", listener);
     }
 
     return worker;
   },
 
--- a/addon-sdk/source/lib/sdk/tabs/utils.js
+++ b/addon-sdk/source/lib/sdk/tabs/utils.js
@@ -12,17 +12,19 @@ module.metadata = {
 
 
 const { Ci } = require('chrome');
 const { defer } = require("../lang/functional");
 const { windows, isBrowser } = require('../window/utils');
 const { isPrivateBrowsingSupported } = require('../self');
 
 // Bug 834961: ignore private windows when they are not supported
-function getWindows() windows(null, { includePrivate: isPrivateBrowsingSupported });
+function getWindows() {
+  return windows(null, { includePrivate: isPrivateBrowsingSupported });
+}
 
 const XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
 
 // Define predicate functions that can be used to detech weather
 // we deal with fennec tabs or firefox tabs.
 
 // Predicate to detect whether tab is XUL "Tab" node.
 const isXULTab = tab =>
@@ -86,17 +88,17 @@ function getTabs(window) {
                reduce((tabs, window) => tabs.concat(getTabs(window)), []);
   }
 
   // fennec
   if (window.BrowserApp)
     return window.BrowserApp.tabs;
 
   // firefox - default
-  return Array.filter(getTabContainer(window).children, function(t) !t.closing);
+  return Array.filter(getTabContainer(window).children, t => !t.closing);
 }
 exports.getTabs = getTabs;
 
 function getActiveTab(window) {
   return getSelectedTab(window);
 }
 exports.getActiveTab = getActiveTab;
 
@@ -316,17 +318,19 @@ exports.pin = pin;
 
 function unpin(tab) {
   let gBrowser = getTabBrowserForTab(tab);
   // TODO: Implement Fennec support
   if (gBrowser) gBrowser.unpinTab(tab);
 }
 exports.unpin = unpin;
 
-function isPinned(tab) !!tab.pinned
+function isPinned(tab) {
+  return !!tab.pinned;
+}
 exports.isPinned = isPinned;
 
 function reload(tab) {
   getBrowserForTab(tab).reload();
 }
 exports.reload = reload
 
 function getIndex(tab) {
--- a/addon-sdk/source/lib/sdk/test/harness.js
+++ b/addon-sdk/source/lib/sdk/test/harness.js
@@ -322,17 +322,19 @@ function getPotentialLeaks() {
         return;
       }
 
       let item = {
         path: matches[1],
         principal: details[1],
         location: details[2] ? details[2].replace(/\\/g, "/") : undefined,
         source: details[3] ? details[3].split(" -> ").reverse() : undefined,
-        toString: function() this.location
+        toString: function() {
+          return this.location;
+        }
       };
 
       if (!isPossibleLeak(item))
         return;
 
       compartments[matches[1]] = item;
       return;
     }
@@ -346,17 +348,19 @@ function getPotentialLeaks() {
         console.error("Unable to parse window detail " + matches[1]);
         return;
       }
 
       let item = {
         path: matches[1],
         location: details[1].replace(/\\/g, "/"),
         source: [details[1].replace(/\\/g, "/")],
-        toString: function() this.location
+        toString: function() {
+          return this.location;
+        }
       };
 
       if (!isPossibleLeak(item))
         return;
 
       windows[matches[1]] = item;
     }
   }
@@ -626,17 +630,17 @@ var runTests = exports.runTests = functi
                     Error.prototype;
     let stack = serializeStack(frames.reverse());
 
     let error = Object.create(prototype, {
       message: { value: e.message, writable: true, configurable: true },
       fileName: { value: e.fileName, writable: true, configurable: true },
       lineNumber: { value: e.lineNumber, writable: true, configurable: true },
       stack: { value: stack, writable: true, configurable: true },
-      toString: { value: function() String(e), writable: true, configurable: true },
+      toString: { value: () => String(e), writable: true, configurable: true },
     });
 
     print("Error: " + error + " \n " + format(error));
     onDone({passed: 0, failed: 1});
   }
 };
 
 unload(_ => consoleListener.unregister());
--- a/addon-sdk/source/lib/sdk/ui/button/action.js
+++ b/addon-sdk/source/lib/sdk/ui/button/action.js
@@ -66,17 +66,19 @@ const ActionButton = Class({
 
     off(this);
 
     view.dispose(id);
 
     unregister(this);
   },
 
-  get id() this.state().id,
+  get id() {
+    return this.state().id;
+  },
 
   click: function click() { view.click(toWidgetId(this.id)) }
 });
 exports.ActionButton = ActionButton;
 
 identify.define(ActionButton, ({id}) => toWidgetId(id));
 
 getNodeView.define(ActionButton, button =>
--- a/addon-sdk/source/lib/sdk/ui/button/toggle.js
+++ b/addon-sdk/source/lib/sdk/ui/button/toggle.js
@@ -67,19 +67,23 @@ const ToggleButton = Class({
 
     off(this);
 
     view.dispose(id);
 
     unregister(this);
   },
 
-  get id() this.state().id,
+  get id() {
+    return this.state().id;
+  },
 
-  click: function click() view.click(toWidgetId(this.id))
+  click: function click() {
+    return view.click(toWidgetId(this.id));
+  }
 });
 exports.ToggleButton = ToggleButton;
 
 identify.define(ToggleButton, ({id}) => toWidgetId(id));
 
 getNodeView.define(ToggleButton, button =>
   view.nodeFor(toWidgetId(button.id))
 );
--- a/addon-sdk/source/lib/sdk/ui/sidebar.js
+++ b/addon-sdk/source/lib/sdk/ui/sidebar.js
@@ -207,48 +207,58 @@ const Sidebar = Class({
         }
       }
     });
 
     views.set(this, bars);
 
     add(sidebars, this);
   },
-  get id() (modelFor(this) || {}).id,
-  get title() (modelFor(this) || {}).title,
+  get id() {
+    return (modelFor(this) || {}).id;
+  },
+  get title() {
+    return (modelFor(this) || {}).title;
+  },
   set title(v) {
     // destroyed?
     if (!modelFor(this))
       return;
     // validation
     if (typeof v != 'string')
       throw Error('title must be a string');
     validateTitleAndURLCombo(this, v, this.url);
     // do update
     updateTitle(this, v);
     return modelFor(this).title = v;
   },
-  get url() (modelFor(this) || {}).url,
+  get url() {
+    return (modelFor(this) || {}).url;
+  },
   set url(v) {
     // destroyed?
     if (!modelFor(this))
       return;
 
     // validation
     if (!isLocalURL(v))
       throw Error('the url must be a valid local url');
 
     validateTitleAndURLCombo(this, this.title, v);
 
     // do update
     updateURL(this, v);
     modelFor(this).url = v;
   },
-  show: function(window) showSidebar(viewFor(window), this),
-  hide: function(window) hideSidebar(viewFor(window), this),
+  show: function(window) {
+    return showSidebar(viewFor(window), this);
+  },
+  hide: function(window) {
+    return hideSidebar(viewFor(window), this);
+  },
   dispose: function() {
     const internals = sidebarNS(this);
 
     off(this);
 
     remove(sidebars, this);
 
     // stop tracking windows
--- a/addon-sdk/source/lib/sdk/ui/sidebar/contract.js
+++ b/addon-sdk/source/lib/sdk/ui/sidebar/contract.js
@@ -16,12 +16,12 @@ exports.contract = contract({
   },
   title: {
   	is: [ 'string' ],
   	ok: v => v.length
   },
   url: {
     is: [ 'string' ],
     ok: v => isLocalURL(v),
-    map: function(v) v.toString(),
+    map: v => v.toString(),
     msg: 'The option "url" must be a valid local URI.'
   }
 });
--- a/addon-sdk/source/lib/sdk/ui/sidebar/namespace.js
+++ b/addon-sdk/source/lib/sdk/ui/sidebar/namespace.js
@@ -2,10 +2,14 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 'use strict';
 
 const models = exports.models = new WeakMap();
 const views = exports.views = new WeakMap();
 exports.buttons = new WeakMap();
 
-exports.viewsFor = function viewsFor(sidebar) views.get(sidebar);
-exports.modelFor = function modelFor(sidebar) models.get(sidebar);
+exports.viewsFor = function viewsFor(sidebar) {
+  return views.get(sidebar);
+};
+exports.modelFor = function modelFor(sidebar) {
+  return models.get(sidebar);
+};
--- a/addon-sdk/source/lib/sdk/url.js
+++ b/addon-sdk/source/lib/sdk/url.js
@@ -132,28 +132,28 @@ function URL(url, base) {
     { value: queryPos }, { value: queryLen },
     { value: refPos }, { value: refLen }] = uriData.slice(2);
 
   let hash = uri.ref ? "#" + uri.ref : "";
   let pathname = uri.path.substr(filepathPos, filepathLen);
   let search = uri.path.substr(queryPos, queryLen);
   search = search ? "?" + search : "";
 
-  this.__defineGetter__("scheme", function() uri.scheme);
-  this.__defineGetter__("userPass", function() userPass);
-  this.__defineGetter__("host", function() host);
-  this.__defineGetter__("hostname", function() host);
-  this.__defineGetter__("port", function() port);
-  this.__defineGetter__("path", function() uri.path);
-  this.__defineGetter__("pathname", function() pathname);
-  this.__defineGetter__("hash", function() hash);
-  this.__defineGetter__("href", function() uri.spec);
-  this.__defineGetter__("origin", function() uri.prePath);
-  this.__defineGetter__("protocol", function() uri.scheme + ":");
-  this.__defineGetter__("search", function() search);
+  this.__defineGetter__("scheme", () => uri.scheme);
+  this.__defineGetter__("userPass", () => userPass);
+  this.__defineGetter__("host", () => host);
+  this.__defineGetter__("hostname", () => host);
+  this.__defineGetter__("port", () => port);
+  this.__defineGetter__("path", () => uri.path);
+  this.__defineGetter__("pathname", () => pathname);
+  this.__defineGetter__("hash", () => hash);
+  this.__defineGetter__("href", () => uri.spec);
+  this.__defineGetter__("origin", () => uri.prePath);
+  this.__defineGetter__("protocol", () => uri.scheme + ":");
+  this.__defineGetter__("search", () => search);
 
   Object.defineProperties(this, {
     toString: {
       value() {
         return new String(uri.spec).toString();
       },
       enumerable: false
     },
--- a/addon-sdk/source/lib/sdk/url/utils.js
+++ b/addon-sdk/source/lib/sdk/url/utils.js
@@ -17,13 +17,13 @@ const { method } = require("../../method
 function newURI (uri) {
   if (!isValidURI(uri))
     throw new Error("malformed URI: " + uri);
   return IOService.newURI(uri, null, null);
 }
 exports.newURI = newURI;
 
 var getURL = method('sdk/url:getURL');
-getURL.define(String, function (url) url);
+getURL.define(String, url => url);
 getURL.define(function (object) {
   return null;
 });
 exports.getURL = getURL;
--- a/addon-sdk/source/lib/sdk/util/list.js
+++ b/addon-sdk/source/lib/sdk/util/list.js
@@ -22,22 +22,26 @@ const listOptions = {
 
     for (let i = 0, ii = arguments.length; i < ii; i++)
       addListItem(this, arguments[i]);
   },
   /**
    * Number of elements in this list.
    * @type {Number}
    */
-  get length() listNS(this).keyValueMap.length,
+  get length() {
+    return listNS(this).keyValueMap.length;
+  },
    /**
     * Returns a string representing this list.
     * @returns {String}
     */
-  toString: function toString() 'List(' + listNS(this).keyValueMap + ')',
+  toString: function toString() {
+    return 'List(' + listNS(this).keyValueMap + ')';
+  },
   /**
    * Custom iterator providing `List`s enumeration behavior.
    * We cant reuse `_iterator` that is defined by `Iterable` since it provides
    * iteration in an arbitrary order.
    * @see https://developer.mozilla.org/en/JavaScript/Reference/Statements/for...in
    * @param {Boolean} onKeys
    */
   __iterator__: function __iterator__(onKeys, onKeyValue) {
--- a/addon-sdk/source/lib/sdk/util/match-pattern.js
+++ b/addon-sdk/source/lib/sdk/util/match-pattern.js
@@ -102,12 +102,12 @@ MatchPattern.prototype = {
       return true;
 
     if (this.urlPrefix && 0 == urlStr.indexOf(this.urlPrefix))
       return true;
 
     return false;
   },
 
-  toString: function () '[object MatchPattern]'
+  toString: () => '[object MatchPattern]'
 };
 
 exports.MatchPattern = MatchPattern;
--- a/addon-sdk/source/lib/sdk/util/object.js
+++ b/addon-sdk/source/lib/sdk/util/object.js
@@ -51,17 +51,19 @@ exports.merge = merge;
  */
 function extend(source) {
   let rest = Array.slice(arguments, 1);
   rest.unshift(Object.create(source));
   return merge.apply(null, rest);
 }
 exports.extend = extend;
 
-function has(obj, key) obj.hasOwnProperty(key);
+function has(obj, key) {
+  return obj.hasOwnProperty(key);
+}
 exports.has = has;
 
 function each(obj, fn) {
   for (let key in obj) has(obj, key) && fn(obj[key], key, obj);
 }
 exports.each = each;
 
 /**
--- a/addon-sdk/source/lib/sdk/util/rules.js
+++ b/addon-sdk/source/lib/sdk/util/rules.js
@@ -14,32 +14,38 @@ const { EventTarget } = require('../even
 const { List, addListItem, removeListItem } = require('./list');
 
 // Should deprecate usage of EventEmitter/compose
 const Rules = Class({
   implements: [
     EventTarget,
     List
   ],
-  add: function(...rules) [].concat(rules).forEach(function onAdd(rule) {
-    addListItem(this, rule);
-    emit(this, 'add', rule);
-  }, this),
-  remove: function(...rules) [].concat(rules).forEach(function onRemove(rule) {
-    removeListItem(this, rule);
-    emit(this, 'remove', rule);
-  }, this),
+  add: function(...rules) {
+    return [].concat(rules).forEach(function onAdd(rule) {
+      addListItem(this, rule);
+      emit(this, 'add', rule);
+    }, this);
+  },
+  remove: function(...rules) {
+    return [].concat(rules).forEach(function onRemove(rule) {
+      removeListItem(this, rule);
+      emit(this, 'remove', rule);
+    }, this);
+  },
   get: function(rule) {
     let found = false;
     for (let i in this) if (this[i] === rule) found = true;
     return found;
   },
   // Returns true if uri matches atleast one stored rule
-  matchesAny: function(uri) !!filterMatches(this, uri).length,
-  toString: function() '[object Rules]'
+  matchesAny: function(uri) {
+    return !!filterMatches(this, uri).length;
+  },
+  toString: () => '[object Rules]'
 });
 exports.Rules = Rules;
 
 function filterMatches(instance, uri) {
   let matches = [];
   for (let i in instance) {
     if (new MatchPattern(instance[i]).test(uri)) matches.push(instance[i]);
   }
--- a/addon-sdk/source/lib/sdk/util/uuid.js
+++ b/addon-sdk/source/lib/sdk/util/uuid.js
@@ -9,9 +9,11 @@ module.metadata = {
 };
 
 const { Cc, Ci, components: { ID: parseUUID } } = require('chrome');
 const { generateUUID } = Cc['@mozilla.org/uuid-generator;1'].
                           getService(Ci.nsIUUIDGenerator);
 
 // Returns `uuid`. If `id` is passed then it's parsed to `uuid` and returned
 // if not then new one is generated.
-exports.uuid = function uuid(id) id ? parseUUID(id) : generateUUID()
+exports.uuid = function uuid(id) {
+  return id ? parseUUID(id) : generateUUID();
+};
--- a/addon-sdk/source/lib/sdk/window/browser.js
+++ b/addon-sdk/source/lib/sdk/window/browser.js
@@ -24,22 +24,28 @@ const BrowserWindow = Class({
   activate: function activate() {
     // TODO
     return null;
   },
   close: function() {
     throw new Error(ERR_FENNEC_MSG);
     return null;
   },
-  get title() getWindowTitle(windowNS(this).window),
+  get title() {
+    return getWindowTitle(windowNS(this).window);
+  },
   // NOTE: Fennec only has one window, which is assumed below
   // TODO: remove assumption below
   // NOTE: tabs requires windows
-  get tabs() require('../tabs'),
-  get activeTab() require('../tabs').activeTab,
+  get tabs() {
+    return require('../tabs');
+  },
+  get activeTab() {
+    return require('../tabs').activeTab;
+  },
   on: method(on),
   removeListener: method(off),
   once: method(once)
 });
 exports.BrowserWindow = BrowserWindow;
 
 const getWindowView = window => windowNS(window).window;
 
--- a/addon-sdk/source/lib/sdk/window/events.js
+++ b/addon-sdk/source/lib/sdk/window/events.js
@@ -14,17 +14,17 @@ const { windows } = require("../window/u
 const { filter, merge, map, expand } = require("../event/utils");
 
 // Function registers single shot event listeners for relevant window events
 // that forward events to exported event stream.
 function eventsFor(window) {
   let interactive = open(window, "DOMContentLoaded", { capture: true });
   let complete = open(window, "load", { capture: true });
   let states = merge([interactive, complete]);
-  let changes = filter(states, function({target}) target === window.document);
+  let changes = filter(states, ({target}) => target === window.document);
   return map(changes, function({type, target}) {
     return { type: type, target: target.defaultView }
   });
 }
 
 // In addition to observing windows that are open we also observe windows
 // that are already already opened in case they're in process of loading.
 var opened = windows(null, { includePrivate: true });
@@ -34,13 +34,13 @@ var currentEvents = merge(opened.map(eve
 function rename({type, target, data}) {
   return { type: rename[type], target: target, data: data }
 }
 rename.domwindowopened = "open";
 rename.domwindowclosed = "close";
 
 var openEvents = map(observe("domwindowopened"), rename);
 var closeEvents = map(observe("domwindowclosed"), rename);
-var futureEvents = expand(openEvents, function({target}) eventsFor(target));
+var futureEvents = expand(openEvents, ({target}) => eventsFor(target));
 
 var channel = merge([currentEvents, futureEvents,
                      openEvents, closeEvents]);
 exports.events = channel;
--- a/addon-sdk/source/lib/sdk/window/utils.js
+++ b/addon-sdk/source/lib/sdk/window/utils.js
@@ -137,17 +137,19 @@ function getToplevelWindow(window) {
                .getInterface(Ci.nsIWebNavigation)
                .QueryInterface(Ci.nsIDocShellTreeItem)
                .rootTreeItem
                .QueryInterface(Ci.nsIInterfaceRequestor)
                .getInterface(Ci.nsIDOMWindow);
 }
 exports.getToplevelWindow = getToplevelWindow;
 
-function getWindowDocShell(window) window.gBrowser.docShell;
+function getWindowDocShell(window) {
+  return window.gBrowser.docShell;
+}
 exports.getWindowDocShell = getWindowDocShell;
 
 function getWindowLoadingContext(window) {
   return getWindowDocShell(window).
          QueryInterface(Ci.nsILoadContext);
 }
 exports.getWindowLoadingContext = getWindowLoadingContext;
 
--- a/addon-sdk/source/lib/sdk/windows/tabs-fennec.js
+++ b/addon-sdk/source/lib/sdk/windows/tabs-fennec.js
@@ -130,20 +130,20 @@ function onTabOpen(event) {
     let rawTab = getRawTabForBrowser(browser);
 
     // create a Tab instance for this new tab
     tab = addTab(Tab(rawTab));
   }
 
   tabNS(tab).opened = true;
 
-  tab.on('ready', function() emit(gTabs, 'ready', tab));
+  tab.on('ready', () => emit(gTabs, 'ready', tab));
   tab.once('close', onTabClose);
 
-  tab.on('pageshow', function(_tab, persisted)
+  tab.on('pageshow', (_tab, persisted) =>
     emit(gTabs, 'pageshow', tab, persisted));
 
   emit(tab, 'open', tab);
   emit(gTabs, 'open', tab);
 }
 
 // TabSelect
 function onTabSelect(event) {
--- a/addon-sdk/source/lib/toolkit/loader.js
+++ b/addon-sdk/source/lib/toolkit/loader.js
@@ -358,17 +358,17 @@ const load = iced(function load(loader, 
     let prototype = typeof(error) === "object" ? error.constructor.prototype :
                     Error.prototype;
 
     throw create(prototype, {
       message: { value: message, writable: true, configurable: true },
       fileName: { value: fileName, writable: true, configurable: true },
       lineNumber: { value: lineNumber, writable: true, configurable: true },
       stack: { value: serializeStack(frames), writable: true, configurable: true },
-      toString: { value: function() toString, writable: true, configurable: true },
+      toString: { value: () => toString, writable: true, configurable: true },
     });
   }
 
   if (loader.checkCompatibility) {
     let err = XulApp.incompatibility(module);
     if (err) {
       throw err;
     }
@@ -793,17 +793,17 @@ function Loader(options) {
     modules, globals, resolve, paths, rootURI, manifest, requireMap, isNative,
     metadata, sharedGlobal, sharedGlobalBlacklist, checkCompatibility
   } = override({
     paths: {},
     modules: {},
     globals: {
       get console() {
         // Import Console.jsm from here to prevent loading it until someone uses it
-        let { ConsoleAPI } = Cu.import("resource://gre/modules/devtools/shared/Console.jsm");
+        let { ConsoleAPI } = Cu.import("resource://gre/modules/Console.jsm");
         let console = new ConsoleAPI({
           consoleID: options.id ? "addon/" + options.id : ""
         });
         Object.defineProperty(this, "console", { value: console });
         return this.console;
       }
     },
     checkCompatibility: false,
--- a/addon-sdk/source/lib/toolkit/require.js
+++ b/addon-sdk/source/lib/toolkit/require.js
@@ -7,17 +7,17 @@ const make = (exports, rootURI, componen
         components.utils.import(rootURI + "toolkit/loader.js", {});
 
   const loader = Loader({
     id: "toolkit/require",
     rootURI: rootURI,
     isNative: true,
     paths: {
      "": rootURI,
-     "devtools/": "resource://gre/modules/devtools/"
+     "devtools/": "resource://devtools/"
     }
   });
 
   // Implement require.unload(uri) that can be used to unload
   // already loaded module which is convinient during development phase.
   const unload = uri => {
     delete loader.sandboxes[uri];
     delete loader.modules[uri];
--- a/addon-sdk/source/python-lib/plural-rules-generator.py
+++ b/addon-sdk/source/python-lib/plural-rules-generator.py
@@ -147,18 +147,22 @@ print """/* This Source Code Form is sub
 
 // This file is automatically generated with /python-lib/plural-rules-generator.py
 // Fetching data from: %s
 
 // Mapping of short locale name == to == > rule index in following list
 const LOCALES_TO_RULES = %s;
 
 // Utility functions for plural rules methods
-function isIn(n, list) list.indexOf(n) !== -1;
-function isBetween(n, start, end) start <= n && n <= end;
+function isIn(n, list) {
+  return list.indexOf(n) !== -1;
+}
+function isBetween(n, start, end) {
+  return start <= n && n <= end;
+}
 
 // List of all plural rules methods, that maps an integer to the plural form name to use
 const RULES = {
   %s
 };
 
 /**
   * Return a function that gives the plural form name for a given integer
--- a/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/test-content-script.js
@@ -629,18 +629,22 @@ exports["test Prototype Inheritance"] = 
       done();
     }
   );
 
 });
 
 exports["test Functions"] = createProxyTest("", function (helper) {
 
-  helper.rawWindow.callFunction = function callFunction(f) f();
-  helper.rawWindow.isEqual = function isEqual(a, b) a == b;
+  helper.rawWindow.callFunction = function callFunction(f) {
+    return f();
+  };
+  helper.rawWindow.isEqual = function isEqual(a, b) {
+    return a == b;
+  };
   // bug 784116: workaround in order to allow proxy code to cache proxies on
   // these functions:
   helper.rawWindow.callFunction.__exposedProps__ = {__proxy: 'rw'};
   helper.rawWindow.isEqual.__exposedProps__ = {__proxy: 'rw'};
 
   helper.createWorker(
     'new ' + function ContentScriptScope() {
       // Check basic usage of functions
--- a/addon-sdk/source/test/addons/e10s-content/lib/test-content-worker.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/test-content-worker.js
@@ -480,17 +480,17 @@ exports["test:setInterval async Errors p
     let count = 0;
     let worker = Worker({
       window: browser.contentWindow,
       contentScript: "setInterval(() => { throw Error('ubik') }, 50)",
       contentScriptWhen: "ready",
       onError: function(err) {
         count++;
         assert.equal(err.message, "ubik",
-            "error (corectly) propagated  " + count + " time(s)");
+            "error (correctly) propagated  " + count + " time(s)");
         if (count >= 3) done();
       }
     });
   }
 );
 
 exports["test:setTimeout throws array, passed to .onError"] = WorkerTest(
   DEFAULT_CONTENT_URL,
--- a/addon-sdk/source/test/addons/e10s-content/lib/test-page-worker.js
+++ b/addon-sdk/source/test/addons/e10s-content/lib/test-page-worker.js
@@ -61,19 +61,19 @@ exports.testWrappedDOM = function(assert
 
 /*
 // We do not offer unwrapped access to DOM since bug 601295 landed
 // See 660780 to track progress of unwrap feature
 exports.testUnwrappedDOM = function(assert, done) {
   let page = Page({
     allow: { script: true },
     contentURL: "data:text/html;charset=utf-8,<script>document.getElementById=3;window.scrollTo=3;</script>",
-    contentScript: "window.addEventListener('load', function () " +
-                   "self.postMessage([typeof(unsafeWindow.document.getElementById), " +
-                   "typeof(unsafeWindow.scrollTo)]), true)",
+    contentScript: "window.addEventListener('load', function () { " +
+                   "return self.postMessage([typeof(unsafeWindow.document.getElementById), " +
+                   "typeof(unsafeWindow.scrollTo)]); }, true)",
     onMessage: function (message) {
       assert.equal(message[0],
                        "number",
                        "document inside page is free to be changed");
 
       assert.equal(message[1],
                        "number",
                        "window inside page is free to be changed");
@@ -88,17 +88,17 @@ exports.testPageProperties = function(as
   let page = new Page();
 
   for (let prop of ['contentURL', 'allow', 'contentScriptFile',
                          'contentScript', 'contentScriptWhen', 'on',
                          'postMessage', 'removeListener']) {
     assert.ok(prop in page, prop + " property is defined on page.");
   }
 
-  assert.ok(function () page.postMessage("foo") || true,
+  assert.ok(() => page.postMessage("foo") || true,
               "postMessage doesn't throw exception on page.");
 }
 
 exports.testConstructorAndDestructor = function(assert, done) {
   let loader = Loader(module);
   let { Page } = loader.require("sdk/page-worker");
   let global = loader.sandbox("sdk/page-worker");
 
@@ -144,23 +144,23 @@ exports.testAutoDestructor = function(as
       assert.ok(isDestroyed(page), "Page correctly unloaded.");
       done();
     }
   });
 }
 
 exports.testValidateOptions = function(assert) {
   assert.throws(
-    function () Page({ contentURL: 'home' }),
+    () => Page({ contentURL: 'home' }),
     /The `contentURL` option must be a valid URL\./,
     "Validation correctly denied a non-URL contentURL"
   );
 
   assert.throws(
-    function () Page({ onMessage: "This is not a function."}),
+    () => Page({ onMessage: "This is not a function."}),
     /The option "onMessage" must be one of the following types: function/,
     "Validation correctly denied a non-function onMessage."
   );
 
   assert.pass("Options validation is working.");
 }
 
 exports.testContentAndAllowGettersAndSetters = function(assert, done) {
@@ -316,17 +316,17 @@ exports.testAllowScript = function(asser
                    "                 document.documentElement.getAttribute('foo') == 3)",
     contentScriptWhen: "ready"
   });
 }
 
 exports.testPingPong = function(assert, done) {
   let page = Page({
     contentURL: 'data:text/html;charset=utf-8,ping-pong',
-    contentScript: 'self.on("message", function(message) self.postMessage("pong"));'
+    contentScript: 'self.on("message", function(message) { return self.postMessage("pong"); });'
       + 'self.postMessage("ready");',
     onMessage: function(message) {
       if ('ready' == message) {
         page.postMessage('ping');
       }
       else {
         assert.ok(message, 'pong', 'Callback from contentScript');
         done();
--- a/addon-sdk/source/test/addons/main/main.js
+++ b/addon-sdk/source/test/addons/main/main.js
@@ -25,11 +25,11 @@ exports.main = function main(options, ca
 
 // this causes a fail if main does not start
 setTimeout(function() {
   if (mainStarted)
   	return;
 
   // main didn't start, fail..
   require("sdk/test/runner").runTestsFromModule({exports: {
-  	testFail: function(assert) assert.fail('Main did not start..')
+  	testFail: assert => assert.fail('Main did not start..')
   }});
 }, 500);
--- a/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-post/main.js
@@ -7,17 +7,17 @@ const { Cu } = require('chrome');
 const { PageMod } = require('sdk/page-mod');
 const tabs = require('sdk/tabs');
 const { closeTab } = require('sdk/tabs/utils');
 const promise = require('sdk/core/promise')
 const { getMostRecentBrowserWindow } = require('sdk/window/utils');
 const { data } = require('sdk/self');
 const { set } = require('sdk/preferences/service');
 
-const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 const { DebuggerClient } = devtoolsRequire("devtools/shared/client/main");
 
 var gClient;
 var ok;
 var testName = 'testDebugger';
 var iframeURL = 'data:text/html;charset=utf-8,' + testName;
 var TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
--- a/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
+++ b/addon-sdk/source/test/addons/page-mod-debugger-pre/main.js
@@ -7,17 +7,17 @@ const { Cu } = require('chrome');
 const { PageMod } = require('sdk/page-mod');
 const tabs = require('sdk/tabs');
 const { closeTab } = require('sdk/tabs/utils');
 const promise = require('sdk/core/promise')
 const { getMostRecentBrowserWindow } = require('sdk/window/utils');
 const { data } = require('sdk/self');
 const { set } = require('sdk/preferences/service');
 
-const { require: devtoolsRequire } = Cu.import("resource://gre/modules/devtools/shared/Loader.jsm", {});
+const { require: devtoolsRequire } = Cu.import("resource://devtools/shared/Loader.jsm", {});
 const { DebuggerServer } = devtoolsRequire("devtools/server/main");
 const { DebuggerClient } = devtoolsRequire("devtools/shared/client/main");
 
 var gClient;
 var ok;
 var testName = 'testDebugger';
 var iframeURL = 'data:text/html;charset=utf-8,' + testName;
 var TAB_URL = 'data:text/html;charset=utf-8,' + encodeURIComponent('<iframe src="' + iframeURL + '" />');
--- a/addon-sdk/source/test/addons/places/lib/test-places-bookmarks.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-bookmarks.js
@@ -794,17 +794,19 @@ exports.testCaching = function (assert, 
   }).then(results => {
     // Should query for each bookmark (5) from the query (id -> data),
     // their parent during `construct` (1) and the root shouldn't
     // require a lookup
     assert.equal(count, 6, 'lookup occurs once for each item and parent');
     off(stream, 'data', handle);
   }).then(done).catch(assert.fail);
 
-  function handle ({data}) count++
+  function handle ({data}) {
+    return count++;
+  }
 };
 
 /*
  * Search Query Options
  */
 
 exports.testSearchCount = function (assert, done) {
   let max = 8;
--- a/addon-sdk/source/test/addons/places/lib/test-places-history.js
+++ b/addon-sdk/source/test/addons/places/lib/test-places-history.js
@@ -90,17 +90,17 @@ exports.testSearchURLForHistory = functi
 /*
 exports.testSearchTimeRange = function (assert, done) {
   let firstTime, secondTime;
   addVisits([
     'http://earlyvisit.org', 'http://earlyvisit.org/earlytown.html'
   ]).then(searchP).then(results => {
     firstTime = results[0].time;
     var deferred = defer();
-    setTimeout(function () deferred.resolve(), 1000);
+    setTimeout(() => deferred.resolve(), 1000);
     return deferred.promise;
   }).then(() => {
     return addVisits(['http://newvisit.org', 'http://newvisit.org/whoawhoa.html']);
   }).then(searchP).then(results => {
     results.filter(({url, time}) => {
       if (/newvisit/.test(url)) secondTime = time;
     });
     return searchP({ from: firstTime - 1000 });
--- a/addon-sdk/source/test/addons/private-browsing-supported/test-page-mod.js
+++ b/addon-sdk/source/test/addons/private-browsing-supported/test-page-mod.js
@@ -8,48 +8,50 @@ const { PageMod } = require("sdk/page-mo
 const { getActiveTab, setTabURL, openTab, closeTab } = require('sdk/tabs/utils');
 const xulApp = require('sdk/system/xul-app');
 const windowHelpers = require('sdk/window/helpers');
 const { defer } = require("sdk/core/promise");
 const { isPrivate } = require('sdk/private-browsing');
 const { isTabPBSupported, isWindowPBSupported } = require('sdk/private-browsing/utils');
 const { cleanUI } = require('sdk/test/utils');
 
-function openWebpage(url, enablePrivate) new Promise((resolve, reject) => {
-  if (xulApp.is("Fennec")) {
-    let chromeWindow = getMostRecentBrowserWindow();
-    let rawTab = openTab(chromeWindow, url, {
-      isPrivate: enablePrivate
-    });
+function openWebpage(url, enablePrivate) {
+  return new Promise((resolve, reject) => {
+    if (xulApp.is("Fennec")) {
+      let chromeWindow = getMostRecentBrowserWindow();
+      let rawTab = openTab(chromeWindow, url, {
+        isPrivate: enablePrivate
+      });
 
-    resolve(() => new Promise(resolve => {
-      closeTab(rawTab);
-      resolve();
-    }));
-  }
-  else {
-    windowHelpers.open("", {
-      features: {
-        toolbar: true,
-        private: enablePrivate
-      }
-    }).
-    then((chromeWindow) => {
-      if (isPrivate(chromeWindow) !== !!enablePrivate) {
-        reject(new Error("Window should have Private set to " + !!enablePrivate));
-      }
+      resolve(() => new Promise(resolve => {
+        closeTab(rawTab);
+        resolve();
+      }));
+    }
+    else {
+      windowHelpers.open("", {
+        features: {
+          toolbar: true,
+          private: enablePrivate
+        }
+      }).
+        then((chromeWindow) => {
+          if (isPrivate(chromeWindow) !== !!enablePrivate) {
+            reject(new Error("Window should have Private set to " + !!enablePrivate));
+          }
 
-      let tab = getActiveTab(chromeWindow);
-      setTabURL(tab, url);
+          let tab = getActiveTab(chromeWindow);
+          setTabURL(tab, url);
 
-      resolve(() => windowHelpers.close(chromeWindow));
-    }).
-    catch(reject);
-  }
-})
+          resolve(() => windowHelpers.close(chromeWindow));
+        }).
+        catch(reject);
+    }
+  });
+}
 
 exports["test page-mod on private tab"] = function*(assert) {
   // Only set private mode when explicitely supported.
   // (fennec 19 has some intermediate PB support where isTabPBSupported
   // will be false, but isPrivate(worker.tab) will be true if we open a private
   // tab)
   let setPrivate = isTabPBSupported || isWindowPBSupported;
 
--- a/addon-sdk/source/test/addons/private-browsing-supported/test-selection.js
+++ b/addon-sdk/source/test/addons/private-browsing-supported/test-selection.js
@@ -213,17 +213,17 @@ exports["test PWPB Selection Listener"] 
   let loader = Loader(module);
   let selection = loader.require("sdk/selection");
 
   open(URL, {private: true, title: "PWPB Selection Listener"}).
     then(function(window) {
       selection.once("select", function() {
         assert.equal(browserWindows.length, 2, "there should be only two windows open.");
         assert.equal(getTabs().length, 2, "there should be only two tabs open: '" +
-                     getTabs().map(function(tab) getTabTitle(tab)).join("', '") +
+                     getTabs().map(tab => getTabTitle(tab)).join("', '") +
                      "'."
         );
 
         // window should be focused, but force the focus anyhow.. see bug 841823
         focus(window).then(function() {
           // check state of window
           assert.ok(isFocused(window), "the window is focused");
           assert.ok(isPrivate(window), "the window should be a private window");
@@ -247,17 +247,17 @@ exports["test PWPB Textarea OnSelect Lis
   let loader = Loader(module);
   let selection = loader.require("sdk/selection");
 
   open(URL, {private: true, title: "PWPB OnSelect Listener"}).
     then(function(window) {
       selection.once("select", function() {
         assert.equal(browserWindows.length, 2, "there should be only two windows open.");
         assert.equal(getTabs().length, 2, "there should be only two tabs open: '" +
-                     getTabs().map(function(tab) getTabTitle(tab)).join("', '") +
+                     getTabs().map(tab => getTabTitle(tab)).join("', '") +
                      "'."
         );
 
         // window should be focused, but force the focus anyhow.. see bug 841823
         focus(window).then(function() {
           assert.equal(selection.text, "noodles");
 
           closeWindow(window).
@@ -285,17 +285,17 @@ exports["test PWPB Single DOM Selection"
 
       assert.equal(selection.text, "foo",
         "selection.text with single DOM Selection works.");
 
       assert.equal(selection.html, "<div>foo</div>",
         "selection.html with single DOM Selection works.");
 
       let selectionCount = 0;
-      for each (let sel in selection) {
+      for (let sel of selection) {
         selectionCount++;
 
         assert.equal(sel.text, "foo",
           "iterable selection.text with single DOM Selection works.");
 
         assert.equal(sel.html, "<div>foo</div>",
           "iterable selection.html with single DOM Selection works.");
       }
@@ -321,17 +321,17 @@ exports["test PWPB Textarea Selection"] 
 
       assert.equal(selection.text, "noodles",
         "selection.text with Textarea Selection works.");
 
       assert.strictEqual(selection.html, null,
         "selection.html with Textarea Selection works.");
 
       let selectionCount = 0;
-      for each (let sel in selection) {
+      for (let sel of selection) {
         selectionCount++;
 
         assert.equal(sel.text, "noodles",
           "iterable selection.text with Textarea Selection works.");
 
         assert.strictEqual(sel.html, null,
           "iterable selection.html with Textarea Selection works.");
       }
@@ -360,17 +360,17 @@ exports["test PWPB Set HTML in Multiple 
 
       assert.equal(selection.text, expectedText[0],
         "set selection.text with DOM Selection works.");
 
       assert.equal(selection.html, expectedHTML[0],
         "selection.html with DOM Selection works.");
 
       let selectionCount = 0;
-      for each (let sel in selection) {
+      for (let sel of selection) {
 
         assert.equal(sel.text, expectedText[selectionCount],
           "iterable selection.text with multiple DOM Selection works.");
 
         assert.equal(sel.html, expectedHTML[selectionCount],
           "iterable selection.html with multiple DOM Selection works.");
 
         selectionCount++;
@@ -398,17 +398,17 @@ exports["test PWPB Set Text in Textarea 
 
       assert.equal(selection.text, text,
         "set selection.text with Textarea Selection works.");
 
       assert.strictEqual(selection.html, null,
         "selection.html with Textarea Selection works.");
 
       let selectionCount = 0;
-      for each (let sel in selection) {
+      for (let sel of selection) {
         selectionCount++;
 
         assert.equal(sel.text, text,
           "iterable selection.text with Textarea Selection works.");
 
         assert.strictEqual(sel.html, null,
           "iterable selection.html with Textarea Selection works.");
       }
--- a/addon-sdk/source/test/addons/private-browsing-supported/test-windows.js
+++ b/addon-sdk/source/test/addons/private-browsing-supported/test-windows.js
@@ -85,17 +85,17 @@ exports.testSettingActiveWindowDoesNotIg
   assert.equal(winUtils.activeBrowserWindow, browserWindow,
                "Browser window is the active browser window.");
   assert.ok(!isPrivate(browserWindow), "Browser window is not private.");
 
   // make a new private window
   makeEmptyBrowserWindow({
     private: true
   }).then(function(window) {
-    let continueAfterFocus = function(window) onFocus(window).then(nextTest);
+    let continueAfterFocus = window => onFocus(window).then(nextTest);
 
     // PWPB case
     if (isWindowPBSupported) {
       assert.ok(isPrivate(window), "window is private");
       assert.notStrictEqual(winUtils.activeBrowserWindow, browserWindow);
     }
     // Global case
     else {
@@ -207,17 +207,17 @@ exports.testWindowIteratorIgnoresPrivate
 };
 
 // test that it is not possible to find a private window in
 // windows module's iterator
 exports.testWindowIteratorPrivateDefault = function(assert, done) {
   // there should only be one window open here, if not give us the
   // the urls
   if (browserWindows.length > 1) {
-    for each (let tab in tabs) {
+    for (let tab of tabs) {
       assert.fail("TAB URL: " + tab.url);
     }
   }
   else {
     assert.equal(browserWindows.length, 1, 'only one window open');
   }
 
   open('chrome://browser/content/browser.xul', {
--- a/addon-sdk/source/test/context-menu/test-helper.js
+++ b/addon-sdk/source/test/context-menu/test-helper.js
@@ -267,17 +267,19 @@ TestHelper.prototype = {
       }
     };
 
     if (this.contextMenuPopup.state == "closed") {
       closeBrowserWindow.call(this);
     }
     else {
       this.delayedEventListener(this.contextMenuPopup, "popuphidden",
-                                function () closeBrowserWindow.call(this),
+                                function () {
+                                  return closeBrowserWindow.call(this);
+                                },
                                 false);
       this.contextMenuPopup.hidePopup();
     }
   },
 
   closeTab: function() {
     if (this.tab) {
       this.tabBrowser.removeTab(this.tab);
--- a/addon-sdk/source/test/event/helpers.js
+++ b/addon-sdk/source/test/event/helpers.js
@@ -58,51 +58,55 @@ exports.wait = wait;
 function scenario(setup) {