diff options
author | Moonchild <moonchild@palemoon.org> | 2020-09-23 23:45:46 +0000 |
---|---|---|
committer | Moonchild <moonchild@palemoon.org> | 2020-09-23 23:45:46 +0000 |
commit | 9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f (patch) | |
tree | 831e0ae1649d6135429def03688bc93ff7c86b03 /dom | |
parent | 42f895f27f239e973c9c06241f7a58da7381353c (diff) | |
parent | f624bd1375655dea196cdcb70a9860bc5817df49 (diff) | |
download | UXP-9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f.tar UXP-9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f.tar.gz UXP-9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f.tar.lz UXP-9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f.tar.xz UXP-9f5c27ba479c54d4ebb1bd59b61fbf793f6df93f.zip |
Merge branch 'redwood' into releaseRELBASE_20200929RC_20200924
Diffstat (limited to 'dom')
79 files changed, 1258 insertions, 2056 deletions
diff --git a/dom/animation/AnimationPerformanceWarning.h b/dom/animation/AnimationPerformanceWarning.h index a1ac35cba..582c48cc3 100644 --- a/dom/animation/AnimationPerformanceWarning.h +++ b/dom/animation/AnimationPerformanceWarning.h @@ -38,8 +38,6 @@ struct AnimationPerformanceWarning std::initializer_list<int32_t> aParams) : mType(aType) { - // FIXME: Once std::initializer_list::size() become a constexpr function, - // we should use static_assert here. MOZ_ASSERT(aParams.size() <= kMaxParamsForLocalization, "The length of parameters should be less than " "kMaxParamsForLocalization"); @@ -49,11 +47,11 @@ struct AnimationPerformanceWarning // Maximum number of parameters passed to // nsContentUtils::FormatLocalizedString to localize warning messages. // - // NOTE: This constexpr can't be forward declared, so if you want to use + // NOTE: This can't be forward declared, so if you want to use // this variable, please include this header file directly. // This value is the same as the limit of nsStringBundle::FormatString. // See the implementation of nsStringBundle::FormatString. - static constexpr uint8_t kMaxParamsForLocalization = 10; + static const uint8_t kMaxParamsForLocalization = 10; // Indicates why this property could not be animated on the compositor. Type mType; diff --git a/dom/base/ResizeObserver.cpp b/dom/base/ResizeObserver.cpp new file mode 100644 index 000000000..37d940c2b --- /dev/null +++ b/dom/base/ResizeObserver.cpp @@ -0,0 +1,304 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#include "mozilla/dom/ResizeObserver.h"
+
+#include "mozilla/dom/DOMRect.h"
+#include "nsContentUtils.h"
+#include "nsIFrame.h"
+#include "nsSVGUtils.h"
+
+namespace mozilla {
+namespace dom {
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserver)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObserver)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObserver)
+
+NS_IMPL_CYCLE_COLLECTION_CLASS(ResizeObserver)
+
+NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(ResizeObserver)
+ NS_IMPL_CYCLE_COLLECTION_TRACE_PRESERVED_WRAPPER
+NS_IMPL_CYCLE_COLLECTION_TRACE_END
+
+NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(ResizeObserver)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mOwner)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mCallback)
+ NS_IMPL_CYCLE_COLLECTION_UNLINK(mObservationMap)
+NS_IMPL_CYCLE_COLLECTION_UNLINK_END
+
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(ResizeObserver)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mOwner)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mCallback)
+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mObservationMap)
+NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
+
+already_AddRefed<ResizeObserver>
+ResizeObserver::Constructor(const GlobalObject& aGlobal,
+ ResizeObserverCallback& aCb,
+ ErrorResult& aRv)
+{
+ nsCOMPtr<nsPIDOMWindowInner> window =
+ do_QueryInterface(aGlobal.GetAsSupports());
+
+ if (!window) {
+ aRv.Throw(NS_ERROR_FAILURE);
+ return nullptr;
+ }
+
+ nsCOMPtr<nsIDocument> document = window->GetExtantDoc();
+
+ if (!document) {
+ aRv.Throw(NS_ERROR_FAILURE);
+ return nullptr;
+ }
+
+ RefPtr<ResizeObserver> observer = new ResizeObserver(window.forget(), aCb);
+ document->AddResizeObserver(observer);
+
+ return observer.forget();
+}
+
+void
+ResizeObserver::Observe(Element* aTarget,
+ ErrorResult& aRv)
+{
+ if (!aTarget) {
+ aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
+ return;
+ }
+
+ RefPtr<ResizeObservation> observation;
+
+ if (!mObservationMap.Get(aTarget, getter_AddRefs(observation))) {
+ observation = new ResizeObservation(this, aTarget);
+
+ mObservationMap.Put(aTarget, observation);
+ mObservationList.insertBack(observation);
+
+ // Per the spec, we need to trigger notification in event loop that
+ // contains ResizeObserver observe call even when resize/reflow does
+ // not happen.
+ aTarget->OwnerDoc()->ScheduleResizeObserversNotification();
+ }
+}
+
+void
+ResizeObserver::Unobserve(Element* aTarget,
+ ErrorResult& aRv)
+{
+ if (!aTarget) {
+ aRv.Throw(NS_ERROR_DOM_NOT_FOUND_ERR);
+ return;
+ }
+
+ RefPtr<ResizeObservation> observation;
+
+ if (mObservationMap.Get(aTarget, getter_AddRefs(observation))) {
+ mObservationMap.Remove(aTarget);
+
+ MOZ_ASSERT(!mObservationList.isEmpty(),
+ "If ResizeObservation found for an element, observation list "
+ "must be not empty.");
+
+ observation->remove();
+ }
+}
+
+void
+ResizeObserver::Disconnect()
+{
+ mObservationMap.Clear();
+ mObservationList.clear();
+ mActiveTargets.Clear();
+}
+
+void
+ResizeObserver::GatherActiveObservations(uint32_t aDepth)
+{
+ mActiveTargets.Clear();
+ mHasSkippedTargets = false;
+
+ for (auto observation : mObservationList) {
+ if (observation->IsActive()) {
+ uint32_t targetDepth =
+ nsContentUtils::GetNodeDepth(observation->Target());
+
+ if (targetDepth > aDepth) {
+ mActiveTargets.AppendElement(observation);
+ } else {
+ mHasSkippedTargets = true;
+ }
+ }
+ }
+}
+
+bool
+ResizeObserver::HasActiveObservations() const
+{
+ return !mActiveTargets.IsEmpty();
+}
+
+bool
+ResizeObserver::HasSkippedObservations() const
+{
+ return mHasSkippedTargets;
+}
+
+uint32_t
+ResizeObserver::BroadcastActiveObservations()
+{
+ uint32_t shallowestTargetDepth = UINT32_MAX;
+
+ if (HasActiveObservations()) {
+ Sequence<OwningNonNull<ResizeObserverEntry>> entries;
+
+ for (auto observation : mActiveTargets) {
+ RefPtr<ResizeObserverEntry> entry =
+ new ResizeObserverEntry(this, observation->Target());
+
+ nsRect rect = observation->GetTargetRect();
+ entry->SetContentRect(rect);
+
+ if (!entries.AppendElement(entry.forget(), fallible)) {
+ // Out of memory.
+ break;
+ }
+
+ // Sync the broadcast size of observation so the next size inspection
+ // will be based on the updated size from last delivered observations.
+ observation->UpdateBroadcastSize(rect);
+
+ uint32_t targetDepth =
+ nsContentUtils::GetNodeDepth(observation->Target());
+
+ if (targetDepth < shallowestTargetDepth) {
+ shallowestTargetDepth = targetDepth;
+ }
+ }
+
+ mCallback->Call(this, entries, *this);
+ mActiveTargets.Clear();
+ mHasSkippedTargets = false;
+ }
+
+ return shallowestTargetDepth;
+}
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObserverEntry)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObserverEntry)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObserverEntry)
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ResizeObserverEntry,
+ mTarget, mContentRect,
+ mOwner)
+
+already_AddRefed<ResizeObserverEntry>
+ResizeObserverEntry::Constructor(const GlobalObject& aGlobal,
+ Element* aTarget,
+ ErrorResult& aRv)
+{
+ RefPtr<ResizeObserverEntry> observerEntry =
+ new ResizeObserverEntry(aGlobal.GetAsSupports(), aTarget);
+ return observerEntry.forget();
+}
+
+void
+ResizeObserverEntry::SetContentRect(nsRect aRect)
+{
+ RefPtr<DOMRect> contentRect = new DOMRect(mTarget);
+ nsIFrame* frame = mTarget->GetPrimaryFrame();
+
+ if (frame) {
+ nsMargin padding = frame->GetUsedPadding();
+
+ // Per the spec, we need to include padding in contentRect of
+ // ResizeObserverEntry.
+ aRect.x = padding.left;
+ aRect.y = padding.top;
+ }
+
+ contentRect->SetLayoutRect(aRect);
+ mContentRect = contentRect.forget();
+}
+
+ResizeObserverEntry::~ResizeObserverEntry()
+{
+}
+
+NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ResizeObservation)
+ NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
+ NS_INTERFACE_MAP_ENTRY(nsISupports)
+NS_INTERFACE_MAP_END
+
+NS_IMPL_CYCLE_COLLECTING_ADDREF(ResizeObservation)
+NS_IMPL_CYCLE_COLLECTING_RELEASE(ResizeObservation)
+
+NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(ResizeObservation,
+ mTarget, mOwner)
+
+already_AddRefed<ResizeObservation>
+ResizeObservation::Constructor(const GlobalObject& aGlobal,
+ Element* aTarget,
+ ErrorResult& aRv)
+{
+ RefPtr<ResizeObservation> observation =
+ new ResizeObservation(aGlobal.GetAsSupports(), aTarget);
+ return observation.forget();
+}
+
+bool
+ResizeObservation::IsActive() const
+{
+ nsRect rect = GetTargetRect();
+ return (rect.width != mBroadcastWidth || rect.height != mBroadcastHeight);
+}
+
+void
+ResizeObservation::UpdateBroadcastSize(nsRect aRect)
+{
+ mBroadcastWidth = aRect.width;
+ mBroadcastHeight = aRect.height;
+}
+
+nsRect
+ResizeObservation::GetTargetRect() const
+{
+ nsRect rect;
+ nsIFrame* frame = mTarget->GetPrimaryFrame();
+
+ if (frame) {
+ if (mTarget->IsSVGElement()) {
+ gfxRect bbox = nsSVGUtils::GetBBox(frame);
+ rect.width = NSFloatPixelsToAppUnits(bbox.width, AppUnitsPerCSSPixel());
+ rect.height = NSFloatPixelsToAppUnits(bbox.height, AppUnitsPerCSSPixel());
+ } else {
+ // Per the spec, non-replaced inline Elements will always have an empty
+ // content rect.
+ if (frame->IsFrameOfType(nsIFrame::eReplaced) ||
+ !frame->IsFrameOfType(nsIFrame::eLineParticipant)) {
+ rect = frame->GetContentRectRelativeToSelf();
+ }
+ }
+ }
+
+ return rect;
+}
+
+ResizeObservation::~ResizeObservation()
+{
+}
+
+} // namespace dom
+} // namespace mozilla
diff --git a/dom/base/ResizeObserver.h b/dom/base/ResizeObserver.h new file mode 100644 index 000000000..2f56c580f --- /dev/null +++ b/dom/base/ResizeObserver.h @@ -0,0 +1,254 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+#ifndef mozilla_dom_ResizeObserver_h
+#define mozilla_dom_ResizeObserver_h
+
+#include "mozilla/dom/ResizeObserverBinding.h"
+
+namespace mozilla {
+namespace dom {
+
+/**
+ * ResizeObserver interfaces and algorithms are based on
+ * https://wicg.github.io/ResizeObserver/#api
+ */
+class ResizeObserver final
+ : public nsISupports
+ , public nsWrapperCache
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserver)
+
+ ResizeObserver(already_AddRefed<nsPIDOMWindowInner>&& aOwner,
+ ResizeObserverCallback& aCb)
+ : mOwner(aOwner)
+ , mCallback(&aCb)
+ {
+ MOZ_ASSERT(mOwner, "Need a non-null owner window");
+ }
+
+ static already_AddRefed<ResizeObserver>
+ Constructor(const GlobalObject& aGlobal,
+ ResizeObserverCallback& aCb,
+ ErrorResult& aRv);
+
+ JSObject* WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) override
+ {
+ return ResizeObserverBinding::Wrap(aCx, this, aGivenProto);
+ }
+
+ nsISupports* GetParentObject() const
+ {
+ return mOwner;
+ }
+
+ void Observe(Element* aTarget, ErrorResult& aRv);
+
+ void Unobserve(Element* aTarget, ErrorResult& aRv);
+
+ void Disconnect();
+
+ /*
+ * Gather all observations which have an observed target with size changed
+ * since last BroadcastActiveObservations() in this ResizeObserver.
+ * An observation will be skipped if the depth of its observed target is less
+ * or equal than aDepth. All gathered observations will be added to
+ * mActiveTargets.
+ */
+ void GatherActiveObservations(uint32_t aDepth);
+
+ /*
+ * Returns whether this ResizeObserver has any active observations
+ * since last GatherActiveObservations().
+ */
+ bool HasActiveObservations() const;
+
+ /*
+ * Returns whether this ResizeObserver has any skipped observations
+ * since last GatherActiveObservations().
+ */
+ bool HasSkippedObservations() const;
+
+ /*
+ * Deliver the callback function in JavaScript for all active observations
+ * and pass the sequence of ResizeObserverEntry so JavaScript can access them.
+ * The broadcast size of observations will be updated and mActiveTargets will
+ * be cleared. It also returns the shallowest depth of elements from active
+ * observations or UINT32_MAX if there is no any active observations.
+ */
+ uint32_t BroadcastActiveObservations();
+
+protected:
+ ~ResizeObserver()
+ {
+ mObservationList.clear();
+ }
+
+ nsCOMPtr<nsPIDOMWindowInner> mOwner;
+ RefPtr<ResizeObserverCallback> mCallback;
+ nsTArray<RefPtr<ResizeObservation>> mActiveTargets;
+ bool mHasSkippedTargets;
+
+ // Combination of HashTable and LinkedList so we can iterate through
+ // the elements of HashTable in order of insertion time.
+ // Will be nice if we have our own data structure for this in the future.
+ nsRefPtrHashtable<nsPtrHashKey<Element>, ResizeObservation> mObservationMap;
+ LinkedList<ResizeObservation> mObservationList;
+};
+
+/**
+ * ResizeObserverEntry is the entry that contains the information for observed
+ * elements. This object is the one that visible to JavaScript in callback
+ * function that is fired by ResizeObserver.
+ */
+class ResizeObserverEntry final
+ : public nsISupports
+ , public nsWrapperCache
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObserverEntry)
+
+ ResizeObserverEntry(nsISupports* aOwner, Element* aTarget)
+ : mOwner(aOwner)
+ , mTarget(aTarget)
+ {
+ MOZ_ASSERT(mOwner, "Need a non-null owner");
+ MOZ_ASSERT(mTarget, "Need a non-null target element");
+ }
+
+ static already_AddRefed<ResizeObserverEntry>
+ Constructor(const GlobalObject& aGlobal,
+ Element* aTarget,
+ ErrorResult& aRv);
+
+ JSObject* WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) override
+ {
+ return ResizeObserverEntryBinding::Wrap(aCx, this,
+ aGivenProto);
+ }
+
+ nsISupports* GetParentObject() const
+ {
+ return mOwner;
+ }
+
+ Element* Target() const
+ {
+ return mTarget;
+ }
+
+ /*
+ * Returns the DOMRectReadOnly of target's content rect so it can be
+ * accessed from JavaScript in callback function of ResizeObserver.
+ */
+ DOMRectReadOnly* GetContentRect() const
+ {
+ return mContentRect;
+ }
+
+ void SetContentRect(nsRect aRect);
+
+protected:
+ ~ResizeObserverEntry();
+
+ nsCOMPtr<nsISupports> mOwner;
+ nsCOMPtr<Element> mTarget;
+ RefPtr<DOMRectReadOnly> mContentRect;
+};
+
+/**
+ * We use ResizeObservation to store and sync the size information of one
+ * observed element so we can decide whether an observation should be fired
+ * or not.
+ */
+class ResizeObservation final
+ : public nsISupports
+ , public nsWrapperCache
+ , public LinkedListElement<ResizeObservation>
+{
+public:
+ NS_DECL_CYCLE_COLLECTING_ISUPPORTS
+ NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ResizeObservation)
+
+ ResizeObservation(nsISupports* aOwner, Element* aTarget)
+ : mOwner(aOwner)
+ , mTarget(aTarget)
+ , mBroadcastWidth(0)
+ , mBroadcastHeight(0)
+ {
+ MOZ_ASSERT(mOwner, "Need a non-null owner");
+ MOZ_ASSERT(mTarget, "Need a non-null target element");
+ }
+
+ static already_AddRefed<ResizeObservation>
+ Constructor(const GlobalObject& aGlobal,
+ Element* aTarget,
+ ErrorResult& aRv);
+
+ JSObject* WrapObject(JSContext* aCx,
+ JS::Handle<JSObject*> aGivenProto) override
+ {
+ return ResizeObservationBinding::Wrap(aCx, this, aGivenProto);
+ }
+
+ nsISupports* GetParentObject() const
+ {
+ return mOwner;
+ }
+
+ Element* Target() const
+ {
+ return mTarget;
+ }
+
+ nscoord BroadcastWidth() const
+ {
+ return mBroadcastWidth;
+ }
+
+ nscoord BroadcastHeight() const
+ {
+ return mBroadcastHeight;
+ }
+
+ /*
+ * Returns whether the observed target element size differs from current
+ * BroadcastWidth and BroadcastHeight
+ */
+ bool IsActive() const;
+
+ /*
+ * Update current BroadcastWidth and BroadcastHeight with size from aRect.
+ */
+ void UpdateBroadcastSize(nsRect aRect);
+
+ /*
+ * Returns the target's rect in the form of nsRect.
+ * If the target is SVG, width and height are determined from bounding box.
+ */
+ nsRect GetTargetRect() const;
+
+protected:
+ ~ResizeObservation();
+
+ nsCOMPtr<nsISupports> mOwner;
+ nsCOMPtr<Element> mTarget;
+
+ // Broadcast width and broadcast height are the latest recorded size
+ // of observed target.
+ nscoord mBroadcastWidth;
+ nscoord mBroadcastHeight;
+};
+
+} // namespace dom
+} // namespace mozilla
+
+#endif // mozilla_dom_ResizeObserver_h
+
diff --git a/dom/base/ResizeObserverController.cpp b/dom/base/ResizeObserverController.cpp new file mode 100644 index 000000000..924bba10d --- /dev/null +++ b/dom/base/ResizeObserverController.cpp @@ -0,0 +1,234 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#include "mozilla/dom/ResizeObserverController.h" +#include "mozilla/dom/Element.h" +#include "mozilla/dom/ErrorEvent.h" +#include "nsIPresShell.h" +#include "nsPresContext.h" + +namespace mozilla { +namespace dom { + +void +ResizeObserverNotificationHelper::WillRefresh(TimeStamp aTime) +{ + MOZ_ASSERT(mOwner, "Why is mOwner already dead when this RefreshObserver is still registered?"); + if (mOwner) { + mOwner->Notify(); + } +} + +nsRefreshDriver* +ResizeObserverNotificationHelper::GetRefreshDriver() const +{ + nsIPresShell* presShell = mOwner->GetShell(); + if (MOZ_UNLIKELY(!presShell)) { + return nullptr; + } + + nsPresContext* presContext = presShell->GetPresContext(); + if (MOZ_UNLIKELY(!presContext)) { + return nullptr; + } + + return presContext->RefreshDriver(); +} + +void +ResizeObserverNotificationHelper::Register() +{ + if (mRegistered) { + return; + } + + nsRefreshDriver* refreshDriver = GetRefreshDriver(); + if (!refreshDriver) { + // We maybe navigating away from this page or currently in an iframe with + // display: none. Just abort the Register(), no need to do notification. + return; + } + + refreshDriver->AddRefreshObserver(this, Flush_Display); + mRegistered = true; +} + +void +ResizeObserverNotificationHelper::Unregister() +{ + if (!mRegistered) { + return; + } + + nsRefreshDriver* refreshDriver = GetRefreshDriver(); + if (!refreshDriver) { + // We can't access RefreshDriver now. Just abort the Unregister(). + return; + } + + refreshDriver->RemoveRefreshObserver(this, Flush_Display); + mRegistered = false; +} + +void +ResizeObserverNotificationHelper::Disconnect() +{ + Unregister(); + // Our owner is dying. Clear our pointer to it, in case we outlive it. + mOwner = nullptr; +} + +ResizeObserverNotificationHelper::~ResizeObserverNotificationHelper() +{ + Unregister(); +} + +void +ResizeObserverController::Traverse(nsCycleCollectionTraversalCallback& aCb) +{ + ImplCycleCollectionTraverse(aCb, mResizeObservers, "mResizeObservers"); +} + +void +ResizeObserverController::Unlink() +{ + mResizeObservers.Clear(); +} + +void +ResizeObserverController::AddResizeObserver(ResizeObserver* aObserver) +{ + MOZ_ASSERT(aObserver, "AddResizeObserver() should never be called with " + "a null parameter"); + mResizeObservers.AppendElement(aObserver); +} + +void +ResizeObserverController::Notify() +{ + if (mResizeObservers.IsEmpty()) { + return; + } + + uint32_t shallowestTargetDepth = 0; + + GatherAllActiveObservations(shallowestTargetDepth); + + while (HasAnyActiveObservations()) { + DebugOnly<uint32_t> oldShallowestTargetDepth = shallowestTargetDepth; + shallowestTargetDepth = BroadcastAllActiveObservations(); + NS_ASSERTION(oldShallowestTargetDepth < shallowestTargetDepth, + "shallowestTargetDepth should be getting strictly deeper"); + + // Flush layout, so that any callback functions' style changes / resizes + // get a chance to take effect. + mDocument->FlushPendingNotifications(Flush_Layout); + + // To avoid infinite resize loop, we only gather all active observations + // that have the depth of observed target element more than current + // shallowestTargetDepth. + GatherAllActiveObservations(shallowestTargetDepth); + } + + mResizeObserverNotificationHelper->Unregister(); + + // Per spec, we deliver an error if the document has any skipped observations. + if (HasAnySkippedObservations()) { + RootedDictionary<ErrorEventInit> init(RootingCx()); + + init.mMessage.AssignLiteral("ResizeObserver loop completed with undelivered" + " notifications."); + init.mCancelable = true; + init.mBubbles = true; + + nsEventStatus status = nsEventStatus_eIgnore; + + nsCOMPtr<nsPIDOMWindowInner> window = + mDocument->GetWindow()->GetCurrentInnerWindow(); + + if (window) { + nsCOMPtr<nsIScriptGlobalObject> sgo = do_QueryInterface(window); + MOZ_ASSERT(sgo); + + if (NS_WARN_IF(NS_FAILED(sgo->HandleScriptError(init, &status)))) { + status = nsEventStatus_eIgnore; + } + } else { + // We don't fire error events at any global for non-window JS on the main + // thread. + } + + // We need to deliver pending notifications in next cycle. + ScheduleNotification(); + } +} + +void +ResizeObserverController::GatherAllActiveObservations(uint32_t aDepth) +{ + for (auto observer : mResizeObservers) { + observer->GatherActiveObservations(aDepth); + } +} + +uint32_t +ResizeObserverController::BroadcastAllActiveObservations() +{ + uint32_t shallowestTargetDepth = UINT32_MAX; + + for (auto observer : mResizeObservers) { + + uint32_t targetDepth = observer->BroadcastActiveObservations(); + + if (targetDepth < shallowestTargetDepth) { + shallowestTargetDepth = targetDepth; + } + } + + return shallowestTargetDepth; +} + +bool +ResizeObserverController::HasAnyActiveObservations() const +{ + for (auto observer : mResizeObservers) { + if (observer->HasActiveObservations()) { + return true; + } + } + return false; +} + +bool +ResizeObserverController::HasAnySkippedObservations() const +{ + for (auto observer : mResizeObservers) { + if (observer->HasSkippedObservations()) { + return true; + } + } + return false; +} + +void +ResizeObserverController::ScheduleNotification() +{ + mResizeObserverNotificationHelper->Register(); +} + +nsIPresShell* +ResizeObserverController::GetShell() const +{ + return mDocument->GetShell(); +} + +ResizeObserverController::~ResizeObserverController() +{ + mResizeObserverNotificationHelper->Disconnect(); +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/base/ResizeObserverController.h b/dom/base/ResizeObserverController.h new file mode 100644 index 000000000..a77511587 --- /dev/null +++ b/dom/base/ResizeObserverController.h @@ -0,0 +1,129 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_ResizeObserverController_h +#define mozilla_dom_ResizeObserverController_h + +#include "mozilla/dom/ResizeObserver.h" +#include "mozilla/TimeStamp.h" +#include "nsRefreshDriver.h" + +namespace mozilla { +namespace dom { + +class ResizeObserverController; + +/* + * ResizeObserverNotificationHelper will trigger ResizeObserver notifications + * by registering with the Refresh Driver. +*/ +class ResizeObserverNotificationHelper final : public nsARefreshObserver +{ +public: + NS_INLINE_DECL_REFCOUNTING(ResizeObserverNotificationHelper, override) + + explicit ResizeObserverNotificationHelper(ResizeObserverController* aOwner) + : mOwner(aOwner) + , mRegistered(false) + { + MOZ_ASSERT(mOwner, "Need a non-null owner"); + } + + void WillRefresh(TimeStamp aTime) override; + + nsRefreshDriver* GetRefreshDriver() const; + + void Register(); + + void Unregister(); + + void Disconnect(); + +protected: + virtual ~ResizeObserverNotificationHelper(); + + ResizeObserverController* mOwner; + bool mRegistered; +}; + +/* + * ResizeObserverController contains the list of ResizeObservers and controls + * the flow of notification. +*/ +class ResizeObserverController final +{ +public: + explicit ResizeObserverController(nsIDocument* aDocument) + : mDocument(aDocument) + , mIsNotificationActive(false) + { + MOZ_ASSERT(mDocument, "Need a non-null document"); + mResizeObserverNotificationHelper = + new ResizeObserverNotificationHelper(this); + } + + // Methods for supporting cycle-collection + void Traverse(nsCycleCollectionTraversalCallback& aCb); + void Unlink(); + + void AddResizeObserver(ResizeObserver* aObserver); + + /* + * Schedule the notification via ResizeObserverNotificationHelper refresh + * observer. + */ + void ScheduleNotification(); + + /* + * Notify all ResizeObservers by gathering and broadcasting all active + * observations. + */ + void Notify(); + + nsIPresShell* GetShell() const; + + ~ResizeObserverController(); + +private: + /* + * Calls GatherActiveObservations(aDepth) for all ResizeObservers in this + * controller. All observations in each ResizeObserver with element's depth + * more than aDepth will be gathered. + */ + void GatherAllActiveObservations(uint32_t aDepth); + + /* + * Calls BroadcastActiveObservations() for all ResizeObservers in this + * controller. It also returns the shallowest depth of observed target + * elements from all ResizeObserver or UINT32_MAX if there is no any + * active obsevations at all. + */ + uint32_t BroadcastAllActiveObservations(); + + /* + * Returns whether there is any ResizeObserver that has active observations. + */ + bool HasAnyActiveObservations() const; + + /* + * Returns whether there is any ResizeObserver that has skipped observations. + */ + bool HasAnySkippedObservations() const; + +protected: + // Raw pointer is OK because mDocument strongly owns us & hence must outlive + // us. + nsIDocument* const mDocument; + + RefPtr<ResizeObserverNotificationHelper> mResizeObserverNotificationHelper; + nsTArray<RefPtr<ResizeObserver>> mResizeObservers; + bool mIsNotificationActive; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_ResizeObserverController_h diff --git a/dom/base/WindowNamedPropertiesHandler.h b/dom/base/WindowNamedPropertiesHandler.h index 227d8c946..cafeadb85 100644 --- a/dom/base/WindowNamedPropertiesHandler.h +++ b/dom/base/WindowNamedPropertiesHandler.h @@ -15,7 +15,7 @@ namespace dom { class WindowNamedPropertiesHandler : public BaseDOMProxyHandler { public: - constexpr WindowNamedPropertiesHandler() + WindowNamedPropertiesHandler() : BaseDOMProxyHandler(nullptr, /* hasPrototype = */ true) { } diff --git a/dom/base/crashtests/1251361.html b/dom/base/crashtests/1251361.html deleted file mode 100644 index 57c76121f..000000000 --- a/dom/base/crashtests/1251361.html +++ /dev/null @@ -1,33 +0,0 @@ -<!DOCTYPE html> -<html> -<head> -<meta charset="UTF-8"> -<script> - -var frameRoot; - -function boom() -{ - var frameWin = f.contentWindow; - frameRoot = frameWin.document.documentElement; - frameWin.location.replace("data:text/html;charset=UTF-8,<body onload='parent.g();'>2"); -} - -function g() -{ - setTimeout(h, 0); -} - -function h() -{ - var newDoc = document.implementation.createDocument('', '', null); - newDoc.adoptNode(frameRoot); -} - -</script> -<body onload="boom();"> - -<iframe id="f" src="data:text/html;charset=UTF-8,<marquee>1"></iframe> - -</body> -</html> diff --git a/dom/base/crashtests/371466-1.xhtml b/dom/base/crashtests/371466-1.xhtml deleted file mode 100644 index 8da0b22b1..000000000 --- a/dom/base/crashtests/371466-1.xhtml +++ /dev/null @@ -1,24 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml" class="reftest-wait"> -<head> -<script> - -function boom() -{ - var marquee = document.getElementById("marquee"); - var span = document.getElementById("span"); - marquee.appendChild(span); - marquee.removeChild(span); - document.documentElement.removeAttribute("class"); -} - -</script> -</head> - -<body onload="setTimeout(boom, 30);"> - -<marquee id="marquee" /> - -<span id="span"><div>Foo</div><textarea/></span> - -</body> -</html> diff --git a/dom/base/crashtests/535926-1.html b/dom/base/crashtests/535926-1.html deleted file mode 100644 index bddd8dc28..000000000 --- a/dom/base/crashtests/535926-1.html +++ /dev/null @@ -1,28 +0,0 @@ -<html class="reftest-wait"> -<head> - -<script type="text/javascript"> - -var i = 0; -function mmf() -{ - if (++i == 2) { - document.body.innerHTML = "<marquee>"; - document.documentElement.removeAttribute("class"); - } -} - -function init() -{ - document.documentElement.offsetHeight; - for (var j = 0; j < 2; ++j) { - var iframe = document.createElementNS("http://www.w3.org/1999/xhtml", "iframe"); - iframe.addEventListener("load", mmf, false); - document.body.appendChild(iframe); - } -} - -</script> -</head> -<body onload="setTimeout(init, 0);"></body> -</html> diff --git a/dom/base/moz.build b/dom/base/moz.build index 1de49424b..65e3c3d76 100755 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -202,6 +202,8 @@ EXPORTS.mozilla.dom += [ 'PartialSHistory.h', 'Pose.h', 'ProcessGlobal.h', + 'ResizeObserver.h', + 'ResizeObserverController.h', 'ResponsiveImageSelector.h', 'SameProcessMessageQueue.h', 'ScreenOrientation.h', @@ -347,6 +349,8 @@ SOURCES += [ 'Pose.cpp', 'PostMessageEvent.cpp', 'ProcessGlobal.cpp', + 'ResizeObserver.cpp', + 'ResizeObserverController.cpp', 'ResponsiveImageSelector.cpp', 'SameProcessMessageQueue.cpp', 'ScreenOrientation.cpp', diff --git a/dom/base/nsAttrValue.h b/dom/base/nsAttrValue.h index 23f61a614..33ee91afd 100644 --- a/dom/base/nsAttrValue.h +++ b/dom/base/nsAttrValue.h @@ -268,7 +268,7 @@ public: // EnumTable can be initialized either with an int16_t value // or a value of an enumeration type that can fit within an int16_t. - constexpr EnumTable(const char* aTag, int16_t aValue) + EnumTable(const char* aTag, int16_t aValue) : tag(aTag) , value(aValue) { @@ -276,7 +276,7 @@ public: template<typename T, typename = typename std::enable_if<std::is_enum<T>::value>::type> - constexpr EnumTable(const char* aTag, T aValue) + EnumTable(const char* aTag, T aValue) : tag(aTag) , value(static_cast<int16_t>(aValue)) { diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 1a3f5b5ca..ffe50a015 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -9843,4 +9843,18 @@ nsContentUtils::IsLocalRefURL(const nsString& aString) } return false; -}
\ No newline at end of file +} + +/* static */ uint32_t +nsContentUtils::GetNodeDepth(nsINode* aNode) +{ + uint32_t depth = 1; + + MOZ_ASSERT(aNode, "Node shouldn't be null"); + + while ((aNode = aNode->GetParentNode())) { + ++depth; + } + + return depth; +} diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index ffbd15e78..08587b5e4 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2745,6 +2745,14 @@ public: static bool IsLocalRefURL(const nsString& aString); + /** + * Returns the length of the parent-traversal path (in terms of the number of + * nodes) to an unparented/root node from aNode. An unparented/root node is + * considered to have a depth of 1, its children have a depth of 2, etc. + * aNode is expected to be non-null. + */ + static uint32_t GetNodeDepth(nsINode* aNode); + private: static bool InitializeEventTable(); diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index de793bfab..0b07ef4ec 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1727,6 +1727,10 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsDocument) cb.NoteXPCOMChild(mql); } } + + if (tmp->mResizeObserverController) { + tmp->mResizeObserverController->Traverse(cb); + } NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_CLASS(nsDocument) @@ -1827,11 +1831,15 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) l != &tmp->mDOMMediaQueryLists; ) { PRCList *next = PR_NEXT_LINK(l); MediaQueryList *mql = static_cast<MediaQueryList*>(l); - mql->RemoveAllListeners(); + mql->Disconnect(); l = next; } tmp->mInUnlinkOrDeletion = false; + + if (tmp->mResizeObserverController) { + tmp->mResizeObserverController->Unlink(); + } NS_IMPL_CYCLE_COLLECTION_UNLINK_END nsresult @@ -12105,6 +12113,24 @@ nsDocument::QuerySelectorAll(const nsAString& aSelector, nsIDOMNodeList **aRetur return nsINode::QuerySelectorAll(aSelector, aReturn); } +void +nsDocument::AddResizeObserver(ResizeObserver* aResizeObserver) +{ + if (!mResizeObserverController) { + mResizeObserverController = MakeUnique<ResizeObserverController>(this); + } + + mResizeObserverController->AddResizeObserver(aResizeObserver); +} + +void +nsDocument::ScheduleResizeObserversNotification() const +{ + if (mResizeObserverController) { + mResizeObserverController->ScheduleNotification(); + } +} + already_AddRefed<nsIDocument> nsIDocument::Constructor(const GlobalObject& aGlobal, ErrorResult& rv) diff --git a/dom/base/nsDocument.h b/dom/base/nsDocument.h index a319ad13e..220f4152d 100644 --- a/dom/base/nsDocument.h +++ b/dom/base/nsDocument.h @@ -59,6 +59,7 @@ #include "mozilla/MemoryReporting.h" #include "mozilla/PendingAnimationTracker.h" #include "mozilla/dom/DOMImplementation.h" +#include "mozilla/dom/ResizeObserverController.h" #include "mozilla/dom/ScriptLoader.h" #include "mozilla/dom/StyleSheetList.h" #include "nsDataHashtable.h" @@ -1206,6 +1207,10 @@ public: virtual void UnblockDOMContentLoaded() override; + void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) override; + + void ScheduleResizeObserversNotification() const override; + protected: friend class nsNodeUtils; friend class nsDocumentOnStack; @@ -1342,6 +1347,9 @@ protected: nsTArray<nsIObserver*> mCharSetObservers; + mozilla::UniquePtr<mozilla::dom::ResizeObserverController> + mResizeObserverController; + PLDHashTable *mSubDocuments; // Array of owning references to all children diff --git a/dom/base/nsGkAtomList.h b/dom/base/nsGkAtomList.h index 96f5acf3a..22869bd66 100644 --- a/dom/base/nsGkAtomList.h +++ b/dom/base/nsGkAtomList.h @@ -580,7 +580,6 @@ GK_ATOM(marginTop, "margin-top") GK_ATOM(marginheight, "marginheight") GK_ATOM(marginwidth, "marginwidth") GK_ATOM(mark, "mark") -GK_ATOM(marquee, "marquee") GK_ATOM(match, "match") GK_ATOM(max, "max") GK_ATOM(maxheight, "maxheight") diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index d696d826b..1c098897b 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -956,7 +956,7 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(DialogValueHolder) class nsOuterWindowProxy : public js::Wrapper { public: - constexpr nsOuterWindowProxy() : js::Wrapper(0) { } + nsOuterWindowProxy() : js::Wrapper(0) { } virtual bool finalizeInBackground(const JS::Value& priv) const override { return false; @@ -1407,7 +1407,7 @@ nsOuterWindowProxy::singleton; class nsChromeOuterWindowProxy : public nsOuterWindowProxy { public: - constexpr nsChromeOuterWindowProxy() : nsOuterWindowProxy() { } + nsChromeOuterWindowProxy() : nsOuterWindowProxy() { } virtual const char *className(JSContext *cx, JS::Handle<JSObject*> wrapper) const override; diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 29afa5439..760048501 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -152,6 +152,7 @@ class ProcessingInstruction; class Promise; class Selection; class ScriptLoader; +class ResizeObserver; class StyleSheetList; class SVGDocument; class SVGSVGElement; @@ -2874,6 +2875,10 @@ public: bool ModuleScriptsEnabled(); + virtual void AddResizeObserver(mozilla::dom::ResizeObserver* aResizeObserver) = 0; + + virtual void ScheduleResizeObserversNotification() const = 0; + protected: bool GetUseCounter(mozilla::UseCounter aUseCounter) { diff --git a/dom/base/nsJSEnvironment.cpp b/dom/base/nsJSEnvironment.cpp index 605b1917f..0411bee80 100644 --- a/dom/base/nsJSEnvironment.cpp +++ b/dom/base/nsJSEnvironment.cpp @@ -1161,7 +1161,7 @@ TimeUntilNow(TimeStamp start) struct CycleCollectorStats { - constexpr CycleCollectorStats() : + CycleCollectorStats() : mMaxGCDuration(0), mRanSyncForgetSkippable(false), mSuspected(0), mMaxSkippableDuration(0), mMaxSliceTime(0), mMaxSliceTimeSinceClear(0), mTotalSliceTime(0), mAnyLockedOut(false), mExtraForgetSkippableCalls(0), diff --git a/dom/base/test/test_bug840098.html b/dom/base/test/test_bug840098.html index 8eaceb589..e9275d55b 100644 --- a/dom/base/test/test_bug840098.html +++ b/dom/base/test/test_bug840098.html @@ -15,7 +15,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=840098 <div id="content" style="display: none"> <div id="foo"></div> </div> -<marquee id="m">Hello</marquee> +<div id="m">Hello</div> <pre id="test"> <script type="application/javascript"> diff --git a/dom/base/test/test_caretPositionFromPoint.html b/dom/base/test/test_caretPositionFromPoint.html index 50f12b1ef..054f73227 100644 --- a/dom/base/test/test_caretPositionFromPoint.html +++ b/dom/base/test/test_caretPositionFromPoint.html @@ -115,7 +115,7 @@ <div id="a" contenteditable><span id="test1">abc, abc, abc</span><br> <span id="test2" style="color: blue;">abc, abc, abc</span><br> <textarea id="test3">abc</textarea><input id="test4" value="abcdef"><br><br> -<marquee>marquee</marquee> +<div>div</div> </div> <input id="test5" value="The rabbit-hole went straight on like a tunnel for some way, and then dipped suddenly down, so suddenly that Alice had not a moment to think about stopping herself before she found herself falling down a very deep well. Either the well was very deep, or she fell very slowly, for she had plenty of time as she went down to look about her and to wonder what was going to happen next. First, she tried to look down and make out what she was coming to, but it was too dark to see anything; then she looked at the sides of the well, and noticed that they were filled with cupboards and book-shelves; here and there she saw maps and pictures hung upon pegs. She took down a jar from one of the shelves as she passed; it was labelled `ORANGE MARMALADE', but to her great disappointment it was empty: she did not like to drop the jar for fear of killing somebody, so managed to put it into one of the cupboards as she fell past it." type="text"> <input id="test6" type="number" style="width:150px; height:57px;" value="31415"><br> diff --git a/dom/base/test/test_mutationobservers.html b/dom/base/test/test_mutationobservers.html deleted file mode 100644 index a6de89595..000000000 --- a/dom/base/test/test_mutationobservers.html +++ /dev/null @@ -1,913 +0,0 @@ -<!DOCTYPE HTML> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=641821 ---> -<head> - <meta charset="utf-8"> - <title>Test for Bug 641821</title> - <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> -</head> -<body onload="runTest()"> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=641821">Mozilla Bug 641821</a> -<p id="display"></p> -<div id="content" style="display: none"> - -</div> -<pre id="test"> -<script type="application/javascript"> - -/** Test for Bug 641821 **/ - -SimpleTest.requestFlakyTimeout("requestFlakyTimeout is silly. (But make sure marquee has time to initialize itself.)"); - -var div = document.createElement("div"); - -var M; -if ("MozMutationObserver" in window) { - M = window.MozMutationObserver; -} else if ("WebKitMutationObserver" in window) { - M = window.WebKitMutationObserver; -} else { - M = window.MutationObserver; -} - -function log(str) { - var d = document.createElement("div"); - d.textContent = str; - if (str.indexOf("PASSED") >= 0) { - d.setAttribute("style", "color: green;"); - } else { - d.setAttribute("style", "color: red;"); - } - document.getElementById("log").appendChild(d); -} - -// Some helper functions so that this test runs also outside mochitest. -if (!("ok" in window)) { - window.ok = function(val, str) { - log(str + (val ? " PASSED\n" : " FAILED\n")); - } -} - -if (!("is" in window)) { - window.is = function(val, refVal, str) { - log(str + (val == refVal? " PASSED " : " FAILED ") + - (val != refVal ? "expected " + refVal + " got " + val + "\n" : "\n")); - } -} - -if (!("isnot" in window)) { - window.isnot = function(val, refVal, str) { - log(str + (val != refVal? " PASSED " : " FAILED ") + - (val == refVal ? "Didn't expect " + refVal + "\n" : "\n")); - } -} - -if (!("SimpleTest" in window)) { - window.SimpleTest = - { - finish: function() { - document.getElementById("log").appendChild(document.createTextNode("DONE")); - }, - waitForExplicitFinish: function() {} - } -} - -function then(thenFn) { - setTimeout(function() { - if (thenFn) { - setTimeout(thenFn, 0); - } else { - SimpleTest.finish(); - } - }, 0); -} - -var m; -var m2; -var m3; -var m4; - -// Checks basic parameter validation and normal 'this' handling. -// Tests also basic attribute handling. -function runTest() { - m = new M(function(){}); - ok(m, "MutationObserver supported"); - - var e = null; - try { - m.observe(document, {}); - } catch (ex) { - e = ex; - } - ok(e, "Should have thrown an exception"); - is(e.name, "TypeError", "Should have thrown TypeError"); - - e = null; - try { - m.observe(document, { childList: true, attributeOldValue: true }); - } catch (ex) { - e = ex; - } - ok(!e, "Shouldn't have thrown an exception"); - - e = null; - try { - m.observe(document, { childList: true, attributeFilter: ["foo"] }); - } catch (ex) { - e = ex; - } - ok(!e, "Shouldn't have thrown an exception"); - - e = null; - try { - m.observe(document, { childList: true, characterDataOldValue: true }); - } catch (ex) { - e = ex; - } - ok(!e, "Shouldn't have thrown an exception"); - - e = null; - try { - m.observe(document); - } catch (ex) { - e = ex; - } - ok(e, "Should have thrown an exception"); - - m = new M(function(records, observer) { - is(observer, m, "2nd parameter should be the mutation observer"); - is(observer, this, "2nd parameter should be 'this'"); - is(records.length, 1, "Should have one record."); - is(records[0].type, "attributes", "Should have got attributes record"); - is(records[0].target, div, "Should have got div as target"); - is(records[0].attributeName, "foo", "Should have got record about foo attribute"); - observer.disconnect(); - then(testThisBind); - m = null; - }); - m.observe(div, { attributes: true, attributeFilter: ["foo"] }); - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true); - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter.length, 1) - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeFilter[0], "foo") - div.setAttribute("foo", "bar"); -} - -// 'this' handling when fn.bind() is used. -function testThisBind() { - var child = div.appendChild(document.createElement("div")); - var gchild = child.appendChild(document.createElement("div")); - m = new M((function(records, observer) { - is(observer, m, "2nd parameter should be the mutation observer"); - isnot(observer, this, "2nd parameter should be 'this'"); - is(records.length, 3, "Should have one record."); - is(records[0].type, "attributes", "Should have got attributes record"); - is(records[0].target, div, "Should have got div as target"); - is(records[0].attributeName, "foo", "Should have got record about foo attribute"); - is(records[0].oldValue, "bar", "oldValue should be bar"); - is(records[1].type, "attributes", "Should have got attributes record"); - is(records[1].target, div, "Should have got div as target"); - is(records[1].attributeName, "foo", "Should have got record about foo attribute"); - is(records[1].oldValue, "bar2", "oldValue should be bar2"); - is(records[2].type, "attributes", "Should have got attributes record"); - is(records[2].target, gchild, "Should have got div as target"); - is(records[2].attributeName, "foo", "Should have got record about foo attribute"); - is(records[2].oldValue, null, "oldValue should be bar2"); - observer.disconnect(); - then(testCharacterData); - m = null; - }).bind(window)); - m.observe(div, { attributes: true, attributeOldValue: true, subtree: true }); - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributes, true) - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].attributeOldValue, true) - is(SpecialPowers.wrap(div).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true) - div.setAttribute("foo", "bar2"); - div.removeAttribute("foo"); - div.removeChild(child); - child.removeChild(gchild); - div.appendChild(gchild); - div.removeChild(gchild); - gchild.setAttribute("foo", "bar"); -} - -function testCharacterData() { - m = new M(function(records, observer) { - is(records[0].type, "characterData", "Should have got characterData"); - is(records[0].oldValue, null, "Shouldn't have got oldData"); - observer.disconnect(); - m = null; - }); - m2 = new M(function(records, observer) { - is(records[0].type, "characterData", "Should have got characterData"); - is(records[0].oldValue, "foo", "Should have got oldData"); - observer.disconnect(); - m2 = null; - }); - m3 = new M(function(records, observer) { - ok(false, "This should not be called!"); - observer.disconnect(); - m3 = null; - }); - m4 = new M(function(records, observer) { - is(records[0].oldValue, null, "Shouldn't have got oldData"); - observer.disconnect(); - m3.disconnect(); - m3 = null; - then(testChildList); - m4 = null; - }); - - div.appendChild(document.createTextNode("foo")); - m.observe(div, { characterData: true, subtree: true }); - m2.observe(div, { characterData: true, characterDataOldValue: true, subtree: true}); - // If observing the same node twice, only the latter option should apply. - m3.observe(div, { characterData: true, subtree: true }); - m3.observe(div, { characterData: true, subtree: false }); - m4.observe(div.firstChild, { characterData: true, subtree: false }); - - is(SpecialPowers.wrap(div).getBoundMutationObservers().length, 3) - is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].characterData, true) - is(SpecialPowers.wrap(div).getBoundMutationObservers()[2].getObservingInfo()[0].subtree, false) - - div.firstChild.data = "bar"; -} - -function testChildList() { - var fc = div.firstChild; - m = new M(function(records, observer) { - is(records[0].type, "childList", "Should have got childList"); - is(records[0].addedNodes.length, 0, "Shouldn't have got addedNodes"); - is(records[0].removedNodes.length, 1, "Should have got removedNodes"); - is(records[0].removedNodes[0], fc, "Should have removed a text node"); - observer.disconnect(); - then(testChildList2); - m = null; - }); - m.observe(div, { childList: true}); - div.removeChild(div.firstChild); -} - -function testChildList2() { - div.innerHTML = "<span>1</span><span>2</span>"; - m = new M(function(records, observer) { - is(records[0].type, "childList", "Should have got childList"); - is(records[0].removedNodes.length, 2, "Should have got removedNodes"); - is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - observer.disconnect(); - then(testChildList3); - m = null; - }); - m.observe(div, { childList: true }); - div.innerHTML = "<span><span>foo</span></span>"; -} - -function testChildList3() { - m = new M(function(records, observer) { - is(records[0].type, "childList", "Should have got childList"); - is(records[0].removedNodes.length, 1, "Should have got removedNodes"); - is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - observer.disconnect(); - then(testChildList4); - m = null; - }); - m.observe(div, { childList: true }); - div.textContent = "hello"; -} - -function testChildList4() { - div.textContent = null; - var df = document.createDocumentFragment(); - var t1 = df.appendChild(document.createTextNode("Hello ")); - var t2 = df.appendChild(document.createTextNode("world!")); - var s1 = div.appendChild(document.createElement("span")); - s1.textContent = "foo"; - var s2 = div.appendChild(document.createElement("span")); - function callback(records, observer) { - is(records.length, 3, "Should have got one record for removing nodes from document fragment and one record for adding them to div"); - is(records[0].removedNodes.length, 2, "Should have got removedNodes"); - is(records[0].removedNodes[0], t1, "Should be the 1st textnode"); - is(records[0].removedNodes[1], t2, "Should be the 2nd textnode"); - is(records[1].addedNodes.length, 2, "Should have got addedNodes"); - is(records[1].addedNodes[0], t1, "Should be the 1st textnode"); - is(records[1].addedNodes[1], t2, "Should be the 2nd textnode"); - is(records[1].previousSibling, s1, "Should have previousSibling"); - is(records[1].nextSibling, s2, "Should have nextSibling"); - is(records[2].type, "characterData", "3rd record should be characterData"); - is(records[2].target, t1, "target should be the textnode"); - is(records[2].oldValue, "Hello ", "oldValue was 'Hello '"); - observer.disconnect(); - then(testChildList5); - m = null; - }; - m = new M(callback); - m.observe(df, { childList: true, characterData: true, characterDataOldValue: true, subtree: true }); - is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].childList, true) - is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterData, true) - is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].characterDataOldValue, true) - is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo()[0].subtree, true) - ok(SpecialPowers.compare(SpecialPowers.wrap(df).getBoundMutationObservers()[0].mutationCallback, callback)) - m.observe(div, { childList: true }); - is(SpecialPowers.wrap(df).getBoundMutationObservers()[0].getObservingInfo().length, 2) - - // Make sure transient observers aren't leaked. - var leakTest = new M(function(){}); - leakTest.observe(div, { characterData: true, subtree: true }); - - div.insertBefore(df, s2); - s1.firstChild.data = "bar"; // This should *not* create a record. - t1.data = "Hello the whole "; // This should create a record. -} - -function testChildList5() { - div.textContent = null; - var c1 = div.appendChild(document.createElement("div")); - var c2 = document.createElement("div"); - var div2 = document.createElement("div"); - var c3 = div2.appendChild(document.createElement("div")); - var c4 = document.createElement("div"); - var c5 = document.createElement("div"); - var df = document.createDocumentFragment(); - var emptyDF = document.createDocumentFragment(); - var dfc1 = df.appendChild(document.createElement("div")); - var dfc2 = df.appendChild(document.createElement("div")); - var dfc3 = df.appendChild(document.createElement("div")); - m = new M(function(records, observer) { - is(records.length, 6 , ""); - is(records[0].removedNodes.length, 1, "Should have got removedNodes"); - is(records[0].removedNodes[0], c1, ""); - is(records[0].addedNodes.length, 1, "Should have got addedNodes"); - is(records[0].addedNodes[0], c2, ""); - is(records[0].previousSibling, null, ""); - is(records[0].nextSibling, null, ""); - is(records[1].removedNodes.length, 1, "Should have got removedNodes"); - is(records[1].removedNodes[0], c3, ""); - is(records[1].addedNodes.length, 0, "Shouldn't have got addedNodes"); - is(records[1].previousSibling, null, ""); - is(records[1].nextSibling, null, ""); - is(records[2].removedNodes.length, 1, "Should have got removedNodes"); - is(records[2].removedNodes[0], c2, ""); - is(records[2].addedNodes.length, 1, "Should have got addedNodes"); - is(records[2].addedNodes[0], c3, ""); - is(records[2].previousSibling, null, ""); - is(records[2].nextSibling, null, ""); - // Check document fragment handling - is(records[5].removedNodes.length, 1, ""); - is(records[5].removedNodes[0], c4, ""); - is(records[5].addedNodes.length, 3, ""); - is(records[5].addedNodes[0], dfc1, ""); - is(records[5].addedNodes[1], dfc2, ""); - is(records[5].addedNodes[2], dfc3, ""); - is(records[5].previousSibling, c3, ""); - is(records[5].nextSibling, c5, ""); - observer.disconnect(); - then(testAdoptNode); - m = null; - }); - m.observe(div, { childList: true, subtree: true }); - m.observe(div2, { childList: true, subtree: true }); - div.replaceChild(c2, c1); - div.replaceChild(c3, c2); - div.appendChild(c4); - div.appendChild(c5); - div.replaceChild(df, c4); - div.appendChild(emptyDF); // empty document shouldn't cause mutation records -} - -function testAdoptNode() { - var d1 = document.implementation.createHTMLDocument(null); - var d2 = document.implementation.createHTMLDocument(null); - var addedNode; - m = new M(function(records, observer) { - is(records.length, 3, "Should have 2 records"); - is(records[0].target.ownerDocument, d1, "ownerDocument should be the initial document") - is(records[1].target.ownerDocument, d2, "ownerDocument should be the new document"); - is(records[2].type, "attributes", "Should have got attribute mutation") - is(records[2].attributeName, "foo", "Should have got foo attribute mutation") - observer.disconnect(); - then(testOuterHTML); - m = null; - }); - m.observe(d1, { childList: true, subtree: true, attributes: true }); - d2.body.appendChild(d1.body); - addedNode = d2.body.lastChild.appendChild(d2.createElement("div")); - addedNode.setAttribute("foo", "bar"); -} - -function testOuterHTML() { - var doc = document.implementation.createHTMLDocument(null); - var d1 = doc.body.appendChild(document.createElement("div")); - var d2 = doc.body.appendChild(document.createElement("div")); - var d3 = doc.body.appendChild(document.createElement("div")); - var d4 = doc.body.appendChild(document.createElement("div")); - m = new M(function(records, observer) { - is(records.length, 4, "Should have 1 record"); - is(records[0].removedNodes.length, 1, "Should have 1 removed nodes"); - is(records[0].addedNodes.length, 2, "Should have 2 added nodes"); - is(records[0].previousSibling, null, ""); - is(records[0].nextSibling, d2, ""); - is(records[1].removedNodes.length, 1, "Should have 1 removed nodes"); - is(records[1].addedNodes.length, 2, "Should have 2 added nodes"); - is(records[1].previousSibling, records[0].addedNodes[1], ""); - is(records[1].nextSibling, d3, ""); - is(records[2].removedNodes.length, 1, "Should have 1 removed nodes"); - is(records[2].addedNodes.length, 2, "Should have 2 added nodes"); - is(records[2].previousSibling, records[1].addedNodes[1], ""); - is(records[2].nextSibling, d4, ""); - is(records[3].removedNodes.length, 1, "Should have 1 removed nodes"); - is(records[3].addedNodes.length, 0); - is(records[3].previousSibling, records[2].addedNodes[1], ""); - is(records[3].nextSibling, null, ""); - observer.disconnect(); - then(testInsertAdjacentHTML); - m = null; - }); - m.observe(doc, { childList: true, subtree: true }); - d1.outerHTML = "<div>1</div><div>1</div>"; - d2.outerHTML = "<div>2</div><div>2</div>"; - d3.outerHTML = "<div>3</div><div>3</div>"; - d4.outerHTML = ""; -} - -function testInsertAdjacentHTML() { - var doc = document.implementation.createHTMLDocument(null); - var d1 = doc.body.appendChild(document.createElement("div")); - var d2 = doc.body.appendChild(document.createElement("div")); - var d3 = doc.body.appendChild(document.createElement("div")); - var d4 = doc.body.appendChild(document.createElement("div")); - m = new M(function(records, observer) { - is(records.length, 4, ""); - is(records[0].target, doc.body, ""); - is(records[0].previousSibling, null, ""); - is(records[0].nextSibling, d1, ""); - is(records[1].target, d2, ""); - is(records[1].previousSibling, null, ""); - is(records[1].nextSibling, null, ""); - is(records[2].target, d3, ""); - is(records[2].previousSibling, null, ""); - is(records[2].nextSibling, null, ""); - is(records[3].target, doc.body, ""); - is(records[3].previousSibling, d4, ""); - is(records[3].nextSibling, null, ""); - observer.disconnect(); - then(testSyncXHR); - m = null; - }); - m.observe(doc, { childList: true, subtree: true }); - d1.insertAdjacentHTML("beforebegin", "<div></div><div></div>"); - d2.insertAdjacentHTML("afterbegin", "<div></div><div></div>"); - d3.insertAdjacentHTML("beforeend", "<div></div><div></div>"); - d4.insertAdjacentHTML("afterend", "<div></div><div></div>"); -} - - -var callbackHandled = false; - -function testSyncXHR() { - div.textContent = null; - m = new M(function(records, observer) { - is(records.length, 1, ""); - is(records[0].addedNodes.length, 1, ""); - callbackHandled = true; - observer.disconnect(); - m = null; - }); - m.observe(div, { childList: true, subtree: true }); - div.innerHTML = "<div>hello</div>"; - var x = new XMLHttpRequest(); - x.open("GET", window.location, false); - x.send(); - ok(!callbackHandled, "Shouldn't have called the mutation callback!"); - setTimeout(testSyncXHR2, 0); -} - -function testSyncXHR2() { - ok(callbackHandled, "Should have called the mutation callback!"); - then(testTakeRecords); -} - -function testTakeRecords() { - var s = "<span>1</span><span>2</span>"; - div.innerHTML = s; - var takenRecords; - m = new M(function(records, observer) { - is(records.length, 3, "Should have got 3 records"); - - is(records[0].type, "attributes", "Should have got attributes"); - is(records[0].attributeName, "foo", ""); - is(records[0].attributeNamespace, null, ""); - is(records[0].prevValue, null, ""); - is(records[1].type, "childList", "Should have got childList"); - is(records[1].removedNodes.length, 2, "Should have got removedNodes"); - is(records[1].addedNodes.length, 2, "Should have got addedNodes"); - is(records[2].type, "attributes", "Should have got attributes"); - is(records[2].attributeName, "foo", ""); - - is(records.length, takenRecords.length, "Should have had similar mutations"); - is(records[0].type, takenRecords[0].type, "Should have had similar mutations"); - is(records[1].type, takenRecords[1].type, "Should have had similar mutations"); - is(records[2].type, takenRecords[2].type, "Should have had similar mutations"); - - is(records[1].removedNodes.length, takenRecords[1].removedNodes.length, "Should have had similar mutations"); - is(records[1].addedNodes.length, takenRecords[1].addedNodes.length, "Should have had similar mutations"); - - is(m.takeRecords().length, 0, "Shouldn't have any records"); - observer.disconnect(); - then(testMutationObserverAndEvents); - m = null; - }); - m.observe(div, { childList: true, attributes: true }); - div.setAttribute("foo", "bar"); - div.innerHTML = s; - div.removeAttribute("foo"); - takenRecords = m.takeRecords(); - div.setAttribute("foo", "bar"); - div.innerHTML = s; - div.removeAttribute("foo"); -} - -function testTakeRecords() { - function mutationListener(e) { - ++mutationEventCount; - is(e.attrChange, MutationEvent.ADDITION, "unexpected change"); - } - - m = new M(function(records, observer) { - is(records.length, 2, "Should have got 2 records"); - is(records[0].type, "attributes", "Should have got attributes"); - is(records[0].attributeName, "foo", ""); - is(records[0].oldValue, null, ""); - is(records[1].type, "attributes", "Should have got attributes"); - is(records[1].attributeName, "foo", ""); - is(records[1].oldValue, "bar", ""); - observer.disconnect(); - div.removeEventListener("DOMAttrModified", mutationListener); - then(testExpandos); - m = null; - }); - m.observe(div, { attributes: true, attributeOldValue: true }); - // Note, [0] points to a mutation observer which is there for a leak test! - ok(SpecialPowers.compare(SpecialPowers.wrap(div).getBoundMutationObservers()[1], m)); - var mutationEventCount = 0; - div.addEventListener("DOMAttrModified", mutationListener); - div.setAttribute("foo", "bar"); - div.setAttribute("foo", "bar"); - is(mutationEventCount, 1, "Should have got only one mutation event!"); -} - -function testExpandos() { - var m2 = new M(function(records, observer) { - is(observer.expandoProperty, true); - observer.disconnect(); - then(testOutsideShadowDOM); - }); - m2.expandoProperty = true; - m2.observe(div, { attributes: true }); - m2 = null; - if (SpecialPowers) { - // Run GC several times to see if the expando property disappears. - - SpecialPowers.gc(); - SpecialPowers.gc(); - SpecialPowers.gc(); - SpecialPowers.gc(); - } - div.setAttribute("foo", "bar2"); -} - -function testOutsideShadowDOM() { - var m = new M(function(records, observer) { - is(records.length, 1); - is(records[0].type, "attributes", "Should have got attributes"); - observer.disconnect(); - then(testInsideShadowDOM); - }); - m.observe(div, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }) - var sr = div.createShadowRoot(); - sr.innerHTML = "<div" + ">text</" + "div>"; - sr.firstChild.setAttribute("foo", "bar"); - sr.firstChild.firstChild.data = "text2"; - sr.firstChild.appendChild(document.createElement("div")); - div.setAttribute("foo", "bar"); -} - -function testInsideShadowDOM() { - var m = new M(function(records, observer) { - is(records.length, 4); - is(records[0].type, "childList"); - is(records[1].type, "attributes"); - is(records[2].type, "characterData"); - is(records[3].type, "childList"); - observer.disconnect(); - then(testMarquee); - }); - var sr = div.createShadowRoot(); - m.observe(sr, { - attributes: true, - childList: true, - characterData: true, - subtree: true - }); - - sr.innerHTML = "<div" + ">text</" + "div>"; - sr.firstChild.setAttribute("foo", "bar"); - sr.firstChild.firstChild.data = "text2"; - sr.firstChild.appendChild(document.createElement("div")); - div.setAttribute("foo", "bar2"); - -} - -function testMarquee() { - var m = new M(function(records, observer) { - is(records.length, 1); - is(records[0].type, "attributes"); - is(records[0].attributeName, "ok"); - is(records[0].oldValue, null); - observer.disconnect(); - then(testStyleCreate); - }); - var marquee = document.createElement("marquee"); - m.observe(marquee, { - attributes: true, - attributeOldValue: true, - childList: true, - characterData: true, - subtree: true - }); - document.body.appendChild(marquee); - setTimeout(function() {marquee.setAttribute("ok", "ok")}, 500); -} - -function testStyleCreate() { - m = new M(function(records, observer) { - is(records.length, 1, "number of records"); - is(records[0].type, "attributes", "record.type"); - is(records[0].attributeName, "style", "record.attributeName"); - is(records[0].oldValue, null, "record.oldValue"); - isnot(div.getAttribute("style"), null, "style attribute after creation"); - observer.disconnect(); - m = null; - div.removeAttribute("style"); - then(testStyleModify); - }); - m.observe(div, { attributes: true, attributeOldValue: true }); - is(div.getAttribute("style"), null, "style attribute before creation"); - div.style.color = "blue"; -} - -function testStyleModify() { - div.style.color = "yellow"; - m = new M(function(records, observer) { - is(records.length, 1, "number of records"); - is(records[0].type, "attributes", "record.type"); - is(records[0].attributeName, "style", "record.attributeName"); - isnot(div.getAttribute("style"), null, "style attribute after modification"); - observer.disconnect(); - m = null; - div.removeAttribute("style"); - then(testStyleRead); - }); - m.observe(div, { attributes: true }); - isnot(div.getAttribute("style"), null, "style attribute before modification"); - div.style.color = "blue"; -} - -function testStyleRead() { - m = new M(function(records, observer) { - is(records.length, 1, "number of records"); - is(records[0].type, "attributes", "record.type"); - is(records[0].attributeName, "data-test", "record.attributeName"); - is(div.getAttribute("style"), null, "style attribute after read"); - observer.disconnect(); - div.removeAttribute("data-test"); - m = null; - then(testStyleRemoveProperty); - }); - m.observe(div, { attributes: true }); - is(div.getAttribute("style"), null, "style attribute before read"); - var value = div.style.color; // shouldn't generate any mutation records - div.setAttribute("data-test", "a"); -} - -function testStyleRemoveProperty() { - div.style.color = "blue"; - m = new M(function(records, observer) { - is(records.length, 1, "number of records"); - is(records[0].type, "attributes", "record.type"); - is(records[0].attributeName, "style", "record.attributeName"); - isnot(div.getAttribute("style"), null, "style attribute after successful removeProperty"); - observer.disconnect(); - m = null; - div.removeAttribute("style"); - then(testStyleRemoveProperty2); - }); - m.observe(div, { attributes: true }); - isnot(div.getAttribute("style"), null, "style attribute before successful removeProperty"); - div.style.removeProperty("color"); -} - -function testStyleRemoveProperty2() { - m = new M(function(records, observer) { - is(records.length, 1, "number of records"); - is(records[0].type, "attributes", "record.type"); - is(records[0].attributeName, "data-test", "record.attributeName"); - is(div.getAttribute("style"), null, "style attribute after unsuccessful removeProperty"); - observer.disconnect(); - m = null; - div.removeAttribute("data-test"); - then(testAttributeRecordMerging1); - }); - m.observe(div, { attributes: true }); - is(div.getAttribute("style"), null, "style attribute before unsuccessful removeProperty"); - div.style.removeProperty("color"); // shouldn't generate any mutation records - div.setAttribute("data-test", "a"); -} - -function testAttributeRecordMerging1() { - ok(true, "testAttributeRecordMerging1"); - var m = new M(function(records, observer) { - is(records.length, 2); - is(records[0].type, "attributes"); - is(records[0].target, div); - is(records[0].attributeName, "foo"); - is(records[0].attributeNamespace, null); - is(records[0].oldValue, null); - - is(records[1].type, "attributes"); - is(records[1].target, div.firstChild); - is(records[1].attributeName, "foo"); - is(records[1].attributeNamespace, null); - is(records[1].oldValue, null); - observer.disconnect(); - div.innerHTML = ""; - div.removeAttribute("foo"); - then(testAttributeRecordMerging2); - }); - m.observe(div, { - attributes: true, - subtree: true - }); - SpecialPowers.wrap(m).mergeAttributeRecords = true; - - div.setAttribute("foo", "bar_1"); - div.setAttribute("foo", "bar_2"); - div.innerHTML = "<div></div>"; - div.firstChild.setAttribute("foo", "bar_1"); - div.firstChild.setAttribute("foo", "bar_2"); -} - -function testAttributeRecordMerging2() { - ok(true, "testAttributeRecordMerging2"); - var m = new M(function(records, observer) { - is(records.length, 2); - is(records[0].type, "attributes"); - is(records[0].target, div); - is(records[0].attributeName, "foo"); - is(records[0].attributeNamespace, null); - is(records[0].oldValue, "initial"); - - is(records[1].type, "attributes"); - is(records[1].target, div.firstChild); - is(records[1].attributeName, "foo"); - is(records[1].attributeNamespace, null); - is(records[1].oldValue, "initial"); - observer.disconnect(); - div.innerHTML = ""; - div.removeAttribute("foo"); - then(testAttributeRecordMerging3); - }); - - div.setAttribute("foo", "initial"); - div.innerHTML = "<div></div>"; - div.firstChild.setAttribute("foo", "initial"); - m.observe(div, { - attributes: true, - subtree: true, - attributeOldValue: true - }); - SpecialPowers.wrap(m).mergeAttributeRecords = true; - - div.setAttribute("foo", "bar_1"); - div.setAttribute("foo", "bar_2"); - div.firstChild.setAttribute("foo", "bar_1"); - div.firstChild.setAttribute("foo", "bar_2"); -} - -function testAttributeRecordMerging3() { - ok(true, "testAttributeRecordMerging3"); - var m = new M(function(records, observer) { - is(records.length, 4); - is(records[0].type, "attributes"); - is(records[0].target, div); - is(records[0].attributeName, "foo"); - is(records[0].attributeNamespace, null); - is(records[0].oldValue, "initial"); - - is(records[1].type, "attributes"); - is(records[1].target, div.firstChild); - is(records[1].attributeName, "foo"); - is(records[1].attributeNamespace, null); - is(records[1].oldValue, "initial"); - - is(records[2].type, "attributes"); - is(records[2].target, div); - is(records[2].attributeName, "foo"); - is(records[2].attributeNamespace, null); - is(records[2].oldValue, "bar_1"); - - is(records[3].type, "attributes"); - is(records[3].target, div.firstChild); - is(records[3].attributeName, "foo"); - is(records[3].attributeNamespace, null); - is(records[3].oldValue, "bar_1"); - - observer.disconnect(); - div.innerHTML = ""; - div.removeAttribute("foo"); - then(testAttributeRecordMerging4); - }); - - div.setAttribute("foo", "initial"); - div.innerHTML = "<div></div>"; - div.firstChild.setAttribute("foo", "initial"); - m.observe(div, { - attributes: true, - subtree: true, - attributeOldValue: true - }); - SpecialPowers.wrap(m).mergeAttributeRecords = true; - - // No merging should happen. - div.setAttribute("foo", "bar_1"); - div.firstChild.setAttribute("foo", "bar_1"); - div.setAttribute("foo", "bar_2"); - div.firstChild.setAttribute("foo", "bar_2"); -} - -function testAttributeRecordMerging4() { - ok(true, "testAttributeRecordMerging4"); - var m = new M(function(records, observer) { - }); - - div.setAttribute("foo", "initial"); - div.innerHTML = "<div></div>"; - div.firstChild.setAttribute("foo", "initial"); - m.observe(div, { - attributes: true, - subtree: true, - attributeOldValue: true - }); - SpecialPowers.wrap(m).mergeAttributeRecords = true; - - div.setAttribute("foo", "bar_1"); - div.setAttribute("foo", "bar_2"); - div.firstChild.setAttribute("foo", "bar_1"); - div.firstChild.setAttribute("foo", "bar_2"); - - var records = m.takeRecords(); - - is(records.length, 2); - is(records[0].type, "attributes"); - is(records[0].target, div); - is(records[0].attributeName, "foo"); - is(records[0].attributeNamespace, null); - is(records[0].oldValue, "initial"); - - is(records[1].type, "attributes"); - is(records[1].target, div.firstChild); - is(records[1].attributeName, "foo"); - is(records[1].attributeNamespace, null); - is(records[1].oldValue, "initial"); - m.disconnect(); - div.innerHTML = ""; - div.removeAttribute("foo"); - then(testChromeOnly); -} - -function testChromeOnly() { - // Content can't access nativeAnonymousChildList - try { - var mo = new M(function(records, observer) { }); - mo.observe(div, { nativeAnonymousChildList: true }); - ok(false, "Should have thrown when trying to observe with chrome-only init"); - } catch (e) { - ok(true, "Throws when trying to observe with chrome-only init"); - } - - then(); -} - -SimpleTest.waitForExplicitFinish(); - -</script> -</pre> -<div id="log"> -</div> -</body> -</html> diff --git a/dom/bindings/BindingUtils.h b/dom/bindings/BindingUtils.h index 5cab835b3..12a2e370a 100644 --- a/dom/bindings/BindingUtils.h +++ b/dom/bindings/BindingUtils.h @@ -3071,21 +3071,21 @@ class GetCCParticipant { // Helper for GetCCParticipant for classes that participate in CC. template<class U> - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* GetHelper(int, typename U::NS_CYCLE_COLLECTION_INNERCLASS* dummy=nullptr) { return T::NS_CYCLE_COLLECTION_INNERCLASS::GetParticipant(); } // Helper for GetCCParticipant for classes that don't participate in CC. template<class U> - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* GetHelper(double) { return nullptr; } public: - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* Get() { // Passing int() here will try to call the GetHelper that takes an int as @@ -3100,7 +3100,7 @@ template<class T> class GetCCParticipant<T, true> { public: - static constexpr nsCycleCollectionParticipant* + static nsCycleCollectionParticipant* Get() { return nullptr; @@ -3123,7 +3123,7 @@ EnumerateGlobal(JSContext* aCx, JS::Handle<JSObject*> aObj); template <class T> struct CreateGlobalOptions { - static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = + static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = ProtoAndIfaceCache::NonWindowLike; static void TraceGlobal(JSTracer* aTrc, JSObject* aObj) { @@ -3140,7 +3140,7 @@ struct CreateGlobalOptions template <> struct CreateGlobalOptions<nsGlobalWindow> { - static constexpr ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = + static const ProtoAndIfaceCache::Kind ProtoAndIfaceCacheKind = ProtoAndIfaceCache::WindowLike; static void TraceGlobal(JSTracer* aTrc, JSObject* aObj); static bool PostCreateGlobal(JSContext* aCx, JS::Handle<JSObject*> aGlobal); diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 941e65eff..f08094617 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -717,6 +717,21 @@ DOMInterfaces = { }, }, +'ResizeObservation': { + 'nativeType': 'mozilla::dom::ResizeObservation', + 'headerFile': 'mozilla/dom/ResizeObserver.h', +}, + +'ResizeObserver': { + 'nativeType': 'mozilla::dom::ResizeObserver', + 'headerFile': 'mozilla/dom/ResizeObserver.h', +}, + +'ResizeObserverEntry': { + 'nativeType': 'mozilla::dom::ResizeObserverEntry', + 'headerFile': 'mozilla/dom/ResizeObserver.h', +}, + 'Response': { 'binaryNames': { 'headers': 'headers_' }, }, diff --git a/dom/bindings/DOMJSClass.h b/dom/bindings/DOMJSClass.h index 6e779840f..c97cf9322 100644 --- a/dom/bindings/DOMJSClass.h +++ b/dom/bindings/DOMJSClass.h @@ -210,7 +210,7 @@ struct NativePropertiesN { const int32_t iteratorAliasMethodIndex; - constexpr const NativePropertiesN<7>* Upcast() const { + const NativePropertiesN<7>* Upcast() const { return reinterpret_cast<const NativePropertiesN<7>*>(this); } diff --git a/dom/bindings/GenerateCSS2PropertiesWebIDL.py b/dom/bindings/GenerateCSS2PropertiesWebIDL.py index 57634494f..b1f2a6016 100644 --- a/dom/bindings/GenerateCSS2PropertiesWebIDL.py +++ b/dom/bindings/GenerateCSS2PropertiesWebIDL.py @@ -17,6 +17,7 @@ def generateLine(propName, extendedAttrs): propName) def generate(output, idlFilename, preprocessorHeader): print(idlFilename) + sys.stdout.flush() cpp = list(buildconfig.substs['CPP']) cpp += shellutil.split(buildconfig.substs['ACDEFINES']) cpp.append(preprocessorHeader) diff --git a/dom/bindings/mozwebidlcodegen/__init__.py b/dom/bindings/mozwebidlcodegen/__init__.py index 69f3f5e25..93b33012a 100644 --- a/dom/bindings/mozwebidlcodegen/__init__.py +++ b/dom/bindings/mozwebidlcodegen/__init__.py @@ -12,6 +12,7 @@ import hashlib import json import logging import os +import sys from copy import deepcopy @@ -270,6 +271,7 @@ class WebIDLCodegenManager(LoggingMixin): for filename in sorted(changed_inputs): basename = mozpath.basename(filename) print basename + sys.stdout.flush() result.inputs.add(filename) written, deps = self._generate_build_files_for_webidl(filename) result.created |= written[0] diff --git a/dom/cache/DBSchema.cpp b/dom/cache/DBSchema.cpp index 176e7b9d1..37510e2e1 100644 --- a/dom/cache/DBSchema.cpp +++ b/dom/cache/DBSchema.cpp @@ -2460,7 +2460,7 @@ Validate(mozIStorageConnection* aConn) typedef nsresult (*MigrationFunc)(mozIStorageConnection*, bool&); struct Migration { - constexpr Migration(int32_t aFromVersion, MigrationFunc aFunc) + Migration(int32_t aFromVersion, MigrationFunc aFunc) : mFromVersion(aFromVersion) , mFunc(aFunc) { } diff --git a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_css.js b/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_css.js deleted file mode 100644 index 60841f8e2..000000000 --- a/dom/canvas/test/webgl-conf/checkout/deqp/temp_externs/webkit_css.js +++ /dev/null @@ -1,456 +0,0 @@ -/* - * Copyright 2008 The Closure Compiler Authors - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -/** - * @fileoverview Definitions for WebKit's custom CSS properties. Copied from: - * {@link - * http://trac.webkit.org/browser/trunk/Source/WebCore/css/CSSPropertyNames.in} - * - * If you make changes to this file, notice that every property appears - * twice: once as an uppercase name and once as a lowercase name. - * WebKit allows both. The uppercase version is preferred. - * - * @externs - * @author nicksantos@google.com (Nick Santos) - */ - -/** @type {string} */ CSSProperties.prototype.WebkitAlignContent; -/** @type {string} */ CSSProperties.prototype.WebkitAlignItems; -/** @type {string} */ CSSProperties.prototype.WebkitAlignSelf; -/** @type {string} */ CSSProperties.prototype.WebkitAnimation; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationDelay; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationDirection; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationDuration; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationFillMode; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationIterationCount; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationName; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationPlayState; -/** @type {string} */ CSSProperties.prototype.WebkitAnimationTimingFunction; -/** @type {string} */ CSSProperties.prototype.WebkitAppearance; -/** @type {string} */ CSSProperties.prototype.WebkitAppRegion; -/** @type {string} */ CSSProperties.prototype.WebkitAspectRatio; -/** @type {string} */ CSSProperties.prototype.WebkitBackfaceVisibility; -/** @type {string} */ CSSProperties.prototype.WebkitBackgroundClip; -/** @type {string} */ CSSProperties.prototype.WebkitBackgroundComposite; -/** @type {string} */ CSSProperties.prototype.WebkitBackgroundOrigin; -/** @type {string} */ CSSProperties.prototype.WebkitBackgroundSize; -/** @type {string} */ CSSProperties.prototype.WebkitBinding; -/** @type {string} */ CSSProperties.prototype.WebkitBlendMode; -/** @type {string} */ CSSProperties.prototype.WebkitBorderAfter; -/** @type {string} */ CSSProperties.prototype.WebkitBorderAfterColor; -/** @type {string} */ CSSProperties.prototype.WebkitBorderAfterStyle; -/** @type {string} */ CSSProperties.prototype.WebkitBorderAfterWidth; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBefore; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBeforeColor; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBeforeStyle; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBeforeWidth; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBottomLeftRadius; -/** @type {string} */ CSSProperties.prototype.WebkitBorderBottomRightRadius; -/** @type {string} */ CSSProperties.prototype.WebkitBorderEnd; -/** @type {string} */ CSSProperties.prototype.WebkitBorderEndColor; -/** @type {string} */ CSSProperties.prototype.WebkitBorderEndStyle; -/** @type {string} */ CSSProperties.prototype.WebkitBorderEndWidth; -/** @type {string} */ CSSProperties.prototype.WebkitBorderFit; -/** @type {string} */ CSSProperties.prototype.WebkitBorderHorizontalSpacing; -/** @type {string} */ CSSProperties.prototype.WebkitBorderImage; -/** @type {string} */ CSSProperties.prototype.WebkitBorderRadius; -/** @type {string} */ CSSProperties.prototype.WebkitBorderStart; -/** @type {string} */ CSSProperties.prototype.WebkitBorderStartColor; -/** @type {string} */ CSSProperties.prototype.WebkitBorderStartStyle; -/** @type {string} */ CSSProperties.prototype.WebkitBorderStartWidth; -/** @type {string} */ CSSProperties.prototype.WebkitBorderTopLeftRadius; -/** @type {string} */ CSSProperties.prototype.WebkitBorderTopRightRadius; -/** @type {string} */ CSSProperties.prototype.WebkitBorderVerticalSpacing; -/** @type {string} */ CSSProperties.prototype.WebkitBoxAlign; -/** @type {string} */ CSSProperties.prototype.WebkitBoxDecorationBreak; -/** @type {string} */ CSSProperties.prototype.WebkitBoxDirection; -/** @type {string} */ CSSProperties.prototype.WebkitBoxFlex; -/** @type {string} */ CSSProperties.prototype.WebkitBoxFlexGroup; -/** @type {string} */ CSSProperties.prototype.WebkitBoxLines; -/** @type {string} */ CSSProperties.prototype.WebkitBoxOrdinalGroup; -/** @type {string} */ CSSProperties.prototype.WebkitBoxOrient; -/** @type {string} */ CSSProperties.prototype.WebkitBoxPack; -/** @type {string} */ CSSProperties.prototype.WebkitBoxReflect; -/** @type {string} */ CSSProperties.prototype.WebkitBoxShadow; -/** @type {string} */ CSSProperties.prototype.WebkitBoxSizing; -/** @type {string} */ CSSProperties.prototype.WebkitColorCorrection; -/** @type {string} */ CSSProperties.prototype.WebkitColumnAxis; -/** @type {string} */ CSSProperties.prototype.WebkitColumnBreakAfter; -/** @type {string} */ CSSProperties.prototype.WebkitColumnBreakBefore; -/** @type {string} */ CSSProperties.prototype.WebkitColumnBreakInside; -/** @type {string} */ CSSProperties.prototype.WebkitColumnCount; -/** @type {string} */ CSSProperties.prototype.WebkitColumnGap; -/** @type {string} */ CSSProperties.prototype.WebkitColumnProgression; -/** @type {string} */ CSSProperties.prototype.WebkitColumnRule; -/** @type {string} */ CSSProperties.prototype.WebkitColumnRuleColor; -/** @type {string} */ CSSProperties.prototype.WebkitColumnRuleStyle; -/** @type {string} */ CSSProperties.prototype.WebkitColumnRuleWidth; -/** @type {string} */ CSSProperties.prototype.WebkitColumns; -/** @type {string} */ CSSProperties.prototype.WebkitColumnSpan; -/** @type {string} */ CSSProperties.prototype.WebkitColumnWidth; -/** @type {string} */ CSSProperties.prototype.WebkitDashboardRegion; -/** @type {string} */ CSSProperties.prototype.WebkitFilter; -/** @type {string} */ CSSProperties.prototype.WebkitFlex; -/** @type {string} */ CSSProperties.prototype.WebkitFlexBasis; -/** @type {string} */ CSSProperties.prototype.WebkitFlexDirection; -/** @type {string} */ CSSProperties.prototype.WebkitFlexFlow; -/** @type {string} */ CSSProperties.prototype.WebkitFlexGrow; -/** @type {string} */ CSSProperties.prototype.WebkitFlexShrink; -/** @type {string} */ CSSProperties.prototype.WebkitFlexWrap; -/** @type {string} */ CSSProperties.prototype.WebkitFlowFrom; -/** @type {string} */ CSSProperties.prototype.WebkitFlowInto; -/** @type {string} */ CSSProperties.prototype.WebkitFontSizeDelta; -/** @type {string} */ CSSProperties.prototype.WebkitFontSmoothing; -/** @type {string} */ CSSProperties.prototype.WebkitGridColumn; -/** @type {string} */ CSSProperties.prototype.WebkitGridColumns; -/** @type {string} */ CSSProperties.prototype.WebkitGridRow; -/** @type {string} */ CSSProperties.prototype.WebkitGridRows; -/** @type {string} */ CSSProperties.prototype.WebkitHighlight; -/** @type {string} */ CSSProperties.prototype.WebkitHyphenateCharacter; -/** @type {string} */ CSSProperties.prototype.WebkitHyphenateLimitAfter; -/** @type {string} */ CSSProperties.prototype.WebkitHyphenateLimitBefore; -/** @type {string} */ CSSProperties.prototype.WebkitHyphenateLimitLines; -/** @type {string} */ CSSProperties.prototype.WebkitHyphens; -/** @type {string} */ CSSProperties.prototype.WebkitJustifyContent; -/** @type {string} */ CSSProperties.prototype.WebkitLineAlign; -/** @type {string} */ CSSProperties.prototype.WebkitLineBoxContain; -/** @type {string} */ CSSProperties.prototype.WebkitLineBreak; -/** @type {string} */ CSSProperties.prototype.WebkitLineClamp; -/** @type {string} */ CSSProperties.prototype.WebkitLineGrid; -/** @type {string} */ CSSProperties.prototype.WebkitLineSnap; -/** @type {string} */ CSSProperties.prototype.WebkitLocale; -/** @type {string} */ CSSProperties.prototype.WebkitLogicalHeight; -/** @type {string} */ CSSProperties.prototype.WebkitLogicalWidth; -/** @type {string} */ CSSProperties.prototype.WebkitMarginAfter; -/** @type {string} */ CSSProperties.prototype.WebkitMarginAfterCollapse; -/** @type {string} */ CSSProperties.prototype.WebkitMarginBefore; -/** @type {string} */ CSSProperties.prototype.WebkitMarginBeforeCollapse; -/** @type {string} */ CSSProperties.prototype.WebkitMarginBottomCollapse; -/** @type {string} */ CSSProperties.prototype.WebkitMarginCollapse; -/** @type {string} */ CSSProperties.prototype.WebkitMarginEnd; -/** @type {string} */ CSSProperties.prototype.WebkitMarginStart; -/** @type {string} */ CSSProperties.prototype.WebkitMarginTopCollapse; -/** @type {string} */ CSSProperties.prototype.WebkitMarquee; -/** @type {string} */ CSSProperties.prototype.WebkitMarqueeDirection; -/** @type {string} */ CSSProperties.prototype.WebkitMarqueeIncrement; -/** @type {string} */ CSSProperties.prototype.WebkitMarqueeRepetition; -/** @type {string} */ CSSProperties.prototype.WebkitMarqueeSpeed; -/** @type {string} */ CSSProperties.prototype.WebkitMarqueeStyle; -/** @type {string} */ CSSProperties.prototype.WebkitMask; -/** @type {string} */ CSSProperties.prototype.WebkitMaskAttachment; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImage; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImageOutset; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImageRepeat; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImageSlice; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImageSource; -/** @type {string} */ CSSProperties.prototype.WebkitMaskBoxImageWidth; -/** @type {string} */ CSSProperties.prototype.WebkitMaskClip; -/** @type {string} */ CSSProperties.prototype.WebkitMaskComposite; -/** @type {string} */ CSSProperties.prototype.WebkitMaskImage; -/** @type {string} */ CSSProperties.prototype.WebkitMaskOrigin; -/** @type {string} */ CSSProperties.prototype.WebkitMaskPosition; -/** @type {string} */ CSSProperties.prototype.WebkitMaskPositionX; -/** @type {string} */ CSSProperties.prototype.WebkitMaskPositionY; -/** @type {string} */ CSSProperties.prototype.WebkitMaskRepeat; -/** @type {string} */ CSSProperties.prototype.WebkitMaskRepeatX; -/** @type {string} */ CSSProperties.prototype.WebkitMaskRepeatY; -/** @type {string} */ CSSProperties.prototype.WebkitMaskSize; -/** @type {string} */ -CSSProperties.prototype.WebkitMatchNearestMailBlockquoteColor; -/** @type {string} */ CSSProperties.prototype.WebkitMaxLogicalHeight; -/** @type {string} */ CSSProperties.prototype.WebkitMaxLogicalWidth; -/** @type {string} */ CSSProperties.prototype.WebkitMinLogicalHeight; -/** @type {string} */ CSSProperties.prototype.WebkitMinLogicalWidth; -/** @type {string} */ CSSProperties.prototype.WebkitNbspMode; -/** @type {string} */ CSSProperties.prototype.WebkitOrder; -/** @type {string} */ CSSProperties.prototype.WebkitOverflowScrolling; -/** @type {string} */ CSSProperties.prototype.WebkitPaddingAfter; -/** @type {string} */ CSSProperties.prototype.WebkitPaddingBefore; -/** @type {string} */ CSSProperties.prototype.WebkitPaddingEnd; -/** @type {string} */ CSSProperties.prototype.WebkitPaddingStart; -/** @type {string} */ CSSProperties.prototype.WebkitPerspective; -/** @type {string} */ CSSProperties.prototype.WebkitPerspectiveOrigin; -/** @type {string} */ CSSProperties.prototype.WebkitPerspectiveOriginX; -/** @type {string} */ CSSProperties.prototype.WebkitPerspectiveOriginY; -/** @type {string} */ CSSProperties.prototype.WebkitPrintColorAdjust; -/** @type {string} */ CSSProperties.prototype.WebkitRegionBreakAfter; -/** @type {string} */ CSSProperties.prototype.WebkitRegionBreakBefore; -/** @type {string} */ CSSProperties.prototype.WebkitRegionBreakInside; -/** @type {string} */ CSSProperties.prototype.WebkitRegionOverflow; -/** @type {string} */ CSSProperties.prototype.WebkitRtlOrdering; -/** @type {string} */ CSSProperties.prototype.WebkitRubyPosition; -/** @type {string} */ CSSProperties.prototype.WebkitShapeInside; -/** @type {string} */ CSSProperties.prototype.WebkitShapeMargin; -/** @type {string} */ CSSProperties.prototype.WebkitShapeOutside; -/** @type {string} */ CSSProperties.prototype.WebkitShapePadding; -/** @type {string} */ CSSProperties.prototype.WebkitTapHighlightColor; -/** @type {string} */ CSSProperties.prototype.WebkitTextAlignLast; -/** @type {string} */ CSSProperties.prototype.WebkitTextCombine; -/** @type {string} */ CSSProperties.prototype.WebkitTextDecorationLine; -/** @type {string} */ CSSProperties.prototype.WebkitTextDecorationsInEffect; -/** @type {string} */ CSSProperties.prototype.WebkitTextDecorationStyle; -/** @type {string} */ CSSProperties.prototype.WebkitTextEmphasis; -/** @type {string} */ CSSProperties.prototype.WebkitTextEmphasisColor; -/** @type {string} */ CSSProperties.prototype.WebkitTextEmphasisPosition; -/** @type {string} */ CSSProperties.prototype.WebkitTextEmphasisStyle; -/** @type {string} */ CSSProperties.prototype.WebkitTextFillColor; -/** @type {string} */ CSSProperties.prototype.WebkitTextOrientation; -/** @type {string} */ CSSProperties.prototype.WebkitTextSecurity; -/** @type {string} */ CSSProperties.prototype.WebkitTextSizeAdjust; -/** @type {string} */ CSSProperties.prototype.WebkitTextStroke; -/** @type {string} */ CSSProperties.prototype.WebkitTextStrokeColor; -/** @type {string} */ CSSProperties.prototype.WebkitTextStrokeWidth; -/** @type {string} */ CSSProperties.prototype.WebkitTransform; -/** @type {string} */ CSSProperties.prototype.WebkitTransformOrigin; -/** @type {string} */ CSSProperties.prototype.WebkitTransformOriginX; -/** @type {string} */ CSSProperties.prototype.WebkitTransformOriginY; -/** @type {string} */ CSSProperties.prototype.WebkitTransformOriginZ; -/** @type {string} */ CSSProperties.prototype.WebkitTransformStyle; -/** @type {string} */ CSSProperties.prototype.WebkitTransition; -/** @type {string} */ CSSProperties.prototype.WebkitTransitionDelay; -/** @type {string} */ CSSProperties.prototype.WebkitTransitionDuration; -/** @type {string} */ CSSProperties.prototype.WebkitTransitionProperty; -/** @type {string} */ CSSProperties.prototype.WebkitTransitionRepeatCount; -/** @type {string} */ CSSProperties.prototype.WebkitTransitionTimingFunction; -/** @type {string} */ CSSProperties.prototype.WebkitUserDrag; -/** @type {string} */ CSSProperties.prototype.WebkitUserModify; -/** @type {string} */ CSSProperties.prototype.WebkitUserSelect; -/** @type {string} */ CSSProperties.prototype.WebkitWrap; -/** @type {string} */ CSSProperties.prototype.WebkitWrapFlow; -/** @type {string} */ CSSProperties.prototype.WebkitWrapThrough; -/** @type {string} */ CSSProperties.prototype.WebkitWritingMode; - -// WebKit also adds bindings for the lowercase versions of these properties. -// The uppercase version is preferred. - -/** @type {string} */ CSSProperties.prototype.webkitAlignContent; -/** @type {string} */ CSSProperties.prototype.webkitAlignItems; -/** @type {string} */ CSSProperties.prototype.webkitAlignSelf; -/** @type {string} */ CSSProperties.prototype.webkitAnimation; -/** @type {string} */ CSSProperties.prototype.webkitAnimationDelay; -/** @type {string} */ CSSProperties.prototype.webkitAnimationDirection; -/** @type {string} */ CSSProperties.prototype.webkitAnimationDuration; -/** @type {string} */ CSSProperties.prototype.webkitAnimationFillMode; -/** @type {string} */ CSSProperties.prototype.webkitAnimationIterationCount; -/** @type {string} */ CSSProperties.prototype.webkitAnimationName; -/** @type {string} */ CSSProperties.prototype.webkitAnimationPlayState; -/** @type {string} */ CSSProperties.prototype.webkitAnimationTimingFunction; -/** @type {string} */ CSSProperties.prototype.webkitAppearance; -/** @type {string} */ CSSProperties.prototype.webkitAppRegion; -/** @type {string} */ CSSProperties.prototype.webkitAspectRatio; -/** @type {string} */ CSSProperties.prototype.webkitBackfaceVisibility; -/** @type {string} */ CSSProperties.prototype.webkitBackgroundClip; -/** @type {string} */ CSSProperties.prototype.webkitBackgroundComposite; -/** @type {string} */ CSSProperties.prototype.webkitBackgroundOrigin; -/** @type {string} */ CSSProperties.prototype.webkitBackgroundSize; -/** @type {string} */ CSSProperties.prototype.webkitBinding; -/** @type {string} */ CSSProperties.prototype.webkitBlendMode; -/** @type {string} */ CSSProperties.prototype.webkitBorderAfter; -/** @type {string} */ CSSProperties.prototype.webkitBorderAfterColor; -/** @type {string} */ CSSProperties.prototype.webkitBorderAfterStyle; -/** @type {string} */ CSSProperties.prototype.webkitBorderAfterWidth; -/** @type {string} */ CSSProperties.prototype.webkitBorderBefore; -/** @type {string} */ CSSProperties.prototype.webkitBorderBeforeColor; -/** @type {string} */ CSSProperties.prototype.webkitBorderBeforeStyle; -/** @type {string} */ CSSProperties.prototype.webkitBorderBeforeWidth; -/** @type {string} */ CSSProperties.prototype.webkitBorderBottomLeftRadius; -/** @type {string} */ CSSProperties.prototype.webkitBorderBottomRightRadius; -/** @type {string} */ CSSProperties.prototype.webkitBorderEnd; -/** @type {string} */ CSSProperties.prototype.webkitBorderEndColor; -/** @type {string} */ CSSProperties.prototype.webkitBorderEndStyle; -/** @type {string} */ CSSProperties.prototype.webkitBorderEndWidth; -/** @type {string} */ CSSProperties.prototype.webkitBorderFit; -/** @type {string} */ CSSProperties.prototype.webkitBorderHorizontalSpacing; -/** @type {string} */ CSSProperties.prototype.webkitBorderImage; -/** @type {string} */ CSSProperties.prototype.webkitBorderRadius; -/** @type {string} */ CSSProperties.prototype.webkitBorderStart; -/** @type {string} */ CSSProperties.prototype.webkitBorderStartColor; -/** @type {string} */ CSSProperties.prototype.webkitBorderStartStyle; -/** @type {string} */ CSSProperties.prototype.webkitBorderStartWidth; -/** @type {string} */ CSSProperties.prototype.webkitBorderTopLeftRadius; -/** @type {string} */ CSSProperties.prototype.webkitBorderTopRightRadius; -/** @type {string} */ CSSProperties.prototype.webkitBorderVerticalSpacing; -/** @type {string} */ CSSProperties.prototype.webkitBoxAlign; -/** @type {string} */ CSSProperties.prototype.webkitBoxDecorationBreak; -/** @type {string} */ CSSProperties.prototype.webkitBoxDirection; -/** @type {string} */ CSSProperties.prototype.webkitBoxFlex; -/** @type {string} */ CSSProperties.prototype.webkitBoxFlexGroup; -/** @type {string} */ CSSProperties.prototype.webkitBoxLines; -/** @type {string} */ CSSProperties.prototype.webkitBoxOrdinalGroup; -/** @type {string} */ CSSProperties.prototype.webkitBoxOrient; -/** @type {string} */ CSSProperties.prototype.webkitBoxPack; -/** @type {string} */ CSSProperties.prototype.webkitBoxReflect; -/** @type {string} */ CSSProperties.prototype.webkitBoxShadow; -/** @type {string} */ CSSProperties.prototype.webkitBoxSizing; -/** @type {string} */ CSSProperties.prototype.webkitColorCorrection; -/** @type {string} */ CSSProperties.prototype.webkitColumnAxis; -/** @type {string} */ CSSProperties.prototype.webkitColumnBreakAfter; -/** @type {string} */ CSSProperties.prototype.webkitColumnBreakBefore; -/** @type {string} */ CSSProperties.prototype.webkitColumnBreakInside; -/** @type {string} */ CSSProperties.prototype.webkitColumnCount; -/** @type {string} */ CSSProperties.prototype.webkitColumnGap; -/** @type {string} */ CSSProperties.prototype.webkitColumnProgression; -/** @type {string} */ CSSProperties.prototype.webkitColumnRule; -/** @type {string} */ CSSProperties.prototype.webkitColumnRuleColor; -/** @type {string} */ CSSProperties.prototype.webkitColumnRuleStyle; -/** @type {string} */ CSSProperties.prototype.webkitColumnRuleWidth; -/** @type {string} */ CSSProperties.prototype.webkitColumns; -/** @type {string} */ CSSProperties.prototype.webkitColumnSpan; -/** @type {string} */ CSSProperties.prototype.webkitColumnWidth; -/** @type {string} */ CSSProperties.prototype.webkitDashboardRegion; -/** @type {string} */ CSSProperties.prototype.webkitFilter; -/** @type {string} */ CSSProperties.prototype.webkitFlex; -/** @type {string} */ CSSProperties.prototype.webkitFlexBasis; -/** @type {string} */ CSSProperties.prototype.webkitFlexDirection; -/** @type {string} */ CSSProperties.prototype.webkitFlexFlow; -/** @type {string} */ CSSProperties.prototype.webkitFlexGrow; -/** @type {string} */ CSSProperties.prototype.webkitFlexShrink; -/** @type {string} */ CSSProperties.prototype.webkitFlexWrap; -/** @type {string} */ CSSProperties.prototype.webkitFlowFrom; -/** @type {string} */ CSSProperties.prototype.webkitFlowInto; -/** @type {string} */ CSSProperties.prototype.webkitFontSizeDelta; -/** @type {string} */ CSSProperties.prototype.webkitFontSmoothing; -/** @type {string} */ CSSProperties.prototype.webkitGridColumn; -/** @type {string} */ CSSProperties.prototype.webkitGridColumns; -/** @type {string} */ CSSProperties.prototype.webkitGridRow; -/** @type {string} */ CSSProperties.prototype.webkitGridRows; -/** @type {string} */ CSSProperties.prototype.webkitHighlight; -/** @type {string} */ CSSProperties.prototype.webkitHyphenateCharacter; -/** @type {string} */ CSSProperties.prototype.webkitHyphenateLimitAfter; -/** @type {string} */ CSSProperties.prototype.webkitHyphenateLimitBefore; -/** @type {string} */ CSSProperties.prototype.webkitHyphenateLimitLines; -/** @type {string} */ CSSProperties.prototype.webkitHyphens; -/** @type {string} */ CSSProperties.prototype.webkitJustifyContent; -/** @type {string} */ CSSProperties.prototype.webkitLineAlign; -/** @type {string} */ CSSProperties.prototype.webkitLineBoxContain; -/** @type {string} */ CSSProperties.prototype.webkitLineBreak; -/** @type {string} */ CSSProperties.prototype.webkitLineClamp; -/** @type {string} */ CSSProperties.prototype.webkitLineGrid; -/** @type {string} */ CSSProperties.prototype.webkitLineSnap; -/** @type {string} */ CSSProperties.prototype.webkitLocale; -/** @type {string} */ CSSProperties.prototype.webkitLogicalHeight; -/** @type {string} */ CSSProperties.prototype.webkitLogicalWidth; -/** @type {string} */ CSSProperties.prototype.webkitMarginAfter; -/** @type {string} */ CSSProperties.prototype.webkitMarginAfterCollapse; -/** @type {string} */ CSSProperties.prototype.webkitMarginBefore; -/** @type {string} */ CSSProperties.prototype.webkitMarginBeforeCollapse; -/** @type {string} */ CSSProperties.prototype.webkitMarginBottomCollapse; -/** @type {string} */ CSSProperties.prototype.webkitMarginCollapse; -/** @type {string} */ CSSProperties.prototype.webkitMarginEnd; -/** @type {string} */ CSSProperties.prototype.webkitMarginStart; -/** @type {string} */ CSSProperties.prototype.webkitMarginTopCollapse; -/** @type {string} */ CSSProperties.prototype.webkitMarquee; -/** @type {string} */ CSSProperties.prototype.webkitMarqueeDirection; -/** @type {string} */ CSSProperties.prototype.webkitMarqueeIncrement; -/** @type {string} */ CSSProperties.prototype.webkitMarqueeRepetition; -/** @type {string} */ CSSProperties.prototype.webkitMarqueeSpeed; -/** @type {string} */ CSSProperties.prototype.webkitMarqueeStyle; -/** @type {string} */ CSSProperties.prototype.webkitMask; -/** @type {string} */ CSSProperties.prototype.webkitMaskAttachment; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImage; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImageOutset; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImageRepeat; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImageSlice; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImageSource; -/** @type {string} */ CSSProperties.prototype.webkitMaskBoxImageWidth; -/** @type {string} */ CSSProperties.prototype.webkitMaskClip; -/** @type {string} */ CSSProperties.prototype.webkitMaskComposite; -/** @type {string} */ CSSProperties.prototype.webkitMaskImage; -/** @type {string} */ CSSProperties.prototype.webkitMaskOrigin; -/** @type {string} */ CSSProperties.prototype.webkitMaskPosition; -/** @type {string} */ CSSProperties.prototype.webkitMaskPositionX; -/** @type {string} */ CSSProperties.prototype.webkitMaskPositionY; -/** @type {string} */ CSSProperties.prototype.webkitMaskRepeat; -/** @type {string} */ CSSProperties.prototype.webkitMaskRepeatX; -/** @type {string} */ CSSProperties.prototype.webkitMaskRepeatY; -/** @type {string} */ CSSProperties.prototype.webkitMaskSize; -/** @type {string} */ -CSSProperties.prototype.webkitMatchNearestMailBlockquoteColor; -/** @type {string} */ CSSProperties.prototype.webkitMaxLogicalHeight; -/** @type {string} */ CSSProperties.prototype.webkitMaxLogicalWidth; -/** @type {string} */ CSSProperties.prototype.webkitMinLogicalHeight; -/** @type {string} */ CSSProperties.prototype.webkitMinLogicalWidth; -/** @type {string} */ CSSProperties.prototype.webkitNbspMode; -/** @type {string} */ CSSProperties.prototype.webkitOrder; -/** @type {string} */ CSSProperties.prototype.webkitOverflowScrolling; -/** @type {string} */ CSSProperties.prototype.webkitPaddingAfter; -/** @type {string} */ CSSProperties.prototype.webkitPaddingBefore; -/** @type {string} */ CSSProperties.prototype.webkitPaddingEnd; -/** @type {string} */ CSSProperties.prototype.webkitPaddingStart; -/** @type {string} */ CSSProperties.prototype.webkitPerspective; -/** @type {string} */ CSSProperties.prototype.webkitPerspectiveOrigin; -/** @type {string} */ CSSProperties.prototype.webkitPerspectiveOriginX; -/** @type {string} */ CSSProperties.prototype.webkitPerspectiveOriginY; -/** @type {string} */ CSSProperties.prototype.webkitPrintColorAdjust; -/** @type {string} */ CSSProperties.prototype.webkitRegionBreakAfter; -/** @type {string} */ CSSProperties.prototype.webkitRegionBreakBefore; -/** @type {string} */ CSSProperties.prototype.webkitRegionBreakInside; -/** @type {string} */ CSSProperties.prototype.webkitRegionOverflow; -/** @type {string} */ CSSProperties.prototype.webkitRtlOrdering; -/** @type {string} */ CSSProperties.prototype.webkitRubyPosition; -/** @type {string} */ CSSProperties.prototype.webkitShapeInside; -/** @type {string} */ CSSProperties.prototype.webkitShapeMargin; -/** @type {string} */ CSSProperties.prototype.webkitShapeOutside; -/** @type {string} */ CSSProperties.prototype.webkitShapePadding; -/** @type {string} */ CSSProperties.prototype.webkitTapHighlightColor; -/** @type {string} */ CSSProperties.prototype.webkitTextAlignLast; -/** @type {string} */ CSSProperties.prototype.webkitTextCombine; -/** @type {string} */ CSSProperties.prototype.webkitTextDecorationLine; -/** @type {string} */ CSSProperties.prototype.webkitTextDecorationsInEffect; -/** @type {string} */ CSSProperties.prototype.webkitTextDecorationStyle; -/** @type {string} */ CSSProperties.prototype.webkitTextEmphasis; -/** @type {string} */ CSSProperties.prototype.webkitTextEmphasisColor; -/** @type {string} */ CSSProperties.prototype.webkitTextEmphasisPosition; -/** @type {string} */ CSSProperties.prototype.webkitTextEmphasisStyle; -/** @type {string} */ CSSProperties.prototype.webkitTextFillColor; -/** @type {string} */ CSSProperties.prototype.webkitTextOrientation; -/** @type {string} */ CSSProperties.prototype.webkitTextSecurity; -/** @type {string} */ CSSProperties.prototype.webkitTextSizeAdjust; -/** @type {string} */ CSSProperties.prototype.webkitTextStroke; -/** @type {string} */ CSSProperties.prototype.webkitTextStrokeColor; -/** @type {string} */ CSSProperties.prototype.webkitTextStrokeWidth; -/** @type {string} */ CSSProperties.prototype.webkitTransform; -/** @type {string} */ CSSProperties.prototype.webkitTransformOrigin; -/** @type {string} */ CSSProperties.prototype.webkitTransformOriginX; -/** @type {string} */ CSSProperties.prototype.webkitTransformOriginY; -/** @type {string} */ CSSProperties.prototype.webkitTransformOriginZ; -/** @type {string} */ CSSProperties.prototype.webkitTransformStyle; -/** @type {string} */ CSSProperties.prototype.webkitTransition; -/** @type {string} */ CSSProperties.prototype.webkitTransitionDelay; -/** @type {string} */ CSSProperties.prototype.webkitTransitionDuration; -/** @type {string} */ CSSProperties.prototype.webkitTransitionProperty; -/** @type {string} */ CSSProperties.prototype.webkitTransitionRepeatCount; -/** @type {string} */ CSSProperties.prototype.webkitTransitionTimingFunction; -/** @type {string} */ CSSProperties.prototype.webkitUserDrag; -/** @type {string} */ CSSProperties.prototype.webkitUserModify; -/** @type {string} */ CSSProperties.prototype.webkitUserSelect; -/** @type {string} */ CSSProperties.prototype.webkitWrap; -/** @type {string} */ CSSProperties.prototype.webkitWrapFlow; -/** @type {string} */ CSSProperties.prototype.webkitWrapThrough; -/** @type {string} */ CSSProperties.prototype.webkitWritingMode; - -/** - * @constructor - * @param {number} x - * @param {number} y - */ -function WebKitPoint(x, y) {} - -/** @type {number} */ -WebKitPoint.prototype.x; - -/** @type {number} */ -WebKitPoint.prototype.y; diff --git a/dom/events/EventStates.h b/dom/events/EventStates.h index 2672d2897..183070755 100644 --- a/dom/events/EventStates.h +++ b/dom/events/EventStates.h @@ -27,7 +27,7 @@ public: typedef uint64_t InternalType; typedef uint8_t ServoType; - constexpr EventStates() + EventStates() : mStates(0) { } @@ -37,12 +37,12 @@ public: // In that case, we could be sure that only macros at the end were creating // EventStates instances with mStates set to something else than 0. // Unfortunately, this constructor is needed at at least two places now. - explicit constexpr EventStates(InternalType aStates) + explicit EventStates(InternalType aStates) : mStates(aStates) { } - EventStates constexpr operator|(const EventStates& aEventStates) const + EventStates operator|(const EventStates& aEventStates) const { return EventStates(mStates | aEventStates.mStates); } @@ -56,7 +56,7 @@ public: // NOTE: calling if (eventStates1 & eventStates2) will not build. // This might work correctly if operator bool() is defined // but using HasState, HasAllStates or HasAtLeastOneOfStates is recommended. - EventStates constexpr operator&(const EventStates& aEventStates) const + EventStates operator&(const EventStates& aEventStates) const { return EventStates(mStates & aEventStates.mStates); } diff --git a/dom/heapsnapshot/HeapSnapshot.cpp b/dom/heapsnapshot/HeapSnapshot.cpp index 299a96a9c..668b7f5a5 100644 --- a/dom/heapsnapshot/HeapSnapshot.cpp +++ b/dom/heapsnapshot/HeapSnapshot.cpp @@ -1455,7 +1455,7 @@ HeapSnapshot::CreateUniqueCoreDumpFile(ErrorResult& rv, class DeleteHeapSnapshotTempFileHelperChild { public: - constexpr DeleteHeapSnapshotTempFileHelperChild() { } + DeleteHeapSnapshotTempFileHelperChild() { } void operator()(PHeapSnapshotTempFileHelperChild* ptr) const { Unused << NS_WARN_IF(!HeapSnapshotTempFileHelperChild::Send__delete__(ptr)); diff --git a/dom/html/HTMLDivElement.cpp b/dom/html/HTMLDivElement.cpp index b56187e29..d5b587241 100644 --- a/dom/html/HTMLDivElement.cpp +++ b/dom/html/HTMLDivElement.cpp @@ -34,20 +34,6 @@ HTMLDivElement::ParseAttribute(int32_t aNamespaceID, nsAttrValue& aResult) { if (aNamespaceID == kNameSpaceID_None) { - if (mNodeInfo->Equals(nsGkAtoms::marquee)) { - if ((aAttribute == nsGkAtoms::width) || - (aAttribute == nsGkAtoms::height)) { - return aResult.ParseSpecialIntValue(aValue); - } - if (aAttribute == nsGkAtoms::bgcolor) { - return aResult.ParseColor(aValue); - } - if ((aAttribute == nsGkAtoms::hspace) || - (aAttribute == nsGkAtoms::vspace)) { - return aResult.ParseIntWithBounds(aValue, 0); - } - } - if (mNodeInfo->Equals(nsGkAtoms::div) && aAttribute == nsGkAtoms::align) { return ParseDivAlignValue(aValue, aResult); @@ -66,15 +52,6 @@ HTMLDivElement::MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); } -static void -MapMarqueeAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData) -{ - nsGenericHTMLElement::MapImageMarginAttributeInto(aAttributes, aData); - nsGenericHTMLElement::MapImageSizeAttributesInto(aAttributes, aData); - nsGenericHTMLElement::MapCommonAttributesInto(aAttributes, aData); - nsGenericHTMLElement::MapBGColorInto(aAttributes, aData); -} - NS_IMETHODIMP_(bool) HTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const { @@ -85,14 +62,6 @@ HTMLDivElement::IsAttributeMapped(const nsIAtom* aAttribute) const }; return FindAttributeDependence(aAttribute, map); } - if (mNodeInfo->Equals(nsGkAtoms::marquee)) { - static const MappedAttributeEntry* const map[] = { - sImageMarginSizeAttributeMap, - sBackgroundColorAttributeMap, - sCommonAttributeMap - }; - return FindAttributeDependence(aAttribute, map); - } return nsGenericHTMLElement::IsAttributeMapped(aAttribute); } @@ -103,9 +72,6 @@ HTMLDivElement::GetAttributeMappingFunction() const if (mNodeInfo->Equals(nsGkAtoms::div)) { return &MapAttributesIntoRule; } - if (mNodeInfo->Equals(nsGkAtoms::marquee)) { - return &MapMarqueeAttributesIntoRule; - } return nsGenericHTMLElement::GetAttributeMappingFunction(); } diff --git a/dom/html/HTMLTrackElement.cpp b/dom/html/HTMLTrackElement.cpp index 758018f8d..59810a444 100644 --- a/dom/html/HTMLTrackElement.cpp +++ b/dom/html/HTMLTrackElement.cpp @@ -57,7 +57,7 @@ namespace mozilla { namespace dom { // Map html attribute string values to TextTrackKind enums. -static constexpr nsAttrValue::EnumTable kKindTable[] = { +static nsAttrValue::EnumTable kKindTable[] = { { "subtitles", static_cast<int16_t>(TextTrackKind::Subtitles) }, { "captions", static_cast<int16_t>(TextTrackKind::Captions) }, { "descriptions", static_cast<int16_t>(TextTrackKind::Descriptions) }, @@ -68,7 +68,7 @@ static constexpr nsAttrValue::EnumTable kKindTable[] = { // Invalid values are treated as "metadata" in ParseAttribute, but if no value // at all is specified, it's treated as "subtitles" in GetKind -static constexpr const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4]; +static const nsAttrValue::EnumTable* kKindTableInvalidValueDefault = &kKindTable[4]; class WindowDestroyObserver final : public nsIObserver { diff --git a/dom/html/nsHTMLDocument.cpp b/dom/html/nsHTMLDocument.cpp index fc5268acc..b0747fb04 100644 --- a/dom/html/nsHTMLDocument.cpp +++ b/dom/html/nsHTMLDocument.cpp @@ -1511,6 +1511,9 @@ nsHTMLDocument::Open(JSContext* cx, // document again otherwise the document could have a non-zero onload block // count without the onload blocker request being in the loadgroup. EnsureOnloadBlocker(); + + // Throw away loaded modules created for the previous global. + ScriptLoader()->ClearModuleMap(); } // Step 8 - Clear all event listeners out of our DOM tree diff --git a/dom/html/test/test_bug389797.html b/dom/html/test/test_bug389797.html index 884348b12..373528c71 100644 --- a/dom/html/test/test_bug389797.html +++ b/dom/html/test/test_bug389797.html @@ -168,7 +168,6 @@ HTML_TAG("listing", "Pre"); HTML_TAG("main", ""); HTML_TAG("map", "Map"); HTML_TAG("mark", ""); -HTML_TAG("marquee", "Div"); HTML_TAG("menu", "Menu"); HTML_TAG("meta", "Meta"); HTML_TAG("meter", "Meter"); diff --git a/dom/html/test/test_documentAll.html b/dom/html/test/test_documentAll.html index ec877acec..9db77d2fe 100644 --- a/dom/html/test/test_documentAll.html +++ b/dom/html/test/test_documentAll.html @@ -117,7 +117,7 @@ var elementNames = 'input','ins','isindex','kbd','keygen','label','li','legend','link','menu', 'multicol','noscript','noframes','object','spacer','table','td','td','th', 'thead','tfoot','tr','textarea','select','option','spacer','param', - 'marquee','hr','title','hx','tt','u','ul','var','wbr','sub','sup','cite', + 'hr','title','hx','tt','u','ul','var','wbr','sub','sup','cite', 'code','q','nobr','ol','p','pre','s','samp','small','body','html','map', 'bdo','legend','listing','style','script','tbody','caption','meta', 'optgroup','button','span','strike','strong','td'].sort(); diff --git a/dom/indexedDB/ActorsParent.cpp b/dom/indexedDB/ActorsParent.cpp index 74afef452..c7feb8d86 100644 --- a/dom/indexedDB/ActorsParent.cpp +++ b/dom/indexedDB/ActorsParent.cpp @@ -270,7 +270,7 @@ const uint32_t kDEBUGTransactionThreadSleepMS = 0; #endif template <size_t N> -constexpr size_t +size_t LiteralStringLength(const char (&aArr)[N]) { static_assert(N, "Zero-length string literal?!"); @@ -2905,11 +2905,11 @@ UpgradeKeyFunction::CopyAndUpgradeKeyBufferInternal(const uint8_t*& aSource, MOZ_ASSERT(aDestination); MOZ_ASSERT(aTagOffset <= Key::kMaxArrayCollapse); - static constexpr uint8_t kOldNumberTag = 0x1; - static constexpr uint8_t kOldDateTag = 0x2; - static constexpr uint8_t kOldStringTag = 0x3; - static constexpr uint8_t kOldArrayTag = 0x4; - static constexpr uint8_t kOldMaxType = kOldArrayTag; + static uint8_t kOldNumberTag = 0x1; + static uint8_t kOldDateTag = 0x2; + static uint8_t kOldStringTag = 0x3; + static uint8_t kOldArrayTag = 0x4; + static uint8_t kOldMaxType = kOldArrayTag; if (NS_WARN_IF(aRecursionDepth > Key::kMaxRecursionDepth)) { IDB_REPORT_INTERNAL_ERR(); diff --git a/dom/media/MediaCache.cpp b/dom/media/MediaCache.cpp index 37399f851..64523afcb 100644 --- a/dom/media/MediaCache.cpp +++ b/dom/media/MediaCache.cpp @@ -277,7 +277,7 @@ protected: }; struct BlockOwner { - constexpr BlockOwner() {} + BlockOwner() {} // The stream that owns this block, or null if the block is free. MediaCacheStream* mStream = nullptr; diff --git a/dom/media/MediaStreamGraphImpl.h b/dom/media/MediaStreamGraphImpl.h index c71975493..b3d7d8701 100644 --- a/dom/media/MediaStreamGraphImpl.h +++ b/dom/media/MediaStreamGraphImpl.h @@ -652,7 +652,7 @@ public: * and boolean to control if we want input/output */ bool mInputWanted; - int mInputDeviceID; + Atomic<int> mInputDeviceID; bool mOutputWanted; int mOutputDeviceID; // Maps AudioDataListeners to a usecount of streams using the listener diff --git a/dom/media/platforms/PDMFactory.h b/dom/media/platforms/PDMFactory.h index 2b43fa1ab..a13c99ac0 100644 --- a/dom/media/platforms/PDMFactory.h +++ b/dom/media/platforms/PDMFactory.h @@ -49,10 +49,10 @@ public: void SetCDMProxy(CDMProxy* aProxy); #endif - static constexpr int kYUV400 = 0; - static constexpr int kYUV420 = 1; - static constexpr int kYUV422 = 2; - static constexpr int kYUV444 = 3; + static const int kYUV400 = 0; + static const int kYUV420 = 1; + static const int kYUV422 = 2; + static const int kYUV444 = 3; private: virtual ~PDMFactory(); diff --git a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp index 090e1b217..96c53b1cd 100644 --- a/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.cpp @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2020 M. Straver. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -72,6 +73,7 @@ HRTFDatabaseLoader::HRTFDatabaseLoader(float sampleRate) , m_threadLock("HRTFDatabaseLoader") , m_databaseLoaderThread(nullptr) , m_databaseSampleRate(sampleRate) + , m_databaseLoaded(false) { MOZ_ASSERT(NS_IsMainThread()); } @@ -164,6 +166,7 @@ void HRTFDatabaseLoader::load() MOZ_ASSERT(!m_hrtfDatabase.get(), "Called twice"); // Load the default HRTF database. m_hrtfDatabase = HRTFDatabase::create(m_databaseSampleRate); + m_databaseLoaded = true; // Notifies the main thread of completion. See loadAsynchronously(). Release(); } diff --git a/dom/media/webaudio/blink/HRTFDatabaseLoader.h b/dom/media/webaudio/blink/HRTFDatabaseLoader.h index 50a875b18..4dfbd4fc8 100644 --- a/dom/media/webaudio/blink/HRTFDatabaseLoader.h +++ b/dom/media/webaudio/blink/HRTFDatabaseLoader.h @@ -1,5 +1,6 @@ /* * Copyright (C) 2010 Google Inc. All rights reserved. + * Copyright (C) 2020 M. Straver. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -85,7 +86,12 @@ public: // on any thread except m_databaseLoaderThread. void waitForLoaderThreadCompletion(); - HRTFDatabase* database() { return m_hrtfDatabase.get(); } + HRTFDatabase* database() { + if (!m_databaseLoaded) { + return nullptr; + } + return m_hrtfDatabase.get(); + } float databaseSampleRate() const { return m_databaseSampleRate; } @@ -141,6 +147,7 @@ private: PRThread* m_databaseLoaderThread; float m_databaseSampleRate; + mozilla::Atomic<bool> m_databaseLoaded; }; } // namespace WebCore diff --git a/dom/plugins/ipc/PluginModuleChild.cpp b/dom/plugins/ipc/PluginModuleChild.cpp index f943dfc42..98c9cd494 100644 --- a/dom/plugins/ipc/PluginModuleChild.cpp +++ b/dom/plugins/ipc/PluginModuleChild.cpp @@ -40,8 +40,8 @@ #ifdef XP_WIN #include "nsWindowsDllInterceptor.h" #include "mozilla/widget/AudioSession.h" -#include "WinUtils.h" #include <knownfolders.h> +#include <shlobj.h> #endif #ifdef MOZ_WIDGET_COCOA @@ -1918,8 +1918,8 @@ GetLocalLowTempPath(size_t aLen, LPWSTR aPath) { NS_NAMED_LITERAL_STRING(tempname, "\\Temp"); LPWSTR path; - if (SUCCEEDED(WinUtils::SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, - nullptr, &path))) { + if (SUCCEEDED(SHGetKnownFolderPath(FOLDERID_LocalAppDataLow, 0, + nullptr, &path))) { if (wcslen(path) + tempname.Length() < aLen) { wcscpy(aPath, path); wcscat(aPath, tempname.get()); diff --git a/dom/script/ModuleLoadRequest.h b/dom/script/ModuleLoadRequest.h index eefb7dad5..4eac65090 100644 --- a/dom/script/ModuleLoadRequest.h +++ b/dom/script/ModuleLoadRequest.h @@ -56,7 +56,7 @@ public: ModuleLoadRequest(nsIURI* aURI, ModuleLoadRequest* aParent); - bool IsTopLevel() const { + bool IsTopLevel() const override { return mIsTopLevel; } diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index 989301b91..362c27f3e 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -477,6 +477,11 @@ ScriptLoader::GetFetchedModule(nsIURI* aURL) const return ms; } +void ScriptLoader::ClearModuleMap() { + MOZ_ASSERT(mFetchingModules.IsEmpty()); + mFetchedModules.Clear(); +} + nsresult ScriptLoader::ProcessFetchedModuleSource(ModuleLoadRequest* aRequest) { @@ -559,7 +564,9 @@ ScriptLoader::CreateModuleScript(ModuleLoadRequest* aRequest) rv = nsJSUtils::CompileModule(cx, srcBuf, global, options, &module); } } + MOZ_ASSERT(NS_SUCCEEDED(rv) == (module != nullptr)); + RefPtr<ModuleScript> moduleScript = new ModuleScript(this, aRequest->mBaseURL); aRequest->mModuleScript = moduleScript; @@ -979,7 +986,7 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType, if (aRequest->IsModuleRequest()) { // Check whether the module has been fetched or is currently being fetched, - // and if so wait for it. + // and if so wait for it rather than starting a new fetch. ModuleLoadRequest* request = aRequest->AsModuleRequest(); if (ModuleMapContainsURL(request->mURI)) { WaitForModuleFetch(request->mURI) @@ -988,9 +995,6 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType, &ModuleLoadRequest::LoadFailed); return NS_OK; } - - // Otherwise put the URL in the module map and mark it as fetching. - SetModuleFetchStarted(request); } nsContentPolicyType contentPolicyType = aRequest->IsPreload() @@ -1103,7 +1107,16 @@ ScriptLoader::StartLoad(ScriptLoadRequest *aRequest, const nsAString &aType, rv = NS_NewIncrementalStreamLoader(getter_AddRefs(loader), handler); NS_ENSURE_SUCCESS(rv, rv); - return channel->AsyncOpen2(loader); + rv = channel->AsyncOpen2(loader); + NS_ENSURE_SUCCESS(rv, rv); + + if (aRequest->IsModuleRequest()) { + // We successfully started fetching a module so put its URL in the module + // map and mark it as fetching. + SetModuleFetchStarted(aRequest->AsModuleRequest()); + } + + return NS_OK; } bool @@ -1355,8 +1368,8 @@ ScriptLoader::ProcessScriptElement(nsIScriptElement *aElement) } } - // Should still be in loading stage of script. - NS_ASSERTION(!request->InCompilingStage(), + // Should still be in loading stage of script unless we're loading a module. + NS_ASSERTION(!request->InCompilingStage() || request->IsModuleRequest(), "Request should not yet be in compiling stage."); request->mJSVersion = version; @@ -1904,14 +1917,17 @@ ScriptLoader::FillCompileOptionsForRequest(const AutoJSAPI&jsapi, aOptions->setMutedErrors(!subsumes); } - JSContext* cx = jsapi.cx(); - JS::Rooted<JS::Value> elementVal(cx); - MOZ_ASSERT(aRequest->mElement); - if (NS_SUCCEEDED(nsContentUtils::WrapNative(cx, aRequest->mElement, - &elementVal, - /* aAllowWrapping = */ true))) { - MOZ_ASSERT(elementVal.isObject()); - aOptions->setElement(&elementVal.toObject()); + if (!aRequest->IsModuleRequest()) { + // Only do this for classic scripts. + JSContext* cx = jsapi.cx(); + JS::Rooted<JS::Value> elementVal(cx); + MOZ_ASSERT(aRequest->mElement); + if (NS_SUCCEEDED(nsContentUtils::WrapNative(cx, aRequest->mElement, + &elementVal, + /* aAllowWrapping = */ true))) { + MOZ_ASSERT(elementVal.isObject()); + aOptions->setElement(&elementVal.toObject()); + } } return NS_OK; @@ -2373,7 +2389,7 @@ ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult) { RefPtr<ScriptLoadRequest> req = mXSLTRequests.Steal(aRequest); FireScriptAvailable(aResult, req); } - } else if (aRequest->IsModuleRequest()) { + } else if (aRequest->IsModuleRequest() && !aRequest->IsPreload()) { ModuleLoadRequest* modReq = aRequest->AsModuleRequest(); MOZ_ASSERT(!modReq->IsTopLevel()); MOZ_ASSERT(!modReq->isInList()); @@ -2394,8 +2410,19 @@ ScriptLoader::HandleLoadError(ScriptLoadRequest *aRequest, nsresult aResult) { FireScriptAvailable(aResult, aRequest); ContinueParserAsync(aRequest); mCurrentParserInsertedScript = oldParserInsertedScript; + } else if (aRequest->IsPreload()) { + if (aRequest->IsModuleRequest()) { + // If there is an error preloading modules, cancel the load request. + aRequest->Cancel(); + } + if (aRequest->IsTopLevel()) { + MOZ_ALWAYS_TRUE(mPreloads.RemoveElement(aRequest, PreloadRequestComparator())); + } + MOZ_ASSERT(!aRequest->isInList()); } else { - mPreloads.RemoveElement(aRequest, PreloadRequestComparator()); + // This happens for blocking requests cancelled by ParsingComplete(). + MOZ_ASSERT(aRequest->IsCanceled()); + MOZ_ASSERT(!aRequest->isInList()); } } @@ -2424,6 +2451,18 @@ ScriptLoader::NumberOfProcessors() return mNumberOfProcessors; } +static bool +IsInternalURIScheme(nsIURI* uri) +{ + // Note: Extend this if other schemes need to be included. + bool isResource; + if (NS_SUCCEEDED(uri->SchemeIs("resource", &isResource)) && isResource) { + return true; + } + + return false; +} + nsresult ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest, nsIIncrementalStreamLoader* aLoader, @@ -2511,7 +2550,17 @@ ScriptLoader::PrepareLoadedRequest(ScriptLoadRequest* aRequest, return NS_ERROR_FAILURE; } - channel->GetURI(getter_AddRefs(request->mBaseURL)); + nsCOMPtr<nsIURI> uri; + rv = channel->GetOriginalURI(getter_AddRefs(uri)); + NS_ENSURE_SUCCESS(rv, rv); + + // Fixup internal scheme URIs like resource:, because the channel URI + // will point to file: which won't be allowed to load. + if (uri && IsInternalURIScheme(uri)) { + request->mBaseURL = uri; + } else { + channel->GetURI(getter_AddRefs(request->mBaseURL)); + } // Attempt to compile off main thread. rv = AttemptAsyncScriptCompile(request); @@ -2576,13 +2625,15 @@ ScriptLoader::ParsingComplete(bool aTerminated) } void -ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset, +ScriptLoader::PreloadURI(nsIURI *aURI, + const nsAString &aCharset, const nsAString &aType, const nsAString &aCrossOrigin, const nsAString& aIntegrity, bool aScriptFromHead, bool aAsync, bool aDefer, + bool aNoModule, const mozilla::net::ReferrerPolicy aReferrerPolicy) { NS_ENSURE_TRUE_VOID(mDocument); @@ -2591,8 +2642,28 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset, return; } - // TODO: Preload module scripts. - if (mDocument->ModuleScriptsEnabled() && aType.LowerCaseEqualsASCII("module")) { + ScriptKind scriptKind = ScriptKind::Classic; + + if (mDocument->ModuleScriptsEnabled()) { + // Don't load nomodule scripts. + if (aNoModule) { + return; + } + + // Preload module scripts. + static const char kASCIIWhitespace[] = "\t\n\f\r "; + + nsAutoString type(aType); + type.Trim(kASCIIWhitespace); + if (type.LowerCaseEqualsASCII("module")) { + scriptKind = ScriptKind::Module; + } + } + + if (scriptKind == ScriptKind::Classic && + !aType.IsEmpty() && !nsContentUtils::IsJavascriptMIMEType(aType)) { + // Unknown type (not type = module and not type = JS MIME type). + // Don't load it. return; } @@ -2609,7 +2680,7 @@ ScriptLoader::PreloadURI(nsIURI *aURI, const nsAString &aCharset, } RefPtr<ScriptLoadRequest> request = - CreateLoadRequest(ScriptKind::Classic, aURI, nullptr, 0, + CreateLoadRequest(scriptKind, aURI, nullptr, 0, Element::StringToCORSMode(aCrossOrigin), sriMetadata, aReferrerPolicy); request->mIsInline = false; diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h index ed1e6acbc..73f2a9258 100644 --- a/dom/script/ScriptLoader.h +++ b/dom/script/ScriptLoader.h @@ -173,6 +173,12 @@ public: return mScriptMode == ScriptMode::eAsync; } + virtual bool IsTopLevel() const + { + // Classic scripts are always top level. + return true; + } + void MaybeCancelOffThreadScript(); using super::getNext; @@ -479,13 +485,15 @@ public: * @param aIntegrity The expect hash url, if avail, of the request * @param aScriptFromHead Whether or not the script was a child of head */ - virtual void PreloadURI(nsIURI *aURI, const nsAString &aCharset, + virtual void PreloadURI(nsIURI *aURI, + const nsAString &aCharset, const nsAString &aType, const nsAString &aCrossOrigin, const nsAString& aIntegrity, bool aScriptFromHead, bool aAsync, bool aDefer, + bool aNoModule, const mozilla::net::ReferrerPolicy aReferrerPolicy); /** @@ -498,6 +506,12 @@ public: return mPendingChildLoaders.AppendElement(aChild) != nullptr; } + /* + * Clear the map of loaded modules. Called when a Document object is reused + * for a different global. + */ + void ClearModuleMap(); + private: virtual ~ScriptLoader(); diff --git a/dom/security/test/csp/file_bug1312272.html b/dom/security/test/csp/file_bug1312272.html deleted file mode 100644 index 18e0e5589..000000000 --- a/dom/security/test/csp/file_bug1312272.html +++ /dev/null @@ -1,13 +0,0 @@ -<!DOCTYPE HTML> -<!-- Any copyright is dedicated to the Public Domain. - http://creativecommons.org/publicdomain/zero/1.0/ --> -<html> -<head> - <meta charset="utf-8"> - <title>marquee inline script tests for Bug 1312272</title> -</head> -<body> -<marquee id="m" onstart="parent.postMessage('csp-violation-marquee-onstart', '*')">bug 1312272</marquee> -<script src="file_bug1312272.js"></script> -</body> -</html> diff --git a/dom/security/test/csp/file_strict_dynamic_script_events_xbl.html b/dom/security/test/csp/file_strict_dynamic_script_events_xbl.html deleted file mode 100644 index 701ef3226..000000000 --- a/dom/security/test/csp/file_strict_dynamic_script_events_xbl.html +++ /dev/null @@ -1,14 +0,0 @@ -<!DOCTYPE HTML> -<html> -<head> - <title>Bug 1316826 - 'strict-dynamic' blocking DOM event handlers</title> -</head> -<body> -<div id="testdiv">blocked</div> - -<marquee onstart='document.getElementById("testdiv").innerHTML = "allowed";'> - Bug 1316826 -</marquee> - -</body> -</html> diff --git a/dom/security/test/csp/test_strict_dynamic.html b/dom/security/test/csp/test_strict_dynamic.html index 00e75143f..8f1b53f31 100644 --- a/dom/security/test/csp/test_strict_dynamic.html +++ b/dom/security/test/csp/test_strict_dynamic.html @@ -79,13 +79,6 @@ var tests = [ policy: "script-src 'strict-dynamic' 'nonce-foo'" }, { - // marquee is a special snowflake. Extra test for xbl things. - desc: "strict-dynamic with DOM events should be blocked (XBL)", - result: "blocked", - file: "file_strict_dynamic_script_events_xbl.html", - policy: "script-src 'strict-dynamic' 'nonce-foo'" - }, - { desc: "strict-dynamic with JS URLs should be blocked", result: "blocked", file: "file_strict_dynamic_js_url.html", diff --git a/dom/smil/SMILBoolType.h b/dom/smil/SMILBoolType.h index 608a09ccf..d0bbcf5ea 100644 --- a/dom/smil/SMILBoolType.h +++ b/dom/smil/SMILBoolType.h @@ -42,7 +42,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILBoolType() {} + SMILBoolType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILEnumType.h b/dom/smil/SMILEnumType.h index b6cda3ff9..070ae60bb 100644 --- a/dom/smil/SMILEnumType.h +++ b/dom/smil/SMILEnumType.h @@ -43,7 +43,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILEnumType() {} + SMILEnumType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILIntegerType.h b/dom/smil/SMILIntegerType.h index 39560cc79..bf8030b6e 100644 --- a/dom/smil/SMILIntegerType.h +++ b/dom/smil/SMILIntegerType.h @@ -38,7 +38,8 @@ public: } private: - constexpr SMILIntegerType() {} + // Private constructor: prevent instances beyond my singleton. + SMILIntegerType() {} }; } // namespace mozilla diff --git a/dom/smil/SMILStringType.h b/dom/smil/SMILStringType.h index 6f160cadb..6fb51b7d9 100644 --- a/dom/smil/SMILStringType.h +++ b/dom/smil/SMILStringType.h @@ -43,7 +43,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SMILStringType() {} + SMILStringType() {} }; } // namespace mozilla diff --git a/dom/smil/nsSMILCSSValueType.h b/dom/smil/nsSMILCSSValueType.h index 0c71605f0..0303e69e3 100644 --- a/dom/smil/nsSMILCSSValueType.h +++ b/dom/smil/nsSMILCSSValueType.h @@ -110,7 +110,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILCSSValueType() {} + nsSMILCSSValueType() {} }; #endif // NS_SMILCSSVALUETYPE_H_ diff --git a/dom/smil/nsSMILFloatType.h b/dom/smil/nsSMILFloatType.h index fd57e4a77..470e935d3 100644 --- a/dom/smil/nsSMILFloatType.h +++ b/dom/smil/nsSMILFloatType.h @@ -41,7 +41,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILFloatType() {} + nsSMILFloatType() {} }; #endif // NS_SMILFLOATTYPE_H_ diff --git a/dom/smil/nsSMILNullType.h b/dom/smil/nsSMILNullType.h index d21610ff4..c668773ce 100644 --- a/dom/smil/nsSMILNullType.h +++ b/dom/smil/nsSMILNullType.h @@ -44,7 +44,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr nsSMILNullType() {} + nsSMILNullType() {} }; #endif // NS_SMILNULLTYPE_H_ diff --git a/dom/svg/SVGIntegerPairSMILType.h b/dom/svg/SVGIntegerPairSMILType.h index 52af5d3dc..ae62781fd 100644 --- a/dom/svg/SVGIntegerPairSMILType.h +++ b/dom/svg/SVGIntegerPairSMILType.h @@ -45,7 +45,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGIntegerPairSMILType() {} + SVGIntegerPairSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGLengthListSMILType.h b/dom/svg/SVGLengthListSMILType.h index 10321b585..2fbb84488 100644 --- a/dom/svg/SVGLengthListSMILType.h +++ b/dom/svg/SVGLengthListSMILType.h @@ -93,7 +93,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGLengthListSMILType() {} + SVGLengthListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGMotionSMILType.h b/dom/svg/SVGMotionSMILType.h index 7529d796d..768c90093 100644 --- a/dom/svg/SVGMotionSMILType.h +++ b/dom/svg/SVGMotionSMILType.h @@ -78,7 +78,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGMotionSMILType() {} + SVGMotionSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGNumberListSMILType.h b/dom/svg/SVGNumberListSMILType.h index 5e8db8afe..efdabdb14 100644 --- a/dom/svg/SVGNumberListSMILType.h +++ b/dom/svg/SVGNumberListSMILType.h @@ -47,7 +47,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGNumberListSMILType() {} + SVGNumberListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGNumberPairSMILType.h b/dom/svg/SVGNumberPairSMILType.h index 0f90163f5..a88a0f5ac 100644 --- a/dom/svg/SVGNumberPairSMILType.h +++ b/dom/svg/SVGNumberPairSMILType.h @@ -40,7 +40,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGNumberPairSMILType() {} + SVGNumberPairSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGOrientSMILType.h b/dom/svg/SVGOrientSMILType.h index 6b30cbee0..904b37680 100644 --- a/dom/svg/SVGOrientSMILType.h +++ b/dom/svg/SVGOrientSMILType.h @@ -60,7 +60,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGOrientSMILType() {} + SVGOrientSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGPathSegListSMILType.h b/dom/svg/SVGPathSegListSMILType.h index 6856ef275..5e4e89141 100644 --- a/dom/svg/SVGPathSegListSMILType.h +++ b/dom/svg/SVGPathSegListSMILType.h @@ -51,7 +51,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGPathSegListSMILType() {} + SVGPathSegListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGPointListSMILType.h b/dom/svg/SVGPointListSMILType.h index 6f58bd42e..053959553 100644 --- a/dom/svg/SVGPointListSMILType.h +++ b/dom/svg/SVGPointListSMILType.h @@ -47,7 +47,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGPointListSMILType() {} + SVGPointListSMILType() {} }; } // namespace mozilla diff --git a/dom/svg/SVGTransformListSMILType.h b/dom/svg/SVGTransformListSMILType.h index 526f9ba50..6572815a1 100644 --- a/dom/svg/SVGTransformListSMILType.h +++ b/dom/svg/SVGTransformListSMILType.h @@ -123,7 +123,7 @@ public: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGTransformListSMILType() {} + SVGTransformListSMILType() {} }; } // end namespace mozilla diff --git a/dom/svg/SVGViewBoxSMILType.h b/dom/svg/SVGViewBoxSMILType.h index f05f3928d..54b171263 100644 --- a/dom/svg/SVGViewBoxSMILType.h +++ b/dom/svg/SVGViewBoxSMILType.h @@ -40,7 +40,7 @@ protected: private: // Private constructor: prevent instances beyond my singleton. - constexpr SVGViewBoxSMILType() {} + SVGViewBoxSMILType() {} }; } // namespace mozilla diff --git a/dom/tests/browser/browser_bug396843.js b/dom/tests/browser/browser_bug396843.js index 84d7e3b83..a2281d1b8 100644 --- a/dom/tests/browser/browser_bug396843.js +++ b/dom/tests/browser/browser_bug396843.js @@ -72,7 +72,6 @@ function testInDocument(doc, documentID) { HTML_TAG("link", "Link") HTML_TAG("listing", "Span") HTML_TAG("map", "Map") - HTML_TAG("marquee", "Div") HTML_TAG("menu", "Shared") HTML_TAG("meta", "Meta") HTML_TAG("multicol", "Unknown") diff --git a/dom/tests/mochitest/bugs/mochitest.ini b/dom/tests/mochitest/bugs/mochitest.ini index 3743c6782..6865ada88 100644 --- a/dom/tests/mochitest/bugs/mochitest.ini +++ b/dom/tests/mochitest/bugs/mochitest.ini @@ -145,5 +145,4 @@ skip-if = toolkit == 'android' #Windows can't change size on Android skip-if = toolkit == 'android' [test_bug1022869.html] [test_bug1112040.html] -[test_bug1160342_marquee.html] [test_bug1171215.html] diff --git a/dom/tests/mochitest/bugs/test_bug1160342_marquee.html b/dom/tests/mochitest/bugs/test_bug1160342_marquee.html deleted file mode 100644 index 8da13478e..000000000 --- a/dom/tests/mochitest/bugs/test_bug1160342_marquee.html +++ /dev/null @@ -1,337 +0,0 @@ -<!DOCTYPE html> -<html> -<!-- -https://bugzilla.mozilla.org/show_bug.cgi?id=1160342 ---> -<head> - <title>Test for Bug 411103</title> - <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> - <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> -</head> -<body> -<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1160342">Mozilla Bug 1160342</a> -<p id="display"></p> -<div id="content"> -<marquee id="a" style="border: 1px solid black;">marquee</marquee> -</div> - -<pre id="test"> -<script class="testbody" type="text/javascript"> -/* The todos are cases where IE/Edge is throwing errors, but - for Mozilla it was decided to not do that for now */ - var x=document.getElementById('a'); - - SimpleTest.waitForExplicitFinish(); - - setTimeout(function() { - is(x.behavior, "scroll", "Wrong behavior value"); - x.setAttribute('behavior', 'alternate'); - is(x.behavior, "alternate", "Wrong behavior value"); - x.setAttribute('behavior', 'invalid'); - is(x.behavior, "scroll", "Wrong behavior value");; - x.setAttribute('behavior', 'Scroll'); - is(x.behavior, "scroll", "Wrong behavior value"); - x.setAttribute('behavior', 'Slide'); - is(x.behavior, "slide", "Wrong behavior value"); - x.setAttribute('behavior', ''); - is(x.behavior, "scroll", "Wrong behavior value"); - x.setAttribute('behavior', 'slide'); - x.removeAttribute('behavior'); - is(x.behavior, "scroll", "Wrong behavior value"); - is(x.getAttribute('behavior'), null, "Wrong behavior attribute"); - - x.behavior = 'alternate'; - is(x.behavior, "alternate", "Wrong behavior value"); - try { - x.behavior = 'invalid'; - todo_is(false, true, "marquee.behavior = 'invalid' should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.behavior, "alternate", "Wrong behavior value"); - is(x.getAttribute('behavior'), "alternate", "Wrong behavior attribute"); - x.behavior = 'Slide'; - is(x.behavior, "slide", "Wrong behavior value"); - is(x.getAttribute('behavior'), "slide", "Wrong behavior attribute"); - try { - x.behavior = 'invalid'; - todo_is(false, true, "marquee.behavior = 'invalid' should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - try { - x.behavior = null; - x.behavior = undefined; - todo_is(false, true, "marquee.behavior = 'invalid' should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.behavior, "slide", "Wrong behavior value"); - is(x.getAttribute('behavior'), "slide", "Wrong behavior attribute"); - // This doesn't work in Mozilla due to chrome XBL security issues - x.behavior = { toString: function _toString() { return "scroll"} } - is(x.behavior, x.getAttribute('behavior'), "Wrong behavior value"); - x.behavior = 'scroll'; - is(x.behavior, "scroll", "Wrong behavior value"); - - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', '1'); - is(x.loop, 1, "Wrong loop value"); - x.setAttribute('loop', 'invalid'); - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', ''); - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', '0'); - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', '1000'); - is(x.loop, 1000, "Wrong loop value"); - x.setAttribute('loop', '-0.123'); - is(x.loop, 1000, "Wrong loop value"); - x.setAttribute('loop', '-1.123'); - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', '-1'); - is(x.loop, -1, "Wrong loop value"); - x.setAttribute('loop', '1000'); - is(x.loop, 1000, "Wrong loop value"); - x.removeAttribute('loop'); - is(x.loop, -1, "Wrong loop value"); - is(x.getAttribute('loop'), null, "Wrong loop attribute"); - - x.loop = 1; - is(x.loop, 1, "Wrong loop value"); - is(x.getAttribute('loop'), "1", "Wrong loop attribute"); - try { - x.loop = -2; - todo_is(false, true, "marquee.loop = -2 should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.loop, 1, "Wrong loop value"); - is(x.getAttribute('loop'), "1", "Wrong loop attribute"); - try { - x.loop = 'invalid'; - todo_is(false, true, ".loop = 'invalid' should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.loop, 1, "Wrong loop value"); - is(x.getAttribute('loop'), "1", "Wrong loop attribute"); - try { - x.loop = null; - todo_is(false, true, "marquee.loop = null should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.loop, 1, "Wrong loop value"); - is(x.getAttribute('loop'), "1", "Wrong loop attribute"); - x.loop = -1; - is(x.loop, -1, "Wrong loop value"); - is(x.getAttribute('loop'), "-1", "Wrong loop attribute"); - x.loop = '100'; - is(x.loop, 100, "Wrong loop value"); - is(x.getAttribute('loop'), "100", "Wrong loop attribute"); - try { - x.loop = -0.123; - todo_is(false, true, "marquee.loop = null should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.loop, 100, "Wrong loop value"); - is(x.getAttribute('loop'), "100", "Wrong loop attribute"); - try { - x.loop = 0; - todo_is(false, true, "marquee.loop = null should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.loop, 100, "Wrong loop value"); - is(x.getAttribute('loop'), "100", "Wrong loop attribute"); - x.loop = -1.123; - is(x.loop, -1, "Wrong loop value"); - is(x.getAttribute('loop'), "-1", "Wrong loop attribute"); - - - is(x.scrollAmount, 6, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', '1'); - is(x.scrollAmount, 1, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', 'invalid'); - is(x.scrollAmount, 6, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', '1000'); - is(x.scrollAmount, 1000, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', '-1'); - is(x.scrollAmount, 1000, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', '999'); - is(x.scrollAmount, 999, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', ''); - is(x.scrollAmount, 6, "Wrong scrollAmount value"); - x.setAttribute('scrollAmount', '999'); - x.removeAttribute('scrollAmount'); - is(x.scrollAmount, 6, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), null, "Wrong scrollamount attribute"); - - x.scrollAmount = 1; - is(x.scrollAmount, 1, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), "1", "Wrong scrolldelay attribute"); - try { - x.scrollAmount = -2; - todo_is(false, true, "marquee.scrollAmount = -2 should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.scrollAmount, 1, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), "1", "Wrong scrolldelay attribute"); - x.scrollAmount = 'invalid'; - is(x.scrollAmount, 0, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), "0", "Wrong scrolldelay attribute"); - x.scrollAmount = 1; - x.scrollAmount = null; - is(x.scrollAmount, 0, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), "0", "Wrong scrolldelay attribute"); - x.scrollAmount = '2'; - is(x.scrollAmount, 2, "Wrong scrollAmount value"); - is(x.getAttribute('scrollamount'), "2", "Wrong scrolldelay attribute"); - - - is(x.scrollDelay, 85, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '1'); - is(x.scrollDelay, 1, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', 'invalid'); - is(x.scrollDelay, 85, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '70'); - is(x.scrollDelay, 70, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '59'); - is(x.scrollDelay, 59, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '1000'); - is(x.scrollDelay, 1000, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '-1'); - is(x.scrollDelay, 1000, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', ''); - is(x.scrollDelay, 85, "Wrong scrollDelay value"); - x.setAttribute('scrollDelay', '1000'); - x.removeAttribute('scrollDelay'); - is(x.scrollDelay, 85, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), null, "Wrong scrolldelay attribute"); - - x.scrollDelay = 100; - is(x.scrollDelay, 100, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute"); - try { - x.scrollDelay = -2; - todo_is(false, true, "marquee.scrollDelay = -2 should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.scrollDelay, 100, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute"); - try { - x.scrollDelay = 'invalid'; - todo_is(false, true, "marquee.scrollDelay = 'invalid' should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.scrollDelay, 100, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute"); - try { - x.scrollDelay = null; - todo_is(false, true, "marquee.scrollDelay = null should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.scrollDelay, 100, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute"); - try { - x.scrollDelay = -1; - todo_is(false, true, "marquee.scrollDelay = -1 should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.scrollDelay, 100, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "100", "Wrong scrolldelay attribute"); - x.scrollDelay = '50'; - is(x.scrollDelay, 50, "Wrong scrollDelay value"); - is(x.getAttribute('scrolldelay'), "50", "Wrong scrolldelay attribute"); - - - is(x.trueSpeed, false, "Wrong trueSpeed value"); - x.setAttribute('trueSpeed', '1'); - is(x.trueSpeed, true, "Wrong trueSpeed value"); - x.setAttribute('trueSpeed', 'false'); - is(x.trueSpeed, true, "Wrong trueSpeed value"); - x.setAttribute('trueSpeed', ''); - is(x.trueSpeed, true, "Wrong trueSpeed value"); - x.removeAttribute('trueSpeed'); - is(x.trueSpeed, false, "Wrong trueSpeed value"); - is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute"); - - x.trueSpeed = 1; - is(x.trueSpeed, true, "Wrong trueSpeed value"); - is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute"); - x.trueSpeed = -2; - is(x.trueSpeed, true, "Wrong trueSpeed value"); - is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute"); - x.trueSpeed = null; - is(x.trueSpeed, false, "Wrong trueSpeed value"); - is(x.getAttribute('truespeed'), null, "Wrong truespeed attribute"); - x.trueSpeed = '100'; - is(x.trueSpeed, true, "Wrong trueSpeed value"); - is(x.getAttribute('truespeed'), "", "Wrong truespeed attribute"); - - - is(x.direction, "left", "Wrong direction value"); - x.setAttribute('direction', 'right'); - is(x.direction, "right", "Wrong direction value"); - x.setAttribute('direction', 'invalid'); - is(x.direction, "left", "Wrong direction value"); - x.setAttribute('direction', 'RIGHT'); - is(x.direction, "right", "Wrong direction value"); - x.setAttribute('direction', ''); - is(x.direction, "left", "Wrong direction value"); - x.setAttribute('direction', 'right'); - x.removeAttribute('direction'); - is(x.direction, "left", "Wrong direction value"); - is(x.getAttribute('direction'), null, "Wrong direction attribute"); - x.setAttribute('direction', 'up'); - is(x.direction, "up", "Wrong direction value"); - x.setAttribute('direction', 'down'); - is(x.direction, "down", "Wrong direction value"); - x.removeAttribute('direction'); - is(x.direction, "left", "Wrong direction value"); - is(x.getAttribute('direction'), null, "Wrong direction attribute"); - - x.direction = 'right'; - is(x.direction, "right", "Wrong direction value"); - is(x.getAttribute('direction'), "right", "Wrong direction attribute"); - x.direction = 'up'; - is(x.direction, "up", "Wrong direction value"); - is(x.getAttribute('direction'), "up", "Wrong direction attribute"); - x.direction = 'down'; - is(x.direction, "down", "Wrong direction value"); - is(x.getAttribute('direction'), "down", "Wrong direction attribute"); - try { - x.direction = 1; - todo_is(false, true, "marquee.direction = 1 should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.direction, "down", "Wrong direction value"); - is(x.getAttribute('direction'), "down", "Wrong direction attribute"); - try { - x.direction = null; - todo_is(false, true, "marquee.direction = null should throw"); - } catch(e) { - ok(true, "Exception was raised"); - } - is(x.direction, "down", "Wrong direction value"); - is(x.getAttribute('direction'), "down", "Wrong direction attribute"); - // This doesn't work in Mozilla due to chrome XBL security issues - x.direction = { toString: function _toString() { return "right"} } - is(x.direction, x.getAttribute('direction'), "Wrong direction value"); - x.direction = 'left'; - is(x.direction, "left", "Wrong direction value"); - SimpleTest.finish(); - }, 0); - -</script> -</pre> -</body> -</html> diff --git a/dom/tests/mochitest/bugs/test_bug396843.html b/dom/tests/mochitest/bugs/test_bug396843.html index 20dc53068..031843fd4 100644 --- a/dom/tests/mochitest/bugs/test_bug396843.html +++ b/dom/tests/mochitest/bugs/test_bug396843.html @@ -92,7 +92,6 @@ HTML_TAG("li", "LI") HTML_TAG("link", "Link") HTML_TAG("listing", "Span") HTML_TAG("map", "Map") -HTML_TAG("marquee", "Div") HTML_TAG("menu", "Shared") HTML_TAG("meta", "Meta") HTML_TAG("multicol", "Unknown") diff --git a/dom/webidl/MediaQueryList.webidl b/dom/webidl/MediaQueryList.webidl index 519ddb0e5..af641a268 100644 --- a/dom/webidl/MediaQueryList.webidl +++ b/dom/webidl/MediaQueryList.webidl @@ -4,17 +4,21 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is - * http://dev.w3.org/csswg/cssom-view/#the-mediaquerylist-interface + * https://drafts.csswg.org/cssom-view/#mediaquerylist * * Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C * liability, trademark and document use rules apply. */ -interface MediaQueryList { +interface MediaQueryList : EventTarget { readonly attribute DOMString media; readonly attribute boolean matches; - void addListener(MediaQueryListListener listener); - void removeListener(MediaQueryListListener listener); -}; -callback MediaQueryListListener = void (MediaQueryList list); + [Throws] + void addListener(EventListener? listener); + + [Throws] + void removeListener(EventListener? listener); + + attribute EventHandler onchange; +}; diff --git a/dom/webidl/MediaQueryListEvent.webidl b/dom/webidl/MediaQueryListEvent.webidl new file mode 100644 index 000000000..f3a66fb57 --- /dev/null +++ b/dom/webidl/MediaQueryListEvent.webidl @@ -0,0 +1,18 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * https://drafts.csswg.org/cssom-view/#mediaquerylistevent
+ */
+
+[Constructor(DOMString type, optional MediaQueryListEventInit eventInitDict)]
+interface MediaQueryListEvent : Event {
+ readonly attribute DOMString media;
+ readonly attribute boolean matches;
+};
+
+dictionary MediaQueryListEventInit : EventInit {
+ DOMString media = "";
+ boolean matches = false;
+};
diff --git a/dom/webidl/ResizeObserver.webidl b/dom/webidl/ResizeObserver.webidl new file mode 100644 index 000000000..98700f53c --- /dev/null +++ b/dom/webidl/ResizeObserver.webidl @@ -0,0 +1,39 @@ +/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this file,
+ * You can obtain one at http://mozilla.org/MPL/2.0/.
+ *
+ * The origin of this IDL file is
+ * https://wicg.github.io/ResizeObserver/
+ */
+
+[Constructor(ResizeObserverCallback callback),
+ Exposed=Window,
+ Pref="layout.css.resizeobserver.enabled"]
+interface ResizeObserver {
+ [Throws]
+ void observe(Element? target);
+ [Throws]
+ void unobserve(Element? target);
+ void disconnect();
+};
+
+callback ResizeObserverCallback = void (sequence<ResizeObserverEntry> entries, ResizeObserver observer);
+
+[Constructor(Element? target),
+ ChromeOnly,
+ Pref="layout.css.resizeobserver.enabled"]
+interface ResizeObserverEntry {
+ readonly attribute Element target;
+ readonly attribute DOMRectReadOnly? contentRect;
+};
+
+[Constructor(Element? target),
+ ChromeOnly,
+ Pref="layout.css.resizeobserver.enabled"]
+interface ResizeObservation {
+ readonly attribute Element target;
+ readonly attribute long broadcastWidth;
+ readonly attribute long broadcastHeight;
+ boolean isActive();
+};
diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index 687e502fa..a4214caea 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -365,6 +365,7 @@ WEBIDL_FILES = [ 'Range.webidl', 'Rect.webidl', 'Request.webidl', + 'ResizeObserver.webidl', 'Response.webidl', 'RGBColor.webidl', 'RTCStatsReport.webidl', @@ -680,6 +681,7 @@ GENERATED_EVENTS_WEBIDL_FILES = [ 'HashChangeEvent.webidl', 'HiddenPluginEvent.webidl', 'ImageCaptureErrorEvent.webidl', + 'MediaQueryListEvent.webidl', 'MediaStreamEvent.webidl', 'MediaStreamTrackEvent.webidl', 'MozSettingsEvent.webidl', diff --git a/dom/xbl/crashtests/342954-1.xhtml b/dom/xbl/crashtests/342954-1.xhtml deleted file mode 100644 index dbaa15384..000000000 --- a/dom/xbl/crashtests/342954-1.xhtml +++ /dev/null @@ -1,46 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xbl="http://www.mozilla.org/xbl"> - - -<head> - -<script> -<![CDATA[ - -function boo() -{ - s1 = document.getElementById("s1"); - marq = document.getElementById("marq"); - marqAnonymousSomething = document.getAnonymousNodes(marq)[0].childNodes[0]; - - removeNode(marqAnonymousSomething); - s1.appendChild(document.createElement("div")); -} - -function removeNode(q1) { q1.parentNode.removeChild(q1); } - -]]> -</script> - -<xbl:bindings id="marqueeBindings"> - <xbl:binding id="marquee-horizontal-12"> - <xbl:content> - <div> - <xbl:children/> - </div> - </xbl:content> - </xbl:binding> -</xbl:bindings> - -</head> - - -<body onload="boo()"> - -<span id="s1">Span</span> - -<div id="marq" style="-moz-binding: url('#marquee-horizontal-12');">Marquee</div> - -</body> - - -</html> diff --git a/dom/xbl/crashtests/342954-2-xbl.xml b/dom/xbl/crashtests/342954-2-xbl.xml deleted file mode 100644 index 3e73f1355..000000000 --- a/dom/xbl/crashtests/342954-2-xbl.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> - -<bindings id="marqueeBindings" - xmlns="http://www.mozilla.org/xbl" - xmlns:html="http://www.w3.org/1999/xhtml" - xmlns:xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - xmlns:xbl="http://www.mozilla.org/xbl"> - - <binding id="marquee-horizontal-10"> - - <content> - <html:div> - <children/> - </html:div> - </content> - - </binding> - -</bindings> diff --git a/dom/xbl/crashtests/342954-2.xhtml b/dom/xbl/crashtests/342954-2.xhtml deleted file mode 100644 index 4a250e31c..000000000 --- a/dom/xbl/crashtests/342954-2.xhtml +++ /dev/null @@ -1,29 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<head> -<script> -<![CDATA[ - -function boo() -{ - s1 = document.getElementById("s1"); - marq = document.getElementById("marq"); - marqAnonymousSomething = document.getAnonymousNodes(marq)[0].childNodes[0]; - - removeNode(marqAnonymousSomething); - s1.appendChild(document.createElement("div")); -} - -function removeNode(q1) { q1.parentNode.removeChild(q1); } - -]]> -</script> -</head> - -<body onload="boo()"> - -<span id="s1">Span</span> - -<div id="marq" style="-moz-binding: url('342954-2-xbl.xml#marquee-horizontal-10');">Marquee</div> - -</body> -</html> diff --git a/dom/xbl/crashtests/477878-1.html b/dom/xbl/crashtests/477878-1.html deleted file mode 100644 index 17e4002b4..000000000 --- a/dom/xbl/crashtests/477878-1.html +++ /dev/null @@ -1,4 +0,0 @@ -<html> -<head></head> -<body><iframe style="display:none" src="data:text/html,<marquee>Marquee</marquee>" onload="this.style.display = '';"></iframe></body> -</html> diff --git a/dom/xbl/nsXBLMaybeCompiled.h b/dom/xbl/nsXBLMaybeCompiled.h index d4b366b0e..ba66ec5d5 100644 --- a/dom/xbl/nsXBLMaybeCompiled.h +++ b/dom/xbl/nsXBLMaybeCompiled.h @@ -124,7 +124,7 @@ struct BarrierMethods<nsXBLMaybeCompiled<UncompiledT>> template <class T> struct IsHeapConstructibleType<nsXBLMaybeCompiled<T>> { // Yes, this is the exception to the rule. Sorry. - static constexpr bool value = true; + static const bool value = true; }; template <class UncompiledT> |