Skip to content

Commit

Permalink
fix: stream property of request context obfuscated in production buil…
Browse files Browse the repository at this point in the history
…ds (#5118)

Co-authored-by: Dan Sparacio <[email protected]>
  • Loading branch information
littlespex and dsparacio authored Mar 23, 2023
1 parent 67b1e90 commit 93baba2
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 43 deletions.
25 changes: 23 additions & 2 deletions externs/shaka/net.js
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,27 @@ shaka.extern.ProgressUpdated;
shaka.extern.HeadersReceived;


/**
* @typedef {{
* type: (shaka.net.NetworkingEngine.AdvancedRequestType|undefined),
* stream: (shaka.extern.Stream|undefined),
* segment: (shaka.media.SegmentReference|undefined)
* }}
*
* @description
* Defines contextual data about a request
*
* @property {shaka.net.NetworkingEngine.AdvancedRequestType=} type
* The advanced type
* @property {shaka.extern.Stream=} stream
* The duration of the segment in seconds
* @property {shaka.media.SegmentReference=} segment
* The request's segment reference
* @exportDoc
*/
shaka.extern.RequestContext;


/**
* Defines a filter for requests. This filter takes the request and modifies
* it before it is sent to the scheme plugin.
Expand All @@ -211,7 +232,7 @@ shaka.extern.HeadersReceived;
*
* @typedef {!function(shaka.net.NetworkingEngine.RequestType,
* shaka.extern.Request,
* shaka.net.NetworkingEngine.RequestContext=):
* shaka.extern.RequestContext=):
* (Promise|undefined)}
* @exportDoc
*/
Expand All @@ -228,7 +249,7 @@ shaka.extern.RequestFilter;
*
* @typedef {!function(shaka.net.NetworkingEngine.RequestType,
* shaka.extern.Response,
* shaka.net.NetworkingEngine.RequestContext=):
* shaka.extern.RequestContext=):
* (Promise|undefined)}
* @exportDoc
*/
Expand Down
2 changes: 1 addition & 1 deletion lib/hls/hls_parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -3386,7 +3386,7 @@ shaka.hls.HlsParser = class {
*
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @return {!Promise.<shaka.extern.Response>}
* @private
*/
Expand Down
31 changes: 5 additions & 26 deletions lib/net/networking_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
*/

goog.provide('shaka.net.NetworkingEngine');
goog.provide('shaka.net.NetworkingEngine.AdvancedRequestType');
goog.provide('shaka.net.NetworkingEngine.RequestType');
goog.provide('shaka.net.NetworkingEngine.PendingRequest');

goog.require('goog.Uri');
goog.require('goog.asserts');
goog.require('shaka.media.SegmentReference');
goog.require('shaka.net.Backoff');
goog.require('shaka.util.AbortableOperation');
goog.require('shaka.util.BufferUtils');
Expand Down Expand Up @@ -254,7 +254,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @return {!shaka.net.NetworkingEngine.PendingRequest}
* @export
*/
Expand Down Expand Up @@ -349,7 +349,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
/**
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @return {!shaka.util.AbortableOperation.<undefined>}
* @private
*/
Expand Down Expand Up @@ -624,7 +624,7 @@ shaka.net.NetworkingEngine = class extends shaka.util.FakeEventTarget {
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.ResponseAndGotProgress}
* responseAndGotProgress
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @return {!shaka.extern.IAbortableOperation.<
* shaka.net.NetworkingEngine.ResponseAndGotProgress>}
* @private
Expand Down Expand Up @@ -845,27 +845,6 @@ shaka.net.NetworkingEngine.schemes_ = {};
shaka.net.NetworkingEngine.ResponseAndGotProgress;


/**
* @typedef {{
* type: (shaka.net.NetworkingEngine.AdvancedRequestType|undefined),
* stream: (shaka.extern.Stream|undefined),
* segment: (shaka.media.SegmentReference|undefined)
* }}
*
* @description
* Defines contextual data about a request
*
* @property {shaka.net.NetworkingEngine.AdvancedRequestType=} type
* The advanced type
* @property {shaka.extern.Stream=} stream
* The duration of the segment in seconds
* @property {shaka.media.SegmentReference=} segment
* The request's segment reference
* @export
*/
shaka.net.NetworkingEngine.RequestContext;


/**
* @typedef {function(
* !Object.<string, string>,
Expand Down Expand Up @@ -899,7 +878,7 @@ shaka.net.NetworkingEngine.OnDownloadFailed;
* @typedef {function(
* !shaka.net.NetworkingEngine.RequestType,
* !shaka.extern.Request,
* (shaka.net.NetworkingEngine.RequestContext|undefined))}
* (shaka.extern.RequestContext|undefined))}
*
* @description
* A callback function called on every request
Expand Down
8 changes: 4 additions & 4 deletions lib/util/cmcd_manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ shaka.util.CmcdManager = class {
* The request type
* @param {!shaka.extern.Request} request
* The request to apply CMCD data to
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* The request context
*/
applyData(type, request, context = {}) {
Expand Down Expand Up @@ -123,7 +123,7 @@ shaka.util.CmcdManager = class {
*
* @param {!shaka.extern.Request} request
* The request to apply CMCD data to
* @param {shaka.net.NetworkingEngine.RequestContext} context
* @param {shaka.extern.RequestContext} context
* The request context
*/
applyManifestData(request, context) {
Expand All @@ -150,7 +150,7 @@ shaka.util.CmcdManager = class {
* Apply CMCD data to a segment request
*
* @param {!shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext} context
* @param {shaka.extern.RequestContext} context
* The request context
*/
applySegmentData(request, context) {
Expand Down Expand Up @@ -349,7 +349,7 @@ shaka.util.CmcdManager = class {
/**
* The CMCD object type.
*
* @param {shaka.net.NetworkingEngine.RequestContext} context
* @param {shaka.extern.RequestContext} context
* The request context
* @private
*/
Expand Down
12 changes: 6 additions & 6 deletions lib/util/fairplay_utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @export
*/
static verimatrixFairPlayRequest(type, request, context) {
Expand All @@ -252,7 +252,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @private
*/
static octetStreamFairPlayRequest_(type, request, context) {
Expand All @@ -267,7 +267,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @export
*/
static ezdrmFairPlayRequest(type, request, context) {
Expand All @@ -279,7 +279,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @export
*/
static conaxFairPlayRequest(type, request, context) {
Expand All @@ -291,7 +291,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Request} request
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @export
*/
static expressplayFairPlayRequest(type, request, context) {
Expand All @@ -303,7 +303,7 @@ shaka.util.FairPlayUtils = class {
*
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.extern.Response} response
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
* @export
*/
static commonFairPlayResponse(type, response, context) {
Expand Down
8 changes: 4 additions & 4 deletions test/test/util/fake_networking_engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ shaka.test.FakeNetworkingEngine = class {
*
* @param {string} uri
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
*/
expectRequest(uri, type, context) {
shaka.test.FakeNetworkingEngine.expectRequest(
Expand All @@ -186,7 +186,7 @@ shaka.test.FakeNetworkingEngine = class {
*
* @param {string} uri
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
*/
expectNoRequest(uri, type, context) {
shaka.test.FakeNetworkingEngine.expectNoRequest(
Expand Down Expand Up @@ -294,7 +294,7 @@ shaka.test.FakeNetworkingEngine = class {
* @param {!Object} requestSpy
* @param {string} uri
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
*/
static expectRequest(requestSpy, uri, type, context) {
// Jasmine "toHaveBeenCalledWith" doesn't handle optional parameters well.
Expand All @@ -314,7 +314,7 @@ shaka.test.FakeNetworkingEngine = class {
* @param {!Object} requestSpy
* @param {string} uri
* @param {shaka.net.NetworkingEngine.RequestType} type
* @param {shaka.net.NetworkingEngine.RequestContext=} context
* @param {shaka.extern.RequestContext=} context
*/
static expectNoRequest(requestSpy, uri, type, context) {
// Jasmine "toHaveBeenCalledWith" doesn't handle optional parameters well.
Expand Down

0 comments on commit 93baba2

Please sign in to comment.