@@ -144,8 +144,8 @@ async function prepareStyles(req) {
144144 [ cached , req . tab ] = ( await all ) . slice ( bgPreInitLen ) ;
145145 __ . DEBUGLOG ( 'prepareStyles cache' , key , cached ) ;
146146 }
147- if ( __ . MV3 && ! cached && bgBusy ) {
148- if ( lock ) unlock ( ) ;
147+ if ( ! cached && bgBusy ) {
148+ if ( lock ) lock = unlock ( ) ; // set to undefined
149149 await bgBusy ;
150150 }
151151 const oldData = toSend [ key ] ;
@@ -162,7 +162,7 @@ async function prepareStyles(req) {
162162}
163163
164164/** @returns {? } falsy = bgPreInit is not locked */
165- async function prepareStylesMV3 ( tabId , frameId , url , data , key , payload , unlockPreInit ) {
165+ async function prepareStylesMV3 ( tabId , frameId , url , data , key , payload , unlock ) {
166166 let blobId ;
167167 for ( const k in toSend ) {
168168 const val = toSend [ k ] ;
@@ -174,9 +174,8 @@ async function prepareStylesMV3(tabId, frameId, url, data, key, payload, unlockP
174174 }
175175 }
176176 if ( ! blobId ) {
177- if ( __ . MV3 && unlockPreInit && clientUrls [ url ] ) {
178- unlockPreInit ( ) ;
179- unlockPreInit = null ;
177+ if ( __ . MV3 && unlock && clientUrls [ url ] ) {
178+ unlock = unlock ( ) ; // set to undefined
180179 }
181180 blobId = ( await API . client . createObjectURL ( makeBlob ( payload ) ) )
182181 . slice ( BLOB_URL_PREFIX . length ) ;
@@ -204,7 +203,7 @@ async function prepareStylesMV3(tabId, frameId, url, data, key, payload, unlockP
204203 responseHeaders : [ { header : kSetCookie , value : cookie , operation : 'append' } ] ,
205204 } ,
206205 } ] ) ;
207- return unlockPreInit ;
206+ return unlock ;
208207}
209208
210209function injectData ( req ) {
0 commit comments