Closed Bug 512347 Opened 15 years ago Closed 15 years ago

synthesizeDrop from EventUtils doesn't work

Categories

(Testing :: Mochitest, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla1.9.3a1

People

(Reporter: Natch, Assigned: Natch)

References

Details

(Whiteboard: [fixed1.9.2b1])

Attachments

(1 file, 2 obsolete files)

It throws since it doesn't specify enough arguments.

Error: uncaught exception: [Exception... "Not enough arguments [nsIDOMDragEvent.initDragEvent]" nsresult: "0x80570001 (NS_ERROR_XPC_NOT_ENOUGH_ARGS)" location: "JS frame :: chrome://mochikit/content/tests/SimpleTest/EventUtils.js :: synthesizeDrop :: line 505" data: no]

The code I was using:

let data = [[ "text/uri-list: http://example.org" ],
            [ "text/plain: http://example.org" ]];

dragDropButtons.forEach(function(val) {
  let button = document.getElementById(val);
  // This throws now, which is why I've commented it out. When synthesizeDrop
  // is fixed this should work just fine. - Natch
   let effectReturned = EventUtils.synthesizeDrop(button, data, "link");
  is(effectReturned, "link" || "copyLink",
     "Wrong dropEffect returned by button: " + val);
})
Attached patch patch (obsolete) — Splinter Review
Assignee: nobody → highmind63
Attachment #396314 - Flags: review?(sayrer)
Whoops, patches got merged.
Attachment #396314 - Attachment is obsolete: true
Attachment #396315 - Flags: review?(sayrer)
Attachment #396314 - Flags: review?(sayrer)
Blocks: 458613
Attachment #396315 - Flags: review?(sayrer) → review?(enndeakin)
Comment on attachment 396315 [details] [diff] [review]
patch
[Checkin: Comment 10 & 12]

I'm going to try to make this function more useful, currently command handlers are called when this function runs which doesn't work out well when testing elements that have both command handlers and drag handlers.
Attachment #396315 - Attachment is obsolete: true
Attachment #396315 - Flags: review?(enndeakin)
Attached patch wip 1 (obsolete) — Splinter Review
This function doesn't really work, the returned dropEffect never matches what actually happens. Another problem is that DragEvents don't set the drag session, so in my case the function fails with an error...

Any help here would be appreciated.
->Default owner, this is getting too complicated for me. The above patch *can* be taken, but I've yet to see a correct dropEffect returned from the function. It used to set the dropEffect, then return that, which doesn't sound all that useful to me...
Assignee: highmind63 → nobody
Attachment #396315 - Flags: review?(enndeakin)
Comment on attachment 396315 [details] [diff] [review]
patch
[Checkin: Comment 10 & 12]

This at least gets in not to throw, so should be taken.
Attachment #396315 - Attachment is obsolete: false
Attachment #396315 - Flags: review?(enndeakin) → review+
Keywords: checkin-needed
Whiteboard: [c-n: NPOTB, 1.9.2 needed]
Maybe once bug 448602 lands, these two functions can just create a pseudo transfer and event object, then call all the event listeners in order and return that? Is that a better hack than the one currently in place?
Don't this need to land in m-c first?
yes, only this can probably land together, there are no tests that use this function now (they would've failed), and this just makes the method call not throw.
Whiteboard: [c-n: NPOTB, 1.9.2 needed] → [c-n: NPOTB, 1.9.2 and m-c needed]
Comment on attachment 396315 [details] [diff] [review]
patch
[Checkin: Comment 10 & 12]


http://hg.mozilla.org/mozilla-central/rev/8384b031de64
Attachment #396315 - Attachment description: patch → patch [Checkin: Comment 10]
Assignee: nobody → highmind63
Status: NEW → ASSIGNED
Whiteboard: [c-n: NPOTB, 1.9.2 and m-c needed] → [c-n: NPOTB, comment 10 to m-1.9.2]
-> Resolved Fixed

Opened bug 514451 to simplify this method somewhat.
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Comment on attachment 396315 [details] [diff] [review]
patch
[Checkin: Comment 10 & 12]


http://hg.mozilla.org/releases/mozilla-1.9.2/rev/b51ae20ae663
Attachment #396315 - Attachment description: patch [Checkin: Comment 10] → patch [Checkin: Comment 10 & 12]
Attachment #396478 - Attachment is obsolete: true
Keywords: checkin-needed
Whiteboard: [c-n: NPOTB, comment 10 to m-1.9.2] → [fixed1.9.2b1]
Target Milestone: --- → mozilla1.9.3a1
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: