Bug 1659407 - Remove newCacheStructure webconsole trait. r=ladybenko.

Differential Revision: https://phabricator.services.mozilla.com/D87234
This commit is contained in:
Nicolas Chevobbe 2020-08-18 15:11:59 +00:00
Родитель 3454e7652e
Коммит 4024f7b515
3 изменённых файлов: 5 добавлений и 35 удалений

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

@ -196,8 +196,6 @@ const WebConsoleActor = ActorClassWithSpec(webconsoleSpec, {
} }
this.traits = { this.traits = {
// Supports new cached messages structure for 77+
newCacheStructure: true,
// Supports retrieving blocked urls // Supports retrieving blocked urls
blockedUrls: true, blockedUrls: true,
}; };

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

@ -43,29 +43,13 @@ module.exports = async function({
// /!\ The actor implementation requires to call startListeners("PageError") first /!\ // /!\ The actor implementation requires to call startListeners("PageError") first /!\
let { messages } = await webConsoleFront.getCachedMessages(["PageError"]); let { messages } = await webConsoleFront.getCachedMessages(["PageError"]);
// On older server (< v77), we're also getting LogMessage cached messages, so we need
// to ignore those.
// On server < v79, we're also getting CSS Messages that we need to filter out. // On server < v79, we're also getting CSS Messages that we need to filter out.
messages = messages.filter(message => { messages = messages.filter(
return ( message => message.pageError.category !== MESSAGE_CATEGORY.CSS_PARSER
(webConsoleFront.traits.newCacheStructure || );
!message._type ||
message._type == "PageError") &&
message.pageError.category !== MESSAGE_CATEGORY.CSS_PARSER
);
});
messages = messages.map(message => { messages.forEach(message => {
// Handling cached messages for servers older than Firefox 78.
// Wrap the message into a `pageError` attribute, to match `pageError` behavior
if (message._type) {
return {
pageError: message,
resourceType: ResourceWatcher.TYPES.ERROR_MESSAGE,
};
}
message.resourceType = ResourceWatcher.TYPES.ERROR_MESSAGE; message.resourceType = ResourceWatcher.TYPES.ERROR_MESSAGE;
return message;
}); });
// Cached messages don't have the same shape as live messages, // Cached messages don't have the same shape as live messages,
// so we need to transform them. // so we need to transform them.

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

@ -29,19 +29,7 @@ module.exports = async function({ targetList, targetFront, onAvailable }) {
// Fetch already existing messages // Fetch already existing messages
// /!\ The actor implementation requires to call startListeners("PageError") first /!\ // /!\ The actor implementation requires to call startListeners("PageError") first /!\
// On older server (< v77), cached messages have to be retrieved at the same time as const { messages } = await webConsoleFront.getCachedMessages(["LogMessage"]);
// PageError messages.
let { messages } = await webConsoleFront.getCachedMessages([
webConsoleFront.traits.newCacheStructure ? "LogMessage" : "PageError",
]);
// On older server (< v77), we're also getting pageError cached messages, so we need
// to ignore those.
messages = messages.filter(message => {
return (
webConsoleFront.traits.newCacheStructure || message._type === "LogMessage"
);
});
for (const message of messages) { for (const message of messages) {
// Handling cached messages for servers older than Firefox 78. // Handling cached messages for servers older than Firefox 78.