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 270896 0aea92b111d76e66a7f9ea8853a27e892217b568
parent 270895 79d2c5f174ccd930866cca108b04de2e99be3cae
child 270897 7728f81b8e04a4987497365b671be3516f3f7803
push id18459
push usercbook@mozilla.com
push dateTue, 03 Nov 2015 11:14:32 +0000
treeherderb2g-inbound@09173d8e6694 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerseeejay
bugs1220860
milestone45.0a1
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));
   },