Bug 1508870 - Make a distinction between an empty returned string versus a null pointer, r=Jamie
authorMarco Zehe <mzehe@mozilla.com>
Thu, 22 Nov 2018 06:09:31 +0000
changeset 504113 af8241e64ecb7096c314c1a174479d11ab18163d
parent 504098 111154a7621cc50da7bed70c93171b96c8ef92f0
child 504114 0a6efd77a79ec268c44b1044476aa92ad996b8c5
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersJamie
bugs1508870
milestone65.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 1508870 - Make a distinction between an empty returned string versus a null pointer, r=Jamie When determining if an author provided an empty alt attribute versus no alt attribute at all, our image accessible name is either an empty string or a null string. Screen readers can then choose to guess the name from the source if the author did not explicitly provide an empty alt text and thus marked the image as decorative. The accessible handler for the Windows remote processes did not account for this distinction, always returning what appeared to be an empty string. This was found while determining why NVDA wasn't guessing the SRC from a non-labelled graphical link. NVDA checks to see if the name returned by the link accessible is null, and then decides to look for the graphical children if that is the case. Differential Revision: https://phabricator.services.mozilla.com/D12532
accessible/ipc/win/handler/AccessibleHandler.h
--- a/accessible/ipc/win/handler/AccessibleHandler.h
+++ b/accessible/ipc/win/handler/AccessibleHandler.h
@@ -292,16 +292,20 @@ private:
   long                              mCachedNTextAttribRuns;
   IARelationData*                   mCachedRelations;
   long                              mCachedNRelations;
 };
 
 inline static BSTR
 CopyBSTR(BSTR aSrc)
 {
+  if (!aSrc) {
+    return nullptr;
+  }      
+  
   return ::SysAllocStringLen(aSrc, ::SysStringLen(aSrc));
 }
 
 } // namespace a11y
 } // namespace mozilla
 
 #endif // !defined(MOZILLA_INTERNAL_API)