test_URLSearchParams.js (1406B)
1 /* 2 Any copyright is dedicated to the Public Domain. 3 http://creativecommons.org/publicdomain/zero/1.0/ 4 */ 5 6 /* exported testSteps */ 7 async function testSteps() { 8 const name = "URLSearchParams"; 9 const options = { foo: "bar", baz: "bar" }; 10 const params = new URLSearchParams(options); 11 const value = { urlSearchParams: params }; 12 const key = 42; 13 14 info("Clearing"); 15 16 let request = clearAllDatabases(); 17 await requestFinished(request); 18 19 info("Installing package"); 20 21 // The profile contains an IndexedDB database containing URLSearchParams. 22 // The file make_URLSearchParams.js was run locally, specifically it was 23 // temporarily enabled in xpcshell-parent-process.toml and then executed: 24 // mach test --interactive dom/indexedDB/test/unit/make_URLSearchParams.js 25 installPackagedProfile("URLSearchParams_profile"); 26 27 info("Opening database"); 28 29 request = indexedDB.open(name); 30 await requestSucceeded(request); 31 32 const database = request.result; 33 34 info("Getting value"); 35 36 request = database.transaction([name]).objectStore(name).get(key); 37 await requestSucceeded(request); 38 39 info("Verifying value"); 40 41 Assert.deepEqual(request.result, value, "Value is correctly structured"); 42 43 ok( 44 request.result.urlSearchParams instanceof URLSearchParams, 45 "Value urlSearchParams property is an instance of URLSearchParams" 46 ); 47 48 info("Closing database"); 49 50 database.close(); 51 }