Skip to content

Commit

Permalink
fix: Fix exception on Tizen due to unsupported Array method (#5429)
Browse files Browse the repository at this point in the history
Tizen 3 does not support Array.flat(). This fixes a runtime exception on
Tizen 3 by replacing flat() with concat() and the spread operator. This
also bans the use of flat().

flat() was originally introduced in PR #5422
  • Loading branch information
joeyparrish authored Jul 21, 2023
1 parent 25ecfa7 commit 8ff2917
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion build/conformance.textproto
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ requirement: {
}

requirement: {
type: BANNED_PROPERTY
type: BANNED_PROPERTY_CALL
value: "String.prototype.replaceAll"
error_message:
"Using \"String.replaceAll\" is not allowed; "
Expand All @@ -377,3 +377,9 @@ requirement: {
whitelist_regexp: "test/"
}

requirement: {
type: BANNED_PROPERTY_CALL
value: "Array.prototype.flat"
error_message:
"Using \"Array.flat\" is not allowed because is not supported on Tizen 3."
}
2 changes: 1 addition & 1 deletion lib/cea/mp4_cea_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -270,7 +270,7 @@ shaka.cea.Mp4CeaParser = class {
// Combine all sample data. This assumes that the samples described across
// multiple trun boxes are still continuous in the mdat box.
const sampleDatas = parsedTRUNs.map((t) => t.sampleData);
const sampleData = sampleDatas.flat();
const sampleData = [].concat(...sampleDatas);

if (sampleData.length) {
sampleSize = sampleData[0].sampleSize || defaultSampleSize;
Expand Down

0 comments on commit 8ff2917

Please sign in to comment.