Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff";
5 const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99";
7 function runTests() {
8 yield setLinks("0,1,2,3,4,5,6,7,8");
9 setPinnedLinks("");
11 yield addNewTabPageTab();
12 checkGrid("0,1,2,3,4,5,6,7,8");
14 sendDropEvent(0, BAD_DRAG_DATA);
15 sendDropEvent(1, GOOD_DRAG_DATA);
17 yield whenPagesUpdated();
18 checkGrid("0,99p,1,2,3,4,5,6,7");
19 }
21 function sendDropEvent(aCellIndex, aDragData) {
22 let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor);
23 let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils);
25 let event = createDragEvent("drop", aDragData);
26 windowUtils.dispatchDOMEventViaPresShell(getCell(aCellIndex).node, event, true);
27 }