Bug 899011 - Make WinTaskbar.GetAvailable() return false if initializing the taskbar fails r=jimm a=bajaj
authorTim Taubert <ttaubert@mozilla.com>
Sat, 11 Jan 2014 23:02:00 +0100
changeset 167970 95fd8e21ee4947e727c978216fa62ded2918c5df
parent 167969 022a1f0ec3fd73b58d23dd894d96ab3c4aa60368
child 167971 840132b6f702ae359d954cbf6c0920e405de4825
push id428
push userbbajaj@mozilla.com
push dateTue, 28 Jan 2014 00:16:25 +0000
treeherdermozilla-release@cd72a7ff3a75 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjimm, bajaj
bugs899011
milestone27.0
Bug 899011 - Make WinTaskbar.GetAvailable() return false if initializing the taskbar fails r=jimm a=bajaj
widget/windows/WinTaskbar.cpp
--- a/widget/windows/WinTaskbar.cpp
+++ b/widget/windows/WinTaskbar.cpp
@@ -214,16 +214,17 @@ WinTaskbar::Initialize() {
                                   CLSCTX_INPROC_SERVER,
                                   IID_ITaskbarList4,
                                   (void**)&mTaskbar);
   if (FAILED(hr))
     return false;
 
   hr = mTaskbar->HrInit();
   if (FAILED(hr)) {
+    // This may fail with shell extensions like blackbox installed.
     NS_WARNING("Unable to initialize taskbar");
     NS_RELEASE(mTaskbar);
     return false;
   }
   return true;
 }
 
 WinTaskbar::WinTaskbar() 
@@ -360,19 +361,21 @@ WinTaskbar::RegisterAppUserModelID() {
   if (hDLL)
     ::FreeLibrary(hDLL);
 
   return retVal;
 }
 
 NS_IMETHODIMP
 WinTaskbar::GetAvailable(bool *aAvailable) {
+  // ITaskbarList4::HrInit() may fail with shell extensions like blackbox
+  // installed. Initialize early to return available=false in those cases.
   *aAvailable = 
     WinUtils::GetWindowsVersion() < WinUtils::WIN7_VERSION ?
-    false : true;
+    false : Initialize();
 
   return NS_OK;
 }
 
 NS_IMETHODIMP
 WinTaskbar::CreateTaskbarTabPreview(nsIDocShell *shell, nsITaskbarPreviewController *controller, nsITaskbarTabPreview **_retval) {
   if (!Initialize())
     return NS_ERROR_NOT_AVAILABLE;