Bug 1674417 - [devtools] Rename SourcesManager instances. r=ochameau.

Differential Revision: https://phabricator.services.mozilla.com/D95333
This commit is contained in:
Nicolas Chevobbe 2020-11-05 08:54:54 +00:00
Родитель a60ce46b27
Коммит 4269e69069
10 изменённых файлов: 49 добавлений и 42 удалений

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

@ -970,7 +970,7 @@ class EventCollector {
line = script.startLine;
column = script.startColumn;
url = script.url;
const actor = this.targetActor.sources.getOrCreateSourceActor(
const actor = this.targetActor.sourcesManager.getOrCreateSourceActor(
script.source
);
sourceActor = actor ? actor.actorID : null;

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

@ -65,7 +65,7 @@ const proto = {
* the caller:
* - createValueGrip
* Creates a value grip for the given object
* - sources
* - getSourcesManager
* SourcesManager getter that manages the sources of a thread
* - createEnvironmentActor
* Creates and return an environment actor
@ -81,7 +81,7 @@ const proto = {
{
thread,
createValueGrip: createValueGripHook,
sources,
getSourcesManager,
createEnvironmentActor,
getGripDepth,
incrementGripDepth,
@ -100,7 +100,7 @@ const proto = {
this.thread = thread;
this.hooks = {
createValueGrip: createValueGripHook,
sources,
getSourcesManager,
createEnvironmentActor,
getGripDepth,
incrementGripDepth,
@ -294,7 +294,9 @@ const proto = {
}
return {
source: this.hooks.sources().createSourceActor(this.obj.script.source),
source: this.hooks
.getSourcesManager()
.createSourceActor(this.obj.script.source),
line: this.obj.script.startLine,
column: 0, // TODO bug 901138: use Debugger.Script.prototype.startColumn
};

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

@ -511,10 +511,10 @@ function createObjectGrip(targetActor, depth, object, pool) {
decrementGripDepth: () => gripDepth--,
createValueGrip: v => createValueGripForTarget(targetActor, v, gripDepth),
createEnvironmentActor: env => createEnvironmentActor(env, targetActor),
sources: () =>
getSourcesManager: () =>
DevToolsUtils.reportException(
"WebConsoleActor",
Error("sources not yet implemented")
Error("getSourcesManager not yet implemented")
),
},
targetActor.conn

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

@ -264,7 +264,7 @@ const browsingContextTargetPrototype = {
// A map of actor names to actor instances provided by extensions.
this._extraActors = {};
this._exited = false;
this._sources = null;
this._sourcesManager = null;
// Map of DOM stylesheets to StyleSheetActors
this._styleSheetActors = new Map();
@ -492,11 +492,14 @@ const browsingContextTargetPrototype = {
return null;
},
get sources() {
if (!this._sources) {
this._sources = new SourcesManager(this.threadActor, this._allowSource);
get sourcesManager() {
if (!this._sourcesManager) {
this._sourcesManager = new SourcesManager(
this.threadActor,
this._allowSource
);
}
return this._sources;
return this._sourcesManager;
},
_createExtraActors() {
@ -977,9 +980,9 @@ const browsingContextTargetPrototype = {
this.threadActor.destroy();
this.threadActor = null;
if (this._sources) {
this._sources.destroy();
this._sources = null;
if (this._sourcesManager) {
this._sourcesManager.destroy();
this._sourcesManager = null;
}
},

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

@ -110,15 +110,15 @@ const ContentProcessTargetActor = TargetActorMixin(
return this._consoleScope;
},
get sources() {
if (!this._sources) {
get sourcesManager() {
if (!this._sourcesManager) {
assert(
this.threadActor,
"threadActor should exist when creating sources."
"threadActor should exist when creating SourcesManager."
);
this._sources = new SourcesManager(this.threadActor);
this._sourcesManager = new SourcesManager(this.threadActor);
}
return this._sources;
return this._sourcesManager;
},
/*
@ -224,9 +224,9 @@ const ContentProcessTargetActor = TargetActorMixin(
this._workerList = null;
}
if (this._sources) {
this._sources.destroy();
this._sources = null;
if (this._sourcesManager) {
this._sourcesManager.destroy();
this._sourcesManager = null;
}
if (this._dbg) {

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

@ -39,7 +39,7 @@ exports.WorkerTargetActor = TargetActorMixin(
this.workerGlobal = workerGlobal;
this._workerDebuggerData = workerDebuggerData;
this._sources = null;
this._sourcesManager = null;
this.makeDebugger = makeDebuggerUtil.bind(null, {
findDebuggees: () => {
@ -83,12 +83,12 @@ exports.WorkerTargetActor = TargetActorMixin(
return this._dbg;
},
get sources() {
if (this._sources === null) {
this._sources = new SourcesManager(this.threadActor);
get sourcesManager() {
if (this._sourcesManager === null) {
this._sourcesManager = new SourcesManager(this.threadActor);
}
return this._sources;
return this._sourcesManager;
},
// This is called from the ThreadActor#onAttach method
@ -100,9 +100,9 @@ exports.WorkerTargetActor = TargetActorMixin(
destroy() {
Actor.prototype.destroy.call(this);
if (this._sources) {
this._sources.destroy();
this._sources = null;
if (this._sourcesManager) {
this._sourcesManager.destroy();
this._sourcesManager = null;
}
this.workerGlobal = null;

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

@ -273,7 +273,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
},
get sourcesManager() {
return this._parent.sources;
return this._parent.sourcesManager;
},
get breakpoints() {
@ -1740,7 +1740,7 @@ const ThreadActor = ActorClassWithSpec(threadSpec, {
return createValueGrip(v, this.threadLifetimePool, this.objectGrip);
},
sources: () => this.sourcesManager,
getSourcesManager: () => this.sourcesManager,
createEnvironmentActor: (e, p) => this.createEnvironmentActor(e, p),
promote: () => this.threadObjectGrip(actor),
isThreadLifetimePool: () =>

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

@ -91,7 +91,7 @@ function getSourceLineOffsets(source) {
* The SourceActor ID
*/
function getActorIdForInternalSourceId(targetActor, id) {
const actor = targetActor.sources.getSourceActorByInternalSourceId(id);
const actor = targetActor.sourcesManager.getSourceActorByInternalSourceId(id);
return actor ? actor.actorID : null;
}
exports.getActorIdForInternalSourceId = getActorIdForInternalSourceId;

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

@ -512,10 +512,10 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
incrementGripDepth: () => this._gripDepth++,
decrementGripDepth: () => this._gripDepth--,
createValueGrip: v => this.createValueGrip(v),
sources: () =>
getSourcesManager: () =>
DevToolsUtils.reportException(
"WebConsoleActor",
Error("sources not yet implemented")
Error("getSourcesManager not yet implemented")
),
createEnvironmentActor: env => this.createEnvironmentActor(env),
},
@ -1602,7 +1602,9 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
},
getActorIdForInternalSourceId(id) {
const actor = this.parentActor.sources.getSourceActorByInternalSourceId(id);
const actor = this.parentActor.sourcesManager.getSourceActorByInternalSourceId(
id
);
return actor ? actor.actorID : null;
},

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

@ -184,11 +184,11 @@ const TestTargetActor = protocol.ActorClassWithSpec(browsingContextTargetSpec, {
return this._global.__name;
},
get sources() {
if (!this._sources) {
this._sources = new SourcesManager(this.threadActor);
get sourcesManager() {
if (!this._sourcesManager) {
this._sourcesManager = new SourcesManager(this.threadActor);
}
return this._sources;
return this._sourcesManager;
},
form: function() {
@ -224,7 +224,7 @@ const TestTargetActor = protocol.ActorClassWithSpec(browsingContextTargetSpec, {
},
reload: function(request) {
this.sources.reset();
this.sourcesManager.reset();
this.threadActor.clearDebuggees();
this.threadActor.dbg.addDebuggees();
return {};