File tree Expand file tree Collapse file tree 8 files changed +36
-16
lines changed
Expand file tree Collapse file tree 8 files changed +36
-16
lines changed Original file line number Diff line number Diff line change 2020
2121 - name : Set Node.js environment
2222 uses : actions/setup-node@v4
23+ with :
24+ node-version : ' 20'
2325
2426 - name : Install dependencies
2527 run : yarn install
Original file line number Diff line number Diff line change 6262 "@types/lodash" : " ^4.14.195" ,
6363 "@types/node" : " ^20.1.0" ,
6464 "@types/text-encoding" : " ^0.0.36" ,
65- "@types/webextension-polyfill" : " ^0.10.0 " ,
65+ "@types/webextension-polyfill" : " ^0.12.1 " ,
6666 "@types/webpack" : " ^4.41.29" ,
6767 "@typescript-eslint/eslint-plugin" : " ^5.59.11" ,
6868 "@typescript-eslint/parser" : " ^5.59.11" ,
Original file line number Diff line number Diff line change @@ -262,15 +262,19 @@ async function handleMessage(
262262}
263263
264264async function onMessageHandler (
265- message : MessageEvent ,
265+ message : unknown ,
266266 _sender : Runtime . MessageSender
267267) : Promise < number | ZestScriptMessage > {
268268 let val : number | ZestScriptMessage = 2 ;
269269 const items = await Browser . storage . sync . get ( {
270270 zapurl : 'http://zap/' ,
271271 zapkey : 'not set' ,
272272 } ) ;
273- const msg = await handleMessage ( message , items . zapurl , items . zapkey ) ;
273+ const msg = await handleMessage (
274+ message as MessageEvent ,
275+ items . zapurl as string ,
276+ items . zapkey as string
277+ ) ;
274278 if ( ! ( typeof msg === 'boolean' ) ) {
275279 val = msg ;
276280 }
@@ -286,7 +290,11 @@ function cookieChangeHandler(
286290 zapkey : 'not set' ,
287291 } )
288292 . then ( ( items ) => {
289- reportCookies ( changeInfo . cookie , items . zapurl , items . zapkey ) ;
293+ reportCookies (
294+ changeInfo . cookie ,
295+ items . zapurl as string ,
296+ items . zapkey as string
297+ ) ;
290298 } ) ;
291299}
292300
Original file line number Diff line number Diff line change @@ -278,15 +278,23 @@ function injectScript(): Promise<boolean> {
278278
279279injectScript ( ) ;
280280
281+ /* eslint-disable @typescript-eslint/no-explicit-any */
281282Browser . runtime . onMessage . addListener (
282- ( message : MessageEvent , _sender : Runtime . MessageSender ) => {
283+ (
284+ message : any ,
285+ _sender : Runtime . MessageSender ,
286+ _sendResponse : ( response ?: any ) => void
287+ ) => {
283288 if ( message . type === ZAP_START_RECORDING ) {
284289 configureExtension ( ) ;
285290 recorder . recordUserInteractions ( ) ;
286291 recorder . initializationScript ( ) ;
287292 } else if ( message . type === ZAP_STOP_RECORDING ) {
288293 recorder . stopRecordingUserInteractions ( ) ;
289294 }
295+
296+ // Returning `true` keeps the message channel open for async responses
297+ return true ;
290298 }
291299) ;
292300
Original file line number Diff line number Diff line change @@ -54,14 +54,14 @@ function restoreOptions(): void {
5454 } )
5555 . then ( ( items ) => {
5656 ( document . getElementById ( ZAP_URL ) as HTMLInputElement ) . value =
57- items . zapurl ;
57+ items . zapurl as string ;
5858 ( document . getElementById ( ZAP_KEY ) as HTMLInputElement ) . value =
59- items . zapkey ;
59+ items . zapkey as string ;
6060 ( document . getElementById ( ZAP_ENABLE ) as HTMLInputElement ) . checked =
61- items . zapenable ;
61+ items . zapenable as boolean ;
6262 (
6363 document . getElementById ( 'window-close-input' ) as HTMLInputElement
64- ) . checked = items . zapclosewindowhandle ;
64+ ) . checked = items . zapclosewindowhandle as boolean ;
6565 } ) ;
6666}
6767document . addEventListener ( 'DOMContentLoaded' , restoreOptions ) ;
Original file line number Diff line number Diff line change @@ -29,6 +29,7 @@ import {
2929 ZAP_START_RECORDING ,
3030 ZAP_STOP_RECORDING ,
3131} from '../utils/constants' ;
32+ import { ZestScriptMessage } from '../types/zestScript/ZestScript' ;
3233
3334const STOP = i18n . t ( 'stop' ) ;
3435const START = i18n . t ( 'start' ) ;
@@ -97,7 +98,7 @@ async function restoreState(): Promise<void> {
9798 } else {
9899 stoppedAnimation ( ) ;
99100 }
100- scriptNameInput . value = items . zapscriptname ;
101+ scriptNameInput . value = items . zapscriptname as string ;
101102 if ( items . zapclosewindowhandle ) {
102103 done ?. classList . remove ( 'invisible' ) ;
103104 } else {
@@ -189,7 +190,8 @@ async function handleSaveScript(): Promise<void> {
189190 await Browser . runtime . sendMessage ( { type : STOP_RECORDING } ) ;
190191 }
191192 Browser . runtime . sendMessage ( { type : SAVE_ZEST_SCRIPT } ) . then ( ( items ) => {
192- downloadZestScript ( items . script , items . title ) ;
193+ const msg = items as ZestScriptMessage ;
194+ downloadZestScript ( msg . script , msg . title ) ;
193195 } ) ;
194196}
195197
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class ZestScript {
9292 getZestScript ( ) : Promise < ZestScriptMessage > {
9393 return new Promise ( ( resolve ) => {
9494 Browser . storage . sync . get ( { zapscriptname : this . title } ) . then ( ( items ) => {
95- this . title = items . zapscriptname ;
95+ this . title = items . zapscriptname as string ;
9696 resolve ( { script : this . toJSON ( ) , title : this . title } ) ;
9797 } ) ;
9898 } ) ;
Original file line number Diff line number Diff line change 18851885 dependencies :
18861886 source-map "^0.6.1"
18871887
1888- " @types/webextension-polyfill@^0.10.0 " :
1889- version "0.10.0 "
1890- resolved "https://registry.yarnpkg.com/@types/webextension-polyfill/-/webextension-polyfill-0.10.0 .tgz#e87b5e2c101599779a584cdb043887ad73b37b0e "
1891- integrity sha512-If4EcaHzYTqcbNMp/FdReVdRmLL/Te42ivnJII551bYjhX19bWem5m14FERCqdJA732OloGuxCRvLBvcMGsn4A ==
1888+ " @types/webextension-polyfill@^0.12.1 " :
1889+ version "0.12.1 "
1890+ resolved "https://registry.yarnpkg.com/@types/webextension-polyfill/-/webextension-polyfill-0.12.1 .tgz#8dae244fe094cbb541005362e8e22f16671f6054 "
1891+ integrity sha512-xPTFWwQ8BxPevPF2IKsf4hpZNss4LxaOLZXypQH4E63BDLmcwX/RMGdI4tB4VO4Nb6xDBH3F/p4gz4wvof1o9w ==
18921892
18931893" @types/webextension-polyfill@^0.8.2 " :
18941894 version "0.8.3"
You can’t perform that action at this time.
0 commit comments