diff --git a/dom/base/test/test_bug116083.html b/dom/base/test/test_bug116083.html index dfdef8d43544..0d37242f82e8 100644 --- a/dom/base/test/test_bug116083.html +++ b/dom/base/test/test_bug116083.html @@ -52,15 +52,22 @@ const Cc = SpecialPowers.Cc; const Ci = SpecialPowers.Ci; function hasExpectedFlavors() { - var flavors = [ - "text/plain", - "text/html", - "application/x-moz-nativehtml", - ]; var cb = Cc["@mozilla.org/widget/clipboard;1"]. getService(Ci.nsIClipboard); - return cb.hasDataMatchingFlavors(flavors, flavors.length, - cb.kGlobalClipboard); + + ok(cb.hasDataMatchingFlavors(["text/unicode"], 1, cb.kGlobalClipboard), + "The clipboard has text/unicode"); + + // Android only supports plain text + if (navigator.appVersion.indexOf("Android") == -1) { + ok(cb.hasDataMatchingFlavors(["text/html"], 1, cb.kGlobalClipboard), + "The clipboard has text/html"); + } + + if (navigator.appVersion.indexOf("Win") >= 0) { + ok(cb.hasDataMatchingFlavors(["application/x-moz-nativehtml"], 1, cb.kGlobalClipboard), + "The clipboard has application/x-moz-nativehtml"); + } } function nextTest() { @@ -77,7 +84,7 @@ function nextTest() { synthesizeKey("C", {accelKey: true}); }, function() { ok(true, div.getAttribute("style") + " passed"); - ok(hasExpectedFlavors(), "The clipboard has the expected flavors"); + hasExpectedFlavors(); div.parentNode.removeChild(div); nextTest(); }, function() { diff --git a/widget/android/nsClipboard.cpp b/widget/android/nsClipboard.cpp index cf8675be12af..9a49bb0d6688 100644 --- a/widget/android/nsClipboard.cpp +++ b/widget/android/nsClipboard.cpp @@ -97,7 +97,14 @@ nsClipboard::HasDataMatchingFlavors(const char **aFlavorList, *aHasText = false; if (aWhichClipboard != kGlobalClipboard) return NS_ERROR_NOT_IMPLEMENTED; - *aHasText = widget::Clipboard::HasText(); + + for (uint32_t k = 0; k < aLength; k++) { + if (strcmp(aFlavorList[k], kUnicodeMime) == 0) { + *aHasText = widget::Clipboard::HasText(); + break; + } + } + return NS_OK; }