Bug 1220860 - fixing an error with getting documentElement on AccessFu stop. r=eeejay
authorYura Zenevich <yzenevich@mozilla.com>
Mon, 02 Nov 2015 14:16:28 -0800
changeset 305004 0aea92b111d76e66a7f9ea8853a27e892217b568
parent 305003 79d2c5f174ccd930866cca108b04de2e99be3cae
child 305005 7728f81b8e04a4987497365b671be3516f3f7803
push id5513
push userraliiev@mozilla.com
push dateMon, 25 Jan 2016 13:55:34 +0000
treeherdermozilla-beta@5ee97dd05b5c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1220860
milestone45.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1220860 - fixing an error with getting documentElement on AccessFu stop. r=eeejay
accessible/jsat/AccessFu.jsm
accessible/jsat/Presentation.jsm
--- a/accessible/jsat/AccessFu.jsm
+++ b/accessible/jsat/AccessFu.jsm
@@ -517,19 +517,20 @@ var Output = {
   },
 
   start: function start() {
     Cu.import('resource://gre/modules/Geometry.jsm');
   },
 
   stop: function stop() {
     if (this.highlightBox) {
-      let doc = Utils.win.document;
-      (doc.body || doc.documentElement).documentElement.removeChild(
-        this.highlightBox.get());
+      let highlightBox = this.highlightBox.get();
+      if (highlightBox) {
+        highlightBox.remove();
+      }
       delete this.highlightBox;
     }
   },
 
   B2G: function B2G(aDetails) {
     Utils.dispatchChromeEvent('accessibility-output', aDetails);
   },
 
--- a/accessible/jsat/Presentation.jsm
+++ b/accessible/jsat/Presentation.jsm
@@ -693,17 +693,19 @@ this.Presentation = { // jshint ignore:l
     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);
+    if (context.accessible) {
+      this.displayedAccessibles.set(context.accessible.document.window, context);
+    }
 
     return this.presenters.map(p => p.pivotChanged(context, aReason, aIsUserInput));
   },
 
   actionInvoked: function Presentation_actionInvoked(aObject, aActionName) {
     return this.presenters.map(p => p.actionInvoked(aObject, aActionName));
   },