Bug 560658, dropping onto findbar inserts text twice, r=mano

This commit is contained in:
Neil Deakin 2010-05-13 09:42:57 -04:00
Родитель 9d899e6494
Коммит 8b143f8cf7
2 изменённых файлов: 17 добавлений и 1 удалений

Просмотреть файл

@ -46,6 +46,9 @@
onload="onLoad();"
title="findbar test">
<script type="application/javascript"
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
<script type="application/javascript"><![CDATA[
const Ci = Components.interfaces;
const Cc = Components.classes;
@ -111,6 +114,7 @@
gFindBar.close();
ok(gFindBar.hidden, "Failed to close findbar after testQuickFindText");
testFindbarSelection();
testDrop();
testQuickFindLink();
testStatusText();
testQuickFindClose();
@ -151,6 +155,12 @@
checkFindbarState("button", "");
}
function testDrop()
{
synthesizeDrop(gFindBar._findField, [[ {type: "text/plain", data: "Rabbits" } ]], "copy", window);
window.opener.wrappedJSObject.SimpleTest.is(gFindBar._findField.inputField.value, "Rabbits", "drop on findbar");
}
function testQuickFindClose() {
var _isClosedCallback = function() {
ok(gFindBar.hidden,

Просмотреть файл

@ -185,11 +185,17 @@
findbar._setFindCloseTimeout();
]]></handler>
<handler event="drop" phase="capturing"><![CDATA[
<handler event="dragover"><![CDATA[
if (event.dataTransfer.types.contains("text/plain"))
event.preventDefault();
]]></handler>
<handler event="drop"><![CDATA[
var value = event.dataTransfer.getData("text/plain");
this.value = value;
this.findbar._find(value);
event.stopPropagation();
event.preventDefault();
]]></handler>
</handlers>
</binding>