Commit 8ed7b877 authored by edward.lee@engineering.uiuc.edu's avatar edward.lee@engineering.uiuc.edu
Browse files

Bug 431346 - File -> Import -> Browsing History crash Firefox [@...

Bug 431346 - File -> Import -> Browsing History crash Firefox [@ nsCOMPtr.h:931]. r=sdwilsh, b-ff3=beltzner, a1.9=shaver. Fixes Bug 431597 - Firefox crash after deleting History Item via Places Library [@ nsNavHistoryResult.h:429]
parent 155ba886
Loading
Loading
Loading
Loading
+2 −5
Original line number Diff line number Diff line
@@ -1802,11 +1802,8 @@ nsDownloadManager::OnBeginUpdateBatch()
NS_IMETHODIMP
nsDownloadManager::OnEndUpdateBatch()
{
  if (mHistoryTransaction) {
    // Delete the transaction and cause it to commit
    delete mHistoryTransaction;
  // Get rid of the transaction and cause it to commit
  mHistoryTransaction = nsnull;
  }

  return NS_OK;
}
+1 −1
Original line number Diff line number Diff line
@@ -250,7 +250,7 @@ private:
  nsCOMPtr<nsIObserverService> mObserverService;
  nsCOMPtr<mozIStorageStatement> mUpdateDownloadStatement;
  nsCOMPtr<mozIStorageStatement> mGetIdsForURIStatement;
  mozStorageTransaction *mHistoryTransaction;
  nsAutoPtr<mozStorageTransaction> mHistoryTransaction;

  static nsDownloadManager *gDownloadManagerService;

+6 −0
Original line number Diff line number Diff line
@@ -36,6 +36,7 @@

/**
 * Test bug 251337 to make sure old downloads are expired and removed.
 * Make sure bug 431346 and bug 431597 don't cause crashes when batching.
 */

function run_test()
@@ -85,6 +86,10 @@ function run_test()
  histsvc.addVisit(theURI, Date.now() * 1000, null,
                   histsvc.TRANSITION_DOWNLOAD, false, 0);

  // Get the download manager as history observer and batch expirations
  let histobs = dm.QueryInterface(Ci.nsINavHistoryObserver);
  histobs.onBeginUpdateBatch();

  // Look for the removed download notification
  let obs = Cc["@mozilla.org/observer-service;1"].
            getService(Ci.nsIObserverService);
@@ -99,6 +104,7 @@ function run_test()
      do_check_eq(id.data, theId);

      // We're done!
      histobs.onEndUpdateBatch();
      obs.removeObserver(testObs, kRemoveTopic);
      do_test_finished();
    }