Backed out 3 changesets (bug 1602075) for causing dt failures CLOSED TREE

Backed out changeset 2df583e25890 (bug 1602075)
Backed out changeset fa77554062c7 (bug 1602075)
Backed out changeset 595a28396874 (bug 1602075)
This commit is contained in:
Ciure Andrei 2020-05-02 00:21:30 +03:00
Родитель 2d1fc3c186
Коммит 48a808ecf8
17 изменённых файлов: 140 добавлений и 241 удалений

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

@ -2134,11 +2134,6 @@ pref("devtools.dom.enabled", false);
// Enable the Accessibility panel.
pref("devtools.accessibility.enabled", true);
#if defined(NIGHTLY_BUILD)
pref("devtools.accessibility.auto-init.enabled", true);
#else
pref("devtools.accessibility.auto-init.enabled", false);
#endif
// Web console filters
pref("devtools.webconsole.filter.error", true);

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

@ -14,12 +14,6 @@ const PARENT_ACCESSIBILITY_EVENTS = [
"can-be-enabled-change",
];
loader.lazyImporter(
this,
"FeatureGate",
"resource://featuregates/FeatureGate.jsm"
);
/**
* Component responsible for tracking all Accessibility fronts in parent and
* content processes.
@ -30,7 +24,6 @@ class AccessibilityProxy {
this.accessibilityEventsMap = new Map();
this.accessibleWalkerEventsMap = new Map();
this.supports = {};
this.audit = this.audit.bind(this);
this.disableAccessibility = this.disableAccessibility.bind(this);
@ -56,16 +49,6 @@ class AccessibilityProxy {
return this.accessibilityFront && this.accessibilityFront.enabled;
}
/**
* Indicates whether the accessibility service is enabled.
*/
get canBeEnabled() {
// TODO: Just use parentAccessibilityFront after Firefox 75.
const { canBeEnabled } =
this.parentAccessibilityFront || this.accessibilityFront;
return canBeEnabled;
}
get currentTarget() {
return this._currentTarget;
}
@ -267,23 +250,12 @@ class AccessibilityProxy {
}
}
async onChange(isEnabled) {
this.supports.autoInit = isEnabled;
}
async initialize() {
try {
await this.toolbox.targetList.watchTargets(
[this.toolbox.targetList.TYPES.FRAME],
this._onTargetAvailable
);
// Bug 1602075: auto init feature definition is used for an experiment to
// determine if we can automatically enable accessibility panel when it
// opens.
this.supports.autoInit = await FeatureGate.addObserver(
"accessibility-panel-auto-init",
this
);
return true;
} catch (e) {
// toolbox may be destroyed during this step.
@ -291,14 +263,12 @@ class AccessibilityProxy {
}
}
async destroy() {
destroy() {
this.toolbox.targetList.unwatchTargets(
[this.toolbox.targetList.TYPES.FRAME],
this._onTargetAvailable
);
await FeatureGate.removeObserver("accessibility-panel-auto-init", this);
this.accessibilityEventsMap = null;
this.accessibleWalkerEventsMap = null;
@ -372,6 +342,7 @@ class AccessibilityProxy {
// Finalize accessibility front initialization. See accessibility front
// bootstrap method description.
await this.accessibilityFront.bootstrap();
this.supports = {};
// To add a check for backward compatibility add something similar to the
// example below:
//

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

@ -85,7 +85,7 @@ class AccessibilityStartup {
shutdown: this._updateToolHighlight,
});
await this.accessibilityProxy.destroy();
this.accessibilityProxy.destroy();
this.accessibilityProxy = null;
}.bind(this)();
return this._destroyingAccessibility;

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

@ -24,7 +24,10 @@ const Button = createFactory(
const LearnMoreLink = createFactory(
require("devtools/client/accessibility/components/LearnMoreLink")
);
const { enable } = require("devtools/client/accessibility/actions/ui");
const {
enable,
updateCanBeEnabled,
} = require("devtools/client/accessibility/actions/ui");
// Localization
const { L10N } = require("devtools/client/accessibility/utils/l10n");
@ -44,7 +47,8 @@ class Description extends Component {
canBeEnabled: PropTypes.bool,
dispatch: PropTypes.func.isRequired,
enableAccessibility: PropTypes.func.isRequired,
autoInit: PropTypes.bool.isRequired,
startListeningForLifecycleEvents: PropTypes.func.isRequired,
stopListeningForLifecycleEvents: PropTypes.func.isRequired,
};
}
@ -56,6 +60,19 @@ class Description extends Component {
};
this.onEnable = this.onEnable.bind(this);
this.onCanBeEnabledChange = this.onCanBeEnabledChange.bind(this);
}
componentWillMount() {
this.props.startListeningForLifecycleEvents({
"can-be-enabled-change": this.onCanBeEnabledChange,
});
}
componentWillUnmount() {
this.props.stopListeningForLifecycleEvents({
"can-be-enabled-change": this.onCanBeEnabledChange,
});
}
onEnable() {
@ -71,38 +88,25 @@ class Description extends Component {
.catch(() => this.setState({ enabling: false }));
}
onCanBeEnabledChange(canBeEnabled) {
this.props.dispatch(updateCanBeEnabled(canBeEnabled));
}
render() {
const { canBeEnabled, autoInit } = this.props;
let warningStringName = "accessibility.enable.disabledTitle";
let button;
if (!autoInit) {
const { enabling } = this.state;
const enableButtonStr = enabling
? "accessibility.enabling"
: "accessibility.enable";
const { canBeEnabled } = this.props;
const { enabling } = this.state;
const enableButtonStr = enabling
? "accessibility.enabling"
: "accessibility.enable";
let title;
let disableButton = false;
let title;
let disableButton = false;
if (canBeEnabled) {
title = L10N.getStr("accessibility.enable.enabledTitle");
} else {
disableButton = true;
title = L10N.getStr("accessibility.enable.disabledTitle");
}
button = Button(
{
id: "accessibility-enable-button",
onClick: this.onEnable,
disabled: enabling || disableButton,
busy: enabling,
"data-standalone": true,
title,
},
L10N.getStr(enableButtonStr)
);
warningStringName = "accessibility.description.general.p2";
if (canBeEnabled) {
title = L10N.getStr("accessibility.enable.enabledTitle");
} else {
disableButton = true;
title = L10N.getStr("accessibility.enable.disabledTitle");
}
return div(
@ -123,22 +127,26 @@ class Description extends Component {
l10n: L10N,
messageStringKey: "accessibility.description.general.p1",
}),
p({}, L10N.getStr(warningStringName))
p({}, L10N.getStr("accessibility.description.general.p2"))
)
),
button
Button(
{
id: "accessibility-enable-button",
onClick: this.onEnable,
disabled: enabling || disableButton,
busy: enabling,
"data-standalone": true,
title,
},
L10N.getStr(enableButtonStr)
)
);
}
}
const mapStateToProps = ({
ui: {
canBeEnabled,
supports: { autoInit },
},
}) => ({
canBeEnabled,
autoInit,
const mapStateToProps = ({ ui }) => ({
canBeEnabled: ui.canBeEnabled,
});
// Exports from this module

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

@ -14,12 +14,7 @@ const {
} = require("devtools/client/shared/vendor/react-dom-factories");
const PropTypes = require("devtools/client/shared/vendor/react-prop-types");
const { connect } = require("devtools/client/shared/vendor/react-redux");
const {
enable,
reset,
updateCanBeEnabled,
updateCanBeDisabled,
} = require("devtools/client/accessibility/actions/ui");
const { reset } = require("devtools/client/accessibility/actions/ui");
// Localization
const FluentReact = require("devtools/client/shared/vendor/fluent-react");
@ -82,16 +77,12 @@ class MainFrame extends Component {
this.resetAccessibility = this.resetAccessibility.bind(this);
this.onPanelWindowResize = this.onPanelWindowResize.bind(this);
this.onCanBeEnabledChange = this.onCanBeEnabledChange.bind(this);
this.onCanBeDisabledChange = this.onCanBeDisabledChange.bind(this);
}
componentWillMount() {
this.props.startListeningForLifecycleEvents({
init: this.resetAccessibility,
shutdown: this.resetAccessibility,
"can-be-enabled-change": this.onCanBeEnabledChange,
"can-be-disabled-change": this.onCanBeDisabledChange,
});
this.props.startListeningForAccessibilityEvents({
"document-ready": this.resetAccessibility,
@ -109,8 +100,6 @@ class MainFrame extends Component {
this.props.stopListeningForLifecycleEvents({
init: this.resetAccessibility,
shutdown: this.resetAccessibility,
"can-be-enabled-change": this.onCanBeEnabledChange,
"can-be-disabled-change": this.onCanBeDisabledChange,
});
this.props.stopListeningForAccessibilityEvents({
"document-ready": this.resetAccessibility,
@ -123,22 +112,6 @@ class MainFrame extends Component {
dispatch(reset(resetAccessiblity, supports));
}
onCanBeEnabledChange(canBeEnabled) {
const {
enableAccessibility,
dispatch,
supports: { autoInit },
} = this.props;
dispatch(updateCanBeEnabled(canBeEnabled));
if (canBeEnabled && autoInit) {
dispatch(enable(enableAccessibility));
}
}
onCanBeDisabledChange(canBeDisabled) {
this.props.dispatch(updateCanBeDisabled(canBeDisabled));
}
get useLandscapeMode() {
const { clientWidth } = document.getElementById("content");
return clientWidth > PORTRAIT_MODE_WIDTH;
@ -170,10 +143,16 @@ class MainFrame extends Component {
audit,
enableAccessibility,
disableAccessibility,
startListeningForLifecycleEvents,
stopListeningForLifecycleEvents,
} = this.props;
if (!enabled) {
return Description({ enableAccessibility });
return Description({
enableAccessibility,
startListeningForLifecycleEvents,
stopListeningForLifecycleEvents,
});
}
// Audit is currently running.
@ -187,6 +166,8 @@ class MainFrame extends Component {
audit,
disableAccessibility,
simulate,
startListeningForLifecycleEvents,
stopListeningForLifecycleEvents,
toolboxDoc: toolbox.doc,
}),
isAuditing && AuditProgressOverlay(),

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

@ -30,7 +30,10 @@ loader.lazyGetter(this, "SimulationMenuButton", function() {
});
const { connect } = require("devtools/client/shared/vendor/react-redux");
const { disable } = require("devtools/client/accessibility/actions/ui");
const {
disable,
updateCanBeDisabled,
} = require("devtools/client/accessibility/actions/ui");
class Toolbar extends Component {
static get propTypes() {
@ -41,7 +44,8 @@ class Toolbar extends Component {
toolboxDoc: PropTypes.object.isRequired,
audit: PropTypes.func.isRequired,
simulate: PropTypes.func,
autoInit: PropTypes.bool.isRequired,
startListeningForLifecycleEvents: PropTypes.func.isRequired,
stopListeningForLifecycleEvents: PropTypes.func.isRequired,
};
}
@ -53,6 +57,23 @@ class Toolbar extends Component {
};
this.onDisable = this.onDisable.bind(this);
this.onCanBeDisabledChange = this.onCanBeDisabledChange.bind(this);
}
componentWillMount() {
this.props.startListeningForLifecycleEvents({
"can-be-disabled-change": this.onCanBeDisabledChange,
});
}
componentWillUnmount() {
this.props.stopListeningForLifecycleEvents({
"can-be-disabled-change": this.onCanBeDisabledChange,
});
}
onCanBeDisabledChange(canBeDisabled) {
this.props.dispatch(updateCanBeDisabled(canBeDisabled));
}
onDisable() {
@ -65,7 +86,7 @@ class Toolbar extends Component {
}
render() {
const { canBeDisabled, simulate, toolboxDoc, audit, autoInit } = this.props;
const { canBeDisabled, simulate, toolboxDoc, audit } = this.props;
const { disabling } = this.state;
const disableButtonStr = disabling
? "accessibility.disabling"
@ -96,23 +117,21 @@ class Toolbar extends Component {
className: "devtools-toolbar",
role: "toolbar",
},
!autoInit &&
Button(
{
className: "disable",
id: "accessibility-disable-button",
onClick: this.onDisable,
disabled: disabling || isDisabled,
busy: disabling,
title,
},
L10N.getStr(disableButtonStr)
),
!autoInit &&
div({
role: "separator",
className: "devtools-separator",
}),
Button(
{
className: "disable",
id: "accessibility-disable-button",
onClick: this.onDisable,
disabled: disabling || isDisabled,
busy: disabling,
title,
},
L10N.getStr(disableButtonStr)
),
div({
role: "separator",
className: "devtools-separator",
}),
// @remove after release 68 (See Bug 1551574)
span(
{
@ -134,14 +153,8 @@ class Toolbar extends Component {
}
}
const mapStateToProps = ({
ui: {
canBeDisabled,
supports: { autoInit },
},
}) => ({
canBeDisabled,
autoInit,
const mapStateToProps = ({ ui }) => ({
canBeDisabled: ui.canBeDisabled,
});
// Exports from this module

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

@ -96,16 +96,6 @@ AccessibilityPanel.prototype = {
this.onTargetAvailable
);
// Bug 1602075: if auto init feature is enabled, enable accessibility
// service if necessary.
if (
this.accessibilityProxy.supports.autoInit &&
this.accessibilityProxy.canBeEnabled &&
!this.accessibilityProxy.enabled
) {
await this.accessibilityProxy.enableAccessibility();
}
this.picker = new Picker(this);
this.fluentBundles = await this.createFluentBundles();
@ -195,7 +185,7 @@ AccessibilityPanel.prototype = {
// Alright reset the flag we are about to refresh the panel.
this.shouldRefresh = false;
this.postContentMessage("initialize", {
supports: this.accessibilityProxy.supports,
supports: this.supports,
fluentBundles: this.fluentBundles,
toolbox: this._toolbox,
getAccessibilityTreeRoot: this.accessibilityProxy

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

@ -123,7 +123,7 @@ function onReceiveChildren(cache, action) {
}
if (accessible.actorID) {
console.warn(`Error fetching children: `, error);
console.warn(`Error fetching children: `, accessible, error);
return cache;
}

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

@ -25,13 +25,21 @@ function getInitialState() {
}
function simulation(state = getInitialState(), action) {
const { error } = action;
if (error) {
console.warn(
`Error running simulation: ${
typeof error == "string"
? error
: "simulate function in simulator.js returned an error"
}`
);
return state;
}
switch (action.type) {
case SIMULATE:
if (action.error) {
console.warn("Error running simulation", action.error);
return state;
}
const simTypes = action.simTypes;
if (simTypes.length === 0) {

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

@ -32,7 +32,7 @@ add_task(async function testNoShowAccessibilityPropertiesContextMenu() {
);
ok(inspectA11YPropsItem.hidden, "Accessibility tools are not enabled.");
contextMenu.hidePopup();
await removeTab(tab);
gBrowser.removeCurrentTab();
});
addA11YPanelTask(

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

@ -57,7 +57,4 @@ add_task(async () => {
await runA11yPanelTests(CONTENT_PROCESS_EXPECTED, env);
await disableAccessibilityInspector(env);
await closeToolbox();
await shutdownA11y();
await removeTab(gBrowser.selectedTab);
});

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

@ -16,7 +16,7 @@ add_task(async function tabNotHighlighted() {
"should not be highlighted when toolbox opens"
);
await closeTabAndToolbox();
gBrowser.removeCurrentTab();
});
add_task(async function tabHighlighted() {
@ -27,7 +27,5 @@ add_task(async function tabHighlighted() {
await checkHighlighted(toolbox, true);
a11yService = null;
await closeToolbox();
await shutdownA11y();
await removeTab(gBrowser.selectedTab);
gBrowser.removeCurrentTab();
});

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

@ -6,10 +6,8 @@
const TEST_URI = '<h1 id="h1">header</h1><p id="p">paragraph</p>';
add_task(async function() {
Services.prefs.setBoolPref("devtools.accessibility.auto-init.enabled", false);
const { toolbox: toolbox1, tab: tab1 } = await addTestTab(buildURL(TEST_URI));
const { toolbox: toolbox2, tab: tab2 } = await addTestTab(buildURL(TEST_URI));
const { toolbox: toolbox1 } = await addTestTab(buildURL(TEST_URI));
const { toolbox: toolbox2 } = await addTestTab(buildURL(TEST_URI));
const options = await openOptions(toolbox2);
info("Check that initially both accessibility panels are highlighted.");
@ -44,14 +42,6 @@ add_task(async function() {
await checkHighlighted(toolbox1, false);
await checkHighlighted(toolbox2, false);
await closeToolbox();
await shutdownA11y();
await removeTab(tab1);
await closeToolbox();
await shutdownA11y();
await removeTab(tab2);
Services.prefs.clearUserPref("devtools.accessibility.auto-init.enabled");
});
async function openOptions(toolbox) {

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

@ -73,36 +73,21 @@ async function initA11y() {
return a11yService;
}
/**
* Force garbage collection.
*/
function forceGC() {
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
SpecialPowers.gc();
SpecialPowers.forceShrinkingGC();
SpecialPowers.forceCC();
}
/**
* Check if accessibility service is enabled.
*/
function isA11YEnabled() {
return Services.appinfo.accessibilityEnabled;
}
/**
* Wait for accessibility service to shut down. We consider it shut down when
* an "a11y-init-or-shutdown" event is received with a value of "0".
*/
function waitForA11YShutdown() {
return new Promise(resolve => {
if (!Services.appinfo.accessibilityEnabled) {
resolve();
return;
}
function shutdownA11y() {
if (!Services.appinfo.accessibilityEnabled) {
return Promise.resolve();
}
// Force collections to speed up accessibility service shutdown.
Cu.forceGC();
Cu.forceCC();
Cu.forceShrinkingGC();
return new Promise(resolve => {
const observe = (subject, topic, data) => {
if (data === "0") {
Services.obs.removeObserver(observe, "a11y-init-or-shutdown");
@ -117,28 +102,6 @@ function waitForA11YShutdown() {
});
}
/**
* Ensure that accessibility is completely shutdown.
*/
async function shutdownA11y() {
forceGC();
if (isA11YEnabled()) {
await waitForA11YShutdown();
}
const browser = gBrowser.selectedBrowser;
if (await SpecialPowers.spawn(browser, [], isA11YEnabled)) {
await SpecialPowers.spawn(browser, [], waitForA11YShutdown);
}
// Sanity check
ok(!isA11YEnabled(), "Accessibility service in parent process is shut down.");
ok(
!(await SpecialPowers.spawn(browser, [], isA11YEnabled)),
"Accessibility service in content process is shut down."
);
}
registerCleanupFunction(async () => {
info("Cleaning up...");
await shutdownA11y();
@ -193,15 +156,6 @@ async function addTestTab(url) {
* cleanup function to make sure that the panel is still present.
*/
async function disableAccessibilityInspector(env) {
if (
Services.prefs.getBoolPref(
"devtools.accessibility.auto-init.enabled",
false
)
) {
return;
}
const { doc, win, panel } = env;
// Disable accessibility service through the panel and wait for the shutdown
// event.
@ -857,9 +811,6 @@ function addA11YPanelTask(msg, uri, task, options = {}) {
const env = await addTestTab(buildURL(uri, options));
await task(env);
await disableAccessibilityInspector(env);
await closeToolbox();
await shutdownA11y();
await removeTab(gBrowser.selectedTab);
});
}

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

@ -396,6 +396,11 @@ const AccessibleActor = ActorClassWithSpec(accessibleSpec, {
const targets = [...relation.getTargets().enumerate(Ci.nsIAccessible)];
let relationObject;
for (const target of targets) {
// Target of the relation is not part of the current root document.
if (target.rootDocument !== doc.rawAccessible) {
continue;
}
let targetAcc;
try {
targetAcc = this.walker.attachAccessible(target, doc.rawAccessible);

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

@ -467,7 +467,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
}
const doc = this.getRawAccessibleFor(this.rootDoc);
if (!doc || isStale(doc)) {
if (isStale(doc)) {
return this.once("document-ready").then(docAcc => this.addRef(docAcc));
}

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

@ -1,3 +1,4 @@
# there are currently no feature gates
[demo-feature]
title = "Demo Feature"
description = "A no-op feature to demo the feature gate system."
@ -7,12 +8,3 @@ type = "boolean"
bug-numbers = [1479127]
is-public = true
default-value = false
[accessibility-panel-auto-init]
title = "Accessibility Panel Automatic Initialization"
description = "Automatically enables accessibility panel when it is opened."
restart-required = false
preference = "devtools.accessibility.auto-init.enabled"
bug-numbers = [1602075]
type = "boolean"
default-value = {default = false, nightly = true}