browser_content_sandbox_fs.js (1888B)
1 /* Any copyright is dedicated to the Public Domain. 2 * http://creativecommons.org/publicdomain/zero/1.0/ */ 3 /* import-globals-from browser_content_sandbox_utils.js */ 4 "use strict"; 5 6 Services.scriptloader.loadSubScript( 7 "chrome://mochitests/content/browser/" + 8 "security/sandbox/test/browser_content_sandbox_utils.js", 9 this 10 ); 11 12 Services.scriptloader.loadSubScript( 13 "chrome://mochitests/content/browser/" + 14 "security/sandbox/test/browser_content_sandbox_fs_tests.js", 15 this 16 ); 17 18 /* 19 * This test exercises file I/O from web and file content processes using 20 * nsIFile etc. methods to validate that calls that are meant to be blocked by 21 * content sandboxing are blocked. 22 */ 23 24 // 25 // Checks that sandboxing is enabled and at the appropriate level 26 // setting before triggering tests that do the file I/O. 27 // 28 // Tests attempting to write to a file in the home directory from the 29 // content process--expected to fail. 30 // 31 // Tests attempting to write to a file in the content temp directory 32 // from the content process--expected to succeed. Uses "ContentTmpD". 33 // 34 // Tests reading various files and directories from file and web 35 // content processes. 36 // 37 add_task(async function () { 38 sanityChecks(); 39 40 // Test creating a file in the home directory from a web content process 41 add_task(createFileInHome); // eslint-disable-line no-undef 42 43 // Test creating a file content temp from a web content process 44 add_task(createTempFile); // eslint-disable-line no-undef 45 46 // Test reading files/dirs from web and file content processes 47 add_task(testFileAccessAllPlatforms); // eslint-disable-line no-undef 48 49 add_task(testFileAccessMacOnly); // eslint-disable-line no-undef 50 51 add_task(testFileAccessLinuxOnly); // eslint-disable-line no-undef 52 53 add_task(testFileAccessWindowsOnly); // eslint-disable-line no-undef 54 55 add_task(cleanupBrowserTabs); // eslint-disable-line no-undef 56 });