зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1813476 - [devtools] Ensure instantiating via "new" all actors. r=devtools-reviewers,nchevobbe
Differential Revision: https://phabricator.services.mozilla.com/D168255
This commit is contained in:
Родитель
8fadefc5be
Коммит
6081889a65
|
@ -264,7 +264,10 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
|
|||
|
||||
get highlighter() {
|
||||
if (!this._highlighter) {
|
||||
this._highlighter = CustomHighlighterActor(this, "AccessibleHighlighter");
|
||||
this._highlighter = new CustomHighlighterActor(
|
||||
this,
|
||||
"AccessibleHighlighter"
|
||||
);
|
||||
|
||||
this.manage(this._highlighter);
|
||||
this._highlighter.on("highlighter-event", this.onHighlighterEvent);
|
||||
|
@ -275,7 +278,7 @@ const AccessibleWalkerActor = ActorClassWithSpec(accessibleWalkerSpec, {
|
|||
|
||||
get tabbingOrderHighlighter() {
|
||||
if (!this._tabbingOrderHighlighter) {
|
||||
this._tabbingOrderHighlighter = CustomHighlighterActor(
|
||||
this._tabbingOrderHighlighter = new CustomHighlighterActor(
|
||||
this,
|
||||
"TabbingOrderHighlighter"
|
||||
);
|
||||
|
|
|
@ -649,7 +649,7 @@ exports.AnimationsActor = protocol.ActorClassWithSpec(animationsSpec, {
|
|||
|
||||
for (const animation of animations) {
|
||||
const createdTime = this.getCreatedTime(animation);
|
||||
const actor = AnimationPlayerActor(this, animation, createdTime);
|
||||
const actor = new AnimationPlayerActor(this, animation, createdTime);
|
||||
this.actors.push(actor);
|
||||
}
|
||||
|
||||
|
@ -726,7 +726,7 @@ exports.AnimationsActor = protocol.ActorClassWithSpec(animationsSpec, {
|
|||
}
|
||||
|
||||
const createdTime = this.getCreatedTime(player);
|
||||
const actor = AnimationPlayerActor(this, player, createdTime);
|
||||
const actor = new AnimationPlayerActor(this, player, createdTime);
|
||||
this.actors.push(actor);
|
||||
eventData.push({
|
||||
type: "added",
|
||||
|
|
|
@ -138,7 +138,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
|
|||
this._walkerPromise = new Promise(resolve => {
|
||||
const domReady = () => {
|
||||
const targetActor = this.targetActor;
|
||||
this.walker = WalkerActor(this.conn, targetActor, options);
|
||||
this.walker = new WalkerActor(this.conn, targetActor, options);
|
||||
this.manage(this.walker);
|
||||
this.walker.once("destroyed", () => {
|
||||
this._walkerPromise = null;
|
||||
|
@ -182,7 +182,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
|
|||
}
|
||||
|
||||
this._pageStylePromise = this.getWalker().then(walker => {
|
||||
const pageStyle = PageStyleActor(this);
|
||||
const pageStyle = new PageStyleActor(this);
|
||||
this.manage(pageStyle);
|
||||
return pageStyle;
|
||||
});
|
||||
|
@ -194,7 +194,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
|
|||
return this._compatibility;
|
||||
}
|
||||
|
||||
this._compatibility = CompatibilityActor(this);
|
||||
this._compatibility = new CompatibilityActor(this);
|
||||
this.manage(this._compatibility);
|
||||
return this._compatibility;
|
||||
},
|
||||
|
@ -212,7 +212,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
|
|||
*/
|
||||
async getHighlighterByType(typeName) {
|
||||
if (isTypeRegistered(typeName)) {
|
||||
const highlighterActor = CustomHighlighterActor(this, typeName);
|
||||
const highlighterActor = new CustomHighlighterActor(this, typeName);
|
||||
if (highlighterActor.instance.isReady) {
|
||||
await highlighterActor.instance.isReady;
|
||||
}
|
||||
|
@ -240,7 +240,7 @@ exports.InspectorActor = protocol.ActorClassWithSpec(inspectorSpec, {
|
|||
// imageToImageData waits for the image to load.
|
||||
return InspectorActorUtils.imageToImageData(img, maxDim).then(imageData => {
|
||||
return {
|
||||
data: LongStringActor(this.conn, imageData.data),
|
||||
data: new LongStringActor(this.conn, imageData.data),
|
||||
size: imageData.size,
|
||||
};
|
||||
});
|
||||
|
|
|
@ -572,7 +572,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
|
|||
getImageData(maxDim) {
|
||||
return imageToImageData(this.rawNode, maxDim).then(imageData => {
|
||||
return {
|
||||
data: LongStringActor(this.conn, imageData.data),
|
||||
data: new LongStringActor(this.conn, imageData.data),
|
||||
size: imageData.size,
|
||||
};
|
||||
});
|
||||
|
@ -687,7 +687,7 @@ const NodeActor = protocol.ActorClassWithSpec(nodeSpec, {
|
|||
};
|
||||
const { dataURL, size } = getFontPreviewData(font, doc, options);
|
||||
|
||||
return { data: LongStringActor(this.conn, dataURL), size };
|
||||
return { data: new LongStringActor(this.conn, dataURL), size };
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -1642,7 +1642,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
if (!isNodeDead(node)) {
|
||||
html = node.rawNode.innerHTML;
|
||||
}
|
||||
return LongStringActor(this.conn, html);
|
||||
return new LongStringActor(this.conn, html);
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1677,7 +1677,7 @@ var WalkerActor = protocol.ActorClassWithSpec(walkerSpec, {
|
|||
if (!isNodeDead(node)) {
|
||||
outerHTML = node.rawNode.outerHTML;
|
||||
}
|
||||
return LongStringActor(this.conn, outerHTML);
|
||||
return new LongStringActor(this.conn, outerHTML);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -308,28 +308,28 @@ const proto = {
|
|||
* @param options object
|
||||
*/
|
||||
enumProperties(options) {
|
||||
return PropertyIteratorActor(this, options, this.conn);
|
||||
return new PropertyIteratorActor(this, options, this.conn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an actor to iterate over entries of a Map/Set-like object.
|
||||
*/
|
||||
enumEntries() {
|
||||
return PropertyIteratorActor(this, { enumEntries: true }, this.conn);
|
||||
return new PropertyIteratorActor(this, { enumEntries: true }, this.conn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an actor to iterate over an object symbols properties.
|
||||
*/
|
||||
enumSymbols() {
|
||||
return SymbolIteratorActor(this, this.conn);
|
||||
return new SymbolIteratorActor(this, this.conn);
|
||||
},
|
||||
|
||||
/**
|
||||
* Creates an actor to iterate over an object private properties.
|
||||
*/
|
||||
enumPrivateProperties() {
|
||||
return PrivatePropertiesIteratorActor(this, this.conn);
|
||||
return new PrivatePropertiesIteratorActor(this, this.conn);
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
|
@ -181,7 +181,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
|
|||
if (this.refMap.has(item)) {
|
||||
return this.refMap.get(item);
|
||||
}
|
||||
const actor = StyleRuleActor(this, item);
|
||||
const actor = new StyleRuleActor(this, item);
|
||||
this.manage(actor);
|
||||
this.refMap.set(item, actor);
|
||||
|
||||
|
@ -353,7 +353,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
|
|||
|
||||
// If this font comes from a @font-face rule
|
||||
if (font.rule) {
|
||||
const styleActor = StyleRuleActor(this, font.rule);
|
||||
const styleActor = new StyleRuleActor(this, font.rule);
|
||||
this.manage(styleActor);
|
||||
fontFace.rule = styleActor;
|
||||
fontFace.ruleText = font.rule.cssText;
|
||||
|
@ -388,7 +388,7 @@ var PageStyleActor = protocol.ActorClassWithSpec(pageStyleSpec, {
|
|||
opts
|
||||
);
|
||||
fontFace.preview = {
|
||||
data: LongStringActor(this.conn, dataURL),
|
||||
data: new LongStringActor(this.conn, dataURL),
|
||||
size,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ function run_test() {
|
|||
for (const key in props) {
|
||||
animation[key] = props[key];
|
||||
}
|
||||
const actor = AnimationPlayerActor({}, animation);
|
||||
const actor = new AnimationPlayerActor({}, animation);
|
||||
Assert.equal(actor.getName(), expectedName);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ function run_test() {
|
|||
|
||||
for (const { desc, animation, expectedType } of TEST_DATA) {
|
||||
info(desc);
|
||||
const actor = AnimationPlayerActor({}, animation);
|
||||
const actor = new AnimationPlayerActor({}, animation);
|
||||
Assert.equal(actor.getType(), expectedType);
|
||||
}
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче