Skip to content

Commit 72eb645

Browse files
committed
Bug 1631234 - Part 2: Moving the setting of the 'HasStoragePermission' before the first check of the storage access in nsGlobalWindowOuter::SetNewDocument(). r=baku
Because we would check the storage access permission inside nsGlobalWindowInner::ExecutionReady(), so we need to set the 'HasStoragePermission' flag before we call it in nsGlobalWindowOuter::SetNewDocument(). In addition, we check the assertion in the ClientSource::WindowExecutionReady() back to a diagnostic assertion. Depends on D71564 Differential Revision: https://phabricator.services.mozilla.com/D71565 UltraBlame original commit: a002677cd9953037c569062b1cbe72cbb773e43e
1 parent 9c6e65c commit 72eb645

File tree

2 files changed

+15
-15
lines changed

2 files changed

+15
-15
lines changed

dom/base/nsGlobalWindowOuter.cpp

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2406,23 +2406,26 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
24062406

24072407

24082408
newInnerWindow->ClearDocumentDependentSlots(cx);
2409-
2410-
2411-
2412-
rv = newInnerWindow->ExecutionReady();
2413-
NS_ENSURE_SUCCESS(rv, rv);
24142409
} else {
24152410
newInnerWindow->InitDocumentDependentState(cx);
24162411

24172412

24182413
JS::Rooted<JSObject*> obj(cx, newInnerGlobal);
24192414
rv = kungFuDeathGrip->InitClasses(obj);
24202415
NS_ENSURE_SUCCESS(rv, rv);
2421-
2422-
rv = newInnerWindow->ExecutionReady();
2423-
NS_ENSURE_SUCCESS(rv, rv);
24242416
}
24252417

2418+
2419+
2420+
newInnerWindow->GetWindowGlobalChild()
2421+
->WindowContext()
2422+
->SetHasStoragePermission(aDocument->HasStoragePermission());
2423+
2424+
2425+
2426+
rv = newInnerWindow->ExecutionReady();
2427+
NS_ENSURE_SUCCESS(rv, rv);
2428+
24262429
if (mArguments) {
24272430
newInnerWindow->DefineArgumentsProperty(mArguments);
24282431
mArguments = nullptr;
@@ -2513,10 +2516,6 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
25132516
newInnerWindow->GetWindowGlobalChild()
25142517
->WindowContext()
25152518
->SetCookieJarSettings(Some(cookieJarSettings));
2516-
2517-
newInnerWindow->GetWindowGlobalChild()
2518-
->WindowContext()
2519-
->SetHasStoragePermission(aDocument->HasStoragePermission());
25202519
}
25212520

25222521
mHasStorageAccess = false;

dom/clients/manager/ClientSource.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -262,9 +262,10 @@ nsresult ClientSource::WindowExecutionReady(nsPIDOMWindowInner* aInnerWindow) {
262262

263263

264264
if (mController.isSome()) {
265-
MOZ_ASSERT(spec.LowerCaseEqualsLiteral("about:blank") ||
266-
StringBeginsWith(spec, NS_LITERAL_CSTRING("blob:")) ||
267-
StorageAllowedForWindow(aInnerWindow) == StorageAccess::eAllow);
265+
MOZ_DIAGNOSTIC_ASSERT(spec.LowerCaseEqualsLiteral("about:blank") ||
266+
StringBeginsWith(spec, NS_LITERAL_CSTRING("blob:")) ||
267+
StorageAllowedForWindow(aInnerWindow) ==
268+
StorageAccess::eAllow);
268269
}
269270

270271
nsPIDOMWindowOuter* outer = aInnerWindow->GetOuterWindow();

0 commit comments

Comments
 (0)