Backed out changeset f74ec3b3a49a (bug 1352801) for eslint failure. r=backout

This commit is contained in:
Sebastian Hengst 2017-04-09 22:33:34 +02:00
Родитель 8975f9e7e1
Коммит e1a015ae5c
3 изменённых файлов: 3 добавлений и 47 удалений

Просмотреть файл

@ -21,11 +21,6 @@
* code by having a tag called "padding" and a property * code by having a tag called "padding" and a property
* value called "margin". * value called "margin".
*/ */
const { PrefObserver } = require("devtools/client/shared/prefs");
const PREF_ENABLE_MDN_DOCS_TOOLTIP =
"devtools.inspector.mdnDocsTooltip.enabled";
const TEST_URI = ` const TEST_URI = `
<html> <html>
<head> <head>
@ -41,51 +36,12 @@ const TEST_URI = `
`; `;
add_task(function* () { add_task(function* () {
info("Ensure the pref is true to begin with");
let initial = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
if (initial != true) {
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, true);
}
yield addTab("data:text/html;charset=utf8," + encodeURIComponent(TEST_URI)); yield addTab("data:text/html;charset=utf8," + encodeURIComponent(TEST_URI));
let {inspector, view} = yield openRuleView(); let {inspector, view} = yield openRuleView();
yield selectNode("padding", inspector); yield selectNode("padding", inspector);
yield testMdnContextMenuItemVisibility(view); yield testMdnContextMenuItemVisibility(view);
info("Ensure the pref is reset to its initial value");
let eventual = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
if (eventual != initial) {
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial);
}
}); });
/**
* Set a boolean pref, and wait for the pref observer to
* trigger, so that code listening for the pref change
* has had a chance to update itself.
*
* @param pref {string} Name of the pref to change
* @param state {boolean} Desired value of the pref.
*
* Note that if the pref already has the value in `state`,
* then the prefObserver will not trigger. So you should only
* call this function if you know the pref's current value is
* not `state`.
*/
function* setBooleanPref(pref, state) {
let oncePrefChanged = defer();
let prefObserver = new PrefObserver("devtools.");
prefObserver.on(pref, oncePrefChanged.resolve);
info("Set the pref " + pref + " to: " + state);
Services.prefs.setBoolPref(pref, state);
info("Wait for prefObserver to call back so the UI can update");
yield oncePrefChanged.promise;
prefObserver.off(pref, oncePrefChanged.resolve);
}
/** /**
* Tests that the MDN context menu item is shown when it should be, * Tests that the MDN context menu item is shown when it should be,
* and hidden when it should be. * and hidden when it should be.

Просмотреть файл

@ -33,7 +33,7 @@ add_task(function* () {
info("Ensure the pref is true to begin with"); info("Ensure the pref is true to begin with");
let initial = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP); let initial = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
if (initial != true) { if (initial != true) {
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, true); setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, true);
} }
yield addTab("data:text/html;charset=utf8," + encodeURIComponent(TEST_DOC)); yield addTab("data:text/html;charset=utf8," + encodeURIComponent(TEST_DOC));
@ -59,7 +59,7 @@ add_task(function* () {
info("Ensure the pref is reset to its initial value"); info("Ensure the pref is reset to its initial value");
let eventual = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP); let eventual = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
if (eventual != initial) { if (eventual != initial) {
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial); setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial);
} }
}); });

Просмотреть файл

@ -62,7 +62,7 @@ pref("devtools.inspector.showUserAgentStyles", false);
// Show all native anonymous content (like controls in <video> tags) // Show all native anonymous content (like controls in <video> tags)
pref("devtools.inspector.showAllAnonymousContent", false); pref("devtools.inspector.showAllAnonymousContent", false);
// Enable the MDN docs tooltip // Enable the MDN docs tooltip
pref("devtools.inspector.mdnDocsTooltip.enabled", false); pref("devtools.inspector.mdnDocsTooltip.enabled", true);
// Enable the new color widget // Enable the new color widget
pref("devtools.inspector.colorWidget.enabled", false); pref("devtools.inspector.colorWidget.enabled", false);