|
1 /* Any copyright is dedicated to the Public Domain. |
|
2 http://creativecommons.org/publicdomain/zero/1.0/ */ |
|
3 |
|
4 const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff"; |
|
5 const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99"; |
|
6 |
|
7 function runTests() { |
|
8 yield setLinks("0,1,2,3,4,5,6,7,8"); |
|
9 setPinnedLinks(""); |
|
10 |
|
11 yield addNewTabPageTab(); |
|
12 checkGrid("0,1,2,3,4,5,6,7,8"); |
|
13 |
|
14 sendDropEvent(0, BAD_DRAG_DATA); |
|
15 sendDropEvent(1, GOOD_DRAG_DATA); |
|
16 |
|
17 yield whenPagesUpdated(); |
|
18 checkGrid("0,99p,1,2,3,4,5,6,7"); |
|
19 } |
|
20 |
|
21 function sendDropEvent(aCellIndex, aDragData) { |
|
22 let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor); |
|
23 let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils); |
|
24 |
|
25 let event = createDragEvent("drop", aDragData); |
|
26 windowUtils.dispatchDOMEventViaPresShell(getCell(aCellIndex).node, event, true); |
|
27 } |