browser_test_clobbered_property.js (931B)
1 "use strict"; 2 3 const TEST_PATH = 4 getRootDirectory(gTestPath).replace( 5 "chrome://mochitests/content/", 6 "https://example.com/" 7 ) + "file_clobbered_property.html"; 8 9 add_task(async function test_clobbered_properties() { 10 Services.fog.testResetFOG(); 11 12 const tab = await BrowserTestUtils.openNewForegroundTab(gBrowser, TEST_PATH); 13 BrowserTestUtils.removeTab(tab); 14 15 ok(true, "before wait"); 16 17 let result = await TestUtils.waitForCondition(() => 18 Glean.security.shadowedHtmlDocumentPropertyAccess.testGetValue() 19 ); 20 21 is(result.length, 3, "Got three HTMLDocument metrics"); 22 23 let names = result.map(entry => entry.extra.name); 24 ok( 25 names.includes("currentScript"), 26 "Clobbering of 'currentScript' was collected" 27 ); 28 ok( 29 names.includes("onreadystatechange"), 30 "Clobbering of 'onreadystatechange' was collected" 31 ); 32 ok(names.includes("hasFocus"), "Clobbering of 'hasFocus' was collected"); 33 });