bug 1348148 - try and avoid firing load events on unloaded documents r=davidb
authorTrevor Saunders <tbsaunde@tbsaunde.org>
Tue, 14 Mar 2017 14:36:06 -0400
changeset 356133 5a08bfa91d2b5c3f8557e1a8d1de55506b3f2f45
parent 356132 2f59f4ccdd751be7c3ff37f85ac9abea7e264886
child 356134 50e6bdbcc7308bbc15f13cbec4ec18cf1a061b7e
push id31757
push usercbook@mozilla.com
push dateWed, 03 May 2017 08:11:42 +0000
treeherdermozilla-central@82c2d17e74ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdavidb
bugs1348148
milestone55.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 1348148 - try and avoid firing load events on unloaded documents r=davidb It is awkward to need to have a DocAccessibleChild to send events with before DocAccessible::DoInitialUpdate() is called because we might not have a TabParent for the document until then. However we could try to fire reload events on documents before DoInitialUpdate() was called which would require having a DocAccessibleChild there to send the load event to the parent process. However before DocAccessible::DoInitialUpdate() is called the document already has a pending load event. If a document hasn't yet been the subject of a load event it doesn't make a lot of sense to fire a reload event for that document, and then the initial load event. So it should be safe to skip firing reload events for documents where mLoadEvent specifies a load event to fire in the future.
accessible/generic/DocAccessible.cpp
--- a/accessible/generic/DocAccessible.cpp
+++ b/accessible/generic/DocAccessible.cpp
@@ -1450,17 +1450,17 @@ DocAccessible::NotifyOfLoading(bool aIsR
 {
   // Mark the document accessible as loading, if it stays alive then we'll mark
   // it as loaded when we receive proper notification.
   mLoadState &= ~eDOMLoaded;
 
   if (!IsLoadEventTarget())
     return;
 
-  if (aIsReloading) {
+  if (aIsReloading && !mLoadEventType) {
     // 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.
     RefPtr<AccEvent> reloadEvent =
       new AccEvent(nsIAccessibleEvent::EVENT_DOCUMENT_RELOAD, this);
     nsEventShell::FireEvent(reloadEvent);
   }