@@ -224,7 +224,6 @@ describe('Runtime checks: should allow element modification', () => {
224
224
}
225
225
}
226
226
} )
227
- // And now with a script that will execute
228
227
const scriptResult4 = await page . evaluate (
229
228
( ) => {
230
229
function getAttributeValues ( el ) {
@@ -295,4 +294,34 @@ describe('Runtime checks: should allow element modification', () => {
295
294
nodeAndFakeNodeMatch : false
296
295
} )
297
296
} )
297
+
298
+ it ( 'Script that should filter props and attributes' , async ( ) => {
299
+ const port = server . address ( ) . port
300
+ const page = await browser . newPage ( )
301
+ await gotoAndWait ( page , `http://localhost:${ port } /blank.html` , {
302
+ site : {
303
+ enabledFeatures : [ 'runtimeChecks' ]
304
+ } ,
305
+ featureSettings : {
306
+ runtimeChecks : {
307
+ taintCheck : 'enabled' ,
308
+ matchAllDomains : 'enabled' ,
309
+ matchAllStackDomains : 'enabled' ,
310
+ overloadInstanceOf : 'enabled'
311
+ }
312
+ }
313
+ } )
314
+ const scriptResult5 = await page . evaluate (
315
+ ( ) => {
316
+ // @ts -expect-error Undefined property for testing
317
+ window . scripty5Ran = false
318
+ const myScript = document . createElement ( 'script' )
319
+ myScript . innerText = 'window.scripty5Ran = true'
320
+ Object . setPrototypeOf ( myScript , HTMLScriptElement . prototype )
321
+ document . body . appendChild ( myScript )
322
+ // @ts -expect-error Undefined property for testing
323
+ return window . scripty5Ran
324
+ } )
325
+ expect ( scriptResult5 ) . toBe ( true )
326
+ } )
298
327
} )
0 commit comments