diff --git a/dom/base/DOMIntersectionObserver.cpp b/dom/base/DOMIntersectionObserver.cpp index 88fea1596ab4b..fae409415ecf6 100644 --- a/dom/base/DOMIntersectionObserver.cpp +++ b/dom/base/DOMIntersectionObserver.cpp @@ -81,8 +81,7 @@ DOMIntersectionObserver::DOMIntersectionObserver( dom::IntersectionCallback& aCb) : mOwner(aOwner), mDocument(mOwner->GetExtantDoc()), - mCallback(RefPtr(&aCb)), - mConnected(false) {} + mCallback(RefPtr(&aCb)) {} already_AddRefed DOMIntersectionObserver::Constructor( const GlobalObject& aGlobal, dom::IntersectionCallback& aCb, @@ -128,6 +127,9 @@ already_AddRefed 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::CreateLazyLoadObserver(Document& aDocument) { diff --git a/dom/base/DOMIntersectionObserver.h b/dom/base/DOMIntersectionObserver.h index 5a9a38e250f2d..fadf46b4e6d87 100644 --- a/dom/base/DOMIntersectionObserver.h +++ b/dom/base/DOMIntersectionObserver.h @@ -185,7 +185,7 @@ class DOMIntersectionObserver final : public nsISupports, Variant, NativeCallback> mCallback; RefPtr mRoot; StyleRect mRootMargin; - nsTArray mThresholds; + AutoTArray mThresholds; // These hold raw pointers which are explicitly cleared by UnlinkTarget(). // @@ -195,7 +195,7 @@ class DOMIntersectionObserver final : public nsISupports, nsTHashSet mObservationTargetSet; nsTArray> mQueuedEntries; - bool mConnected; + bool mConnected = false; }; NS_DEFINE_STATIC_IID_ACCESSOR(DOMIntersectionObserver, diff --git a/testing/web-platform/meta/intersection-observer/observer-attributes.html.ini b/testing/web-platform/meta/intersection-observer/observer-attributes.html.ini deleted file mode 100644 index 0f95d7c417068..0000000000000 --- a/testing/web-platform/meta/intersection-observer/observer-attributes.html.ini +++ /dev/null @@ -1,5 +0,0 @@ -[observer-attributes.html] - expected: - if (os == "android") and fission: [OK, TIMEOUT] - [empty observer.thresholds] - expected: FAIL