Skip to content

Commit

Permalink
Fix CastUtils.serialize handling of errors.
Browse files Browse the repository at this point in the history
Beforehand, we stripped out all objects variables in events when
serializing. This was intended to remove complicated DOM objects, and
prevent the error messages from containing large amounts of unnecessary
information. However, this also caused the cast receiver to strip away
the detail variable in error events, thus removing all useful
information from the error event.
This adds a special exception to serialize for the contents of the
'detail' variable.

Issue #1065

Change-Id: Ie291e317cc6e856af20af5df57ecf3b5c81ec8bd
  • Loading branch information
theodab authored and joeyparrish committed Oct 22, 2017
1 parent 631e2d0 commit 7786473
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/cast/cast_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ shaka.cast.CastUtils.serialize = function(thing) {
for (var eventKey in value) {
var eventValue = value[eventKey];
if (eventValue && typeof eventValue == 'object') {
if (eventKey == 'detail') {
// Keep the detail value, because it contains important information
// for diagnosing errors.
simpleEvent[eventKey] = eventValue;
}
// Strip out non-null object types because they are complex and we
// don't need them.
} else if (eventKey in Event) {
Expand Down

0 comments on commit 7786473

Please sign in to comment.