зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1498012 Part 1 - Fix ReplayDebugger problems when searching for scripts and enumerating object properties, r=lsmyth.
--HG-- extra : rebase_source : e80c94d7821b813c2d588c36edd232370f385749
This commit is contained in:
Родитель
6782ee5d3a
Коммит
8ec92382a7
|
@ -163,10 +163,24 @@ ReplayDebugger.prototype = {
|
|||
return this._scripts[data.id];
|
||||
},
|
||||
|
||||
findScripts() {
|
||||
// Note: Debugger's findScripts() method takes a query argument, which
|
||||
// we ignore here.
|
||||
const data = this._sendRequest({ type: "findScripts" });
|
||||
_convertScriptQuery(query) {
|
||||
// Make a copy of the query, converting properties referring to debugger
|
||||
// things into their associated ids.
|
||||
const rv = Object.assign({}, query);
|
||||
if ("global" in query) {
|
||||
rv.global = query.global._data.id;
|
||||
}
|
||||
if ("source" in query) {
|
||||
rv.source = query.source._data.id;
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
findScripts(query) {
|
||||
const data = this._sendRequest({
|
||||
type: "findScripts",
|
||||
query: this._convertScriptQuery(query)
|
||||
});
|
||||
return data.map(script => this._addScript(script));
|
||||
},
|
||||
|
||||
|
@ -604,7 +618,8 @@ ReplayDebuggerObject.prototype = {
|
|||
|
||||
getOwnPropertyDescriptor(name) {
|
||||
this._ensureProperties();
|
||||
return this._properties[name];
|
||||
const desc = this._properties[name];
|
||||
return desc ? this._convertPropertyDescriptor(desc) : null;
|
||||
},
|
||||
|
||||
_ensureProperties() {
|
||||
|
@ -614,21 +629,24 @@ ReplayDebuggerObject.prototype = {
|
|||
id: this._data.id
|
||||
});
|
||||
this._properties = {};
|
||||
properties.forEach(({name, desc}) => {
|
||||
if ("value" in desc) {
|
||||
desc.value = this._dbg._convertValue(desc.value);
|
||||
}
|
||||
if ("get" in desc) {
|
||||
desc.get = this._dbg._getObject(desc.get);
|
||||
}
|
||||
if ("set" in desc) {
|
||||
desc.set = this._dbg._getObject(desc.set);
|
||||
}
|
||||
this._properties[name] = desc;
|
||||
});
|
||||
properties.forEach(({name, desc}) => { this._properties[name] = desc; });
|
||||
}
|
||||
},
|
||||
|
||||
_convertPropertyDescriptor(desc) {
|
||||
const rv = Object.assign({}, desc);
|
||||
if ("value" in desc) {
|
||||
rv.value = this._dbg._convertValue(desc.value);
|
||||
}
|
||||
if ("get" in desc) {
|
||||
rv.get = this._dbg._getObject(desc.get);
|
||||
}
|
||||
if ("set" in desc) {
|
||||
rv.set = this._dbg._getObject(desc.set);
|
||||
}
|
||||
return rv;
|
||||
},
|
||||
|
||||
get allocationSite() { NYI(); },
|
||||
get errorMessageName() { NYI(); },
|
||||
get errorNotes() { NYI(); },
|
||||
|
|
|
@ -524,9 +524,22 @@ function forwardToScript(name) {
|
|||
const gRequestHandlers = {
|
||||
|
||||
findScripts(request) {
|
||||
const query = Object.assign({}, request.query);
|
||||
if ("global" in query) {
|
||||
query.global = gPausedObjects.getObject(query.global);
|
||||
}
|
||||
if ("source" in query) {
|
||||
query.source = gScriptSources.getObject(query.source);
|
||||
if (!query.source) {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
const scripts = dbg.findScripts(query);
|
||||
const rv = [];
|
||||
gScripts.forEach((id) => {
|
||||
rv.push(getScriptData(id));
|
||||
scripts.forEach(script => {
|
||||
if (considerScript(script)) {
|
||||
rv.push(getScriptData(gScripts.getId(script)));
|
||||
}
|
||||
});
|
||||
return rv;
|
||||
},
|
||||
|
|
Загрузка…
Ссылка в новой задаче