mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-10-26 17:17:31 +09:00
Merge remote-tracking branch 'origin/tracking' into custom
This commit is contained in:
commit
1e871780fb
5 changed files with 71 additions and 37 deletions
|
|
@ -20,6 +20,11 @@
|
||||||
* 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>
|
||||||
|
|
@ -35,12 +40,50 @@ 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.
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,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) {
|
||||||
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));
|
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");
|
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) {
|
||||||
setBooleanPref(PREF_ENABLE_MDN_DOCS_TOOLTIP, initial);
|
yield 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", true);
|
pref("devtools.inspector.mdnDocsTooltip.enabled", false);
|
||||||
|
|
||||||
// Enable the Font Inspector
|
// Enable the Font Inspector
|
||||||
pref("devtools.fontinspector.enabled", true);
|
pref("devtools.fontinspector.enabled", true);
|
||||||
|
|
|
||||||
|
|
@ -1180,16 +1180,16 @@ pref("dom.forms.number", true);
|
||||||
// platforms which don't have a color picker implemented yet.
|
// platforms which don't have a color picker implemented yet.
|
||||||
pref("dom.forms.color", true);
|
pref("dom.forms.color", true);
|
||||||
|
|
||||||
// Support for input type=date and type=time. By default, disabled.
|
// Support for input type=date and type=time.
|
||||||
pref("dom.forms.datetime", false);
|
pref("dom.forms.datetime", true);
|
||||||
|
|
||||||
// Support for input type=month, type=week and type=datetime-local. By default,
|
// Enable time picker UI.
|
||||||
// disabled.
|
|
||||||
pref("dom.forms.datetime.others", false);
|
|
||||||
|
|
||||||
// Enable time picker UI. By default, disabled.
|
|
||||||
pref("dom.forms.datetime.timepicker", false);
|
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
|
// Support for new @autocomplete values
|
||||||
pref("dom.forms.autocomplete.experimental", false);
|
pref("dom.forms.autocomplete.experimental", false);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,27 +22,6 @@ const DISABLE_VIDEO_PREF="media.hardware-video-decoding.failed";
|
||||||
const RUNNING_PREF="sanity-test.running";
|
const RUNNING_PREF="sanity-test.running";
|
||||||
const TIMEOUT_SEC=20;
|
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) {
|
function testPixel(ctx, x, y, r, g, b, a, fuzz) {
|
||||||
var data = ctx.getImageData(x, y, 1, 1);
|
var data = ctx.getImageData(x, y, 1, 1);
|
||||||
|
|
||||||
|
|
@ -55,6 +34,11 @@ function testPixel(ctx, x, y, r, g, b, a, fuzz) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function stopRunning() {
|
||||||
|
Preferences.set(RUNNING_PREF, false);
|
||||||
|
Services.prefs.savePrefFile(null);
|
||||||
|
}
|
||||||
|
|
||||||
function setTimeout(aMs, aCallback) {
|
function setTimeout(aMs, aCallback) {
|
||||||
var timer = Cc['@mozilla.org/timer;1'].
|
var timer = Cc['@mozilla.org/timer;1'].
|
||||||
createInstance(Ci.nsITimer);
|
createInstance(Ci.nsITimer);
|
||||||
|
|
@ -100,15 +84,18 @@ function testCompositor(win, ctx) {
|
||||||
var testPassed = true;
|
var testPassed = true;
|
||||||
|
|
||||||
if (!verifyVideoRendering(ctx)) {
|
if (!verifyVideoRendering(ctx)) {
|
||||||
|
stopRunning();
|
||||||
Preferences.set(DISABLE_VIDEO_PREF, true);
|
Preferences.set(DISABLE_VIDEO_PREF, true);
|
||||||
testPassed = false;
|
testPassed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!verifyLayersRendering(ctx)) {
|
if (!verifyLayersRendering(ctx)) {
|
||||||
|
stopRunning();
|
||||||
testPassed = false;
|
testPassed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (testPassed) {
|
if (testPassed) {
|
||||||
|
stopRunning();
|
||||||
}
|
}
|
||||||
|
|
||||||
return testPassed;
|
return testPassed;
|
||||||
|
|
@ -130,8 +117,10 @@ var listener = {
|
||||||
this.win.onload = this.onWindowLoaded.bind(this);
|
this.win.onload = this.onWindowLoaded.bind(this);
|
||||||
this.utils = this.win.QueryInterface(Ci.nsIInterfaceRequestor)
|
this.utils = this.win.QueryInterface(Ci.nsIInterfaceRequestor)
|
||||||
.getInterface(Ci.nsIDOMWindowUtils);
|
.getInterface(Ci.nsIDOMWindowUtils);
|
||||||
|
// Stop running the test if it timed out.
|
||||||
setTimeout(TIMEOUT_SEC * 1000, () => {
|
setTimeout(TIMEOUT_SEC * 1000, () => {
|
||||||
if (this.win) {
|
if (this.win) {
|
||||||
|
stopRunning();
|
||||||
this.endTest();
|
this.endTest();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -208,17 +197,19 @@ SanityTest.prototype = {
|
||||||
Ci.nsISupportsWeakReference]),
|
Ci.nsISupportsWeakReference]),
|
||||||
|
|
||||||
shouldRunTest: function() {
|
shouldRunTest: function() {
|
||||||
// Only test gfx features if firefox has updated, or if the user has a new
|
// Only test GFX features if the application was updated, or if the user
|
||||||
// gpu or drivers.
|
// has a new GPU or drivers.
|
||||||
var buildId = Services.appinfo.platformBuildID;
|
var buildId = Services.appinfo.platformBuildID;
|
||||||
var gfxinfo = Cc["@mozilla.org/gfx/info;1"].getService(Ci.nsIGfxInfo);
|
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)) {
|
if (Preferences.get(RUNNING_PREF, false)) {
|
||||||
Preferences.set(DISABLE_VIDEO_PREF, true);
|
Preferences.set(DISABLE_VIDEO_PREF, true);
|
||||||
|
stopRunning();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkPref(pref, value, reason) {
|
function checkPref(pref, value) {
|
||||||
var prefValue = Preferences.get(pref, undefined);
|
var prefValue = Preferences.get(pref, undefined);
|
||||||
if (prefValue == value) {
|
if (prefValue == value) {
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -227,9 +218,9 @@ SanityTest.prototype = {
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Handle dual GPU setups
|
// TODO: Handle dual GPU setups
|
||||||
if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion, REASON_DRIVER_CHANGED) &&
|
if (checkPref(DRIVER_PREF, gfxinfo.adapterDriverVersion) &&
|
||||||
checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID, REASON_DEVICE_CHANGED) &&
|
checkPref(DEVICE_PREF, gfxinfo.adapterDeviceID) &&
|
||||||
checkPref(VERSION_PREF, buildId, REASON_FIREFOX_CHANGED))
|
checkPref(VERSION_PREF, buildId))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue