summaryrefslogtreecommitdiffstats
path: root/browser/base/content/test/general/browser_homeDrop.js
diff options
context:
space:
mode:
authorMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
committerMatt A. Tobin <email@mattatobin.com>2018-02-03 06:00:38 -0500
commit8148615da179fdd60f19018e13b4e94b95609cc6 (patch)
tree771fccdd99fa3adf35fdd2c81d8197b415a89b91 /browser/base/content/test/general/browser_homeDrop.js
parent494802c1be7888025b95260d23db187467d2b9dd (diff)
downloadUXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.gz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.lz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.tar.xz
UXP-8148615da179fdd60f19018e13b4e94b95609cc6.zip
Remove browser tests - Part 1: The Tests (except for experiments)
Diffstat (limited to 'browser/base/content/test/general/browser_homeDrop.js')
-rw-r--r--browser/base/content/test/general/browser_homeDrop.js90
1 files changed, 0 insertions, 90 deletions
diff --git a/browser/base/content/test/general/browser_homeDrop.js b/browser/base/content/test/general/browser_homeDrop.js
deleted file mode 100644
index 6e87963d5..000000000
--- a/browser/base/content/test/general/browser_homeDrop.js
+++ /dev/null
@@ -1,90 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-add_task(function*() {
- let HOMEPAGE_PREF = "browser.startup.homepage";
-
- let homepageStr = Cc["@mozilla.org/supports-string;1"]
- .createInstance(Ci.nsISupportsString);
- homepageStr.data = "about:mozilla";
- yield pushPrefs([HOMEPAGE_PREF, homepageStr, Ci.nsISupportsString]);
-
- let scriptLoader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
- getService(Ci.mozIJSSubScriptLoader);
- let EventUtils = {};
- scriptLoader.loadSubScript("chrome://mochikit/content/tests/SimpleTest/EventUtils.js", EventUtils);
-
- // Since synthesizeDrop triggers the srcElement, need to use another button.
- let dragSrcElement = document.getElementById("downloads-button");
- ok(dragSrcElement, "Downloads button exists");
- let homeButton = document.getElementById("home-button");
- ok(homeButton, "home button present");
-
- function* drop(dragData, homepage) {
- let setHomepageDialogPromise = BrowserTestUtils.domWindowOpened();
-
- EventUtils.synthesizeDrop(dragSrcElement, homeButton, dragData, "copy", window);
-
- let setHomepageDialog = yield setHomepageDialogPromise;
- ok(true, "dialog appeared in response to home button drop");
- yield BrowserTestUtils.waitForEvent(setHomepageDialog, "load", false);
-
- let setHomepagePromise = new Promise(function(resolve) {
- let observer = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIObserver]),
- observe: function(subject, topic, data) {
- is(topic, "nsPref:changed", "observed correct topic");
- is(data, HOMEPAGE_PREF, "observed correct data");
- let modified = Services.prefs.getComplexValue(HOMEPAGE_PREF,
- Ci.nsISupportsString);
- is(modified.data, homepage, "homepage is set correctly");
- Services.prefs.removeObserver(HOMEPAGE_PREF, observer);
-
- Services.prefs.setComplexValue(HOMEPAGE_PREF,
- Ci.nsISupportsString, homepageStr);
-
- resolve();
- }
- };
- Services.prefs.addObserver(HOMEPAGE_PREF, observer, false);
- });
-
- setHomepageDialog.document.documentElement.acceptDialog();
-
- yield setHomepagePromise;
- }
-
- function dropInvalidURI() {
- return new Promise(resolve => {
- let consoleListener = {
- observe: function (m) {
- if (m.message.includes("NS_ERROR_DOM_BAD_URI")) {
- ok(true, "drop was blocked");
- resolve();
- }
- }
- };
- Services.console.registerListener(consoleListener);
- registerCleanupFunction(function () {
- Services.console.unregisterListener(consoleListener);
- });
-
- executeSoon(function () {
- info("Attempting second drop, of a javascript: URI");
- // The drop handler throws an exception when dragging URIs that inherit
- // principal, e.g. javascript:
- expectUncaughtException();
- EventUtils.synthesizeDrop(dragSrcElement, homeButton, [[{type: "text/plain", data: "javascript:8888"}]], "copy", window);
- });
- });
- }
-
- yield* drop([[{type: "text/plain",
- data: "http://mochi.test:8888/"}]],
- "http://mochi.test:8888/");
- yield* drop([[{type: "text/plain",
- data: "http://mochi.test:8888/\nhttp://mochi.test:8888/b\nhttp://mochi.test:8888/c"}]],
- "http://mochi.test:8888/|http://mochi.test:8888/b|http://mochi.test:8888/c");
- yield dropInvalidURI();
-});
-