diff options
Diffstat (limited to 'dom/indexedDB/test/unit/test_URLSearchParams.js')
-rw-r--r-- | dom/indexedDB/test/unit/test_URLSearchParams.js | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/dom/indexedDB/test/unit/test_URLSearchParams.js b/dom/indexedDB/test/unit/test_URLSearchParams.js new file mode 100644 index 0000000000..9227898963 --- /dev/null +++ b/dom/indexedDB/test/unit/test_URLSearchParams.js @@ -0,0 +1,51 @@ +/* + Any copyright is dedicated to the Public Domain. + http://creativecommons.org/publicdomain/zero/1.0/ +*/ + +/* exported testSteps */ +async function testSteps() { + const name = "URLSearchParams"; + const options = { foo: "bar", baz: "bar" }; + const params = new URLSearchParams(options); + const value = { urlSearchParams: params }; + const key = 42; + + info("Clearing"); + + let request = clearAllDatabases(); + await requestFinished(request); + + info("Installing package"); + + // The profile contains an IndexedDB database containing URLSearchParams. + // The file make_URLSearchParams.js was run locally, specifically it was + // temporarily enabled in xpcshell-parent-process.toml and then executed: + // mach test --interactive dom/indexedDB/test/unit/make_URLSearchParams.js + installPackagedProfile("URLSearchParams_profile"); + + info("Opening database"); + + request = indexedDB.open(name); + await requestSucceeded(request); + + const database = request.result; + + info("Getting value"); + + request = database.transaction([name]).objectStore(name).get(key); + await requestSucceeded(request); + + info("Verifying value"); + + Assert.deepEqual(request.result, value, "Value is correctly structured"); + + ok( + request.result.urlSearchParams instanceof URLSearchParams, + "Value urlSearchParams property is an instance of URLSearchParams" + ); + + info("Closing database"); + + database.close(); +} |