Bug 1318006 - Clone originAttributes on cached console message events.
MozReview-Commit-ID: tnWCa5CsuE
--- a/dom/console/ConsoleAPIStorage.js
+++ b/dom/console/ConsoleAPIStorage.js
@@ -122,16 +122,22 @@ ConsoleAPIStorageService.prototype = {
*/
recordEvent: function CS_recordEvent(aId, aOuterId, aEvent)
{
if (!_consoleStorage.has(aId)) {
_consoleStorage.set(aId, []);
}
let storage = _consoleStorage.get(aId);
+
+ // Clone originAttributes to prevent "TypeError: can't access dead object"
+ // exceptions when cached console messages are retrieved/filtered
+ // by the devtools webconsole actor.
+ aEvent.originAttributes = Cu.cloneInto(aEvent.originAttributes, {});
+
storage.push(aEvent);
// truncate
if (storage.length > STORAGE_MAX_EVENTS) {
storage.shift();
}
Services.obs.notifyObservers(aEvent, "console-api-log-event", aOuterId);