Skip to content

Commit

Permalink
Update navigator test to include storage.quota
Browse files Browse the repository at this point in the history
  • Loading branch information
kkapsner committed Mar 30, 2024
1 parent 87790c9 commit 36b54f3
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 15 additions & 2 deletions test/navigatorTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,28 @@ function processNavigatorObject(navigator, keys, name){
});
}

iframeAPI.forEachMethod(function(windowToUse, name){
iframeAPI.forEachMethod(async function(windowToUse, name){
"use strict";

const navigator = windowToUse.navigator;
processNavigatorObject(navigator, Object.keys(navigator.__proto__), name);
const values = {};
const keys = Object.keys(navigator.__proto__);
keys.forEach(function(property){
const value = navigator[property];
if ((typeof value) === "string"){
values[property] = value;
}
});
const storage = await navigator.storage.estimate();
values.storage_quota = storage.quota.toString(10);
keys.push("storage_quota");
console.log(name, values);
processNavigatorObject(values, keys, name);
});

function processWorkerNavigatorObject(data, name){
"use strict";
console.log(name, data);
processNavigatorObject(data.values, Object.keys(data.values), name);
if (data.nestedValues){
processWorkerNavigatorObject(data.nestedValues, "nested " + name);
Expand Down
4 changes: 3 additions & 1 deletion test/navigatorTestWorker.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(function(){
(async function(){
"use strict";

const values = {};
Expand All @@ -10,6 +10,8 @@
values[property] = value;
}
});
const storage = await navigator.storage.estimate();
values.storage_quota = storage.quota.toString(10);

const ports = [];
const sources = [];
Expand Down

0 comments on commit 36b54f3

Please sign in to comment.