зеркало из https://github.com/mozilla/gecko-dev.git
Bug 550701 - synthesizeDragStart should not fail with |expectedDragData| = null.
r=enndeakin.
This commit is contained in:
Родитель
f54b79a4a5
Коммит
b1da1d01a2
|
@ -446,8 +446,8 @@ function synthesizeDragStart(element, expectedDragData, aWindow)
|
|||
result = null;
|
||||
if (!dataTransfer)
|
||||
throw "no dataTransfer";
|
||||
if (dataTransfer.mozItemCount != expectedDragData.length ||
|
||||
expectedDragData == null)
|
||||
if (expectedDragData == null ||
|
||||
dataTransfer.mozItemCount != expectedDragData.length)
|
||||
throw dataTransfer;
|
||||
for (var i = 0; i < dataTransfer.mozItemCount; i++) {
|
||||
var dtTypes = dataTransfer.mozTypesAt(i);
|
||||
|
|
|
@ -58,16 +58,15 @@ check if nsIFile can be determined
|
|||
src="chrome://mochikit/content/MochiKit/packed.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/chrome/toolkit/mozapps/downloads/tests/chrome/utils.js"/>
|
||||
<script type="application/javascript"
|
||||
src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script>
|
||||
<script type="application/javascript">
|
||||
<![CDATA[
|
||||
|
||||
/** Test for Bug 462172 synthesizeDragStart**/
|
||||
var testFile = Cc["@mozilla.org/file/directory_service;1"].
|
||||
var testFile = Components.classes["@mozilla.org/file/directory_service;1"].
|
||||
getService(Ci.nsIProperties).get("CurWorkD", Ci.nsIFile);
|
||||
var regularDtForDrag1 = null;
|
||||
|
||||
function doOnDragStart(aEvent)
|
||||
{
|
||||
|
@ -76,6 +75,7 @@ function doOnDragStart(aEvent)
|
|||
case "drag2" :
|
||||
dt.setData("text/plain", "this is text/plain");
|
||||
case "drag1" :
|
||||
regularDtForDrag1 = dt;
|
||||
dt.setData("text/uri-list", "http://www.mozilla.org/");
|
||||
break;
|
||||
case "dragfile" :
|
||||
|
@ -140,6 +140,8 @@ function test() {
|
|||
isnot(result, null, "drag2 is not ordered text/uri-list then text/plain");
|
||||
result = synthesizeDragStart($("dragfile"), dragfile, window);
|
||||
is(result, null, "dragfile is nsIFile");
|
||||
result = synthesizeDragStart($("drag1"), null, window);
|
||||
is(result, regularDtForDrag1, "synthesizeDragStart accepts null expectedDragData");
|
||||
|
||||
SimpleTest.finish();
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче