icecat: add release icecat-140.10.1-1gnu1 for ecne

This commit is contained in:
Ark74 2026-05-04 16:58:41 -06:00
parent a5f93cb214
commit ff85d7c623
1256 changed files with 63469 additions and 24141 deletions

View file

@ -151,40 +151,7 @@ void HTMLAllCollection::NamedGetter(
}
void HTMLAllCollection::GetSupportedNames(nsTArray<nsString>& aNames) {
// XXXbz this is very similar to nsContentList::GetSupportedNames,
// but has to check IsAllNamedElement for the name case.
AutoTArray<nsAtom*, 8> atoms;
for (uint32_t i = 0; i < Length(); ++i) {
nsIContent* content = Item(i);
if (content->HasID()) {
nsAtom* id = content->GetID();
MOZ_ASSERT(id != nsGkAtoms::_empty, "Empty ids don't get atomized");
if (!atoms.Contains(id)) {
atoms.AppendElement(id);
}
}
nsGenericHTMLElement* el = nsGenericHTMLElement::FromNode(content);
if (el) {
// Note: nsINode::HasName means the name is exposed on the document,
// which is false for options, so we don't check it here.
const nsAttrValue* val = el->GetParsedAttr(nsGkAtoms::name);
if (val && val->Type() == nsAttrValue::eAtom &&
IsAllNamedElement(content)) {
nsAtom* name = val->GetAtomValue();
MOZ_ASSERT(name != nsGkAtoms::_empty, "Empty names don't get atomized");
if (!atoms.Contains(name)) {
atoms.AppendElement(name);
}
}
}
}
uint32_t atomsLen = atoms.Length();
nsString* names = aNames.AppendElements(atomsLen);
for (uint32_t i = 0; i < atomsLen; ++i) {
atoms[i]->ToString(names[i]);
}
Collection()->GetSupportedNames(aNames, IsAllNamedElement);
}
JSObject* HTMLAllCollection::WrapObject(JSContext* aCx,

View file

@ -23,7 +23,6 @@ HTMLFieldSetElement::HTMLFieldSetElement(
: nsGenericHTMLFormControlElement(std::move(aNodeInfo),
FormControlType::Fieldset),
mElements(nullptr),
mFirstLegend(nullptr),
mInvalidElementsCount(0) {
// <fieldset> is always barred from constraint validation.
SetBarredFromConstraintValidation(true);
@ -41,7 +40,7 @@ HTMLFieldSetElement::~HTMLFieldSetElement() {
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement,
nsGenericHTMLFormControlElement, mValidity,
mElements)
mElements, mFirstLegend)
NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLFieldSetElement,
nsGenericHTMLFormControlElement,
@ -110,6 +109,7 @@ void HTMLFieldSetElement::InsertChildBefore(nsIContent* aChild,
nsIContent* aBeforeThis,
bool aNotify, ErrorResult& aRv) {
bool firstLegendHasChanged = false;
RefPtr<nsIContent> oldFirstLegend = mFirstLegend;
if (aChild->IsHTMLElement(nsGkAtoms::legend)) {
if (!mFirstLegend) {
@ -134,6 +134,7 @@ void HTMLFieldSetElement::InsertChildBefore(nsIContent* aChild,
nsGenericHTMLFormControlElement::InsertChildBefore(aChild, aBeforeThis,
aNotify, aRv);
if (aRv.Failed()) {
mFirstLegend = oldFirstLegend;
return;
}

View file

@ -126,7 +126,7 @@ class HTMLFieldSetElement final : public nsGenericHTMLFormControlElement,
// List of elements which have this fieldset as first fieldset ancestor.
nsTArray<nsGenericHTMLFormElement*> mDependentElements;
nsIContent* mFirstLegend;
RefPtr<nsIContent> mFirstLegend;
/**
* Number of invalid and candidate for constraint validation

View file

@ -249,7 +249,7 @@ void HTMLFormElement::MaybeSubmit(Element* aSubmitter) {
// 1-4 of
// https://html.spec.whatwg.org/multipage/forms.html#concept-form-submit
Document* doc = GetComposedDoc();
RefPtr<Document> doc = GetComposedDoc();
if (mIsConstructingEntryList || !doc ||
(doc->GetSandboxFlags() & SANDBOXED_FORMS)) {
return;

View file

@ -2161,6 +2161,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(HTMLMediaElement,
NS_IMPL_CYCLE_COLLECTION_UNLINK(mMediaKeys)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIncomingMediaKeys)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSelectedVideoStreamTrack)
tmp->mSelectedVideoStreamTrackGraph = nullptr;
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPendingPlayPromises)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSeekDOMPromise)
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSetMediaKeysDOMPromise)
@ -2882,17 +2883,24 @@ void HTMLMediaElement::NotifyMediaTrackEnabled(dom::MediaTrack* aTrack) {
mSelectedVideoStreamTrack = t->GetVideoStreamTrack();
mSelectedVideoStreamTrack->AddPrincipalChangeObserver(this);
if (mMediaStreamRenderer) {
mMediaStreamRenderer->AddTrack(mSelectedVideoStreamTrack);
if (!mSelectedVideoStreamTrackGraph) {
mSelectedVideoStreamTrackGraph = mSelectedVideoStreamTrack->Graph();
}
if (mSecondaryMediaStreamRenderer) {
mSecondaryMediaStreamRenderer->AddTrack(mSelectedVideoStreamTrack);
if (mSelectedVideoStreamTrackGraph ==
mSelectedVideoStreamTrack->Graph()) {
if (mMediaStreamRenderer) {
mMediaStreamRenderer->AddTrack(mSelectedVideoStreamTrack);
}
if (mSecondaryMediaStreamRenderer) {
mSecondaryMediaStreamRenderer->AddTrack(mSelectedVideoStreamTrack);
}
if (mMediaInfo.HasVideo()) {
mMediaInfo.mVideo.SetAlpha(mSelectedVideoStreamTrack->HasAlpha());
}
nsContentUtils::CombineResourcePrincipals(
&mSrcStreamVideoPrincipal,
mSelectedVideoStreamTrack->GetPrincipal());
}
if (mMediaInfo.HasVideo()) {
mMediaInfo.mVideo.SetAlpha(mSelectedVideoStreamTrack->HasAlpha());
}
nsContentUtils::CombineResourcePrincipals(
&mSrcStreamVideoPrincipal, mSelectedVideoStreamTrack->GetPrincipal());
}
}
@ -5484,6 +5492,7 @@ void HTMLMediaElement::EndSrcMediaStreamPlayback() {
mSelectedVideoStreamTrack->RemovePrincipalChangeObserver(this);
}
mSelectedVideoStreamTrack = nullptr;
mSelectedVideoStreamTrackGraph = nullptr;
MOZ_ASSERT_IF(mSecondaryMediaStreamRenderer,
!mMediaStreamRenderer == !mSecondaryMediaStreamRenderer);

View file

@ -1490,6 +1490,7 @@ class HTMLMediaElement : public nsGenericHTMLElement,
// The currently selected video stream track.
RefPtr<VideoStreamTrack> mSelectedVideoStreamTrack;
MediaTrackGraph* mSelectedVideoStreamTrackGraph = nullptr;
const RefPtr<ShutdownObserver> mShutdownObserver;

View file

@ -299,24 +299,10 @@ void HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
OnSelectionChanged();
}
// Get the frame stuff for notification. No need to flush here
// since if there's no frame for the select yet the select will
// get into the right state once it's created.
nsISelectControlFrame* selectFrame = nullptr;
AutoWeakFrame weakSelectFrame;
bool didGetFrame = false;
// Actually select the options if the added options warrant it
for (int32_t i = aListIndex; i < insertIndex; i++) {
// Notify the frame that the option is added
if (!didGetFrame || (selectFrame && !weakSelectFrame.IsAlive())) {
selectFrame = GetSelectFrame();
weakSelectFrame = do_QueryFrame(selectFrame);
didGetFrame = true;
}
if (selectFrame) {
selectFrame->AddOption(i);
if (auto* frame = GetSelectFrame()) {
frame->AddOption(i);
}
RefPtr<HTMLOptionElement> option = Item(i);
@ -332,7 +318,7 @@ void HTMLSelectElement::InsertOptionsIntoList(nsIContent* aOptions,
// This is sort of a hack ... we need to notify that the option was
// set and change selectedIndex even though we didn't really change
// its value.
OnOptionSelected(selectFrame, i, true, false, aNotify);
OnOptionSelected(i, true, false, aNotify);
}
}
@ -715,8 +701,7 @@ bool HTMLSelectElement::IsOptionSelectedByIndex(int32_t aIndex) const {
return option && option->Selected();
}
void HTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame,
int32_t aIndex, bool aSelected,
void HTMLSelectElement::OnOptionSelected(int32_t aIndex, bool aSelected,
bool aChangeOptionState,
bool aNotify) {
// Set the selected index
@ -736,8 +721,8 @@ void HTMLSelectElement::OnOptionSelected(nsISelectControlFrame* aSelectFrame,
}
// Let the frame know too
if (aSelectFrame) {
aSelectFrame->OnOptionSelected(aIndex, aSelected);
if (auto* frame = GetSelectFrame()) {
frame->OnOptionSelected(aIndex, aSelected);
}
UpdateSelectedOptions();
@ -808,10 +793,6 @@ bool HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
bool optionsSelected = false;
bool optionsDeselected = false;
nsISelectControlFrame* selectFrame = nullptr;
bool didGetFrame = false;
AutoWeakFrame weakSelectFrame;
if (aOptionsMask.contains(OptionFlag::IsSelected)) {
// Setting selectedIndex to an out-of-bounds index means -1. (HTML5)
if (aStartIndex < 0 || AssertedCast<uint32_t>(aStartIndex) >= numItems ||
@ -861,15 +842,7 @@ bool HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
// the option has just been inserted we have to get in sync with it.
if (option && (aOptionsMask.contains(OptionFlag::InsertingOptions) ||
!option->Selected())) {
// To notify the frame if anything gets changed. No need
// to flush here, if there's no frame yet we don't need to
// force it to be created just to notify it about a change
// in the select.
selectFrame = GetSelectFrame();
weakSelectFrame = do_QueryFrame(selectFrame);
didGetFrame = true;
OnOptionSelected(selectFrame, optIndex, true, !option->Selected(),
OnOptionSelected(optIndex, true, !option->Selected(),
aOptionsMask.contains(OptionFlag::Notify));
optionsSelected = true;
}
@ -889,17 +862,7 @@ bool HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
HTMLOptionElement* option = Item(optIndex);
// If the index is already deselected, ignore it.
if (option && option->Selected()) {
if (!didGetFrame || (selectFrame && !weakSelectFrame.IsAlive())) {
// To notify the frame if anything gets changed, don't
// flush, if the frame doesn't exist we don't need to
// create it just to tell it about this change.
selectFrame = GetSelectFrame();
weakSelectFrame = do_QueryFrame(selectFrame);
didGetFrame = true;
}
OnOptionSelected(selectFrame, optIndex, false, true,
OnOptionSelected(optIndex, false, true,
aOptionsMask.contains(OptionFlag::Notify));
optionsDeselected = true;
@ -923,17 +886,7 @@ bool HTMLSelectElement::SetOptionsSelectedByIndex(int32_t aStartIndex,
// If the index is already selected, ignore it.
if (option && option->Selected()) {
if (!didGetFrame || (selectFrame && !weakSelectFrame.IsAlive())) {
// To notify the frame if anything gets changed, don't
// flush, if the frame doesn't exist we don't need to
// create it just to tell it about this change.
selectFrame = GetSelectFrame();
weakSelectFrame = do_QueryFrame(selectFrame);
didGetFrame = true;
}
OnOptionSelected(selectFrame, optIndex, false, true,
OnOptionSelected(optIndex, false, true,
aOptionsMask.contains(OptionFlag::Notify));
optionsDeselected = true;
}

View file

@ -368,7 +368,6 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
/**
* Called to trigger notifications of frames and fixing selected index
*
* @param aSelectFrame the frame for this content (could be null)
* @param aIndex the index that was selected or deselected
* @param aSelected whether the index was selected or deselected
* @param aChangeOptionState if false, don't do anything to the
@ -376,8 +375,8 @@ class HTMLSelectElement final : public nsGenericHTMLFormControlElementWithState,
* its selected state to aSelected.
* @param aNotify whether to notify the style system and such
*/
void OnOptionSelected(nsISelectControlFrame* aSelectFrame, int32_t aIndex,
bool aSelected, bool aChangeOptionState, bool aNotify);
void OnOptionSelected(int32_t aIndex, bool aSelected, bool aChangeOptionState,
bool aNotify);
/**
* Restore state to a particular state string (representing the options)
* @param aNewSelected the state string to restore to

View file

@ -231,7 +231,9 @@ void HTMLSlotElement::Assign(const Sequence<OwningElementOrText>& aNodes) {
if (!mAssignedNodes.IsEmpty()) {
changedSlots.EnsureInserted(this);
if (root) {
root->InvalidateStyleAndLayoutOnSubtree(this);
// If not in a shadow tree, the flat tree is not really changing, so no
// need to invalidate layout. Same applies to other callers here.
ShadowRoot::InvalidateStyleAndLayoutOnSubtree(this);
}
ClearAssignedNodes();
}
@ -252,29 +254,27 @@ void HTMLSlotElement::Assign(const Sequence<OwningElementOrText>& aNodes) {
// XXXsmaug Should we have a helper for
// https://infra.spec.whatwg.org/#ordered-set?
if (content->GetManualSlotAssignment() != this) {
if (HTMLSlotElement* oldSlot = content->GetAssignedSlot()) {
if (changedSlots.EnsureInserted(oldSlot)) {
if (root) {
MOZ_ASSERT(oldSlot->GetContainingShadow() == root);
root->InvalidateStyleAndLayoutOnSubtree(oldSlot);
}
// Step 3.1: If content's manual slot assignment refers to a slot,
// then remove node from that slot's manually assigned nodes.
if (HTMLSlotElement* prevSlot = content->GetManualSlotAssignment()) {
ShadowRoot* prevSlotRoot = prevSlot->GetContainingShadow();
const bool wasAssigned = content->GetAssignedSlot() == prevSlot;
if (wasAssigned && prevSlotRoot &&
changedSlots.EnsureInserted(prevSlot)) {
ShadowRoot::InvalidateStyleAndLayoutOnSubtree(prevSlot);
}
prevSlot->RemoveManuallyAssignedNode(*content);
}
if (changedSlots.EnsureInserted(this)) {
if (root) {
root->InvalidateStyleAndLayoutOnSubtree(this);
}
}
// 3.1 (HTML Spec) If content's manual slot assignment refers to a slot,
// then remove node from that slot's manually assigned nodes. 3.2 (HTML
// Spec) Set content's manual slot assignment to this.
if (HTMLSlotElement* oldSlot = content->GetManualSlotAssignment()) {
oldSlot->RemoveManuallyAssignedNode(*content);
}
// Step 3.2: Set content's manual slot assignment to this.
content->SetManualSlotAssignment(this);
// Step 3.3: Append content to nodesSet.
mManuallyAssignedNodes.AppendElement(content);
if (changedSlots.EnsureInserted(this) && root) {
ShadowRoot::InvalidateStyleAndLayoutOnSubtree(this);
}
if (root && host && content->GetParent() == host) {
// Equivalent to 4.2.2.4.3 (DOM Spec) `Set slot's assigned nodes to
// slottables`
@ -295,7 +295,11 @@ void HTMLSlotElement::Assign(const Sequence<OwningElementOrText>& aNodes) {
}
}
}
MOZ_ASSERT(changedSlots.IsEmpty());
}
// Fire slotchange for any remaining slots that are in a different shadow
// tree (cross-root case). The spec doesn't define an ordering here.
for (const auto& slot : changedSlots) {
slot->EnqueueSlotChangeEvent();
}
}

View file

@ -202,6 +202,7 @@ void TextTrackManager::AddCues(TextTrack* aTextTrack) {
for (uint32_t i = 0; i < cueList->Length(); ++i) {
mNewCues->AddCue(*cueList->IndexedGetter(i, dummy));
}
RefPtr<TextTrackManager> kungFuDeathGrip(this);
MaybeRunTimeMarchesOn();
}
}
@ -226,6 +227,7 @@ void TextTrackManager::RemoveTextTrack(TextTrack* aTextTrack,
for (uint32_t i = 0; i < removeCueList->Length(); ++i) {
mNewCues->RemoveCue(*((*removeCueList)[i]));
}
RefPtr<TextTrackManager> kungFuDeathGrip(this);
MaybeRunTimeMarchesOn();
}
}
@ -288,6 +290,7 @@ void TextTrackManager::NotifyCueAdded(TextTrackCue& aCue) {
if (mNewCues) {
mNewCues->AddCue(aCue);
}
RefPtr<TextTrackManager> kungFuDeathGrip(this);
MaybeRunTimeMarchesOn();
}
@ -296,6 +299,7 @@ void TextTrackManager::NotifyCueRemoved(TextTrackCue& aCue) {
if (mNewCues) {
mNewCues->RemoveCue(aCue);
}
RefPtr<TextTrackManager> kungFuDeathGrip(this);
MaybeRunTimeMarchesOn();
DispatchUpdateCueDisplay();
}
@ -342,7 +346,7 @@ void TextTrackManager::HonorUserPreferencesForTrackSelection() {
// Step 4: Set all TextTracks with a kind of metadata that are disabled
// to hidden.
for (uint32_t i = 0; i < mTextTracks->Length(); i++) {
TextTrack* track = (*mTextTracks)[i];
RefPtr<TextTrack> track = (*mTextTracks)[i];
if (track->Kind() == TextTrackKind::Metadata && TrackIsDefault(track) &&
track->Mode() == TextTrackMode::Disabled) {
track->SetMode(TextTrackMode::Hidden);
@ -383,11 +387,11 @@ void TextTrackManager::PerformTrackSelection(TextTrackKind aTextTrackKinds[],
// first TextTrack in candidates with a default attribute to showing.
// TODO: Bug 981691 - Honor user preferences for text track selection.
for (uint32_t i = 0; i < candidates.Length(); i++) {
if (TrackIsDefault(candidates[i]) &&
candidates[i]->Mode() == TextTrackMode::Disabled) {
candidates[i]->SetMode(TextTrackMode::Showing);
RefPtr<TextTrack> track = candidates[i];
if (TrackIsDefault(track) && track->Mode() == TextTrackMode::Disabled) {
track->SetMode(TextTrackMode::Showing);
WEBVTT_LOGV("PerformTrackSelection set Showing kind %d",
static_cast<int>(candidates[i]->Kind()));
static_cast<int>(track->Kind()));
return;
}
}
@ -831,6 +835,7 @@ void TextTrackManager::TimeMarchesOn() {
void TextTrackManager::NotifyCueUpdated(TextTrackCue* aCue) {
// TODO: Add/Reorder the cue to mNewCues if we have some optimization?
WEBVTT_LOG("NotifyCueUpdated, cue=%p", aCue);
RefPtr<TextTrackManager> kungFuDeathGrip(this);
MaybeRunTimeMarchesOn();
// For the case "Texttrack.mode = hidden/showing", if the mode
// changing between showing and hidden, TimeMarchesOn