Compare commits

...

6 Commits

Author SHA1 Message Date
roytam1 1e871780fb Merge remote-tracking branch 'origin/tracking' into custom 1 month ago
Moonchild 8dfcd4553f Issue #1210 - Keep timepicker disabled for now. 1 month ago
Moonchild 40e9f40e89 Issue #1813 - Enable date and time picker by default. 1 month ago
FranklinDM d42af42d26 Issue #1898 - Make sure that the sanity test stops running if necessary 1 month ago
Moonchild 349d3d96a2 Issue #1899 - Make sure the test for it still works 1 month ago
Moonchild 0749a8828c Issue #1899 - Disable the (broken) MDN integration widget by default. 1 month ago
  1. 43
      devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js
  2. 4
      devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-03.js
  3. 2
      devtools/client/preferences/devtools.js
  4. 14
      modules/libpref/init/all.js
  5. 45
      toolkit/components/gfx/SanityTest.js

43
devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-01.js

@ -20,6 +20,11 @@
* code by having a tag called "padding" and a property
* value called "margin".
*/
const { PrefObserver } = require("devtools/client/shared/prefs");
const PREF_ENABLE_MDN_DOCS_TOOLTIP =
"devtools.inspector.mdnDocsTooltip.enabled";
const TEST_URI = `
<html>
<head>
@ -35,12 +40,50 @@ const TEST_URI = `
`;
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));
let {inspector, view} = yield openRuleView();
yield selectNode("padding", inspector);
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,
* and hidden when it should be.

4
devtools/client/inspector/rules/test/browser_rules_context-menu-show-mdn-docs-03.js

@ -32,7 +32,7 @@ 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) {
setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, true);
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, true);
}
yield addTab("data:text/html;charset=utf8," + encodeURIComponent(TEST_DOC));
@ -58,7 +58,7 @@ add_task(function* () {
info("Ensure the pref is reset to its initial value");
let eventual = Services.prefs.getBoolPref(PREF_ENABLE_MDN_DOCS_TOOLTIP);
if (eventual != initial) {
setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial);
yield setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial);
}
});

2
devtools/client/preferences/devtools.js

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

14
modules/libpref/init/all.js

@ -1180,16 +1180,16 @@ pref("dom.forms.number", true);
// platforms which don't have a color picker implemented yet.
pref("dom.forms.color", true);
// Support for input type=date and type=time. By default, disabled.
pref("dom.forms.datetime", false);
// Support for input type=date and type=time.
pref("dom.forms.datetime", true);
// Support for input type=month, type=week and type=datetime-local. By default,
// disabled.
pref("dom.forms.datetime.others", false);
// Enable time picker UI. By default, disabled.
// Enable time picker UI.
pref("dom.forms.datetime.timepicker", false);
// Support for input type=month, type=week and type=datetime-local.
// TODO: implement/fix these.
pref("dom.forms.datetime.others", false);
// Support for new @autocomplete values
pref("dom.forms.autocomplete.experimental", false);

45
toolkit/components/gfx/SanityTest.js

@ -22,27 +22,6 @@ const DISABLE_VIDEO_PREF="media.hardware-video-decoding.failed";
const RUNNING_PREF="sanity-test.running";
const TIMEOUT_SEC=20;
// GRAPHICS_SANITY_TEST histogram enumeration values
const TEST_PASSED=0;
const TEST_FAILED_RENDER=1;
const TEST_FAILED_VIDEO=2;
const TEST_CRASHED=3;
const TEST_TIMEOUT=4;
// GRAPHICS_SANITY_TEST_REASON enumeration values.
const REASON_FIRST_RUN=0;
const REASON_FIREFOX_CHANGED=1;
const REASON_DEVICE_CHANGED=2;
const REASON_DRIVER_CHANGED=3;
// GRAPHICS_SANITY_TEST_OS_SNAPSHOT histogram enumeration values
const SNAPSHOT_VIDEO_OK=0;
const SNAPSHOT_VIDEO_FAIL=1;
const SNAPSHOT_ERROR=2;
const SNAPSHOT_TIMEOUT=3;
const SNAPSHOT_LAYERS_OK=4;
const SNAPSHOT_LAYERS_FAIL=5;
function testPixel(ctx, x, y, r, g, b, a, fuzz) {
var data = ctx.getImageData(x, y, 1, 1);
@ -55,6 +34,11 @@ function testPixel(ctx, x, y, r, g, b, a, fuzz) {
return false;
}
function stopRunning() {
Preferences.set(RUNNING_PREF, false);
Services.prefs.savePrefFile(null);
}
function setTimeout(aMs, aCallback) {
var timer = Cc['@mozilla.org/timer;1'].
createInstance(Ci.nsITimer);
@ -100,15 +84,18 @@ function testCompositor(win, ctx) {
var testPassed = true;
if (!verifyVideoRendering(ctx)) {
stopRunning();
Preferences.set(DISABLE_VIDEO_PREF, true);
testPassed = false;
}
if (!verifyLayersRendering(ctx)) {
stopRunning();
testPassed = false;
}
if (testPassed) {
stopRunning();
}
return testPassed;
@ -130,8 +117,10 @@ var listener = {
this.win.onload = this.onWindowLoaded.bind(this);
this.utils = this.win.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindowUtils);
// Stop running the test if it timed out.
setTimeout(TIMEOUT_SEC * 1000, () => {
if (this.win) {
stopRunning();
this.endTest();
}
});
@ -208,17 +197,19 @@ SanityTest.prototype = {
Ci.nsISupportsWeakReference]),
shouldRunTest: function() {
// Only test gfx features if firefox has updated, or if the user has a new
// gpu or drivers.
// Only test GFX features if the application was updated, or if the user
// has a new GPU or drivers.
var buildId = Services.appinfo.platformBuildID;
var gfxinfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
// Stop the test and disable hardware video decoding if we crashed.
if (Preferences.get(RUNNING_PREF, false)) {
Preferences.set(DISABLE_VIDEO_PREF, true);
stopRunning();
return false;
}
function checkPref(pref, value, reason) {
function checkPref(pref, value) {
var prefValue = Preferences.get(pref, undefined);
if (prefValue == value) {
return true;
@ -227,9 +218,9 @@ SanityTest.prototype = {
}
// TODO: Handle dual GPU setups
if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion, REASON_DRIVER_CHANGED) &&
checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID, REASON_DEVICE_CHANGED) &&
checkPref(VERSION_PREF, buildId, REASON_FIREFOX_CHANGED))
if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion) &&
checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID) &&
checkPref(VERSION_PREF, buildId))
{
return false;
}

Loading…
Cancel
Save