test_ReadHeapSnapshot_with_utf8_paths.js (1064B)
1 /* Any copyright is dedicated to the Public Domain. 2 http://creativecommons.org/publicdomain/zero/1.0/ */ 3 4 // Test that we can read core dumps with a UTF8 path into HeapSnapshot instances. 5 /* eslint-disable strict */ 6 add_task(async function () { 7 const fileNameWithRussianCharacters = 8 "Снимок памяти Click.ru 08.06.2020 (Firefox dump).fxsnapshot"; 9 const filePathWithRussianCharacters = PathUtils.join( 10 PathUtils.tempDir, 11 fileNameWithRussianCharacters 12 ); 13 14 const filePath = ChromeUtils.saveHeapSnapshot({ globals: [this] }); 15 ok(true, "Should be able to save a snapshot."); 16 17 await IOUtils.copy(filePath, filePathWithRussianCharacters); 18 19 ok( 20 await IOUtils.exists(filePathWithRussianCharacters), 21 `We could copy the file to the expected path ${filePathWithRussianCharacters}` 22 ); 23 24 const snapshot = ChromeUtils.readHeapSnapshot(filePathWithRussianCharacters); 25 ok(snapshot, "Should be able to read a heap snapshot from an utf8 path"); 26 ok(HeapSnapshot.isInstance(snapshot), "Should be an instanceof HeapSnapshot"); 27 });