Bug 1662059 - [devtools] Only read devtools.overflow.debugging.enabled from the client. r=jdescottes

Differential Revision: https://phabricator.services.mozilla.com/D92363
This commit is contained in:
Gabriel Luong 2020-10-06 02:50:38 +00:00
Родитель 6d87f384ee
Коммит 7afa635edb
2 изменённых файлов: 15 добавлений и 29 удалений

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

@ -103,12 +103,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
this.wasDisplayed = this.isDisplayed; this.wasDisplayed = this.isDisplayed;
this.wasScrollable = wasScrollable; this.wasScrollable = wasScrollable;
// We check this on each call because a static check requires a full browser restart if (wasScrollable) {
// to pick up changes.
const OVERFLOW_DEBUGGING_ENABLED = Services.prefs.getBoolPref(
"devtools.overflow.debugging.enabled"
);
if (OVERFLOW_DEBUGGING_ENABLED && wasScrollable) {
this.walker.updateOverflowCausingElements( this.walker.updateOverflowCausingElements(
this, this,
this.walker.overflowCausingElementsMap this.walker.overflowCausingElementsMap

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

@ -212,13 +212,6 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
targetActor.chromeEventHandler targetActor.chromeEventHandler
); );
// TODO: This preference is a client preference and should not be read here.
// See Bug 1662059.
this.isOverflowDebuggingEnabled = Services.prefs.getBoolPref(
"devtools.overflow.debugging.enabled",
false
);
// In this map, the key-value pairs are the overflow causing elements and their // In this map, the key-value pairs are the overflow causing elements and their
// respective ancestor scrollable node actor. // respective ancestor scrollable node actor.
this.overflowCausingElementsMap = new Map(); this.overflowCausingElementsMap = new Map();
@ -568,7 +561,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
actor.wasScrollable = isScrollable; actor.wasScrollable = isScrollable;
} }
if (this.isOverflowDebuggingEnabled && isScrollable) { if (isScrollable) {
this.updateOverflowCausingElements( this.updateOverflowCausingElements(
actor, actor,
currentOverflowCausingElementsMap currentOverflowCausingElementsMap
@ -576,24 +569,22 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
} }
} }
if (this.isOverflowDebuggingEnabled) { // Get the NodeActor for each node in the symmetric difference of
// Get the NodeActor for each node in the symmetric difference of // currentOverflowCausingElementsMap and this.overflowCausingElementsMap
// currentOverflowCausingElementsMap and this.overflowCausingElementsMap const overflowStateChanges = [...currentOverflowCausingElementsMap.keys()]
const overflowStateChanges = [...currentOverflowCausingElementsMap.keys()] .filter(node => !this.overflowCausingElementsMap.has(node))
.filter(node => !this.overflowCausingElementsMap.has(node)) .concat(
.concat( [...this.overflowCausingElementsMap.keys()].filter(
[...this.overflowCausingElementsMap.keys()].filter( node => !currentOverflowCausingElementsMap.has(node)
node => !currentOverflowCausingElementsMap.has(node)
)
) )
.filter(node => this.hasNode(node)) )
.map(node => this.getNode(node)); .filter(node => this.hasNode(node))
.map(node => this.getNode(node));
this.overflowCausingElementsMap = currentOverflowCausingElementsMap; this.overflowCausingElementsMap = currentOverflowCausingElementsMap;
if (overflowStateChanges.length) { if (overflowStateChanges.length) {
this.emit("overflow-change", overflowStateChanges); this.emit("overflow-change", overflowStateChanges);
}
} }
if (displayTypeChanges.length) { if (displayTypeChanges.length) {