summaryrefslogtreecommitdiff
path: root/browser/base/content/test/newtab/browser_newtab_bug765628.js
diff options
context:
space:
mode:
Diffstat (limited to 'browser/base/content/test/newtab/browser_newtab_bug765628.js')
-rw-r--r--browser/base/content/test/newtab/browser_newtab_bug765628.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/browser/base/content/test/newtab/browser_newtab_bug765628.js b/browser/base/content/test/newtab/browser_newtab_bug765628.js
new file mode 100644
index 000000000..6b93c8e6d
--- /dev/null
+++ b/browser/base/content/test/newtab/browser_newtab_bug765628.js
@@ -0,0 +1,27 @@
+/* Any copyright is dedicated to the Public Domain.
+ http://creativecommons.org/publicdomain/zero/1.0/ */
+
+const BAD_DRAG_DATA = "javascript:alert('h4ck0rz');\nbad stuff";
+const GOOD_DRAG_DATA = "http://example.com/#99\nsite 99";
+
+function runTests() {
+ yield setLinks("0,1,2,3,4,5,6,7,8");
+ setPinnedLinks("");
+
+ yield addNewTabPageTab();
+ checkGrid("0,1,2,3,4,5,6,7,8");
+
+ sendDropEvent(0, BAD_DRAG_DATA);
+ sendDropEvent(1, GOOD_DRAG_DATA);
+
+ yield whenPagesUpdated();
+ checkGrid("0,99p,1,2,3,4,5,6,7");
+}
+
+function sendDropEvent(aCellIndex, aDragData) {
+ let ifaceReq = getContentWindow().QueryInterface(Ci.nsIInterfaceRequestor);
+ let windowUtils = ifaceReq.getInterface(Ci.nsIDOMWindowUtils);
+
+ let event = createDragEvent("drop", aDragData);
+ windowUtils.dispatchDOMEventViaPresShell(getCell(aCellIndex).node, event, true);
+}