michael@0: /* Any copyright is dedicated to the Public Domain. michael@0: http://creativecommons.org/publicdomain/zero/1.0/ */ michael@0: michael@0: const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff"; michael@0: const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99"; michael@0: michael@0: function runTests() { michael@0: yield setLinks("0,1,2,3,4,5,6,7,8"); michael@0: setPinnedLinks(""); michael@0: michael@0: yield addNewTabPageTab(); michael@0: checkGrid("0,1,2,3,4,5,6,7,8"); michael@0: michael@0: sendDropEvent(0, BAD_DRAG_DATA); michael@0: sendDropEvent(1, GOOD_DRAG_DATA); michael@0: michael@0: yield whenPagesUpdated(); michael@0: checkGrid("0,99p,1,2,3,4,5,6,7"); michael@0: } michael@0: michael@0: function sendDropEvent(aCellIndex, aDragData) { michael@0: let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor); michael@0: let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils); michael@0: michael@0: let event = createDragEvent("drop", aDragData); michael@0: windowUtils.dispatchDOMEventViaPresShell(getCell(aCellIndex).node, event, true); michael@0: }