Bug 1855836 - Make empty threshold list behavior match other browsers. r=smaug
Technically a broken test, but given other browsers' behavior and that having no thresholds is useless, I don't think this edge-case is worth fighting about. See https://github.com/w3c/IntersectionObserver/pull/516 for the spec change. Differential Revision: https://phabricator.services.mozilla.com/D189764
This commit is contained in:
@@ -81,8 +81,7 @@ DOMIntersectionObserver::DOMIntersectionObserver(
|
||||
dom::IntersectionCallback& aCb)
|
||||
: mOwner(aOwner),
|
||||
mDocument(mOwner->GetExtantDoc()),
|
||||
mCallback(RefPtr<dom::IntersectionCallback>(&aCb)),
|
||||
mConnected(false) {}
|
||||
mCallback(RefPtr<dom::IntersectionCallback>(&aCb)) {}
|
||||
|
||||
already_AddRefed<DOMIntersectionObserver> DOMIntersectionObserver::Constructor(
|
||||
const GlobalObject& aGlobal, dom::IntersectionCallback& aCb,
|
||||
@@ -128,6 +127,9 @@ already_AddRefed<DOMIntersectionObserver> DOMIntersectionObserver::Constructor(
|
||||
observer->mThresholds.AppendElement(thresh);
|
||||
}
|
||||
observer->mThresholds.Sort();
|
||||
if (observer->mThresholds.IsEmpty()) {
|
||||
observer->mThresholds.AppendElement(0.0);
|
||||
}
|
||||
} else {
|
||||
double thresh = aOptions.mThreshold.GetAsDouble();
|
||||
if (thresh < 0.0 || thresh > 1.0) {
|
||||
@@ -174,8 +176,7 @@ DOMIntersectionObserver::DOMIntersectionObserver(Document& aDocument,
|
||||
NativeCallback aCallback)
|
||||
: mOwner(aDocument.GetInnerWindow()),
|
||||
mDocument(&aDocument),
|
||||
mCallback(aCallback),
|
||||
mConnected(false) {}
|
||||
mCallback(aCallback) {}
|
||||
|
||||
already_AddRefed<DOMIntersectionObserver>
|
||||
DOMIntersectionObserver::CreateLazyLoadObserver(Document& aDocument) {
|
||||
|
||||
@@ -185,7 +185,7 @@ class DOMIntersectionObserver final : public nsISupports,
|
||||
Variant<RefPtr<dom::IntersectionCallback>, NativeCallback> mCallback;
|
||||
RefPtr<nsINode> mRoot;
|
||||
StyleRect<LengthPercentage> mRootMargin;
|
||||
nsTArray<double> mThresholds;
|
||||
AutoTArray<double, 1> mThresholds;
|
||||
|
||||
// These hold raw pointers which are explicitly cleared by UnlinkTarget().
|
||||
//
|
||||
@@ -195,7 +195,7 @@ class DOMIntersectionObserver final : public nsISupports,
|
||||
nsTHashSet<Element*> mObservationTargetSet;
|
||||
|
||||
nsTArray<RefPtr<DOMIntersectionObserverEntry>> mQueuedEntries;
|
||||
bool mConnected;
|
||||
bool mConnected = false;
|
||||
};
|
||||
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(DOMIntersectionObserver,
|
||||
|
||||
@@ -1,5 +0,0 @@
|
||||
[observer-attributes.html]
|
||||
expected:
|
||||
if (os == "android") and fission: [OK, TIMEOUT]
|
||||
[empty observer.thresholds]
|
||||
expected: FAIL
|
||||
Reference in New Issue
Block a user