Bug 842361 - nsIClipboard's clearClipboard doesn't clear the clipboard on Windows. r=bbondy
authorJim Mathies <jmathies@mozilla.com>
Tue, 19 Feb 2013 19:51:02 -0600
changeset 122439 efae9ff1466263b5a5c85e80cfd7cdb28ea5c011
parent 122438 7c4498f0fd0794ed167d0654f412048668d90d9c
child 122440 8b45c32b6028a944c3dddd538d5d9320c089c306
push id24342
push userryanvm@gmail.com
push dateThu, 21 Feb 2013 13:05:06 +0000
treeherdermozilla-central@702d2814efbf [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbondy
bugs842361
milestone22.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 842361 - nsIClipboard's clearClipboard doesn't clear the clipboard on Windows. r=bbondy
widget/windows/nsClipboard.cpp
widget/windows/nsClipboard.h
--- a/widget/windows/nsClipboard.cpp
+++ b/widget/windows/nsClipboard.cpp
@@ -919,16 +919,25 @@ nsClipboard::GetNativeClipboardData ( ns
   else {
     // do it the old manual way
     res = GetDataFromDataObject(nullptr, 0, mWindow, aTransferable);
   }
   return res;
 
 }
 
+NS_IMETHODIMP
+nsClipboard::EmptyClipboard(int32_t aWhichClipboard)
+{
+  if (::OpenClipboard(nullptr)) { 
+    ::EmptyClipboard();
+    ::CloseClipboard();
+  }
+  return nsBaseClipboard::EmptyClipboard(aWhichClipboard);
+}
 
 //-------------------------------------------------------------------------
 NS_IMETHODIMP nsClipboard::HasDataMatchingFlavors(const char** aFlavorList,
                                                   uint32_t aLength,
                                                   int32_t aWhichClipboard,
                                                   bool *_retval)
 {
   *_retval = false;
--- a/widget/windows/nsClipboard.h
+++ b/widget/windows/nsClipboard.h
@@ -25,16 +25,17 @@ class nsClipboard : public nsBaseClipboa
 
 public:
   nsClipboard();
   virtual ~nsClipboard();
 
   // nsIClipboard
   NS_IMETHOD HasDataMatchingFlavors(const char** aFlavorList, uint32_t aLength,
                                     int32_t aWhichClipboard, bool *_retval); 
+  NS_IMETHOD EmptyClipboard(int32_t aWhichClipboard);
 
   // Internal Native Routines
   static nsresult CreateNativeDataObject(nsITransferable * aTransferable, 
                                          IDataObject ** aDataObj,
                                          nsIURI       * uri);
   static nsresult SetupNativeDataObject(nsITransferable * aTransferable, 
                                         IDataObject * aDataObj);
   static nsresult GetDataFromDataObject(IDataObject     * aDataObject,