Bug 1613431 - Part 3: Handle synced setters return value. r=nika

Depends on D83646

Differential Revision: https://phabricator.services.mozilla.com/D83647
This commit is contained in:
Andreas Farre 2020-07-31 13:37:13 +00:00
parent 8d7d0ec85c
commit b13577d8e4
23 changed files with 136 additions and 108 deletions

View File

@ -549,7 +549,8 @@ void BrowsingContext::SetEmbedderElement(Element* aEmbedder) {
kNameSpaceID_None, nsGkAtoms::disableglobalhistory);
txn.SetUseGlobalHistory(useGlobalHistory);
}
txn.Commit(this);
MOZ_ALWAYS_SUCCEEDS(txn.Commit(this));
}
mEmbedderElement = aEmbedder;
@ -1276,8 +1277,8 @@ void BrowsingContext::SetUsePrivateBrowsing(bool aUsePrivateBrowsing,
}
void BrowsingContext::SetUseTrackingProtectionWebIDL(
bool aUseTrackingProtection) {
SetForceEnableTrackingProtection(aUseTrackingProtection);
bool aUseTrackingProtection, ErrorResult& aRv) {
SetForceEnableTrackingProtection(aUseTrackingProtection, aRv);
}
void BrowsingContext::GetOriginAttributes(JSContext* aCx,
@ -1427,8 +1428,7 @@ NS_IMETHODIMP BrowsingContext::GetUseTrackingProtection(
NS_IMETHODIMP BrowsingContext::SetUseTrackingProtection(
bool aUseTrackingProtection) {
SetForceEnableTrackingProtection(aUseTrackingProtection);
return NS_OK;
return SetForceEnableTrackingProtection(aUseTrackingProtection);
}
NS_IMETHODIMP BrowsingContext::GetScriptableOriginAttributes(
@ -1712,7 +1712,8 @@ nsresult BrowsingContext::InternalLoad(nsDocShellLoadState* aLoadState) {
MOZ_TRY(CheckSandboxFlags(aLoadState));
if (XRE_IsParentProcess()) {
SetCurrentLoadIdentifier(Some(aLoadState->GetLoadIdentifier()));
MOZ_ALWAYS_SUCCEEDS(
SetCurrentLoadIdentifier(Some(aLoadState->GetLoadIdentifier())));
if (ContentParent* cp = Canonical()->GetContentParent()) {
Unused << cp->SendInternalLoad(this, aLoadState, isActive);
@ -1725,7 +1726,8 @@ nsresult BrowsingContext::InternalLoad(nsDocShellLoadState* aLoadState) {
return NS_ERROR_DOM_PROP_ACCESS_DENIED;
}
SetCurrentLoadIdentifier(Some(aLoadState->GetLoadIdentifier()));
MOZ_ALWAYS_SUCCEEDS(
SetCurrentLoadIdentifier(Some(aLoadState->GetLoadIdentifier())));
nsCOMPtr<nsPIDOMWindowOuter> win(sourceBC->GetDOMWindow());
if (WindowGlobalChild* wgc =
@ -1777,7 +1779,7 @@ void BrowsingContext::Close(CallerType aCallerType, ErrorResult& aError) {
// |window.closed| value as early as possible, so we set this before we
// actually send the DOMWindowClose event, which happens in the process where
// the document for this browsing context is loaded.
SetClosed(true);
MOZ_ALWAYS_SUCCEEDS(SetClosed(true));
if (ContentChild* cc = ContentChild::GetSingleton()) {
cc->SendWindowClose(this, aCallerType == CallerType::System);
@ -2025,12 +2027,15 @@ void BrowsingContext::StartDelayedAutoplayMediaComponents() {
mDocShell->StartDelayedAutoplayMediaComponents();
}
void BrowsingContext::ResetGVAutoplayRequestStatus() {
nsresult BrowsingContext::ResetGVAutoplayRequestStatus() {
MOZ_ASSERT(IsTop(),
"Should only set GVAudibleAutoplayRequestStatus in the top-level "
"browsing context");
SetGVAudibleAutoplayRequestStatus(GVAutoplayRequestStatus::eUNKNOWN);
SetGVInaudibleAutoplayRequestStatus(GVAutoplayRequestStatus::eUNKNOWN);
Transaction txn;
txn.SetGVAudibleAutoplayRequestStatus(GVAutoplayRequestStatus::eUNKNOWN);
txn.SetGVInaudibleAutoplayRequestStatus(GVAutoplayRequestStatus::eUNKNOWN);
return txn.Commit(this);
}
void BrowsingContext::DidSet(FieldIndex<IDX_GVAudibleAutoplayRequestStatus>) {
@ -2101,16 +2106,22 @@ void BrowsingContext::DidSet(FieldIndex<IDX_Muted>) {
});
}
void BrowsingContext::SetAllowContentRetargeting(
nsresult BrowsingContext::SetAllowContentRetargeting(
bool aAllowContentRetargeting) {
Transaction txn;
txn.SetAllowContentRetargeting(aAllowContentRetargeting);
txn.SetAllowContentRetargetingOnChildren(aAllowContentRetargeting);
txn.Commit(this);
return txn.Commit(this);
}
void BrowsingContext::SetCustomUserAgent(const nsAString& aUserAgent) {
Top()->SetUserAgentOverride(aUserAgent);
void BrowsingContext::SetCustomUserAgent(const nsAString& aUserAgent,
ErrorResult& aRv) {
Top()->SetUserAgentOverride(aUserAgent, aRv);
}
nsresult BrowsingContext::SetCustomUserAgent(const nsAString& aUserAgent) {
return Top()->SetUserAgentOverride(aUserAgent);
}
void BrowsingContext::DidSet(FieldIndex<IDX_UserAgentOverride>) {
@ -2124,8 +2135,9 @@ void BrowsingContext::DidSet(FieldIndex<IDX_UserAgentOverride>) {
});
}
void BrowsingContext::SetCustomPlatform(const nsAString& aPlatform) {
Top()->SetPlatformOverride(aPlatform);
void BrowsingContext::SetCustomPlatform(const nsAString& aPlatform,
ErrorResult& aRv) {
Top()->SetPlatformOverride(aPlatform, aRv);
}
void BrowsingContext::DidSet(FieldIndex<IDX_PlatformOverride>) {
@ -2206,7 +2218,7 @@ void BrowsingContext::SetWatchedByDevTools(bool aWatchedByDevTools,
"watchedByDevTools can only be set on top BrowsingContext");
return;
}
SetWatchedByDevToolsInternal(aWatchedByDevTools);
SetWatchedByDevToolsInternal(aWatchedByDevTools, aRv);
}
bool BrowsingContext::CanSet(FieldIndex<IDX_DefaultLoadFlags>,
@ -2496,7 +2508,7 @@ void BrowsingContext::InitSessionHistory() {
MOZ_ASSERT(EverAttached());
if (!GetHasSessionHistory()) {
SetHasSessionHistory(true);
MOZ_ALWAYS_SUCCEEDS(SetHasSessionHistory(true));
}
}

View File

@ -338,7 +338,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void SetOpener(BrowsingContext* aOpener) {
MOZ_DIAGNOSTIC_ASSERT(!aOpener || aOpener->Group() == Group());
MOZ_DIAGNOSTIC_ASSERT(!aOpener || aOpener->mType == mType);
SetOpenerId(aOpener ? aOpener->Id() : 0);
MOZ_ALWAYS_SUCCEEDS(SetOpenerId(aOpener ? aOpener->Id() : 0));
}
bool HasOpener() const;
@ -356,12 +357,15 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
already_AddRefed<BrowsingContext> GetOnePermittedSandboxedNavigator() const {
return Get(GetOnePermittedSandboxedNavigatorId());
}
void SetOnePermittedSandboxedNavigator(BrowsingContext* aNavigator) {
MOZ_MUST_USE nsresult
SetOnePermittedSandboxedNavigator(BrowsingContext* aNavigator) {
if (GetOnePermittedSandboxedNavigatorId()) {
MOZ_ASSERT(false,
"One Permitted Sandboxed Navigator should only be set once.");
return NS_ERROR_FAILURE;
} else {
SetOnePermittedSandboxedNavigatorId(aNavigator ? aNavigator->Id() : 0);
return SetOnePermittedSandboxedNavigatorId(aNavigator ? aNavigator->Id()
: 0);
}
}
@ -398,7 +402,8 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void SetUsePrivateBrowsing(bool aUsePrivateBrowsing, ErrorResult& aError);
// Needs a different name to disambiguate from the xpidl method with
// the same signature but different return value.
void SetUseTrackingProtectionWebIDL(bool aUseTrackingProtection);
void SetUseTrackingProtectionWebIDL(bool aUseTrackingProtection,
ErrorResult& aRv);
bool UseTrackingProtectionWebIDL() { return UseTrackingProtection(); }
void GetOriginAttributes(JSContext* aCx, JS::MutableHandle<JS::Value> aVal,
ErrorResult& aError);
@ -434,24 +439,30 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
}
// ScreenOrientation related APIs
void SetCurrentOrientation(OrientationType aType, float aAngle) {
SetCurrentOrientationType(aType);
SetCurrentOrientationAngle(aAngle);
MOZ_MUST_USE nsresult SetCurrentOrientation(OrientationType aType,
float aAngle) {
Transaction txn;
txn.SetCurrentOrientationType(aType);
txn.SetCurrentOrientationAngle(aAngle);
return txn.Commit(this);
}
void SetRDMPaneOrientation(OrientationType aType, float aAngle) {
void SetRDMPaneOrientation(OrientationType aType, float aAngle,
ErrorResult& aRv) {
if (InRDMPane()) {
SetCurrentOrientation(aType, aAngle);
if (NS_FAILED(SetCurrentOrientation(aType, aAngle))) {
aRv.ThrowInvalidStateError("Browsing context is discarded");
}
}
}
void SetRDMPaneMaxTouchPoints(uint8_t aMaxTouchPoints) {
void SetRDMPaneMaxTouchPoints(uint8_t aMaxTouchPoints, ErrorResult& aRv) {
if (InRDMPane()) {
SetMaxTouchPointsOverride(aMaxTouchPoints);
SetMaxTouchPointsOverride(aMaxTouchPoints, aRv);
}
}
void SetAllowContentRetargeting(bool aAllowContentRetargeting);
nsresult SetAllowContentRetargeting(bool aAllowContentRetargeting);
// Using the rules for choosing a browsing context we try to find
// the browsing context with the given name in the set of
@ -551,12 +562,13 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void GetCustomUserAgent(nsAString& aUserAgent) {
aUserAgent = Top()->GetUserAgentOverride();
}
void SetCustomUserAgent(const nsAString& aUserAgent);
nsresult SetCustomUserAgent(const nsAString& aUserAgent);
void SetCustomUserAgent(const nsAString& aUserAgent, ErrorResult& aRv);
void GetCustomPlatform(nsAString& aPlatform) {
aPlatform = Top()->GetPlatformOverride();
}
void SetCustomPlatform(const nsAString& aPlatform);
void SetCustomPlatform(const nsAString& aPlatform, ErrorResult& aRv);
JSObject* WrapObject(JSContext* aCx);
@ -568,7 +580,7 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
void StartDelayedAutoplayMediaComponents();
void ResetGVAutoplayRequestStatus();
MOZ_MUST_USE nsresult ResetGVAutoplayRequestStatus();
/**
* Information required to initialize a BrowsingContext in another process.

View File

@ -414,10 +414,11 @@ void CanonicalBrowsingContext::NotifyStartDelayedAutoplayMedia() {
});
}
void CanonicalBrowsingContext::NotifyMediaMutedChanged(bool aMuted) {
void CanonicalBrowsingContext::NotifyMediaMutedChanged(bool aMuted,
ErrorResult& aRv) {
MOZ_ASSERT(!GetParent(),
"Notify media mute change on non top-level context!");
SetMuted(aMuted);
SetMuted(aMuted, aRv);
}
uint32_t CanonicalBrowsingContext::CountSiteOrigins(
@ -1135,7 +1136,12 @@ bool CanonicalBrowsingContext::StartDocumentLoad(
mCurrentLoad->Cancel(NS_BINDING_ABORTED);
}
mCurrentLoad = aLoad;
SetCurrentLoadIdentifier(Some(aLoad->GetLoadIdentifier()));
if (NS_FAILED(SetCurrentLoadIdentifier(Some(aLoad->GetLoadIdentifier())))) {
mCurrentLoad = nullptr;
return false;
}
return true;
}

View File

@ -125,7 +125,7 @@ class CanonicalBrowsingContext final : public BrowsingContext {
// This function is used to mute or unmute all media within a tab. It would
// set the media mute property for the top level window and propagate it to
// other top level windows in other processes.
void NotifyMediaMutedChanged(bool aMuted);
void NotifyMediaMutedChanged(bool aMuted, ErrorResult& aRv);
// Return the number of unique site origins by iterating all given BCs,
// including their subtrees.

View File

@ -783,7 +783,8 @@ nsDocShell::LoadURI(nsDocShellLoadState* aLoadState, bool aSetNavigating) {
} else if (aLoadState->LoadFlags() & LOAD_FLAGS_DISABLE_TRR) {
defaultLoadFlags |= nsIRequest::LOAD_TRR_DISABLED_MODE;
}
mBrowsingContext->SetDefaultLoadFlags(defaultLoadFlags);
MOZ_ALWAYS_SUCCEEDS(mBrowsingContext->SetDefaultLoadFlags(defaultLoadFlags));
if (!StartupTimeline::HasRecord(StartupTimeline::FIRST_LOAD_URI) &&
mItemType == typeContent && !NS_IsAboutBlank(aLoadState->URI())) {
@ -1484,9 +1485,8 @@ nsDocShell::GetAllowPlugins(bool* aAllowPlugins) {
NS_IMETHODIMP
nsDocShell::SetAllowPlugins(bool aAllowPlugins) {
mBrowsingContext->SetAllowPlugins(aAllowPlugins);
// XXX should enable or disable a plugin host
return NS_OK;
return mBrowsingContext->SetAllowPlugins(aAllowPlugins);
}
NS_IMETHODIMP
@ -1759,8 +1759,7 @@ nsDocShell::GetAllowContentRetargeting(bool* aAllowContentRetargeting) {
NS_IMETHODIMP
nsDocShell::SetAllowContentRetargeting(bool aAllowContentRetargeting) {
mBrowsingContext->SetAllowContentRetargeting(aAllowContentRetargeting);
return NS_OK;
return mBrowsingContext->SetAllowContentRetargeting(aAllowContentRetargeting);
}
NS_IMETHODIMP
@ -1774,9 +1773,8 @@ nsDocShell::GetAllowContentRetargetingOnChildren(
NS_IMETHODIMP
nsDocShell::SetAllowContentRetargetingOnChildren(
bool aAllowContentRetargetingOnChildren) {
mBrowsingContext->SetAllowContentRetargetingOnChildren(
return mBrowsingContext->SetAllowContentRetargetingOnChildren(
aAllowContentRetargetingOnChildren);
return NS_OK;
}
NS_IMETHODIMP
@ -1926,8 +1924,7 @@ nsDocShell::GetUseErrorPages(bool* aUseErrorPages) {
NS_IMETHODIMP
nsDocShell::SetUseErrorPages(bool aUseErrorPages) {
mBrowsingContext->SetUseErrorPages(aUseErrorPages);
return NS_OK;
return mBrowsingContext->SetUseErrorPages(aUseErrorPages);
}
NS_IMETHODIMP
@ -2172,8 +2169,7 @@ nsDocShell::GetName(nsAString& aName) {
NS_IMETHODIMP
nsDocShell::SetName(const nsAString& aName) {
mBrowsingContext->SetName(aName);
return NS_OK;
return mBrowsingContext->SetName(aName);
}
NS_IMETHODIMP
@ -2196,8 +2192,7 @@ nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent) {
return NS_ERROR_FAILURE;
}
mBrowsingContext->SetCustomUserAgent(aCustomUserAgent);
return NS_OK;
return mBrowsingContext->SetCustomUserAgent(aCustomUserAgent);
}
NS_IMETHODIMP
@ -8905,7 +8900,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState) {
// here because orientation is only set on top-level browsing contexts.
if (mBrowsingContext->GetOrientationLock() != hal::eScreenOrientation_None) {
MOZ_ASSERT(mBrowsingContext->IsTop());
mBrowsingContext->SetOrientationLock(hal::eScreenOrientation_None);
MOZ_ALWAYS_SUCCEEDS(
mBrowsingContext->SetOrientationLock(hal::eScreenOrientation_None));
if (mBrowsingContext->GetIsActive()) {
ScreenOrientation::UpdateActiveOrientationLock(
hal::eScreenOrientation_None);
@ -8959,7 +8955,8 @@ nsresult nsDocShell::InternalLoad(nsDocShellLoadState* aLoadState) {
// We're making history navigation or a reload. Make sure our history ID
// points to the same ID as SHEntry's docshell ID.
aLoadState->SHEntry()->GetDocshellID(mHistoryID);
mBrowsingContext->SetHistoryID(mHistoryID);
MOZ_ALWAYS_SUCCEEDS(mBrowsingContext->SetHistoryID(mHistoryID));
}
}
@ -11074,16 +11071,16 @@ nsresult nsDocShell::AddToSessionHistory(
// user interaction flag.
if (aCloneChildren) {
WindowContext* topWc = mBrowsingContext->GetTopWindowContext();
if (topWc) {
topWc->SetSHEntryHasUserInteraction(false);
if (topWc && !topWc->IsDiscarded()) {
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(false));
}
}
} else {
// This is a subframe, make sure that this new SHEntry will be
// marked with user interaction.
WindowContext* topWc = mBrowsingContext->GetTopWindowContext();
if (topWc) {
topWc->SetSHEntryHasUserInteraction(false);
if (topWc && !topWc->IsDiscarded()) {
MOZ_ALWAYS_SUCCEEDS(topWc->SetSHEntryHasUserInteraction(false));
}
if (!mOSHE || !LOAD_TYPE_HAS_FLAGS(mLoadType, LOAD_FLAGS_REPLACE_HISTORY)) {
rv = AddChildSHEntryToParent(entry, mChildOffset, aCloneChildren);

View File

@ -15287,8 +15287,8 @@ bool Document::ConsumeTransientUserGestureActivation() {
void Document::SetDocTreeHadAudibleMedia() {
RefPtr<WindowContext> topWc = GetTopLevelWindowContext();
if (topWc && !topWc->GetDocTreeHadAudibleMedia()) {
topWc->SetDocTreeHadAudibleMedia(true);
if (topWc && !topWc->IsDiscarded() && !topWc->GetDocTreeHadAudibleMedia()) {
MOZ_ALWAYS_SUCCEEDS(topWc->SetDocTreeHadAudibleMedia(true));
}
}
@ -16283,7 +16283,7 @@ void Document::ReportShadowDOMUsage() {
}
WindowContext* wc = inner->GetWindowContext();
if (NS_WARN_IF(!wc)) {
if (NS_WARN_IF(!wc || wc->IsDiscarded())) {
return;
}
@ -16292,7 +16292,7 @@ void Document::ReportShadowDOMUsage() {
return;
}
topWc->SetHasReportedShadowDOMUsage(true);
MOZ_ALWAYS_SUCCEEDS(topWc->SetHasReportedShadowDOMUsage(true));
}
// static

View File

@ -79,8 +79,8 @@ ScreenOrientation::ScreenOrientation(nsPIDOMWindowInner* aWindow,
Document* doc = GetResponsibleDocument();
BrowsingContext* bc = doc ? doc->GetBrowsingContext() : nullptr;
if (bc && !bc->InRDMPane()) {
bc->SetCurrentOrientation(mType, mAngle);
if (bc && !bc->IsDiscarded() && !bc->InRDMPane()) {
MOZ_ALWAYS_SUCCEEDS(bc->SetCurrentOrientation(mType, mAngle));
}
}
@ -317,7 +317,11 @@ already_AddRefed<Promise> ScreenOrientation::LockInternal(
return nullptr;
}
bc->SetOrientationLock(aOrientation);
bc->SetOrientationLock(aOrientation, aRv);
if (aRv.Failed()) {
return nullptr;
}
AbortInProcessOrientationPromises(bc);
dom::ContentChild::GetSingleton()->SendAbortOtherOrientationPendingPromises(
bc);
@ -523,7 +527,8 @@ void ScreenOrientation::Notify(const hal::ScreenConfiguration& aConfiguration) {
}
if (mType != bc->GetCurrentOrientationType()) {
bc->SetCurrentOrientation(mType, mAngle);
rv = bc->SetCurrentOrientation(mType, mAngle);
NS_WARNING_ASSERTION(NS_SUCCEEDED(rv), "SetCurrentOrientation failed");
nsCOMPtr<nsIRunnable> runnable = DispatchChangeEventAndResolvePromise();
rv = NS_DispatchToMainThread(runnable);
@ -606,8 +611,10 @@ ScreenOrientation::VisibleEventListener::HandleEvent(Event* aEvent) {
BrowsingContext* bc = doc->GetBrowsingContext();
if (bc && bc->GetCurrentOrientationType() !=
orientation->DeviceType(CallerType::System)) {
bc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
orientation->DeviceAngle(CallerType::System));
nsresult result =
bc->SetCurrentOrientation(orientation->DeviceType(CallerType::System),
orientation->DeviceAngle(CallerType::System));
NS_ENSURE_SUCCESS(result, result);
nsCOMPtr<nsIRunnable> runnable =
orientation->DispatchChangeEventAndResolvePromise();

View File

@ -2621,7 +2621,7 @@ bool nsFrameLoader::TryRemoteBrowserInternal() {
nsAutoString frameName;
mOwnerContent->GetAttr(kNameSpaceID_None, nsGkAtoms::name, frameName);
if (nsContentUtils::IsOverridingWindowName(frameName)) {
mPendingBrowsingContext->SetName(frameName);
MOZ_ALWAYS_SUCCEEDS(mPendingBrowsingContext->SetName(frameName));
}
// Allow scripts to close the window if the browser specified so:
if (mOwnerContent->AttrValueIs(kNameSpaceID_None,
@ -2988,7 +2988,7 @@ void nsFrameLoader::ApplySandboxFlags(uint32_t sandboxFlags) {
}
}
context->SetSandboxFlags(sandboxFlags);
MOZ_ALWAYS_SUCCEEDS(context->SetSandboxFlags(sandboxFlags));
}
/* virtual */

View File

@ -2410,7 +2410,7 @@ nsresult nsGlobalWindowOuter::SetNewDocument(Document* aDocument,
// Update the current window for our BrowsingContext.
RefPtr<BrowsingContext> bc = GetBrowsingContext();
bc->SetCurrentInnerWindowId(mInnerWindow->WindowID());
MOZ_ALWAYS_SUCCEEDS(bc->SetCurrentInnerWindowId(mInnerWindow->WindowID()));
// We no longer need the old inner window. Start its destruction if
// its not being reused and clear our reference.
@ -3034,13 +3034,6 @@ bool nsPIDOMWindowOuter::GetAudioMuted() const {
return bc ? bc->Top()->GetMuted() : false;
}
void nsPIDOMWindowOuter::SetAudioMuted(bool aMuted) {
BrowsingContext* bc = GetBrowsingContext();
if (bc) {
bc->Top()->SetMuted(aMuted);
}
}
float nsPIDOMWindowOuter::GetAudioVolume() const { return mAudioVolume; }
nsresult nsPIDOMWindowOuter::SetAudioVolume(float aVolume) {
@ -6139,7 +6132,7 @@ void nsGlobalWindowOuter::FinalClose() {
mIsClosed = true;
if (!mBrowsingContext->IsDiscarded()) {
mBrowsingContext->SetClosed(true);
MOZ_ALWAYS_SUCCEEDS(mBrowsingContext->SetClosed(true));
}
// If we get here from CloseOuter then it means that the parent process is

View File

@ -710,7 +710,6 @@ class nsPIDOMWindowOuter : public mozIDOMWindowProxy {
void SetMediaSuspend(SuspendTypes aSuspend);
bool GetAudioMuted() const;
void SetAudioMuted(bool aMuted);
float GetAudioVolume() const;
nsresult SetAudioVolume(float aVolume);

View File

@ -23,7 +23,7 @@ interface mixin LoadContextMixin {
readonly attribute boolean useRemoteSubframes;
[BinaryName="useTrackingProtectionWebIDL"]
[BinaryName="useTrackingProtectionWebIDL", SetterThrows]
attribute boolean useTrackingProtection;
[NewObject, Throws]
@ -68,9 +68,9 @@ interface BrowsingContext {
readonly attribute WindowContext? topWindowContext;
attribute [TreatNullAs=EmptyString] DOMString customPlatform;
[SetterThrows] attribute [TreatNullAs=EmptyString] DOMString customPlatform;
attribute [TreatNullAs=EmptyString] DOMString customUserAgent;
[SetterThrows] attribute [TreatNullAs=EmptyString] DOMString customUserAgent;
readonly attribute DOMString embedderElementType;
@ -103,11 +103,11 @@ interface BrowsingContext {
// Extension to give chrome JS the ability to set the window screen
// orientation while in RDM.
void setRDMPaneOrientation(OrientationType type, float rotationAngle);
[Throws] void setRDMPaneOrientation(OrientationType type, float rotationAngle);
// Extension to give chrome JS the ability to set a maxTouchPoints override
// while in RDM.
void setRDMPaneMaxTouchPoints(octet maxTouchPoints);
[Throws] void setRDMPaneMaxTouchPoints(octet maxTouchPoints);
// The watchedByDevTools flag indicates whether or not DevTools are currently
// debugging this browsing context.
@ -143,7 +143,7 @@ interface CanonicalBrowsingContext : BrowsingContext {
readonly attribute WindowGlobalParent? embedderWindowGlobal;
void notifyStartDelayedAutoplayMedia();
void notifyMediaMutedChanged(boolean muted);
[Throws] void notifyMediaMutedChanged(boolean muted);
readonly attribute nsISecureBrowserUI? secureBrowserUI;

View File

@ -123,7 +123,7 @@ nsresult HTMLEmbedElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
if (aNamespaceID == kNameSpaceID_None &&
aName == nsGkAtoms::allowfullscreen && mFrameLoader) {
if (auto* bc = mFrameLoader->GetExtantBrowsingContext()) {
bc->SetFullscreenAllowedByOwner(AllowFullscreen());
MOZ_ALWAYS_SUCCEEDS(bc->SetFullscreenAllowedByOwner(AllowFullscreen()));
}
}

View File

@ -187,8 +187,8 @@ nsresult HTMLIFrameElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
aName == nsGkAtoms::mozallowfullscreen) {
if (mFrameLoader) {
if (auto* bc = mFrameLoader->GetExtantBrowsingContext()) {
// This can go away once we remove the featurePolicy pref.
bc->SetFullscreenAllowedByOwner(AllowFullscreen());
MOZ_ALWAYS_SUCCEEDS(
bc->SetFullscreenAllowedByOwner(AllowFullscreen()));
}
}
}

View File

@ -293,9 +293,9 @@ void nsGenericHTMLFrameElement::AfterMaybeChangeAttr(
mFrameLoader ? mFrameLoader->GetExtantBrowsingContext() : nullptr;
if (bc) {
if (aValue) {
bc->SetName(aValue->String());
MOZ_ALWAYS_SUCCEEDS(bc->SetName(aValue->String()));
} else {
bc->SetName(EmptyString());
MOZ_ALWAYS_SUCCEEDS(bc->SetName(EmptyString()));
}
}
}

View File

@ -732,7 +732,7 @@ void BrowserParent::ActorDestroy(ActorDestroyReason why) {
// page in that process.
mBrowsingContext->SetOwnerProcessId(
bridge->Manager()->Manager()->ChildID());
mBrowsingContext->SetCurrentInnerWindowId(0);
MOZ_ALWAYS_SUCCEEDS(mBrowsingContext->SetCurrentInnerWindowId(0));
// Tell the browser bridge to show the subframe crashed page.
Unused << bridge->SendSubFrameCrashed();

View File

@ -5102,7 +5102,7 @@ mozilla::ipc::IPCResult ContentParent::CommonCreateWindow(
// If we were passed a name for the window which would override the default,
// we should send it down to the new tab.
if (nsContentUtils::IsOverridingWindowName(aName)) {
newBrowserHost->GetBrowsingContext()->SetName(aName);
MOZ_ALWAYS_SUCCEEDS(newBrowserHost->GetBrowsingContext()->SetName(aName));
}
MOZ_ASSERT(newBrowserHost->GetBrowsingContext()->OriginAttributesRef() ==

View File

@ -235,7 +235,8 @@ void WindowGlobalChild::OnNewDocument(Document* aDocument) {
if (mixedChannel && (mixedChannel == aDocument->GetChannel())) {
txn.SetAllowMixedContent(true);
}
txn.Commit(mWindowContext);
MOZ_ALWAYS_SUCCEEDS(txn.Commit(mWindowContext));
}
/* static */

View File

@ -142,7 +142,8 @@ void WindowGlobalParent::Init() {
// If there is no current window global, assume we're about to become it
// optimistically.
if (!BrowsingContext()->IsDiscarded()) {
BrowsingContext()->SetCurrentInnerWindowId(InnerWindowId());
MOZ_ALWAYS_SUCCEEDS(
BrowsingContext()->SetCurrentInnerWindowId(InnerWindowId()));
}
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();

View File

@ -186,7 +186,7 @@ nsresult XULFrameElement::AfterSetAttr(int32_t aNamespaceID, nsAtom* aName,
LoadSrc();
} else if (aName == nsGkAtoms::disablefullscreen && mFrameLoader) {
if (auto* bc = mFrameLoader->GetExtantBrowsingContext()) {
bc->SetFullscreenAllowedByOwner(!aValue);
MOZ_ALWAYS_SUCCEEDS(bc->SetFullscreenAllowedByOwner(!aValue));
}
}
}

View File

@ -184,7 +184,8 @@ nsresult nsEditingSession::DisableJSAndPlugins(nsIDocShell& aDocShell) {
// Disable plugins in this document:
mPluginsEnabled = aDocShell.PluginsAllowedInCurrentDoc();
aDocShell.GetBrowsingContext()->SetAllowPlugins(false);
rv = aDocShell.GetBrowsingContext()->SetAllowPlugins(false);
NS_ENSURE_SUCCESS(rv, rv);
mDisabledJSAndPlugins = true;
@ -211,9 +212,8 @@ nsresult nsEditingSession::RestoreJSAndPlugins(nsPIDOMWindowOuter* aWindow) {
// Disable plugins in this document:
auto* browsingContext = aWindow->GetBrowsingContext();
NS_ENSURE_TRUE(browsingContext, NS_ERROR_FAILURE);
browsingContext->SetAllowPlugins(mPluginsEnabled);
return NS_OK;
return browsingContext->SetAllowPlugins(mPluginsEnabled);
}
/*---------------------------------------------------------------------------

View File

@ -305,7 +305,7 @@ void PermissionDelegateHandler::PopulateAllDelegatedPermissions() {
}
RefPtr<WindowContext> wc = mDocument->GetWindowContext();
NS_ENSURE_TRUE_VOID(wc);
NS_ENSURE_TRUE_VOID(wc && !wc->IsDiscarded());
DelegatedPermissionList list;
DelegatedPermissionList exactHostMatchList;
@ -330,7 +330,7 @@ void PermissionDelegateHandler::PopulateAllDelegatedPermissions() {
WindowContext::Transaction txn;
txn.SetDelegatedPermissions(list);
txn.SetDelegatedExactHostMatchPermissions(exactHostMatchList);
txn.Commit(wc);
MOZ_ALWAYS_SUCCEEDS(txn.Commit(wc));
}
void PermissionDelegateHandler::UpdateDelegatedPermission(
@ -374,7 +374,7 @@ void PermissionDelegateHandler::UpdateDelegatedPermission(
// We only commit if there is any change of permissions.
if (changed) {
txn.Commit(wc);
MOZ_ALWAYS_SUCCEEDS(txn.Commit(wc));
}
}

View File

@ -132,8 +132,8 @@ DocumentChannelChild::AsyncOpen(nsIStreamListener* aListener) {
switch (mLoadInfo->GetExternalContentPolicyType()) {
case nsIContentPolicy::TYPE_DOCUMENT:
case nsIContentPolicy::TYPE_SUBDOCUMENT:
loadingContext->SetCurrentLoadIdentifier(
Some(mLoadState->GetLoadIdentifier()));
MOZ_ALWAYS_SUCCEEDS(loadingContext->SetCurrentLoadIdentifier(
Some(mLoadState->GetLoadIdentifier())));
break;
default:

View File

@ -967,7 +967,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
// If our parent is sandboxed, set it as the one permitted sandboxed navigator
// on the new window we're opening.
if (activeDocsSandboxFlags && parentBC) {
newBC->SetOnePermittedSandboxedNavigator(parentBC);
MOZ_ALWAYS_SUCCEEDS(newBC->SetOnePermittedSandboxedNavigator(parentBC));
}
if (!aForceNoOpener && parentBC) {
@ -998,7 +998,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
if (activeDocsSandboxFlags &
SANDBOX_PROPAGATES_TO_AUXILIARY_BROWSING_CONTEXTS) {
MOZ_ASSERT(windowIsNew, "Should only get here for new windows");
newBC->SetSandboxFlags(activeDocsSandboxFlags);
MOZ_ALWAYS_SUCCEEDS(newBC->SetSandboxFlags(activeDocsSandboxFlags));
}
RefPtr<nsGlobalWindowOuter> win(
@ -1043,9 +1043,9 @@ nsresult nsWindowWatcher::OpenWindowInternal(
is not a window name. */
if (windowNeedsName) {
if (nameSpecified && !name.LowerCaseEqualsLiteral("_blank")) {
newBC->SetName(name);
MOZ_ALWAYS_SUCCEEDS(newBC->SetName(name));
} else {
newBC->SetName(EmptyString());
MOZ_ALWAYS_SUCCEEDS(newBC->SetName(EmptyString()));
}
}
@ -1123,7 +1123,7 @@ nsresult nsWindowWatcher::OpenWindowInternal(
// Make sure we don't mess up our counter even if the above assert
// fails.
if (!newBC->GetIsPopupSpam()) {
newBC->SetIsPopupSpam(true);
MOZ_ALWAYS_SUCCEEDS(newBC->SetIsPopupSpam(true));
}
}
}