Commit Graph

15 Commits

Author SHA1 Message Date
Joey Parrish 849bff1db3 fix: Audit all usage of readBytes for memory leaks (#9027)
Make cloning buffers (or not) explicit in readBytes.

When we use a range of bytes temporarily for further parsing, we pass
clone=false and get a view on the existing memory buffer. When we want
to store the range of bytes, we pass clone=true and avoid holding a
reference to an entire segment in memory.

The call for the EMSG parser in MediaSourceEngine had an explicit clone,
but now uses the new clone parameter. This is not a functional change,
though.

The only readBytes call that changed in this audit was in the UI seek
bar.

The rest all appear to be values for temporary usage, and so are not
being cloned.

The new `clone` parameter will require future callers of `readBytes()`
to think about their purpose and make a choice.
2025-08-27 10:49:48 +02:00
Joey Parrish fbbd63d96b test: Late load tests, fix Chromecast test flake (#4115)
This change fixes tests on Chromecast by loading tests later in the process.  Test scripts are now dynamically inserted by boot.js, rather than loaded by Karma.  The bootstrapping code then awaits the completion of that before starting the Karma frameworks (Jasmine) to run the tests.

This also removes the use of goog.provide/goog.require in tests and test utils.  We don't need to load test utils or library sources dynamically in each test, and this gives us more explicit control over script loading and ordering.

Closes #4094
2022-04-11 15:47:48 -07:00
michellezhuo 0eb3b620d3 build: add goog.require for compiler upgrade (Part 5)
Change-Id: I7c001f1c6d68a994342c1184e394f4643fd56ac9
2020-10-16 00:10:07 +00:00
Joey Parrish 7e6a0f38ff fix: Correct license headers in misc. files
This corrects/normalizes license headers in misc. files, such as
config files, docs, build tools, tests, and externs.  This does not
affect the compiled output, and is only done for consistency.

Issue #2638

Change-Id: I9d8da2de55243b08d7df2b743aac73c6f15e858a
2020-06-09 16:13:56 -07:00
Joey Parrish 64896d70b0 Use shorter license header
This reflects changes in Google's policy on JavaScript license
headers, which should be smaller to avoid increasing the size of the
binary unnecessarily.

This also updates the company name from "Google, Inc" to "Google LLC".

Change-Id: I3f8b9ed3700b6351f43173d50c94d35c333e82b4
2019-11-22 18:18:36 +00:00
Jacob Trimble ac4fdfd0cd Make the reader types more permissive of inputs.
Now the EbmlParser and DataViewReader types can accept BufferSource
objects to avoid the caller having to convert it at each callsite.

Change-Id: I527fbc638485214bfe976d7da89b79b6098033a8
2019-08-20 22:08:27 +00:00
Jacob Trimble 12d71f9ebd Convert ui and util tests to ES6.
Issue #1157

Change-Id: Ib4edb2eb06a302385ca7ca084367803356b8aae6
2019-05-24 20:54:48 +00:00
Jacob Trimble 0dd64074b9 Only allow one statement per line.
With the new style rule, we cannot have two statements on the same line.
So we can no longer have an "if" on a single line and we cannot have
an arrow function with a body on the same line as when it is used.
This is mostly a manual change.

Change-Id: I2285202dd5ecbad764308bc725e6d317ff2ee7f0
2019-05-13 22:11:50 +00:00
Jacob Trimble 47daf49f31 Use arrow functions for callbacks.
This is an automated change to convert use of "function" functions
to arrow functions.  This doesn't change all uses of bind() that
could be converted.  This also doesn't remove all "function" functions.

Change-Id: I40ac7d086bcef947a1be083359c8fd1d4499a9c3
2019-05-09 16:40:46 +00:00
Jacob Trimble c81389741f Prefer const over let.
A coming update to the Google eslint config will require using "const"
over "let".  This makes that one change to isolate the big changes.

Change-Id: I7d0974c3ae15c53cc45a6b07bf9f6586e2d34aca
2019-05-08 09:22:10 -07:00
Jacob Trimble f70436540c Convert 'var' to 'let'/'const' (3 of 9).
This is part of a change to convert all usages of 'var' with either
'let' or 'const'.  This takes a conservative approach for 'const' where
it will only be used for aliases and storing the "original" values in
tests.

Change-Id: I10f5c38a8b06b5797c6eec7492829084114514c9
2018-02-14 00:47:03 +00:00
Jacob Trimble 26bacb1489 Disallow unknown properties (3/5).
This is part of adding a new conformance rule to add additional type
safety.  This will disallow using properties of unknown types or using
unknown properties.

The first parts will be fixing errors caused by the new rule.  These
are backwards compatible, so can be applied before the rule is enabled.
Once all the errors and bugs are fixed, the rule will be enabled.

Change-Id: Ic37437a1ad2305bc50a814cdcc562e74703222ac
2017-07-05 17:47:03 +00:00
Aaron Vaage 924e396a18 Added readInt32 to DataViewReader
Change-Id: Ib54b4997df19902c35ada8aaadbacba7292e2198
2017-03-20 12:50:55 -07:00
Jacob Trimble ded62a8205 Add more tests and remove dead code.
This brings 9 classes over 80% branch coverage.

Change-Id: Id9edf22022c3f99d21fa6cad6df6994ee751079d
2017-01-11 01:20:19 +00:00
Leandro Moreira a8c44da4b1 restructures test files 2016-07-01 09:53:30 -03:00