зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1417368
- Fixing launchpad `response is undefined` error & Toolbox.shouldComponentUpdate warning r=Honza
MozReview-Commit-ID: ImN34U0tFGm --HG-- extra : rebase_source : 82d34dba3d75273685eea11016640a05f83f7b28
This commit is contained in:
Родитель
c02e5e066a
Коммит
493d8e263a
|
@ -99,7 +99,7 @@ class Toolbar extends Component {
|
|||
|| !I.is(this.props.requestFilterTypes, nextProps.requestFilterTypes)
|
||||
|
||||
// Filtered requests are useful only when searchbox is focused
|
||||
|| this.refs.searchbox && this.refs.searchbox.focused;
|
||||
|| !!(this.refs.searchbox && this.refs.searchbox.focused);
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
|
|
|
@ -533,26 +533,28 @@ class FirefoxDataProvider {
|
|||
*/
|
||||
async _requestData(actor, method) {
|
||||
// Calculate real name of the client getter.
|
||||
let clientMethodName = "get" + method.charAt(0).toUpperCase() +
|
||||
method.slice(1);
|
||||
let clientMethodName = `get${method.charAt(0).toUpperCase()}${method.slice(1)}`;
|
||||
// The name of the callback that processes request response
|
||||
let callbackMethodName = "on" + method.charAt(0).toUpperCase() +
|
||||
method.slice(1);
|
||||
let callbackMethodName = `on${method.charAt(0).toUpperCase()}${method.slice(1)}`;
|
||||
// And the event to fire before updating this data
|
||||
let updatingEventName = "UPDATING_" + method.replace(/([A-Z])/g, "_$1").toUpperCase();
|
||||
let updatingEventName = `UPDATING_${method.replace(/([A-Z])/g, "_$1").toUpperCase()}`;
|
||||
|
||||
if (typeof this.webConsoleClient[clientMethodName] == "function") {
|
||||
// Emit event that tell we just start fetching some data
|
||||
emit(EVENTS[updatingEventName], actor);
|
||||
// Emit event that tell we just start fetching some data
|
||||
emit(EVENTS[updatingEventName], actor);
|
||||
|
||||
let response = await new Promise((resolve, reject) => {
|
||||
// Do a RDP request to fetch data from the actor.
|
||||
let response = await this.webConsoleClient[clientMethodName](actor);
|
||||
if (typeof this.webConsoleClient[clientMethodName] === "function") {
|
||||
this.webConsoleClient[clientMethodName](actor, (res) => {
|
||||
resolve(res);
|
||||
});
|
||||
} else {
|
||||
reject(new Error(`Error: No such client method '${clientMethodName}'!`));
|
||||
}
|
||||
});
|
||||
|
||||
// Call data processing method.
|
||||
response = await this[callbackMethodName](response);
|
||||
return response;
|
||||
}
|
||||
throw new Error("Error: No such client method '" + clientMethodName + "'!");
|
||||
// Call data processing method.
|
||||
return this[callbackMethodName](response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Загрузка…
Ссылка в новой задаче