Bug 1613431 - Part 2: Ignore synced setters return value. r=nika

Depends on D83645

Differential Revision: https://phabricator.services.mozilla.com/D83646
This commit is contained in:
Andreas Farre 2020-07-31 13:37:00 +00:00
Родитель 336fe46681
Коммит 8d7d0ec85c
11 изменённых файлов: 51 добавлений и 23 удалений

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

@ -1159,11 +1159,13 @@ JSObject* BrowsingContext::ReadStructuredClone(JSContext* aCx,
}
void BrowsingContext::NotifyUserGestureActivation() {
SetUserActivationState(UserActivation::State::FullActivated);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << SetUserActivationState(UserActivation::State::FullActivated);
}
void BrowsingContext::NotifyResetUserGestureActivation() {
SetUserActivationState(UserActivation::State::None);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << SetUserActivationState(UserActivation::State::None);
}
bool BrowsingContext::HasBeenUserGestureActivated() {
@ -1201,7 +1203,9 @@ bool BrowsingContext::ConsumeTransientUserGestureActivation() {
top->PreOrderWalk([&](BrowsingContext* aContext) {
if (aContext->GetUserActivationState() ==
UserActivation::State::FullActivated) {
aContext->SetUserActivationState(UserActivation::State::HasBeenActivated);
// Updating user activation state on a discarded context has no effect.
Unused << aContext->SetUserActivationState(
UserActivation::State::HasBeenActivated);
}
});
@ -2222,7 +2226,8 @@ void BrowsingContext::DidSet(FieldIndex<IDX_DefaultLoadFlags>) {
if (XRE_IsParentProcess()) {
PreOrderWalk([&](BrowsingContext* aContext) {
if (aContext != this) {
aContext->SetDefaultLoadFlags(loadFlags);
// Setting load flags on a discarded context has no effect.
Unused << aContext->SetDefaultLoadFlags(loadFlags);
}
});
}
@ -2428,7 +2433,8 @@ void BrowsingContext::DidSet(FieldIndex<IDX_TextZoom>, float aOldValue) {
}
for (BrowsingContext* child : Children()) {
child->SetTextZoom(GetTextZoom());
// Setting text zoom on a discarded context has no effect.
Unused << child->SetTextZoom(GetTextZoom());
}
}
@ -2458,7 +2464,8 @@ void BrowsingContext::DidSet(FieldIndex<IDX_FullZoom>, float aOldValue) {
}
for (BrowsingContext* child : Children()) {
child->SetFullZoom(GetFullZoom());
// Setting full zoom on a discarded context has no effect.
Unused << child->SetFullZoom(GetFullZoom());
}
}

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

@ -1143,7 +1143,9 @@ void CanonicalBrowsingContext::EndDocumentLoad(bool aForProcessSwitch) {
mCurrentLoad = nullptr;
if (!aForProcessSwitch) {
SetCurrentLoadIdentifier(Nothing());
// Resetting the current load identifier on a discarded context
// has no effect when a document load has finished.
Unused << SetCurrentLoadIdentifier(Nothing());
}
}

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

@ -4555,7 +4555,8 @@ nsDocShell::GetSuspendMediaWhenInactive(bool* aSuspendMediaWhenInactive) {
NS_IMETHODIMP
nsDocShell::SetIsActive(bool aIsActive) {
// Keep track ourselves.
mBrowsingContext->SetIsActive(aIsActive);
// Changing the activeness on a discarded browsing context has no effect.
Unused << mBrowsingContext->SetIsActive(aIsActive);
// Tell the PresShell about it.
if (RefPtr<PresShell> presShell = GetPresShell()) {
@ -4637,7 +4638,8 @@ nsDocShell::GetIsAppTab(bool* aIsAppTab) {
NS_IMETHODIMP
nsDocShell::SetDefaultLoadFlags(uint32_t aDefaultLoadFlags) {
if (!mWillChangeProcess) {
mBrowsingContext->SetDefaultLoadFlags(aDefaultLoadFlags);
// Intentionally ignoring handling discarded browsing contexts.
Unused << mBrowsingContext->SetDefaultLoadFlags(aDefaultLoadFlags);
} else {
// Bug 1623565: DevTools tries to clean up defaultLoadFlags on
// shutdown. Sorry DevTools, your DocShell is in another process.

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

@ -3156,7 +3156,8 @@ nsresult Document::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
if (IsTopLevelContentDocument() && httpChan &&
NS_SUCCEEDED(httpChan->GetCrossOriginOpenerPolicy(&policy)) && docShell &&
docShell->GetBrowsingContext()) {
docShell->GetBrowsingContext()->SetOpenerPolicy(policy);
// Setting the opener policy on a discarded context has no effect.
Unused << docShell->GetBrowsingContext()->SetOpenerPolicy(policy);
}
// The CSP directives upgrade-insecure-requests as well as
@ -11247,7 +11248,9 @@ void Document::NotifyLoading(bool aNewParentIsLoading,
for (auto& child : context->Children()) {
MOZ_LOG(gTimeoutDeferralLog, mozilla::LogLevel::Debug,
("bc: %p SetAncestorLoading(%d)", (void*)child, is_loading));
child->SetAncestorLoading(is_loading);
// Setting ancestor loading on a discarded browsing context has no
// effect.
Unused << child->SetAncestorLoading(is_loading);
}
}
}
@ -15168,7 +15171,9 @@ void Document::ReportHasScrollLinkedEffect() {
void Document::SetSHEntryHasUserInteraction(bool aHasInteraction) {
if (RefPtr<WindowContext> topWc = GetTopLevelWindowContext()) {
topWc->SetSHEntryHasUserInteraction(aHasInteraction);
// Setting has user interction on a discarded browsing context has
// no effect.
Unused << topWc->SetSHEntryHasUserInteraction(aHasInteraction);
}
}

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

@ -1559,7 +1559,9 @@ void nsGlobalWindowInner::UpdateAutoplayPermission() {
if (GetWindowContext()->GetAutoplayPermission() == perm) {
return;
}
GetWindowContext()->SetAutoplayPermission(perm);
// Setting autoplay permission on a discarded context has no effect.
Unused << GetWindowContext()->SetAutoplayPermission(perm);
}
void nsGlobalWindowInner::UpdateShortcutsPermission() {
@ -1583,7 +1585,7 @@ void nsGlobalWindowInner::UpdateShortcutsPermission() {
}
// If the WindowContext is discarded this has no effect.
GetWindowContext()->SetShortcutsPermission(perm);
Unused << GetWindowContext()->SetShortcutsPermission(perm);
}
void nsGlobalWindowInner::InitDocumentDependentState(JSContext* aCx) {
@ -1631,7 +1633,8 @@ void nsGlobalWindowInner::InitDocumentDependentState(JSContext* aCx) {
// previous document.
if (mWindowGlobalChild && GetBrowsingContext() &&
!GetBrowsingContext()->GetParent()) {
GetBrowsingContext()->ResetGVAutoplayRequestStatus();
// Return value of setting synced field should be checked. See bug 1656492.
Unused << GetBrowsingContext()->ResetGVAutoplayRequestStatus();
}
#endif
@ -2618,7 +2621,8 @@ void nsGlobalWindowInner::SetActiveLoadingState(bool aIsLoading) {
gTimeoutLog, mozilla::LogLevel::Debug,
("SetActiveLoadingState innerwindow %p: %d", (void*)this, aIsLoading));
if (GetBrowsingContext()) {
GetBrowsingContext()->SetLoading(aIsLoading);
// Setting loading on a discarded context has no effect.
Unused << GetBrowsingContext()->SetLoading(aIsLoading);
}
if (!nsGlobalWindowInner::Cast(this)->IsChromeWindow()) {

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

@ -211,7 +211,9 @@ static void UpdateDocShellOrientationLock(nsPIDOMWindowInner* aWindow,
if (!bc) {
return;
}
bc->SetOrientationLock(aOrientation);
// Setting orientation lock on a discarded context has no effect.
Unused << bc->SetOrientationLock(aOrientation);
}
bool nsScreen::MozLockOrientation(const nsAString& aOrientation,

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

@ -279,7 +279,8 @@ void HTMLIFrameElement::MaybeStoreCrossOriginFeaturePolicy() {
return;
}
browsingContext->SetFeaturePolicy(mFeaturePolicy);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << browsingContext->SetFeaturePolicy(mFeaturePolicy);
}
already_AddRefed<nsIPrincipal>

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

@ -680,7 +680,8 @@ void ImageDocument::ResetZoomLevel() {
}
if (RefPtr<BrowsingContext> bc = GetBrowsingContext()) {
bc->SetFullZoom(mOriginalZoomLevel);
// Resetting the zoom level on a discarded browsing context has no effect.
Unused << bc->SetFullZoom(mOriginalZoomLevel);
}
}

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

@ -562,7 +562,8 @@ void BrowserChild::NotifyTabContextUpdated() {
// Set SANDBOXED_AUXILIARY_NAVIGATION flag if this is a receiver page.
if (!PresentationURL().IsEmpty()) {
mBrowsingContext->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << mBrowsingContext->SetSandboxFlags(SANDBOXED_AUXILIARY_NAVIGATION);
}
}

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

@ -145,9 +145,11 @@ void GVAutoplayPermissionRequest::SetRequestStatus(RStatus aStatus) {
MOZ_ASSERT(mContext);
AssertIsOnMainThread();
if (mType == RType::eAUDIBLE) {
mContext->SetGVAudibleAutoplayRequestStatus(aStatus);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << mContext->SetGVAudibleAutoplayRequestStatus(aStatus);
} else {
mContext->SetGVInaudibleAutoplayRequestStatus(aStatus);
// Return value of setting synced field should be checked. See bug 1656492.
Unused << mContext->SetGVInaudibleAutoplayRequestStatus(aStatus);
}
}

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

@ -151,7 +151,8 @@ NS_IMETHODIMP ParentProcessDocumentChannel::AsyncOpen(
gHttpHandler->OnOpeningDocumentRequest(this);
if (isDocumentLoad) {
GetDocShell()->GetBrowsingContext()->SetCurrentLoadIdentifier(
// Return value of setting synced field should be checked. See bug 1656492.
Unused << GetDocShell()->GetBrowsingContext()->SetCurrentLoadIdentifier(
Some(mLoadState->GetLoadIdentifier()));
}