Bug 1922020, part 8 - Remove reliance on window.opener storage access heuristic in user.js from dom/indexedDB - r=asuth,dom-storage-reviewers

Differential Revision: https://phabricator.services.mozilla.com/D224813
This commit is contained in:
Benjamin VanderSloot 2024-10-31 18:36:30 +00:00
Родитель 5909c1fa93
Коммит 7cd55cf3f2
3 изменённых файлов: 4 добавлений и 4 удалений

Просмотреть файл

@ -253,7 +253,7 @@ function grabFileUsageAndContinueHandler(request) {
function getCurrentUsage(usageHandler) {
let qms = SpecialPowers.Services.qms;
let principal = SpecialPowers.wrap(document).nodePrincipal;
let principal = SpecialPowers.wrap(document).effectiveStoragePrincipal;
let cb = SpecialPowers.wrapCallback(usageHandler);
qms.getUsageForPrincipal(principal, cb);
}

Просмотреть файл

@ -81,7 +81,7 @@ function runInSandbox(sandbox, testFunc) {
}
// Use the window principal for the sandbox; location.origin is not sufficient.
var sb = new SpecialPowers.Cu.Sandbox(window,
var sb = new SpecialPowers.Cu.Sandbox(SpecialPowers.wrap(window.document).effectiveStoragePrincipal,
{ wantGlobalProperties: ["indexedDB"] });
sb.ok = SpecialPowers.Cu.exportFunction(ok, sb);

Просмотреть файл

@ -272,7 +272,7 @@ Result<PrincipalMetadata, nsresult> GetInfoFromWindow(
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
QM_TRY(OkIf(sop), Err(NS_ERROR_FAILURE));
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
nsCOMPtr<nsIPrincipal> principal = sop->GetEffectiveStoragePrincipal();
QM_TRY(OkIf(principal), Err(NS_ERROR_FAILURE));
return GetInfoFromPrincipal(principal);
@ -311,7 +311,7 @@ Result<nsAutoCString, nsresult> GetOriginFromWindow(
nsCOMPtr<nsIScriptObjectPrincipal> sop = do_QueryInterface(aWindow);
QM_TRY(OkIf(sop), Err(NS_ERROR_FAILURE));
nsCOMPtr<nsIPrincipal> principal = sop->GetPrincipal();
nsCOMPtr<nsIPrincipal> principal = sop->GetEffectiveStoragePrincipal();
QM_TRY(OkIf(principal), Err(NS_ERROR_FAILURE));
QM_TRY_RETURN(GetOriginFromPrincipal(principal));