Bug 574005 - Make obtaining CF_HTML directly work on Windows and Linux (application/x-moz-nativehtml); r=ehsan
☠☠ backed out by 90a54cb7f985 ☠ ☠
authorBrian R. Bondy <netzen@gmail.com>
Mon, 12 Sep 2011 18:38:57 -0400
changeset 78212 b8d354d37128bdbbd7e3f781c914dd45b0e71a3d
parent 78211 3f3380cfd15a583ed60b6039942ae1fcdaeecfc8
child 78213 90a54cb7f985ea9613444d4cc2403e0171e76d09
push id78
push userclegnitto@mozilla.com
push dateFri, 16 Dec 2011 17:32:24 +0000
treeherdermozilla-release@79d24e644fdd [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs574005
milestone9.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 574005 - Make obtaining CF_HTML directly work on Windows and Linux (application/x-moz-nativehtml); r=ehsan
editor/libeditor/html/tests/test_CF_HTML_clipboard.html
widget/src/xpwidgets/nsPrimitiveHelpers.cpp
--- a/editor/libeditor/html/tests/test_CF_HTML_clipboard.html
+++ b/editor/libeditor/html/tests/test_CF_HTML_clipboard.html
@@ -131,21 +131,14 @@ function runTest() {
         }, false);
         win.focus();
       }, 0);
     }, false);
     iframe.src = "data:text/html,";
   }, SimpleTest.finish);
 }
 
-var isMac = ("nsILocalFileMac" in Components.interfaces);
-if (isMac)
-  SimpleTest.waitForFocus(runTest);
-else {
-  // This test is not yet supported on non-Mac platforms, see bug 574005.
-  todo(false, "Test not supported on this platform");
-  SimpleTest.finish();
-}
+SimpleTest.waitForFocus(runTest);
 
 </script>
 </pre>
 </body>
 </html>
--- a/widget/src/xpwidgets/nsPrimitiveHelpers.cpp
+++ b/widget/src/xpwidgets/nsPrimitiveHelpers.cpp
@@ -138,16 +138,25 @@ nsPrimitiveHelpers :: CreateDataFromPrim
 
   if ( strcmp(aFlavor,kTextMime) == 0 ) {
     nsCOMPtr<nsISupportsCString> plainText ( do_QueryInterface(aPrimitive) );
     if ( plainText ) {
       nsCAutoString data;
       plainText->GetData ( data );
       *aDataBuff = ToNewCString(data);
     }
+  // CF_HTML only supports single byte.
+  // Reference: http://msdn.microsoft.com/en-us/library/aa767917(v=vs.85).aspx
+  } else if ( strcmp(aFlavor,kNativeHTMLMime) == 0 ) {
+    nsCOMPtr<nsISupportsCString> plainText ( do_QueryInterface(aPrimitive) );
+    if ( plainText ) {
+      nsCAutoString data;
+      plainText->GetData ( data );
+      *aDataBuff = ToNewUnicode(data);
+    }
   }
   else {
     nsCOMPtr<nsISupportsString> doubleByteText ( do_QueryInterface(aPrimitive) );
     if ( doubleByteText ) {
       nsAutoString data;
       doubleByteText->GetData ( data );
       *aDataBuff = ToNewUnicode(data);
     }