# HG changeset patch # User Boris Zbarsky # Date 1517512874 18000 # Thu Feb 01 14:21:14 2018 -0500 # Node ID a3d5547b0b7f7aa9a3e5eaed7b3151cadff42334 # Parent 729abe46846dd59473b06caa9c114f3c6cc02757 Bug 1434686 part 4. Use IgnoreErrors() in dom/. r=mystor MozReview-Commit-ID: GwVDrTLPTOb diff --git a/dom/base/CustomElementRegistry.cpp b/dom/base/CustomElementRegistry.cpp --- a/dom/base/CustomElementRegistry.cpp +++ b/dom/base/CustomElementRegistry.cpp @@ -67,31 +67,30 @@ class CustomElementCallbackReaction fina }; //----------------------------------------------------- // CustomElementCallback void CustomElementCallback::Call() { - IgnoredErrorResult rv; switch (mType) { case nsIDocument::eConnected: - static_cast(mCallback.get())->Call(mThisObject, rv); + static_cast(mCallback.get())->Call(mThisObject); break; case nsIDocument::eDisconnected: - static_cast(mCallback.get())->Call(mThisObject, rv); + static_cast(mCallback.get())->Call(mThisObject); break; case nsIDocument::eAdopted: static_cast(mCallback.get())->Call(mThisObject, - mAdoptedCallbackArgs.mOldDocument, mAdoptedCallbackArgs.mNewDocument, rv); + mAdoptedCallbackArgs.mOldDocument, mAdoptedCallbackArgs.mNewDocument); break; case nsIDocument::eAttributeChanged: static_cast(mCallback.get())->Call(mThisObject, - mArgs.name, mArgs.oldValue, mArgs.newValue, mArgs.namespaceURI, rv); + mArgs.name, mArgs.oldValue, mArgs.newValue, mArgs.namespaceURI); break; } } void CustomElementCallback::Traverse(nsCycleCollectionTraversalCallback& aCb) const { NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(aCb, "mThisObject"); diff --git a/dom/base/Navigator.cpp.1434686.later b/dom/base/Navigator.cpp.1434686.later new file mode 100644 --- /dev/null +++ b/dom/base/Navigator.cpp.1434686.later @@ -0,0 +1,22 @@ +--- Navigator.cpp ++++ Navigator.cpp +@@ -1474,18 +1474,17 @@ Navigator::RequestVRPresentation(VRDispl + { + nsGlobalWindowInner* win = nsGlobalWindowInner::Cast(mWindow); + win->DispatchVRDisplayActivate(aDisplay.DisplayId(), VRDisplayEventReason::Requested); + } + + nsINetworkProperties* + Navigator::GetNetworkProperties() + { +- IgnoredErrorResult rv; +- return GetConnection(rv); ++ return GetConnection(IgnoreErrors()); + } + + network::Connection* + Navigator::GetConnection(ErrorResult& aRv) + { + if (!mConnection) { + if (!mWindow) { + aRv.Throw(NS_ERROR_UNEXPECTED); diff --git a/dom/base/nsContentAreaDragDrop.cpp b/dom/base/nsContentAreaDragDrop.cpp --- a/dom/base/nsContentAreaDragDrop.cpp +++ b/dom/base/nsContentAreaDragDrop.cpp @@ -55,16 +55,17 @@ #include "nsRange.h" #include "TabParent.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/HTMLAreaElement.h" #include "mozilla/dom/HTMLAnchorElement.h" #include "nsVariant.h" using namespace mozilla::dom; +using mozilla::IgnoreErrors; class MOZ_STACK_CLASS DragDataProducer { public: DragDataProducer(nsPIDOMWindowOuter* aWindow, nsIContent* aTarget, nsIContent* aSelectionTargetNode, bool aIsAltKeyPressed); @@ -348,20 +349,19 @@ DragDataProducer::GetNodeString(nsIConte nsAString & outNodeString) { nsCOMPtr node = inNode; outNodeString.Truncate(); // use a range to get the text-equivalent of the node nsCOMPtr doc = node->OwnerDoc(); - mozilla::IgnoredErrorResult rv; - RefPtr range = doc->CreateRange(rv); + RefPtr range = doc->CreateRange(IgnoreErrors()); if (range) { - range->SelectNode(*node, rv); + range->SelectNode(*node, IgnoreErrors()); range->ToString(outNodeString); } } nsresult DragDataProducer::Produce(DataTransfer* aDataTransfer, bool* aCanDrag, nsISelection** aSelection, diff --git a/dom/base/nsFocusManager.cpp.1434686.later b/dom/base/nsFocusManager.cpp.1434686.later new file mode 100644 --- /dev/null +++ b/dom/base/nsFocusManager.cpp.1434686.later @@ -0,0 +1,35 @@ +--- nsFocusManager.cpp ++++ nsFocusManager.cpp +@@ -2445,29 +2445,25 @@ nsFocusManager::MoveCaretToFocus(nsIPres + RefPtr newRange = doc->CreateRange(rv); + if (NS_WARN_IF(rv.Failed())) { + rv.SuppressException(); + return; + } + + // Set the range to the start of the currently focused node + // Make sure it's collapsed +- { +- IgnoredErrorResult ignored; +- newRange->SelectNodeContents(*aContent, ignored); +- } ++ newRange->SelectNodeContents(*aContent, IgnoreErrors()); + + if (!aContent->GetFirstChild() || + aContent->IsNodeOfType(nsINode::eHTML_FORM_CONTROL)) { + // If current focus node is a leaf, set range to before the + // node by using the parent as a container. + // This prevents it from appearing as selected. +- IgnoredErrorResult err1, err2; +- newRange->SetStartBefore(*aContent, err1); +- newRange->SetEndBefore(*aContent, err2); ++ newRange->SetStartBefore(*aContent, IgnoreErrors()); ++ newRange->SetEndBefore(*aContent, IgnoreErrors()); + } + domSelection->AddRange(newRange); + domSelection->CollapseToStart(); + } + } + } + } + diff --git a/dom/base/nsFrameLoader.cpp.1434686.later b/dom/base/nsFrameLoader.cpp.1434686.later new file mode 100644 --- /dev/null +++ b/dom/base/nsFrameLoader.cpp.1434686.later @@ -0,0 +1,31 @@ +--- nsFrameLoader.cpp ++++ nsFrameLoader.cpp +@@ -904,23 +904,21 @@ nsFrameLoader::Show(int32_t marginWidth, + nsAutoString designMode; + htmlDoc->GetDesignMode(designMode); + + if (designMode.EqualsLiteral("on")) { + // Hold on to the editor object to let the document reattach to the + // same editor object, instead of creating a new one. + RefPtr htmlEditor = mDocShell->GetHTMLEditor(); + Unused << htmlEditor; +- { +- IgnoredErrorResult rv; +- htmlDoc->SetDesignMode(NS_LITERAL_STRING("off"), Nothing(), rv); +- } +- +- IgnoredErrorResult rv; +- htmlDoc->SetDesignMode(NS_LITERAL_STRING("on"), Nothing(), rv); ++ htmlDoc->SetDesignMode(NS_LITERAL_STRING("off"), Nothing(), ++ IgnoreErrors()); ++ ++ htmlDoc->SetDesignMode(NS_LITERAL_STRING("on"), Nothing(), ++ IgnoreErrors()); + } else { + // Re-initialize the presentation for contenteditable documents + bool editable = false, + hasEditingSession = false; + mDocShell->GetEditable(&editable); + mDocShell->GetHasEditingSession(&hasEditingSession); + RefPtr htmlEditor = mDocShell->GetHTMLEditor(); + if (editable && hasEditingSession && htmlEditor) { diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -1226,19 +1226,19 @@ public: mozilla::ErrorResult& aError); void GetContent(JSContext* aCx, JS::MutableHandle aRetval, mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aError); already_AddRefed GetContent() { MOZ_ASSERT(IsOuterWindow()); - mozilla::IgnoredErrorResult ignored; nsCOMPtr win = - GetContentInternal(ignored, mozilla::dom::CallerType::System); + GetContentInternal(mozilla::IgnoreErrors(), + mozilla::dom::CallerType::System); return win.forget(); } void Get_content(JSContext* aCx, JS::MutableHandle aRetval, mozilla::dom::SystemCallerGuarantee aCallerType, mozilla::ErrorResult& aError) { diff --git a/dom/base/nsINode.cpp b/dom/base/nsINode.cpp --- a/dom/base/nsINode.cpp +++ b/dom/base/nsINode.cpp @@ -1899,18 +1899,17 @@ nsINode::ReplaceWith(const Sequence parent = GetParentNode(); if (!parent) { return; } - IgnoredErrorResult err; - parent->RemoveChild(*this, err); + parent->RemoveChild(*this, IgnoreErrors()); } Element* nsINode::GetFirstElementChild() const { for (nsIContent* child = GetFirstChild(); child; child = child->GetNextSibling()) { diff --git a/dom/clients/manager/ClientSource.cpp b/dom/clients/manager/ClientSource.cpp --- a/dom/clients/manager/ClientSource.cpp +++ b/dom/clients/manager/ClientSource.cpp @@ -403,18 +403,17 @@ ClientSource::SetController(const Servic if (navigator) { swc = navigator->ServiceWorker(); } } // TODO: Also self.navigator.serviceWorker on workers when its exposed there if (swc && nsContentUtils::IsSafeToRunScript()) { - IgnoredErrorResult ignored; - swc->ControllerChanged(ignored); + swc->ControllerChanged(IgnoreErrors()); } } RefPtr ClientSource::Control(const ClientControlledArgs& aArgs) { NS_ASSERT_OWNINGTHREAD(ClientSource); diff --git a/dom/console/Console.cpp b/dom/console/Console.cpp --- a/dom/console/Console.cpp +++ b/dom/console/Console.cpp @@ -2650,18 +2650,17 @@ Console::MaybeExecuteDumpFunctionForTrac message.AppendLiteral("\n"); ExecuteDumpFunction(message); } void Console::ExecuteDumpFunction(const nsAString& aMessage) { if (mDumpFunction) { - IgnoredErrorResult rv; - mDumpFunction->Call(aMessage, rv); + mDumpFunction->Call(aMessage); return; } NS_ConvertUTF16toUTF8 str(aMessage); MOZ_LOG(nsContentUtils::DOMDumpLog(), LogLevel::Debug, ("%s", str.get())); #ifdef ANDROID __android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", str.get()); #endif diff --git a/dom/events/DOMEventTargetHelper.cpp b/dom/events/DOMEventTargetHelper.cpp --- a/dom/events/DOMEventTargetHelper.cpp +++ b/dom/events/DOMEventTargetHelper.cpp @@ -382,42 +382,40 @@ DOMEventTargetHelper::WantsUntrusted(boo // We can let listeners on workers to always handle all the events. *aRetVal = (doc && !nsContentUtils::IsChromeDoc(doc)) || !NS_IsMainThread(); return rv; } void DOMEventTargetHelper::EventListenerAdded(nsIAtom* aType) { - IgnoredErrorResult rv; - EventListenerWasAdded(Substring(nsDependentAtomString(aType), 2), rv); + EventListenerWasAdded(Substring(nsDependentAtomString(aType), 2), + IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerAdded(const nsAString& aType) { - IgnoredErrorResult rv; - EventListenerWasAdded(aType, rv); + EventListenerWasAdded(aType, IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerRemoved(nsIAtom* aType) { - IgnoredErrorResult rv; - EventListenerWasRemoved(Substring(nsDependentAtomString(aType), 2), rv); + EventListenerWasRemoved(Substring(nsDependentAtomString(aType), 2), + IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::EventListenerRemoved(const nsAString& aType) { - IgnoredErrorResult rv; - EventListenerWasRemoved(aType, rv); + EventListenerWasRemoved(aType, IgnoreErrors()); MaybeUpdateKeepAlive(); } void DOMEventTargetHelper::KeepAliveIfHasListenersFor(const nsAString& aType) { mKeepingAliveTypes.mStrings.AppendElement(aType); MaybeUpdateKeepAlive(); diff --git a/dom/events/DataTransferItemList.cpp b/dom/events/DataTransferItemList.cpp --- a/dom/events/DataTransferItemList.cpp +++ b/dom/events/DataTransferItemList.cpp @@ -573,19 +573,18 @@ DataTransferItemList::GenerateFiles(File uint32_t count = Length(); for (uint32_t i = 0; i < count; i++) { bool found; RefPtr item = IndexedGetter(i, found); MOZ_ASSERT(found); if (item->Kind() == DataTransferItem::KIND_FILE) { - IgnoredErrorResult rv; - RefPtr file = item->GetAsFile(*aFilesPrincipal, rv); - if (NS_WARN_IF(rv.Failed() || !file)) { + RefPtr file = item->GetAsFile(*aFilesPrincipal, IgnoreErrors()); + if (NS_WARN_IF(!file)) { continue; } aFiles->Append(file); } } } } // namespace mozilla diff --git a/dom/fetch/InternalHeaders.cpp b/dom/fetch/InternalHeaders.cpp --- a/dom/fetch/InternalHeaders.cpp +++ b/dom/fetch/InternalHeaders.cpp @@ -343,18 +343,17 @@ public: : mInternalHeaders(aInternalHeaders) { MOZ_DIAGNOSTIC_ASSERT(mInternalHeaders); } NS_IMETHOD VisitHeader(const nsACString& aHeader, const nsACString& aValue) override { - IgnoredErrorResult result; - mInternalHeaders->Append(aHeader, aValue, result); + mInternalHeaders->Append(aHeader, aValue, IgnoreErrors()); return NS_OK; } }; NS_IMPL_ISUPPORTS(FillHeaders, nsIHttpHeaderVisitor) } // namespace diff --git a/dom/html/HTMLButtonElement.cpp b/dom/html/HTMLButtonElement.cpp --- a/dom/html/HTMLButtonElement.cpp +++ b/dom/html/HTMLButtonElement.cpp @@ -458,18 +458,17 @@ HTMLButtonElement::SaveState() return NS_OK; } bool HTMLButtonElement::RestoreState(nsPresState* aState) { if (aState && aState->IsDisabledSet() && !aState->GetDisabled()) { - IgnoredErrorResult rv; - SetDisabled(false, rv); + SetDisabled(false, IgnoreErrors()); } return false; } EventStates HTMLButtonElement::IntrinsicState() const { diff --git a/dom/html/HTMLImageElement.cpp b/dom/html/HTMLImageElement.cpp --- a/dom/html/HTMLImageElement.cpp +++ b/dom/html/HTMLImageElement.cpp @@ -490,18 +490,17 @@ HTMLImageElement::AfterMaybeChangeAttr(i if (InResponsiveMode()) { // per spec, full selection runs when this changes, even though // it doesn't directly affect the source selection QueueImageLoadTask(true); } else if (OwnerDoc()->ShouldLoadImages()) { // Bug 1076583 - We still use the older synchronous algorithm in // non-responsive mode. Force a new load of the image with the // new cross origin policy - IgnoredErrorResult error; - ForceReload(aNotify, error); + ForceReload(aNotify, IgnoreErrors()); } } } nsresult HTMLImageElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) { // We handle image element with attribute ismap in its corresponding frame diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -744,18 +744,17 @@ nsColorPickerShownCallback::UpdateIntern nsAutoString oldValue; if (aTrustedUpdate) { valueChanged = true; } else { mInput->GetValue(oldValue, CallerType::System); } - IgnoredErrorResult rv; - mInput->SetValue(aColor, CallerType::System, rv); + mInput->SetValue(aColor, CallerType::System, IgnoreErrors()); if (!aTrustedUpdate) { nsAutoString newValue; mInput->GetValue(newValue, CallerType::System); if (!oldValue.Equals(newValue)) { valueChanged = true; } } @@ -1903,25 +1902,23 @@ HTMLInputElement::GetList(nsIDOMHTMLElem } void HTMLInputElement::SetValue(Decimal aValue, CallerType aCallerType) { MOZ_ASSERT(!aValue.isInfinity(), "aValue must not be Infinity!"); if (aValue.isNaN()) { - IgnoredErrorResult rv; - SetValue(EmptyString(), aCallerType, rv); + SetValue(EmptyString(), aCallerType, IgnoreErrors()); return; } nsAutoString value; mInputType->ConvertNumberToString(aValue, value); - IgnoredErrorResult rv; - SetValue(value, aCallerType, rv); + SetValue(value, aCallerType, IgnoreErrors()); } Nullable HTMLInputElement::GetValueAsDate(ErrorResult& aRv) { if (!IsDateTimeInputType(mType)) { return Nullable(); } @@ -6685,18 +6682,17 @@ HTMLInputElement::RestoreState(nsPresSta // before the type change.) SetValueInternal(inputState->GetValue(), nsTextEditorState::eSetValue_Notify); break; } } if (aState->IsDisabledSet() && !aState->GetDisabled()) { - IgnoredErrorResult ignored; - SetDisabled(false, ignored); + SetDisabled(false, IgnoreErrors()); } return restoredCheckedState; } bool HTMLInputElement::AllowDrop() { diff --git a/dom/html/HTMLScriptElement.cpp b/dom/html/HTMLScriptElement.cpp --- a/dom/html/HTMLScriptElement.cpp +++ b/dom/html/HTMLScriptElement.cpp @@ -185,18 +185,17 @@ HTMLScriptElement::GetScriptType(nsAStri aType.Assign(type); return true; } void HTMLScriptElement::GetScriptText(nsAString& text) { - IgnoredErrorResult rv; - GetText(text, rv); + GetText(text, IgnoreErrors()); } void HTMLScriptElement::GetScriptCharset(nsAString& charset) { GetCharset(charset); } diff --git a/dom/html/HTMLSelectElement.cpp b/dom/html/HTMLSelectElement.cpp --- a/dom/html/HTMLSelectElement.cpp +++ b/dom/html/HTMLSelectElement.cpp @@ -1439,18 +1439,17 @@ HTMLSelectElement::RestoreState(nsPresSt RestoreStateTo(state); // Don't flush, if the frame doesn't exist yet it doesn't care if // we're reset or not. DispatchContentReset(); } if (aState->IsDisabledSet() && !aState->GetDisabled()) { - IgnoredErrorResult rv; - SetDisabled(false, rv); + SetDisabled(false, IgnoreErrors()); } return false; } void HTMLSelectElement::RestoreStateTo(SelectState* aNewSelected) { diff --git a/dom/html/HTMLTableElement.cpp b/dom/html/HTMLTableElement.cpp --- a/dom/html/HTMLTableElement.cpp +++ b/dom/html/HTMLTableElement.cpp @@ -667,18 +667,17 @@ HTMLTableElement::CreateTHead() if (refNode->IsHTMLElement() && !refNode->IsHTMLElement(nsGkAtoms::caption) && !refNode->IsHTMLElement(nsGkAtoms::colgroup)) { break; } } - IgnoredErrorResult rv; - nsINode::InsertBefore(*head, refNode, rv); + nsINode::InsertBefore(*head, refNode, IgnoreErrors()); } return head.forget(); } void HTMLTableElement::DeleteTHead() { RefPtr tHead = GetTHead(); if (tHead) { mozilla::IgnoredErrorResult rv; @@ -724,19 +723,18 @@ HTMLTableElement::CreateCaption() nsContentUtils::QNameChanged(mNodeInfo, nsGkAtoms::caption, getter_AddRefs(nodeInfo)); caption = NS_NewHTMLTableCaptionElement(nodeInfo.forget()); if (!caption) { return nullptr; } - IgnoredErrorResult rv; nsCOMPtr firsChild = nsINode::GetFirstChild(); - nsINode::InsertBefore(*caption, firsChild, rv); + nsINode::InsertBefore(*caption, firsChild, IgnoreErrors()); } return caption.forget(); } void HTMLTableElement::DeleteCaption() { RefPtr caption = GetCaption(); if (caption) { mozilla::IgnoredErrorResult rv; @@ -762,18 +760,17 @@ HTMLTableElement::CreateTBody() child; child = child->GetPreviousSibling()) { if (child->IsHTMLElement(nsGkAtoms::tbody)) { referenceNode = child->GetNextSibling(); break; } } - IgnoredErrorResult rv; - nsINode::InsertBefore(*newBody, referenceNode, rv); + nsINode::InsertBefore(*newBody, referenceNode, IgnoreErrors()); return newBody.forget(); } already_AddRefed HTMLTableElement::InsertRow(int32_t aIndex, ErrorResult& aError) { /* get the ref row at aIndex diff --git a/dom/html/HTMLTextAreaElement.cpp b/dom/html/HTMLTextAreaElement.cpp --- a/dom/html/HTMLTextAreaElement.cpp +++ b/dom/html/HTMLTextAreaElement.cpp @@ -780,18 +780,17 @@ HTMLTextAreaElement::SetValueFromSetRang nsTextEditorState::eSetValue_ByContent | nsTextEditorState::eSetValue_Notify); } nsresult HTMLTextAreaElement::Reset() { nsAutoString resetVal; - IgnoredErrorResult res; - GetDefaultValue(resetVal, res); + GetDefaultValue(resetVal, IgnoreErrors()); SetValueChanged(false); nsresult rv = SetValueInternal(resetVal, nsTextEditorState::eSetValue_Internal); NS_ENSURE_SUCCESS(rv, rv); return NS_OK; } @@ -882,18 +881,17 @@ HTMLTextAreaElement::RestoreState(nsPres nsAutoString data; state->GetData(data); ErrorResult rv; SetValue(data, rv); ENSURE_SUCCESS(rv, false); } if (aState->IsDisabledSet() && !aState->GetDisabled()) { - IgnoredErrorResult rv; - SetDisabled(false, rv); + SetDisabled(false, IgnoreErrors()); } return false; } EventStates HTMLTextAreaElement::IntrinsicState() const { @@ -1300,18 +1298,17 @@ HTMLTextAreaElement::GetRows() } return DEFAULT_ROWS_TEXTAREA; } NS_IMETHODIMP_(void) HTMLTextAreaElement::GetDefaultValueFromContent(nsAString& aValue) { - IgnoredErrorResult rv; - GetDefaultValue(aValue, rv); + GetDefaultValue(aValue, IgnoreErrors()); } NS_IMETHODIMP_(bool) HTMLTextAreaElement::ValueChanged() const { return mValueChanged; } diff --git a/dom/html/ImageDocument.cpp b/dom/html/ImageDocument.cpp --- a/dom/html/ImageDocument.cpp +++ b/dom/html/ImageDocument.cpp @@ -364,26 +364,20 @@ ImageDocument::ShrinkToFit() classList->Remove(NS_LITERAL_STRING("overflowingVertical"), ignored); } ignored.SuppressException(); return; } // Keep image content alive while changing the attributes. RefPtr image = HTMLImageElement::FromContent(mImageContent); - { - IgnoredErrorResult ignored; - image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)), - ignored); - } - { - IgnoredErrorResult ignored; - image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)), - ignored); - } + image->SetWidth(std::max(1, NSToCoordFloor(GetRatio() * mImageWidth)), + IgnoreErrors()); + image->SetHeight(std::max(1, NSToCoordFloor(GetRatio() * mImageHeight)), + IgnoreErrors()); // The view might have been scrolled when zooming in, scroll back to the // origin now that we're showing a shrunk-to-window version. ScrollImageTo(0, 0, false); if (!mImageContent) { // ScrollImageTo flush destroyed our content. return; diff --git a/dom/html/nsTextEditorState.cpp b/dom/html/nsTextEditorState.cpp --- a/dom/html/nsTextEditorState.cpp +++ b/dom/html/nsTextEditorState.cpp @@ -2036,22 +2036,20 @@ nsTextEditorState::UnbindFromFrame(nsTex // Save our selection state if needed. // Note that GetSelectionRange will attempt to work with our selection // controller, so we should make sure we do it before we start doing things // like destroying our editor (if we have one), tearing down the selection // controller, and so forth. if (!IsSelectionCached()) { // Go ahead and cache it now. uint32_t start = 0, end = 0; - IgnoredErrorResult rangeRv; - GetSelectionRange(&start, &end, rangeRv); + GetSelectionRange(&start, &end, IgnoreErrors()); - IgnoredErrorResult dirRv; nsITextControlFrame::SelectionDirection direction = - GetSelectionDirection(dirRv); + GetSelectionDirection(IgnoreErrors()); SelectionProperties& props = GetSelectionProperties(); props.SetStart(start); props.SetEnd(end); props.SetDirection(direction); HTMLInputElement* number = GetParentNumberControl(aFrame); if (number) { // If we are inside a number control, cache the selection on the diff --git a/dom/media/webaudio/AudioContext.cpp b/dom/media/webaudio/AudioContext.cpp --- a/dom/media/webaudio/AudioContext.cpp +++ b/dom/media/webaudio/AudioContext.cpp @@ -669,18 +669,17 @@ void AudioContext::DisconnectFromOwner() void AudioContext::Shutdown() { mIsShutDown = true; // We don't want to touch promises if the global is going away soon. if (!mIsDisconnecting) { if (!mIsOffline) { - IgnoredErrorResult dummy; - RefPtr ignored = Close(dummy); + RefPtr ignored = Close(IgnoreErrors()); } for (auto p : mPromiseGripArray) { p->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR); } mPromiseGripArray.Clear(); } diff --git a/dom/promise/PromiseDebugging.cpp b/dom/promise/PromiseDebugging.cpp --- a/dom/promise/PromiseDebugging.cpp +++ b/dom/promise/PromiseDebugging.cpp @@ -272,34 +272,32 @@ PromiseDebugging::FlushUncaughtRejection if (!promise) { continue; } for (size_t j = 0; j < observers.Length(); ++j) { RefPtr obs = static_cast(observers[j].get()); - IgnoredErrorResult err; - obs->OnLeftUncaught(promise, err); + obs->OnLeftUncaught(promise, IgnoreErrors()); } JSAutoCompartment ac(cx, promise); Promise::ReportRejectedPromise(cx, promise); } storage->mUncaughtRejections.clear(); // Notify observers of consumed Promise. for (size_t i = 0; i < consumed.length(); i++) { JS::RootedObject promise(cx, consumed[i]); for (size_t j = 0; j < observers.Length(); ++j) { RefPtr obs = static_cast(observers[j].get()); - IgnoredErrorResult err; - obs->OnConsumed(promise, err); + obs->OnConsumed(promise, IgnoreErrors()); } } storage->mConsumedRejections.clear(); } } // namespace dom } // namespace mozilla diff --git a/dom/serviceworkers/ServiceWorkerEvents.cpp b/dom/serviceworkers/ServiceWorkerEvents.cpp --- a/dom/serviceworkers/ServiceWorkerEvents.cpp +++ b/dom/serviceworkers/ServiceWorkerEvents.cpp @@ -726,17 +726,17 @@ RespondWithHandler::ResolvedCallback(JSC mScriptSpec, responseURL, Move(closure)); nsCOMPtr body; ir->GetUnfilteredBody(getter_AddRefs(body)); // Errors and redirects may not have a body. if (body) { - IgnoredErrorResult error; + ErrorResult error; response->SetBodyUsed(aCx, error); if (NS_WARN_IF(error.Failed())) { autoCancel.SetCancelErrorResult(aCx, error); return; } } MOZ_ALWAYS_SUCCEEDS(worker->DispatchToMainThread(startRunnable.forget())); diff --git a/dom/serviceworkers/ServiceWorkerScriptCache.cpp b/dom/serviceworkers/ServiceWorkerScriptCache.cpp --- a/dom/serviceworkers/ServiceWorkerScriptCache.cpp +++ b/dom/serviceworkers/ServiceWorkerScriptCache.cpp @@ -613,19 +613,18 @@ private: ir->SetURLList(aCN->URLList()); ir->InitChannelInfo(aCN->GetChannelInfo()); UniquePtr principalInfo = aCN->TakePrincipalInfo(); if (principalInfo) { ir->SetPrincipalInfo(Move(principalInfo)); } - IgnoredErrorResult ignored; RefPtr internalHeaders = aCN->GetInternalHeaders(); - ir->Headers()->Fill(*(internalHeaders.get()), ignored); + ir->Headers()->Fill(*(internalHeaders.get()), IgnoreErrors()); RefPtr response = new Response(aCache->GetGlobalObject(), ir, nullptr); RequestOrUSVString request; request.SetAsUSVString().Rebind(aCN->URL().Data(), aCN->URL().Length()); // For now we have to wait until the Put Promise is fulfilled before we can diff --git a/dom/svg/SVGAnimationElement.cpp b/dom/svg/SVGAnimationElement.cpp --- a/dom/svg/SVGAnimationElement.cpp +++ b/dom/svg/SVGAnimationElement.cpp @@ -381,18 +381,17 @@ SVGAnimationElement::ActivateByHyperlink AnimationNeedsResample(); // As with SVGSVGElement::SetCurrentTime, we need to trigger // a synchronous sample now. FlushAnimations(); } // else, silently fail. We mustn't be part of an SVG document fragment that // is attached to the document tree so there's nothing we can do here } else { - IgnoredErrorResult rv; - BeginElement(rv); + BeginElement(IgnoreErrors()); } } //---------------------------------------------------------------------- // Implementation helpers nsSMILTimeContainer* SVGAnimationElement::GetTimeContainer() diff --git a/dom/svg/SVGUseElement.cpp b/dom/svg/SVGUseElement.cpp --- a/dom/svg/SVGUseElement.cpp +++ b/dom/svg/SVGUseElement.cpp @@ -253,19 +253,19 @@ SVGUseElement::CreateAnonymousContent() return nullptr; } } } nsNodeInfoManager* nodeInfoManager = targetContent->OwnerDoc() == OwnerDoc() ? nullptr : OwnerDoc()->NodeInfoManager(); - IgnoredErrorResult rv; nsCOMPtr newnode = - nsNodeUtils::Clone(targetContent, true, nodeInfoManager, nullptr, rv); + nsNodeUtils::Clone(targetContent, true, nodeInfoManager, nullptr, + IgnoreErrors()); nsCOMPtr newcontent = do_QueryInterface(newnode); if (!newcontent) return nullptr; if (newcontent->IsAnyOfSVGElements(nsGkAtoms::svg, nsGkAtoms::symbol)) { nsSVGElement *newElement = static_cast(newcontent.get()); diff --git a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp --- a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp +++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp @@ -1122,28 +1122,26 @@ PersistNodeFixup::FixupNode(nsIDOMNode * case NS_FORM_INPUT_NUMBER: case NS_FORM_INPUT_RANGE: case NS_FORM_INPUT_DATE: case NS_FORM_INPUT_TIME: case NS_FORM_INPUT_COLOR: nodeAsInput->GetValue(valueStr, dom::CallerType::System); // Avoid superfluous value="" serialization if (valueStr.IsEmpty()) { - IgnoredErrorResult ignored; - outElt->RemoveAttribute(valueAttr, ignored); + outElt->RemoveAttribute(valueAttr, IgnoreErrors()); } else { outElt->SetAttribute(valueAttr, valueStr); } break; case NS_FORM_INPUT_CHECKBOX: case NS_FORM_INPUT_RADIO: { bool checked = nodeAsInput->Checked(); - IgnoredErrorResult ignored; - outElt->SetDefaultChecked(checked, ignored); + outElt->SetDefaultChecked(checked, IgnoreErrors()); } break; default: break; } } return rv; } @@ -1165,18 +1163,17 @@ PersistNodeFixup::FixupNode(nsIDOMNode * dom::HTMLOptionElement* nodeAsOption = dom::HTMLOptionElement::FromContent(content); if (nodeAsOption) { rv = GetNodeToFixup(aNodeIn, aNodeOut); if (NS_SUCCEEDED(rv) && *aNodeOut) { nsCOMPtr outContent = do_QueryInterface(*aNodeOut); dom::HTMLOptionElement* outElt = dom::HTMLOptionElement::FromContent(outContent); bool selected = nodeAsOption->Selected(); - IgnoredErrorResult ignored; - outElt->SetDefaultSelected(selected, ignored); + outElt->SetDefaultSelected(selected, IgnoreErrors()); } return rv; } return NS_OK; } } // unnamed namespace diff --git a/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp.1434686.later b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp.1434686.later new file mode 100644 --- /dev/null +++ b/dom/webbrowserpersist/WebBrowserPersistLocalDocument.cpp.1434686.later @@ -0,0 +1,74 @@ +--- WebBrowserPersistLocalDocument.cpp ++++ WebBrowserPersistLocalDocument.cpp +@@ -691,18 +691,17 @@ PersistNodeFixup::FixupAttribute(nsINode + NS_ConvertASCIItoUTF16 namespaceURI(aNamespaceURI); + RefPtr attr = attrMap->GetNamedItemNS(namespaceURI, attribute); + nsresult rv = NS_OK; + if (attr) { + nsString uri; + attr->GetValue(uri); + rv = FixupURI(uri); + if (NS_SUCCEEDED(rv)) { +- IgnoredErrorResult err; +- attr->SetValue(uri, err); ++ attr->SetValue(uri, IgnoreErrors()); + } + } + + return rv; + } + + nsresult + PersistNodeFixup::FixupAnchor(nsINode *aNode) +@@ -744,18 +743,17 @@ PersistNodeFixup::FixupAnchor(nsINode *a + nsCOMPtr newURI; + nsresult rv = NS_NewURI(getter_AddRefs(newURI), oldCValue, + mParent->GetCharacterSet(), relativeURI); + if (NS_SUCCEEDED(rv) && newURI) { + newURI->SetUserPass(EmptyCString()); + nsAutoCString uriSpec; + rv = newURI->GetSpec(uriSpec); + NS_ENSURE_SUCCESS(rv, rv); +- IgnoredErrorResult err; +- attr->SetValue(NS_ConvertUTF8toUTF16(uriSpec), err); ++ attr->SetValue(NS_ConvertUTF8toUTF16(uriSpec), IgnoreErrors()); + } + } + + return NS_OK; + } + + static void + AppendXMLAttr(const nsAString& key, const nsAString& aValue, nsAString& aBuffer) +@@ -1123,29 +1121,26 @@ PersistNodeFixup::FixupNode(nsINode* aNo + case NS_FORM_INPUT_NUMBER: + case NS_FORM_INPUT_RANGE: + case NS_FORM_INPUT_DATE: + case NS_FORM_INPUT_TIME: + case NS_FORM_INPUT_COLOR: + nodeAsInput->GetValue(valueStr, dom::CallerType::System); + // Avoid superfluous value="" serialization + if (valueStr.IsEmpty()) { + outElt->RemoveAttribute(valueAttr, IgnoreErrors()); + } else { +- IgnoredErrorResult ignored; +- outElt->SetAttribute(valueAttr, valueStr, ignored); ++ outElt->SetAttribute(valueAttr, valueStr, IgnoreErrors()); + } + break; +@@ -1155,31 +1150,29 @@ PersistNodeFixup::FixupNode(nsINode* aNo + nsresult rv = GetNodeToFixup(aNodeIn, aNodeOut); + if (NS_SUCCEEDED(rv) && *aNodeOut) { + // Tell the document encoder to serialize the text child we create below + *aSerializeCloneKids = true; + + nsAutoString valueStr; + nodeAsTextArea->GetValue(valueStr); + +- IgnoredErrorResult err; +- (*aNodeOut)->SetTextContent(valueStr, err); ++ (*aNodeOut)->SetTextContent(valueStr, IgnoreErrors()); + } + return rv; + } + diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -1645,18 +1645,17 @@ CacheCreator::DeleteCache() { AssertIsOnMainThread(); // This is called when the load is canceled which can occur before // mCacheStorage is initialized. if (mCacheStorage) { // It's safe to do this while Cache::Match() and Cache::Put() calls are // running. - IgnoredErrorResult rv; - RefPtr promise = mCacheStorage->Delete(mCacheName, rv); + RefPtr promise = mCacheStorage->Delete(mCacheName, IgnoreErrors()); // We don't care to know the result of the promise object. } // Always call this here to ensure the loaders array is cleared. FailLoaders(NS_ERROR_FAILURE); } @@ -1777,23 +1776,22 @@ CacheScriptLoader::ResolvedCallback(JSCo rv = UNWRAP_OBJECT(Response, &obj, response); if (NS_WARN_IF(NS_FAILED(rv))) { Fail(rv); return; } InternalHeaders* headers = response->GetInternalHeaders(); - IgnoredErrorResult ignored; headers->Get(NS_LITERAL_CSTRING("content-security-policy"), - mCSPHeaderValue, ignored); + mCSPHeaderValue, IgnoreErrors()); headers->Get(NS_LITERAL_CSTRING("content-security-policy-report-only"), - mCSPReportOnlyHeaderValue, ignored); + mCSPReportOnlyHeaderValue, IgnoreErrors()); headers->Get(NS_LITERAL_CSTRING("referrer-policy"), - mReferrerPolicyHeaderValue, ignored); + mReferrerPolicyHeaderValue, IgnoreErrors()); nsCOMPtr inputStream; response->GetBody(getter_AddRefs(inputStream)); mChannelInfo = response->GetChannelInfo(); const UniquePtr& pInfo = response->GetPrincipalInfo(); if (pInfo) { mPrincipalInfo = mozilla::MakeUnique(*pInfo); } diff --git a/dom/xbl/nsXBLBinding.cpp b/dom/xbl/nsXBLBinding.cpp --- a/dom/xbl/nsXBLBinding.cpp +++ b/dom/xbl/nsXBLBinding.cpp @@ -316,19 +316,19 @@ nsXBLBinding::GenerateAnonymousContent() // using the attribute-setting shorthand hack. uint32_t contentCount = content->GetChildCount(); // Plan to build the content by default. bool hasContent = (contentCount > 0); if (hasContent) { nsIDocument* doc = mBoundElement->OwnerDoc(); - IgnoredErrorResult rv; nsCOMPtr clonedNode = - nsNodeUtils::Clone(content, true, doc->NodeInfoManager(), nullptr, rv); + nsNodeUtils::Clone(content, true, doc->NodeInfoManager(), nullptr, + IgnoreErrors()); // FIXME: Bug 1399558, Why is this code OK assuming that nsNodeUtils::Clone // never fails? mContent = clonedNode->AsElement(); // Search for elements in the XBL content. In the presence // of multiple default insertion points, we use the last one in document // order. for (nsIContent* child = mContent; child; child = child->GetNextNode(mContent)) { diff --git a/dom/xbl/nsXBLPrototypeHandler.cpp b/dom/xbl/nsXBLPrototypeHandler.cpp --- a/dom/xbl/nsXBLPrototypeHandler.cpp +++ b/dom/xbl/nsXBLPrototypeHandler.cpp @@ -670,18 +670,17 @@ nsXBLPrototypeHandler::GetController(Eve // XXX Fix this so there's a generic interface that describes controllers, // This code should have no special knowledge of what objects might have controllers. nsCOMPtr controllers; nsCOMPtr targetContent(do_QueryInterface(aTarget)); RefPtr xulElement = nsXULElement::FromContentOrNull(targetContent); if (xulElement) { - IgnoredErrorResult rv; - controllers = xulElement->GetControllers(rv); + controllers = xulElement->GetControllers(IgnoreErrors()); } if (!controllers) { HTMLTextAreaElement* htmlTextArea = HTMLTextAreaElement::FromContent(targetContent); if (htmlTextArea) htmlTextArea->GetControllers(getter_AddRefs(controllers)); } diff --git a/dom/xul/nsXULElement.cpp b/dom/xul/nsXULElement.cpp --- a/dom/xul/nsXULElement.cpp +++ b/dom/xul/nsXULElement.cpp @@ -894,18 +894,17 @@ nsXULElement::RemoveChildAt(uint32_t aIn } } nsCOMPtr curItem; controlElement->GetCurrentItem(getter_AddRefs(curItem)); nsCOMPtr curNode = do_QueryInterface(curItem); if (curNode && nsContentUtils::ContentIsDescendantOf(curNode, oldKid)) { // Current item going away - IgnoredErrorResult ignored; - nsCOMPtr box = xulElement->GetBoxObject(ignored); + nsCOMPtr box = xulElement->GetBoxObject(IgnoreErrors()); listBox = do_QueryInterface(box); if (listBox && oldKidElem) { listBox->GetIndexOfItem(oldKidElem, &newCurrentIndex); } // If any of this fails, we'll just set the current item to null if (newCurrentIndex == -1) newCurrentIndex = -2; diff --git a/dom/xul/nsXULElement.cpp.1434686.later b/dom/xul/nsXULElement.cpp.1434686.later new file mode 100644 --- /dev/null +++ b/dom/xul/nsXULElement.cpp.1434686.later @@ -0,0 +1,22 @@ +--- nsXULElement.cpp ++++ nsXULElement.cpp +@@ -969,18 +968,17 @@ nsXULElement::RemoveChildNode(nsIContent + } + } + + nsCOMPtr curItem; + controlElement->GetCurrentItem(getter_AddRefs(curItem)); + nsCOMPtr curNode = do_QueryInterface(curItem); + if (curNode && nsContentUtils::ContentIsDescendantOf(curNode, aKid)) { + // Current item going away +- IgnoredErrorResult ignored; +- nsCOMPtr box = xulElement->GetBoxObject(ignored); ++ nsCOMPtr box = xulElement->GetBoxObject(IgnoreErrors()); + listBox = do_QueryInterface(box); + if (listBox && oldKidElem) { + listBox->GetIndexOfItem(oldKidElem, &newCurrentIndex); + } + + // If any of this fails, we'll just set the current item to null + if (newCurrentIndex == -1) + newCurrentIndex = -2;