@@ -45,7 +45,7 @@ chrome.webRequest.onBeforeSendHeaders.addListener(
4545 [ 'requestHeaders' , chrome . webRequest . OnSendHeadersOptions . EXTRA_HEADERS ] . filter ( Boolean )
4646) ;
4747
48- async function parseClearKey ( body , sendResponse , tab_url ) {
48+ async function parseClearKey ( body , sendResponse , tab_title , tab_url ) {
4949 const clearkey = JSON . parse ( atob ( body ) ) ;
5050
5151 const formatted_keys = clearkey [ "keys" ] . map ( key => ( {
@@ -66,6 +66,7 @@ async function parseClearKey(body, sendResponse, tab_url) {
6666 type : "CLEARKEY" ,
6767 pssh_data : pssh_data ,
6868 keys : formatted_keys ,
69+ title : tab_title ,
6970 url : tab_url ,
7071 timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
7172 manifests : manifests . has ( tab_url ) ? manifests . get ( tab_url ) : [ ]
@@ -117,7 +118,7 @@ async function generateChallenge(body, sendResponse) {
117118 sendResponse ( uint8ArrayToBase64 ( challenge ) ) ;
118119}
119120
120- async function parseLicense ( body , sendResponse , tab_url ) {
121+ async function parseLicense ( body , sendResponse , tab_title , tab_url ) {
121122 const license = base64toUint8Array ( body ) ;
122123 const signed_license_message = SignedMessage . decode ( license ) ;
123124
@@ -144,6 +145,7 @@ async function parseLicense(body, sendResponse, tab_url) {
144145 type : "WIDEVINE" ,
145146 pssh_data : pssh ,
146147 keys : keys ,
148+ title : tab_title ,
147149 url : tab_url ,
148150 timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
149151 manifests : manifests . has ( tab_url ) ? manifests . get ( tab_url ) : [ ]
@@ -196,7 +198,7 @@ async function generateChallengeRemote(body, sendResponse) {
196198 sendResponse ( challenge_b64 ) ;
197199}
198200
199- async function parseLicenseRemote ( body , sendResponse , tab_url ) {
201+ async function parseLicenseRemote ( body , sendResponse , tab_title , tab_url ) {
200202 const license = base64toUint8Array ( body ) ;
201203 const signed_license_message = SignedMessage . decode ( license ) ;
202204
@@ -241,6 +243,7 @@ async function parseLicenseRemote(body, sendResponse, tab_url) {
241243 type : "WIDEVINE" ,
242244 pssh_data : session_id . pssh ,
243245 keys : keys ,
246+ title : tab_title ,
244247 url : tab_url ,
245248 timestamp : Math . floor ( Date . now ( ) / 1000 ) ,
246249 manifests : manifests . has ( tab_url ) ? manifests . get ( tab_url ) : [ ]
@@ -254,6 +257,7 @@ async function parseLicenseRemote(body, sendResponse, tab_url) {
254257
255258chrome . runtime . onMessage . addListener ( ( message , sender , sendResponse ) => {
256259 ( async ( ) => {
260+ const tab_title = sender . tab ? sender . tab . title : '' ;
257261 const tab_url = sender . tab ? sender . tab . url : null ;
258262
259263 switch ( message . type ) {
@@ -291,16 +295,16 @@ chrome.runtime.onMessage.addListener((message, sender, sendResponse) => {
291295 }
292296
293297 try {
294- await parseClearKey ( message . body , sendResponse , tab_url ) ;
298+ await parseClearKey ( message . body , sendResponse , tab_title , tab_url ) ;
295299 return ;
296300 } catch ( e ) {
297301 const device_type = await SettingsManager . getSelectedDeviceType ( ) ;
298302 switch ( device_type ) {
299303 case "WVD" :
300- await parseLicense ( message . body , sendResponse , tab_url ) ;
304+ await parseLicense ( message . body , sendResponse , tab_title , tab_url ) ;
301305 break ;
302306 case "REMOTE" :
303- await parseLicenseRemote ( message . body , sendResponse , tab_url ) ;
307+ await parseLicenseRemote ( message . body , sendResponse , tab_title , tab_url ) ;
304308 break ;
305309 }
306310 return ;
0 commit comments