Skip to content

Commit

Permalink
Bug 1875498 - Make URI non-nullable in some WindowGlobal methods. r=nika
Browse files Browse the repository at this point in the history
  • Loading branch information
choller committed Jan 22, 2024
1 parent 68a1b05 commit 0634d90
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion dom/base/Document.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9033,7 +9033,7 @@ void Document::SetDomain(const nsAString& aDomain, ErrorResult& rv) {
MOZ_ALWAYS_SUCCEEDS(NodePrincipal()->SetDomain(newURI));
MOZ_ALWAYS_SUCCEEDS(PartitionedPrincipal()->SetDomain(newURI));
if (WindowGlobalChild* wgc = GetWindowGlobalChild()) {
wgc->SendSetDocumentDomain(newURI);
wgc->SendSetDocumentDomain(WrapNotNull(newURI));
}
}

Expand Down
4 changes: 2 additions & 2 deletions dom/ipc/PWindowGlobal.ipdl
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ parent:
async InternalLoad(nsDocShellLoadState aLoadState);

/// Update the URI of the document in this WindowGlobal.
[LazySend] async UpdateDocumentURI(nullable nsIURI aUri);
[LazySend] async UpdateDocumentURI(nsIURI aUri);

// We expose frameAncestors to web-extensions and they extract URIs from the
// principals collected. In order to be compatible with that API, we need to
Expand Down Expand Up @@ -196,7 +196,7 @@ parent:
*/
async SetSingleChannelId(uint64_t? singleChannelId);

async SetDocumentDomain(nullable nsIURI aDomain);
async SetDocumentDomain(nsIURI aDomain);

async Destroy();

Expand Down
2 changes: 1 addition & 1 deletion dom/ipc/WindowGlobalChild.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,7 @@ void WindowGlobalChild::SetDocumentURI(nsIURI* aDocumentURI) {
}

mDocumentURI = aDocumentURI;
SendUpdateDocumentURI(aDocumentURI);
SendUpdateDocumentURI(WrapNotNull(aDocumentURI));
}

void WindowGlobalChild::SetDocumentPrincipal(
Expand Down
6 changes: 3 additions & 3 deletions dom/ipc/WindowGlobalParent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvInternalLoad(
return IPC_OK();
}

IPCResult WindowGlobalParent::RecvUpdateDocumentURI(nsIURI* aURI) {
IPCResult WindowGlobalParent::RecvUpdateDocumentURI(NotNull<nsIURI*> aURI) {
// XXX(nika): Assert that the URI change was one which makes sense (either
// about:blank -> a real URI, or a legal push/popstate URI change):
if (StaticPrefs::dom_security_setdocumenturi()) {
Expand Down Expand Up @@ -1317,7 +1317,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvSetSingleChannelId(
}

mozilla::ipc::IPCResult WindowGlobalParent::RecvSetDocumentDomain(
nsIURI* aDomain) {
NotNull<nsIURI*> aDomain) {
if (mSandboxFlags & SANDBOXED_DOMAIN) {
// We're sandboxed; disallow setting domain
return IPC_FAIL(this, "Sandbox disallows domain setting.");
Expand All @@ -1335,7 +1335,7 @@ mozilla::ipc::IPCResult WindowGlobalParent::RecvSetDocumentDomain(
}
}

if (!aDomain || !Document::IsValidDomain(uri, aDomain)) {
if (!Document::IsValidDomain(uri, aDomain)) {
// Error: illegal domain
return IPC_FAIL(
this, "Setting domain that's not a suffix of existing domain value.");
Expand Down
4 changes: 2 additions & 2 deletions dom/ipc/WindowGlobalParent.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ class WindowGlobalParent final : public WindowContext,
const MaybeDiscarded<dom::BrowsingContext>& aTargetBC,
nsDocShellLoadState* aLoadState, bool aSetNavigating);
mozilla::ipc::IPCResult RecvInternalLoad(nsDocShellLoadState* aLoadState);
mozilla::ipc::IPCResult RecvUpdateDocumentURI(nsIURI* aURI);
mozilla::ipc::IPCResult RecvUpdateDocumentURI(NotNull<nsIURI*> aURI);
mozilla::ipc::IPCResult RecvUpdateDocumentPrincipal(
nsIPrincipal* aNewDocumentPrincipal,
nsIPrincipal* aNewDocumentStoragePrincipal);
Expand Down Expand Up @@ -312,7 +312,7 @@ class WindowGlobalParent final : public WindowContext,
mozilla::ipc::IPCResult RecvSetSingleChannelId(
const Maybe<uint64_t>& aSingleChannelId);

mozilla::ipc::IPCResult RecvSetDocumentDomain(nsIURI* aDomain);
mozilla::ipc::IPCResult RecvSetDocumentDomain(NotNull<nsIURI*> aDomain);

mozilla::ipc::IPCResult RecvReloadWithHttpsOnlyException();

Expand Down

0 comments on commit 0634d90

Please sign in to comment.