test_ext_tabs_autoDiscardable.html (1376B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>autoDiscardable test</title> 6 <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 7 <script type="text/javascript" src="/tests/SimpleTest/ExtensionTestUtils.js"></script> 8 <script type="text/javascript" src="head.js"></script> 9 <link rel="stylesheet" href="/tests/SimpleTest/test.css"/> 10 </head> 11 <body> 12 13 <script type="text/javascript"> 14 "use strict"; 15 16 add_task(async function() { 17 const extension = ExtensionTestUtils.loadExtension({ 18 async background() { 19 const tab = await browser.tabs.create({}); 20 browser.test.assertTrue(tab.autoDiscardable, "autoDiscardable should be true on Android"); 21 browser.test.assertThrows(() => browser.tabs.query({ autoDiscardable: true }), 22 /Unexpected property "autoDiscardable"/, 23 `tabs.query with autoDiscardable should error out on Android`); 24 browser.test.assertThrows(() => browser.tabs.update(tab.id, { autoDiscardable: true }), 25 /Unexpected property "autoDiscardable"/, 26 `tabs.update with autoDiscardable should error out on Android`); 27 await browser.tabs.remove(tab.id); // Cleanup 28 browser.test.notifyPass("tabs.autoDiscardable"); 29 }, 30 }); 31 32 await extension.startup(); 33 await extension.awaitFinish("tabs.autoDiscardable"); 34 await extension.unload(); 35 }); 36 </script> 37 38 </body> 39 </html>