From d4f4b4353836a0f50a10ee46b9ce26df00cfde66 Mon Sep 17 00:00:00 2001 From: Cameron Kaiser Date: Thu, 22 Mar 2018 20:17:48 -0700 Subject: [PATCH] closes #488: M1257849 M1244328 finish DOMTokenList transition, bustage fixes --- dom/base/DOMTokenListSupportedTokens.h | 31 +++ dom/base/Element.cpp | 24 +- dom/base/Element.h | 5 +- dom/base/FragmentOrElement.h | 2 +- dom/base/IframeSandboxKeywordList.h | 24 ++ dom/base/moz.build | 4 +- dom/base/nsContentUtils.cpp | 12 +- dom/base/nsDOMTokenList.cpp | 231 +++++++++++++----- dom/base/nsDOMTokenList.h | 22 +- dom/base/nsStyleLinkElement.cpp | 4 +- dom/bindings/Bindings.conf | 4 - dom/bindings/Errors.msg | 1 + .../test/TestInterfaceIterableSingle.cpp | 17 +- .../test/TestInterfaceIterableSingle.h | 7 +- dom/html/HTMLAnchorElement.cpp | 8 +- dom/html/HTMLAnchorElement.h | 2 + dom/html/HTMLAreaElement.cpp | 4 +- dom/html/HTMLIFrameElement.cpp | 9 + dom/html/HTMLIFrameElement.h | 8 +- dom/html/HTMLLinkElement.cpp | 22 +- dom/html/HTMLLinkElement.h | 2 +- dom/html/HTMLMenuItemElement.cpp | 1 + dom/html/HTMLOutputElement.cpp | 5 +- dom/html/HTMLOutputElement.h | 4 +- dom/html/HTMLPropertiesCollection.cpp | 2 +- dom/html/HTMLTableCellElement.h | 2 +- dom/html/nsGenericHTMLElement.cpp | 2 +- dom/html/nsGenericHTMLElement.h | 8 +- dom/interfaces/html/nsIDOMHTMLElement.idl | 2 +- dom/webidl/DOMTokenList.webidl | 6 + dom/webidl/Element.webidl | 2 +- dom/webidl/HTMLAnchorElement.webidl | 1 + dom/webidl/HTMLAreaElement.webidl | 1 + dom/webidl/HTMLElement.webidl | 8 +- dom/webidl/HTMLIFrameElement.webidl | 2 +- dom/webidl/HTMLLinkElement.webidl | 3 +- dom/webidl/HTMLOutputElement.webidl | 2 +- dom/webidl/HTMLTableCellElement.webidl | 2 +- ...stInterfaceJSMaplikeSetlikeIterable.webidl | 2 + dom/webidl/moz.build | 1 - 40 files changed, 367 insertions(+), 132 deletions(-) create mode 100644 dom/base/DOMTokenListSupportedTokens.h create mode 100644 dom/base/IframeSandboxKeywordList.h diff --git a/dom/base/DOMTokenListSupportedTokens.h b/dom/base/DOMTokenListSupportedTokens.h new file mode 100644 index 000000000..f68f48554 --- /dev/null +++ b/dom/base/DOMTokenListSupportedTokens.h @@ -0,0 +1,31 @@ +/* -*- 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/. */ + +/* + * Definitions of supported tokens data types for nsDOMTokenList. This is in a + * separate header so Element.h can include it too. + */ + +#ifndef mozilla_dom_DOMTokenListSupportedTokens_h +#define mozilla_dom_DOMTokenListSupportedTokens_h + +namespace mozilla { +namespace dom { + +// A single supported token. +typedef const char* const DOMTokenListSupportedToken; + +// An array of supported tokens. This should end with a null +// DOMTokenListSupportedToken to indicate array termination. A null value for +// the DOMTokenListSupportedTokenArray means there is no definition of supported +// tokens for the given DOMTokenList. This should generally be a static table, +// or at least outlive the DOMTokenList whose constructor it's passed to. +typedef DOMTokenListSupportedToken* DOMTokenListSupportedTokenArray; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_DOMTokenListSupportedTokens_h diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index 51f6860ff..21e3354de 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -44,7 +44,6 @@ #include "nsNameSpaceManager.h" #include "nsContentList.h" #include "nsVariant.h" -#include "nsDOMSettableTokenList.h" #include "nsDOMTokenList.h" #include "nsXBLPrototypeBinding.h" #include "nsError.h" @@ -3086,11 +3085,11 @@ Element::GetLinkTarget(nsAString& aTarget) } static void -nsDOMSettableTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty, - void *aPropertyValue, void *aData) +nsDOMTokenListPropertyDestructor(void *aObject, nsIAtom *aProperty, + void *aPropertyValue, void *aData) { - nsDOMSettableTokenList* list = - static_cast(aPropertyValue); + nsDOMTokenList* list = + static_cast(aPropertyValue); NS_RELEASE(list); } @@ -3113,8 +3112,9 @@ Element::HTMLSVGPropertiesToTraverseAndUnlink() return sPropertiesToTraverseAndUnlink; } -nsDOMSettableTokenList* -Element::GetTokenList(nsIAtom* aAtom) +nsDOMTokenList* +Element::GetTokenList(nsIAtom* aAtom, + const DOMTokenListSupportedTokenArray aSupportedTokens) { #ifdef DEBUG nsIAtom*** props = @@ -3129,14 +3129,14 @@ Element::GetTokenList(nsIAtom* aAtom) MOZ_ASSERT(found, "Trying to use an unknown tokenlist!"); #endif - nsDOMSettableTokenList* list = nullptr; + nsDOMTokenList* list = nullptr; if (HasProperties()) { - list = static_cast(GetProperty(aAtom)); + list = static_cast(GetProperty(aAtom)); } if (!list) { - list = new nsDOMSettableTokenList(this, aAtom); + list = new nsDOMTokenList(this, aAtom, aSupportedTokens); NS_ADDREF(list); - SetProperty(aAtom, list, nsDOMSettableTokenListPropertyDestructor); + SetProperty(aAtom, list, nsDOMTokenListPropertyDestructor); } return list; } @@ -3153,7 +3153,7 @@ Element::GetTokenList(nsIAtom* aAtom, nsIVariant** aResult) nsresult Element::SetTokenList(nsIAtom* aAtom, nsIVariant* aValue) { - nsDOMSettableTokenList* itemType = GetTokenList(aAtom); + nsDOMTokenList* itemType = GetTokenList(aAtom); nsAutoString string; aValue->GetAsAString(string); ErrorResult rv; diff --git a/dom/base/Element.h b/dom/base/Element.h index 71c1614cd..1433c3b85 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -34,6 +34,7 @@ #include "nsAttrValue.h" #include "mozilla/EventForwards.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/DOMTokenListSupportedTokens.h" #include "mozilla/dom/WindowBinding.h" #include "mozilla/dom/ElementBinding.h" #include "Units.h" @@ -44,7 +45,6 @@ class nsIURI; class nsIScrollableFrame; class nsAttrValueOrString; class nsContentList; -class nsDOMSettableTokenList; class nsDOMTokenList; struct nsRect; class nsFocusManager; @@ -1342,7 +1342,8 @@ protected: */ virtual void GetLinkTarget(nsAString& aTarget); - nsDOMSettableTokenList* GetTokenList(nsIAtom* aAtom); + nsDOMTokenList* GetTokenList(nsIAtom* aAtom, + const DOMTokenListSupportedTokenArray aSupportedTokens = nullptr); void GetTokenList(nsIAtom* aAtom, nsIVariant** aResult); nsresult SetTokenList(nsIAtom* aAtom, nsIVariant* aValue); diff --git a/dom/base/FragmentOrElement.h b/dom/base/FragmentOrElement.h index b45f60517..86766ab52 100644 --- a/dom/base/FragmentOrElement.h +++ b/dom/base/FragmentOrElement.h @@ -25,11 +25,11 @@ class ContentUnbinder; class nsContentList; class nsDOMAttributeMap; -class nsDOMTokenList; class nsIControllers; class nsICSSDeclaration; class nsIDocument; class nsDOMStringMap; +class nsDOMTokenList; class nsIURI; namespace mozilla { diff --git a/dom/base/IframeSandboxKeywordList.h b/dom/base/IframeSandboxKeywordList.h new file mode 100644 index 000000000..63a4b3e6e --- /dev/null +++ b/dom/base/IframeSandboxKeywordList.h @@ -0,0 +1,24 @@ +/* -*- 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/. */ + +/* NOTE: no include guard; this file is meant to maybe be included multiple + times. It has a list of the sandbox keywords we support, with their + corresponding sandbox flags. */ + +#include "nsSandboxFlags.h" + +// Each entry has the sandbox keyword as a string, the corresponding nsGkAtoms +// atom name, and the corresponding sandbox flags. +SANDBOX_KEYWORD("allow-same-origin", allowsameorigin, SANDBOXED_ORIGIN) +SANDBOX_KEYWORD("allow-forms", allowforms, SANDBOXED_FORMS) +SANDBOX_KEYWORD("allow-scripts", allowscripts, + SANDBOXED_SCRIPTS | SANDBOXED_AUTOMATIC_FEATURES) +SANDBOX_KEYWORD("allow-top-navigation", allowtopnavigation, + SANDBOXED_TOPLEVEL_NAVIGATION) +SANDBOX_KEYWORD("allow-pointer-lock", allowpointerlock, SANDBOXED_POINTER_LOCK) +SANDBOX_KEYWORD("allow-orientation-lock", alloworientationlock, + SANDBOXED_ORIENTATION_LOCK) +SANDBOX_KEYWORD("allow-popups", allowpopups, SANDBOXED_AUXILIARY_NAVIGATION) diff --git a/dom/base/moz.build b/dom/base/moz.build index 5e64c0b41..69d940052 100644 --- a/dom/base/moz.build +++ b/dom/base/moz.build @@ -45,6 +45,7 @@ EXPORTS += [ 'AutocompleteFieldList.h', 'Crypto.h', 'HTMLSplitOnSpacesTokenizer.h', + 'IframeSandboxKeywordList.h', 'mozAutoDocUpdate.h', 'mozFlushType.h', 'nsAtomListUtils.h', @@ -74,6 +75,7 @@ EXPORTS += [ 'nsDOMJSUtils.h', 'nsDOMNavigationTiming.h', 'nsDOMString.h', + 'nsDOMTokenList.h', 'nsFocusManager.h', 'nsFormData.h', 'nsFrameMessageManager.h', @@ -174,6 +176,7 @@ EXPORTS.mozilla.dom += [ 'DOMRect.h', 'DOMRequest.h', 'DOMStringList.h', + 'DOMTokenListSupportedTokens.h', 'Element.h', 'ElementInlines.h', 'EventSource.h', @@ -278,7 +281,6 @@ UNIFIED_SOURCES += [ 'nsDOMNavigationTiming.cpp', 'nsDOMScriptObjectFactory.cpp', 'nsDOMSerializer.cpp', - 'nsDOMSettableTokenList.cpp', 'nsDOMTokenList.cpp', 'nsDOMWindowList.cpp', 'nsFocusManager.cpp', diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 45d7f1cfd..3a9afc301 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -1362,19 +1362,13 @@ nsContentUtils::ParseSandboxAttributeToFlags(const nsAttrValue* sandboxAttr) | SANDBOXED_DOMAIN; // Macro for updating the flag according to the keywords -#define IF_KEYWORD(atom, flags) \ +#define SANDBOX_KEYWORD(string, atom, flags) \ if (sandboxAttr->Contains(nsGkAtoms::atom, eIgnoreCase)) { out &= ~(flags); } - IF_KEYWORD(allowsameorigin, SANDBOXED_ORIGIN) - IF_KEYWORD(allowforms, SANDBOXED_FORMS) - IF_KEYWORD(allowscripts, SANDBOXED_SCRIPTS | SANDBOXED_AUTOMATIC_FEATURES) - IF_KEYWORD(allowtopnavigation, SANDBOXED_TOPLEVEL_NAVIGATION) - IF_KEYWORD(allowpointerlock, SANDBOXED_POINTER_LOCK) - IF_KEYWORD(alloworientationlock, SANDBOXED_ORIENTATION_LOCK) - IF_KEYWORD(allowpopups, SANDBOXED_AUXILIARY_NAVIGATION) +#include "IframeSandboxKeywordList.h" return out; -#undef IF_KEYWORD +#undef SANDBOX_KEYWORD } nsIBidiKeyboard* diff --git a/dom/base/nsDOMTokenList.cpp b/dom/base/nsDOMTokenList.cpp index 682be1ddb..da526b6d7 100644 --- a/dom/base/nsDOMTokenList.cpp +++ b/dom/base/nsDOMTokenList.cpp @@ -9,20 +9,25 @@ */ #include "nsDOMTokenList.h" - +#include "nsAttrValueInlines.h" +#include "nsDataHashtable.h" #include "nsAttrValue.h" #include "nsContentUtils.h" #include "nsError.h" +#include "nsHashKeys.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/DOMTokenListBinding.h" +#include "mozilla/BloomFilter.h" #include "mozilla/ErrorResult.h" using namespace mozilla; using namespace mozilla::dom; -nsDOMTokenList::nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom) +nsDOMTokenList::nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom, + const DOMTokenListSupportedTokenArray aSupportedTokens) : mElement(aElement), - mAttrAtom(aAttrAtom) + mAttrAtom(aAttrAtom), + mSupportedTokens(aSupportedTokens) { // We don't add a reference to our element. If it goes away, // we'll be told to drop our reference @@ -50,6 +55,45 @@ nsDOMTokenList::GetParsedAttr() return mElement->GetAttrInfo(kNameSpaceID_None, mAttrAtom).mValue; } +void +nsDOMTokenList::RemoveDuplicates(const nsAttrValue* aAttr) +{ + if (!aAttr || aAttr->Type() != nsAttrValue::eAtomArray) { + return; + } + + BloomFilter<8, nsIAtom> filter; + nsAttrValue::AtomArray* array = aAttr->GetAtomArrayValue(); + for (uint32_t i = 0; i < array->Length(); i++) { + nsIAtom* atom = array->ElementAt(i); + if (filter.mightContain(atom)) { + // Start again, with a hashtable + RemoveDuplicatesInternal(array, i); + return; + } else { + filter.add(atom); + } + } +} + +void +nsDOMTokenList::RemoveDuplicatesInternal(nsAttrValue::AtomArray* aArray, + uint32_t aStart) +{ + nsDataHashtable, bool> tokens; + + for (uint32_t i = 0; i < aArray->Length(); i++) { + nsIAtom* atom = aArray->ElementAt(i); + // No need to check the hashtable below aStart + if (i >= aStart && tokens.Get(atom)) { + aArray->RemoveElementAt(i); + i--; + } else { + tokens.Put(atom, true); + } + } +} + uint32_t nsDOMTokenList::Length() { @@ -58,6 +102,7 @@ nsDOMTokenList::Length() return 0; } + RemoveDuplicates(attr); return attr->GetAtomCount(); } @@ -66,6 +111,13 @@ nsDOMTokenList::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult) { const nsAttrValue* attr = GetParsedAttr(); + if (!attr || aIndex >= static_cast(attr->GetAtomCount())) { + aFound = false; + return; + } + + RemoveDuplicates(attr); + if (attr && aIndex < static_cast(attr->GetAtomCount())) { aFound = true; attr->AtomAt(aIndex)->ToString(aResult); @@ -74,6 +126,16 @@ nsDOMTokenList::IndexedGetter(uint32_t aIndex, bool& aFound, nsAString& aResult) } } +void +nsDOMTokenList::SetValue(const nsAString& aValue, ErrorResult& rv) +{ + if (!mElement) { + return; + } + + rv = mElement->SetAttr(kNameSpaceID_None, mAttrAtom, aValue, true); +} + nsresult nsDOMTokenList::CheckToken(const nsAString& aStr) { @@ -130,10 +192,15 @@ nsDOMTokenList::AddInternal(const nsAttrValue* aAttr, nsAutoString resultStr; if (aAttr) { - aAttr->ToString(resultStr); + RemoveDuplicates(aAttr); + for (uint32_t i = 0; i < aAttr->GetAtomCount(); i++) { + if (i != 0) { + resultStr.AppendLiteral(" "); + } + resultStr.Append(nsDependentAtomString(aAttr->AtomAt(i))); + } } - bool oneWasAdded = false; nsAutoTArray addedClasses; for (uint32_t i = 0, l = aTokens.Length(); i < l; ++i) { @@ -144,16 +211,11 @@ nsDOMTokenList::AddInternal(const nsAttrValue* aAttr, continue; } - if (oneWasAdded || - (!resultStr.IsEmpty() && - !nsContentUtils::IsHTMLWhitespace(resultStr.Last()))) { + if (!resultStr.IsEmpty()) { resultStr.Append(' '); - resultStr.Append(aToken); - } else { - resultStr.Append(aToken); } + resultStr.Append(aToken); - oneWasAdded = true; addedClasses.AppendElement(aToken); } @@ -186,60 +248,20 @@ nsDOMTokenList::RemoveInternal(const nsAttrValue* aAttr, { MOZ_ASSERT(aAttr, "Need an attribute"); - nsAutoString input; - aAttr->ToString(input); + RemoveDuplicates(aAttr); - nsAString::const_iterator copyStart, tokenStart, iter, end; - input.BeginReading(iter); - input.EndReading(end); - copyStart = iter; - - nsAutoString output; - bool lastTokenRemoved = false; - - while (iter != end) { - // skip whitespace. - while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) { - ++iter; + nsAutoString resultStr; + for (uint32_t i = 0; i < aAttr->GetAtomCount(); i++) { + if (aTokens.Contains(nsDependentAtomString(aAttr->AtomAt(i)))) { + continue; } - - if (iter == end) { - // At this point we're sure the last seen token (if any) wasn't to be - // removed. So the trailing spaces will need to be kept. - MOZ_ASSERT(!lastTokenRemoved, "How did this happen?"); - - output.Append(Substring(copyStart, end)); - break; - } - - tokenStart = iter; - do { - ++iter; - } while (iter != end && !nsContentUtils::IsHTMLWhitespace(*iter)); - - if (aTokens.Contains(Substring(tokenStart, iter))) { - - // Skip whitespace after the token, it will be collapsed. - while (iter != end && nsContentUtils::IsHTMLWhitespace(*iter)) { - ++iter; - } - copyStart = iter; - lastTokenRemoved = true; - - } else { - - if (lastTokenRemoved && !output.IsEmpty()) { - MOZ_ASSERT(!nsContentUtils::IsHTMLWhitespace(output.Last()), - "Invalid last output token"); - output.Append(char16_t(' ')); - } - lastTokenRemoved = false; - output.Append(Substring(copyStart, iter)); - copyStart = iter; + if (!resultStr.IsEmpty()) { + resultStr.AppendLiteral(" "); } + resultStr.Append(nsDependentAtomString(aAttr->AtomAt(i))); } - mElement->SetAttr(kNameSpaceID_None, mAttrAtom, output, true); + mElement->SetAttr(kNameSpaceID_None, mAttrAtom, resultStr, true); } void @@ -299,6 +321,93 @@ nsDOMTokenList::Toggle(const nsAString& aToken, return isPresent; } +void +nsDOMTokenList::Replace(const nsAString& aToken, + const nsAString& aNewToken, + ErrorResult& aError) +{ + // Doing this here instead of using `CheckToken` because if aToken had invalid + // characters, and aNewToken is empty, the returned error should be a + // SyntaxError, not an InvalidCharacterError. + if (aNewToken.IsEmpty()) { + aError.Throw(NS_ERROR_DOM_SYNTAX_ERR); + return; + } + + aError = CheckToken(aToken); + if (aError.Failed()) { + return; + } + + aError = CheckToken(aNewToken); + if (aError.Failed()) { + return; + } + + const nsAttrValue* attr = GetParsedAttr(); + if (!attr) { + return; + } + + ReplaceInternal(attr, aToken, aNewToken); +} + +void +nsDOMTokenList::ReplaceInternal(const nsAttrValue* aAttr, + const nsAString& aToken, + const nsAString& aNewToken) +{ + RemoveDuplicates(aAttr); + + bool sawIt = false; + nsAutoString resultStr; + for (uint32_t i = 0; i < aAttr->GetAtomCount(); i++) { + if (aAttr->AtomAt(i)->Equals(aToken) || + aAttr->AtomAt(i)->Equals(aNewToken)) { + if (sawIt) { + // We keep only the first + continue; + } + sawIt = true; + if (!resultStr.IsEmpty()) { + resultStr.AppendLiteral(" "); + } + resultStr.Append(aNewToken); + continue; + } + if (!resultStr.IsEmpty()) { + resultStr.AppendLiteral(" "); + } + resultStr.Append(nsDependentAtomString(aAttr->AtomAt(i))); + } + + if (sawIt) { + mElement->SetAttr(kNameSpaceID_None, mAttrAtom, resultStr, true); + } +} + +bool +nsDOMTokenList::Supports(const nsAString& aToken, + ErrorResult& aError) +{ + if (!mSupportedTokens) { + aError.ThrowTypeError( + mElement->LocalName(), + nsDependentAtomString(mAttrAtom)); + return false; + } + + for (DOMTokenListSupportedToken* supportedToken = mSupportedTokens; + *supportedToken; + ++supportedToken) { + if (aToken.LowerCaseEqualsASCII(*supportedToken)) { + return true; + } + } + + return false; +} + void nsDOMTokenList::Stringify(nsAString& aResult) { diff --git a/dom/base/nsDOMTokenList.h b/dom/base/nsDOMTokenList.h index 60fd59687..28fc50ed5 100644 --- a/dom/base/nsDOMTokenList.h +++ b/dom/base/nsDOMTokenList.h @@ -13,9 +13,11 @@ #include "nsCOMPtr.h" #include "nsDOMString.h" +#include "nsDOMString.h" #include "nsWrapperCache.h" #include "mozilla/dom/Element.h" #include "mozilla/dom/BindingDeclarations.h" +#include "mozilla/dom/DOMTokenListSupportedTokens.h" namespace mozilla { class ErrorResult; @@ -26,7 +28,7 @@ class nsAttrValue; class nsIAtom; // nsISupports must be on the primary inheritance chain -// because nsDOMSettableTokenList is traversed by Element. + class nsDOMTokenList : public nsISupports, public nsWrapperCache { @@ -37,7 +39,8 @@ public: NS_DECL_CYCLE_COLLECTING_ISUPPORTS NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(nsDOMTokenList) - nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom); + nsDOMTokenList(Element* aElement, nsIAtom* aAttrAtom, + const mozilla::dom::DOMTokenListSupportedTokenArray = nullptr); virtual JSObject* WrapObject(JSContext *cx, JS::Handle aGivenProto) override; @@ -46,6 +49,7 @@ public: return mElement; } + void RemoveDuplicates(const nsAttrValue* aAttr); uint32_t Length(); void Item(uint32_t aIndex, nsAString& aResult) { @@ -63,9 +67,17 @@ public: void Remove(const nsAString& aToken, mozilla::ErrorResult& aError); void Remove(const nsTArray& aTokens, mozilla::ErrorResult& aError); + void Replace(const nsAString& aToken, + const nsAString& aNewToken, + mozilla::ErrorResult& aError); bool Toggle(const nsAString& aToken, const mozilla::dom::Optional& force, mozilla::ErrorResult& aError); + bool Supports(const nsAString& aToken, + mozilla::ErrorResult& aError); + + void GetValue(nsAString& aResult) { Stringify(aResult); } + void SetValue(const nsAString& aValue, mozilla::ErrorResult& rv); void Stringify(nsAString& aResult); protected: @@ -73,14 +85,20 @@ protected: nsresult CheckToken(const nsAString& aStr); nsresult CheckTokens(const nsTArray& aStr); + void RemoveDuplicatesInternal(nsTArray>* aArray, + uint32_t aStart); void AddInternal(const nsAttrValue* aAttr, const nsTArray& aTokens); void RemoveInternal(const nsAttrValue* aAttr, const nsTArray& aTokens); + void ReplaceInternal(const nsAttrValue* aAttr, + const nsAString& aToken, + const nsAString& aNewToken); inline const nsAttrValue* GetParsedAttr(); nsCOMPtr mElement; nsCOMPtr mAttrAtom; + const mozilla::dom::DOMTokenListSupportedTokenArray mSupportedTokens; }; #endif // nsDOMTokenList_h___ diff --git a/dom/base/nsStyleLinkElement.cpp b/dom/base/nsStyleLinkElement.cpp index bf7d9bfbd..0b7e36812 100644 --- a/dom/base/nsStyleLinkElement.cpp +++ b/dom/base/nsStyleLinkElement.cpp @@ -149,7 +149,9 @@ nsStyleLinkElement::IsImportEnabled() } static uint32_t ToLinkMask(const nsAString& aLink, nsIPrincipal* aPrincipal) -{ +{ + // Keep this in sync with sRelValues in HTMLLinkElement.cpp + // XXX: "icon" and "search" are supported, but not listed here. if (aLink.EqualsLiteral("prefetch")) return nsStyleLinkElement::ePREFETCH; else if (aLink.EqualsLiteral("dns-prefetch")) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index c00f9c594..6cdf7a89e 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -441,10 +441,6 @@ DOMInterfaces = { 'implicitJSContext': [ 'then' ], }, -'DOMSettableTokenList': { - 'nativeType': 'nsDOMSettableTokenList', -}, - 'DOMStringMap': { 'nativeType': 'nsDOMStringMap' }, diff --git a/dom/bindings/Errors.msg b/dom/bindings/Errors.msg index acc06573b..2b51ec578 100644 --- a/dom/bindings/Errors.msg +++ b/dom/bindings/Errors.msg @@ -92,3 +92,4 @@ MSG_DEF(MSG_IS_NOT_PROMISE, 1, JSEXN_TYPEERR, "{0} is not a Promise") MSG_DEF(MSG_SW_INSTALL_ERROR, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for scope {1} encountered an error during installation.") MSG_DEF(MSG_SW_SCRIPT_THREW, 2, JSEXN_TYPEERR, "ServiceWorker script at {0} for scope {1} threw an exception during script evaluation.") MSG_DEF(MSG_TYPEDARRAY_IS_SHARED, 1, JSEXN_TYPEERR, "{0} can't be a typed array on SharedArrayBuffer") +MSG_DEF(MSG_TOKENLIST_NO_SUPPORTED_TOKENS, 2, JSEXN_TYPEERR, "{0} attribute of <{1}> does not define any supported tokens") diff --git a/dom/bindings/test/TestInterfaceIterableSingle.cpp b/dom/bindings/test/TestInterfaceIterableSingle.cpp index a79f91baf..36151c486 100644 --- a/dom/bindings/test/TestInterfaceIterableSingle.cpp +++ b/dom/bindings/test/TestInterfaceIterableSingle.cpp @@ -55,17 +55,22 @@ TestInterfaceIterableSingle::GetParentObject() const return mParent; } -size_t -TestInterfaceIterableSingle::GetIterableLength() const +uint32_t +TestInterfaceIterableSingle::Length() const { return mValues.Length(); } -uint32_t -TestInterfaceIterableSingle::GetValueAtIndex(uint32_t index) const +int32_t +TestInterfaceIterableSingle::IndexedGetter(uint32_t aIndex, bool& aFound) const { - MOZ_ASSERT(index < mValues.Length()); - return mValues.ElementAt(index); + if (aIndex >= mValues.Length()) { + aFound = false; + return 0; + } + + aFound = true; + return mValues[aIndex]; } } // namespace dom diff --git a/dom/bindings/test/TestInterfaceIterableSingle.h b/dom/bindings/test/TestInterfaceIterableSingle.h index 950858c0b..f14aaccc5 100644 --- a/dom/bindings/test/TestInterfaceIterableSingle.h +++ b/dom/bindings/test/TestInterfaceIterableSingle.h @@ -36,12 +36,13 @@ public: static already_AddRefed Constructor(const GlobalObject& aGlobal, ErrorResult& rv); - size_t GetIterableLength() const; - uint32_t GetValueAtIndex(uint32_t aIndex) const; + uint32_t Length() const; + int32_t IndexedGetter(uint32_t aIndex, bool& aFound) const; + private: virtual ~TestInterfaceIterableSingle() {} nsCOMPtr mParent; - nsTArray mValues; + nsTArray mValues; }; } // namespace dom diff --git a/dom/html/HTMLAnchorElement.cpp b/dom/html/HTMLAnchorElement.cpp index f9dea267b..b71d5a43b 100644 --- a/dom/html/HTMLAnchorElement.cpp +++ b/dom/html/HTMLAnchorElement.cpp @@ -39,6 +39,12 @@ ASSERT_NODE_FLAGS_SPACE(ELEMENT_TYPE_SPECIFIC_BITS_OFFSET + 2); #undef ANCHOR_ELEMENT_FLAG_BIT +// static +const DOMTokenListSupportedToken HTMLAnchorElement::sSupportedRelValues[] = { + "noreferrer", + nullptr +}; + HTMLAnchorElement::~HTMLAnchorElement() { } @@ -302,7 +308,7 @@ nsDOMTokenList* HTMLAnchorElement::RelList() { if (!mRelList) { - mRelList = new nsDOMTokenList(this, nsGkAtoms::rel); + mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, sSupportedRelValues); } return mRelList; } diff --git a/dom/html/HTMLAnchorElement.h b/dom/html/HTMLAnchorElement.h index 7251b45c3..67dc015e6 100644 --- a/dom/html/HTMLAnchorElement.h +++ b/dom/html/HTMLAnchorElement.h @@ -227,6 +227,8 @@ public: GetHref(aResult); } + static DOMTokenListSupportedToken sSupportedRelValues[]; + protected: virtual ~HTMLAnchorElement(); diff --git a/dom/html/HTMLAreaElement.cpp b/dom/html/HTMLAreaElement.cpp index eecdf2731..c50368a4d 100644 --- a/dom/html/HTMLAreaElement.cpp +++ b/dom/html/HTMLAreaElement.cpp @@ -7,6 +7,7 @@ #include "mozilla/dom/HTMLAreaElement.h" #include "mozilla/Attributes.h" +#include "mozilla/dom/HTMLAnchorElement.h" #include "mozilla/dom/HTMLAreaElementBinding.h" #include "mozilla/EventDispatcher.h" #include "mozilla/EventStates.h" @@ -122,7 +123,8 @@ nsDOMTokenList* HTMLAreaElement::RelList() { if (!mRelList) { - mRelList = new nsDOMTokenList(this, nsGkAtoms::rel); + mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, + HTMLAnchorElement::sSupportedRelValues); } return mRelList; } diff --git a/dom/html/HTMLIFrameElement.cpp b/dom/html/HTMLIFrameElement.cpp index 9618520df..d694cde02 100644 --- a/dom/html/HTMLIFrameElement.cpp +++ b/dom/html/HTMLIFrameElement.cpp @@ -18,6 +18,15 @@ NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(IFrame) namespace mozilla { namespace dom { +// static +const DOMTokenListSupportedToken HTMLIFrameElement::sSupportedSandboxTokens[] = +{ +#define SANDBOX_KEYWORD(string, atom, flags) string, +#include "IframeSandboxKeywordList.h" +#undef SANDBOX_KEYWORD + nullptr +}; + HTMLIFrameElement::HTMLIFrameElement(already_AddRefed& aNodeInfo, FromParser aFromParser) : nsGenericHTMLFrameElement(aNodeInfo, aFromParser) diff --git a/dom/html/HTMLIFrameElement.h b/dom/html/HTMLIFrameElement.h index da8c0b280..454752e08 100644 --- a/dom/html/HTMLIFrameElement.h +++ b/dom/html/HTMLIFrameElement.h @@ -10,7 +10,7 @@ #include "mozilla/Attributes.h" #include "nsGenericHTMLFrameElement.h" #include "nsIDOMHTMLIFrameElement.h" -#include "nsDOMSettableTokenList.h" +#include "nsDOMTokenList.h" namespace mozilla { namespace dom { @@ -84,9 +84,9 @@ public: { SetHTMLAttr(nsGkAtoms::name, aName, aError); } - nsDOMSettableTokenList* Sandbox() + nsDOMTokenList* Sandbox() { - return GetTokenList(nsGkAtoms::sandbox); + return GetTokenList(nsGkAtoms::sandbox, sSupportedSandboxTokens); } bool AllowFullscreen() const { @@ -202,6 +202,8 @@ protected: private: static void MapAttributesIntoRule(const nsMappedAttributes* aAttributes, nsRuleData* aData); + + static const DOMTokenListSupportedToken sSupportedSandboxTokens[]; }; } // namespace dom diff --git a/dom/html/HTMLLinkElement.cpp b/dom/html/HTMLLinkElement.cpp index 1e13b8d85..5d73a210c 100644 --- a/dom/html/HTMLLinkElement.cpp +++ b/dom/html/HTMLLinkElement.cpp @@ -26,6 +26,7 @@ #include "nsPIDOMWindow.h" #include "nsReadableUtils.h" #include "nsStyleConsts.h" +#include "nsStyleLinkElement.h" #include "nsUnicharUtils.h" #define LINK_ELEMENT_FLAG_BIT(n_) \ @@ -499,11 +500,30 @@ HTMLLinkElement::GetLinkTarget(nsAString& aTarget) } } +static const DOMTokenListSupportedToken sSupportedRelValues[] = { + // Keep this in sync with ToLinkMask in nsStyleLinkElement.cpp. + // "import" must come first because it's conditional. + "import" + "prefetch", + "dns-prefetch", + "stylesheet", + "next", + "alternate", + "preconnect", + "icon", + "search", + nullptr +}; + nsDOMTokenList* HTMLLinkElement::RelList() { if (!mRelList) { - mRelList = new nsDOMTokenList(this, nsGkAtoms::rel); + const DOMTokenListSupportedTokenArray relValues = + nsStyleLinkElement::IsImportEnabled() ? + sSupportedRelValues : &sSupportedRelValues[1]; + + mRelList = new nsDOMTokenList(this, nsGkAtoms::rel, relValues); } return mRelList; } diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h index 0411bcede..44596bf1e 100644 --- a/dom/html/HTMLLinkElement.h +++ b/dom/html/HTMLLinkElement.h @@ -119,7 +119,7 @@ public: { SetHTMLAttr(nsGkAtoms::hreflang, aHreflang, aRv); } - nsDOMSettableTokenList* Sizes() + nsDOMTokenList* Sizes() { return GetTokenList(nsGkAtoms::sizes); } diff --git a/dom/html/HTMLMenuItemElement.cpp b/dom/html/HTMLMenuItemElement.cpp index a40645c4c..c0320543d 100644 --- a/dom/html/HTMLMenuItemElement.cpp +++ b/dom/html/HTMLMenuItemElement.cpp @@ -11,6 +11,7 @@ #include "mozilla/dom/HTMLMenuItemElementBinding.h" #include "nsAttrValueInlines.h" #include "nsContentUtils.h" +#include "nsDOMTokenList.h" NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(MenuItem) diff --git a/dom/html/HTMLOutputElement.cpp b/dom/html/HTMLOutputElement.cpp index 79c30cc65..8a1c59646 100644 --- a/dom/html/HTMLOutputElement.cpp +++ b/dom/html/HTMLOutputElement.cpp @@ -11,7 +11,6 @@ #include "mozilla/dom/HTMLFormElement.h" #include "mozilla/dom/HTMLOutputElementBinding.h" #include "nsContentUtils.h" -#include "nsDOMSettableTokenList.h" #include "nsFormSubmission.h" NS_IMPL_NS_NEW_HTML_ELEMENT_CHECK_PARSER(Output) @@ -166,11 +165,11 @@ HTMLOutputElement::SetDefaultValue(const nsAString& aDefaultValue, ErrorResult& } } -nsDOMSettableTokenList* +nsDOMTokenList* HTMLOutputElement::HtmlFor() { if (!mTokenList) { - mTokenList = new nsDOMSettableTokenList(this, nsGkAtoms::_for); + mTokenList = new nsDOMTokenList(this, nsGkAtoms::_for); } return mTokenList; } diff --git a/dom/html/HTMLOutputElement.h b/dom/html/HTMLOutputElement.h index 0f57cabfa..b9e6ecd9c 100644 --- a/dom/html/HTMLOutputElement.h +++ b/dom/html/HTMLOutputElement.h @@ -64,7 +64,7 @@ public: virtual JSObject* WrapNode(JSContext* aCx, JS::Handle aGivenProto) override; // WebIDL - nsDOMSettableTokenList* HtmlFor(); + nsDOMTokenList* HtmlFor(); // nsGenericHTMLFormElement::GetForm is fine. void GetName(nsAString& aName) { @@ -108,7 +108,7 @@ protected: ValueModeFlag mValueModeFlag; bool mIsDoneAddingChildren; nsString mDefaultValue; - RefPtr mTokenList; + RefPtr mTokenList; }; } // namespace dom diff --git a/dom/html/HTMLPropertiesCollection.cpp b/dom/html/HTMLPropertiesCollection.cpp index 252b89a22..3eb340a9d 100644 --- a/dom/html/HTMLPropertiesCollection.cpp +++ b/dom/html/HTMLPropertiesCollection.cpp @@ -9,7 +9,7 @@ #include "nsContentUtils.h" #include "nsGenericHTMLElement.h" #include "nsVariant.h" -#include "nsDOMSettableTokenList.h" +#include "nsDOMTokenList.h" #include "nsAttrValue.h" #include "nsWrapperCacheInlines.h" #include "mozilla/dom/HTMLPropertiesCollectionBinding.h" diff --git a/dom/html/HTMLTableCellElement.h b/dom/html/HTMLTableCellElement.h index 0e0c1b07e..abc984dba 100644 --- a/dom/html/HTMLTableCellElement.h +++ b/dom/html/HTMLTableCellElement.h @@ -47,7 +47,7 @@ public: { SetUnsignedIntAttr(nsGkAtoms::rowspan, aRowSpan, aError); } - //already_AddRefed Headers() const; + //already_AddRefed Headers() const; void GetHeaders(DOMString& aHeaders) { GetHTMLAttr(nsGkAtoms::headers, aHeaders); diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 552a7d99e..b2243723b 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -96,7 +96,7 @@ #include "HTMLPropertiesCollection.h" #include "nsVariant.h" -#include "nsDOMSettableTokenList.h" +#include "nsDOMTokenList.h" #include "nsThreadUtils.h" #include "nsTextFragment.h" #include "mozilla/dom/BindingUtils.h" diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 3dd4161a7..7440b825b 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -20,7 +20,7 @@ #include "mozilla/dom/ValidityState.h" #include "mozilla/dom/ElementInlines.h" -class nsDOMSettableTokenList; +class nsDOMTokenList; class nsIDOMHTMLMenuElement; class nsIEditor; class nsIFormControlFrame; @@ -104,7 +104,7 @@ public: { SetHTMLBoolAttr(nsGkAtoms::itemscope, aItemScope, aError); } - nsDOMSettableTokenList* ItemType() + nsDOMTokenList* ItemType() { return GetTokenList(nsGkAtoms::itemtype); } @@ -116,11 +116,11 @@ public: { SetHTMLAttr(nsGkAtoms::itemid, aItemID, aError); } - nsDOMSettableTokenList* ItemRef() + nsDOMTokenList* ItemRef() { return GetTokenList(nsGkAtoms::itemref); } - nsDOMSettableTokenList* ItemProp() + nsDOMTokenList* ItemProp() { return GetTokenList(nsGkAtoms::itemprop); } diff --git a/dom/interfaces/html/nsIDOMHTMLElement.idl b/dom/interfaces/html/nsIDOMHTMLElement.idl index 2d67399e2..7db07f4e0 100644 --- a/dom/interfaces/html/nsIDOMHTMLElement.idl +++ b/dom/interfaces/html/nsIDOMHTMLElement.idl @@ -32,7 +32,7 @@ interface nsIDOMHTMLElement : nsIDOMElement attribute nsIVariant itemType; attribute DOMString itemId; readonly attribute nsISupports properties; - // The following attributes are really nsDOMSettableTokenList, which has + // The following attributes are really nsDOMTokenList, which has // PutForwards, so we express them as nsIVariants to deal with this. attribute nsIVariant itemValue; attribute nsIVariant itemProp; diff --git a/dom/webidl/DOMTokenList.webidl b/dom/webidl/DOMTokenList.webidl index 2621ba936..41f06a805 100644 --- a/dom/webidl/DOMTokenList.webidl +++ b/dom/webidl/DOMTokenList.webidl @@ -20,7 +20,13 @@ interface DOMTokenList { [Throws] void remove(DOMString... tokens); [Throws] + void replace(DOMString token, DOMString newToken); + [Throws] boolean toggle(DOMString token, optional boolean force); + [Throws] + boolean supports(DOMString token); + [SetterThrows] + attribute DOMString value; stringifier DOMString (); iterable; }; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index 984e37f50..a456aeaaa 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -30,7 +30,7 @@ interface Element : Node { attribute DOMString id; [Pure] attribute DOMString className; - [Constant] + [Constant, PutForwards=value] readonly attribute DOMTokenList classList; [SameObject] diff --git a/dom/webidl/HTMLAnchorElement.webidl b/dom/webidl/HTMLAnchorElement.webidl index 3fa2b9fbc..0b8ded6d7 100644 --- a/dom/webidl/HTMLAnchorElement.webidl +++ b/dom/webidl/HTMLAnchorElement.webidl @@ -23,6 +23,7 @@ interface HTMLAnchorElement : HTMLElement { attribute DOMString rel; [SetterThrows, Pref="network.http.enablePerElementReferrer"] attribute DOMString referrerPolicy; + [PutForwards=value] readonly attribute DOMTokenList relList; [SetterThrows] attribute DOMString hreflang; diff --git a/dom/webidl/HTMLAreaElement.webidl b/dom/webidl/HTMLAreaElement.webidl index f8640d653..be3f37885 100644 --- a/dom/webidl/HTMLAreaElement.webidl +++ b/dom/webidl/HTMLAreaElement.webidl @@ -30,6 +30,7 @@ interface HTMLAreaElement : HTMLElement { attribute DOMString rel; [SetterThrows, Pref="network.http.enablePerElementReferrer"] attribute DOMString referrerPolicy; + [PutForwards=value] readonly attribute DOMTokenList relList; }; diff --git a/dom/webidl/HTMLElement.webidl b/dom/webidl/HTMLElement.webidl index 7caf68785..efbdc921e 100644 --- a/dom/webidl/HTMLElement.webidl +++ b/dom/webidl/HTMLElement.webidl @@ -28,11 +28,11 @@ interface HTMLElement : Element { // microdata [SetterThrows, Pure] attribute boolean itemScope; - [PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemType; + [PutForwards=value,Constant] readonly attribute DOMTokenList itemType; [SetterThrows, Pure] attribute DOMString itemId; - [PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemRef; - [PutForwards=value,Constant] readonly attribute DOMSettableTokenList itemProp; + [PutForwards=value,Constant] readonly attribute DOMTokenList itemRef; + [PutForwards=value,Constant] readonly attribute DOMTokenList itemProp; [Constant] readonly attribute HTMLPropertiesCollection properties; [Throws] @@ -54,7 +54,7 @@ interface HTMLElement : Element { readonly attribute DOMString accessKeyLabel; [SetterThrows, Pure] attribute boolean draggable; - //[PutForwards=value] readonly attribute DOMSettableTokenList dropzone; + //[PutForwards=value] readonly attribute DOMTokenList dropzone; [SetterThrows, Pure] attribute DOMString contentEditable; [Pure] diff --git a/dom/webidl/HTMLIFrameElement.webidl b/dom/webidl/HTMLIFrameElement.webidl index c0813cf4c..f7452dc72 100644 --- a/dom/webidl/HTMLIFrameElement.webidl +++ b/dom/webidl/HTMLIFrameElement.webidl @@ -18,7 +18,7 @@ interface HTMLIFrameElement : HTMLElement { attribute DOMString srcdoc; [SetterThrows, Pure] attribute DOMString name; - [PutForwards=value] readonly attribute DOMSettableTokenList sandbox; + [PutForwards=value] readonly attribute DOMTokenList sandbox; // attribute boolean seamless; [SetterThrows, Pure] attribute boolean allowFullscreen; diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl index 468c4db2c..af53c5824 100644 --- a/dom/webidl/HTMLLinkElement.webidl +++ b/dom/webidl/HTMLLinkElement.webidl @@ -21,6 +21,7 @@ interface HTMLLinkElement : HTMLElement { attribute DOMString? crossOrigin; [SetterThrows, Pure] attribute DOMString rel; + [PutForwards=value] readonly attribute DOMTokenList relList; [SetterThrows, Pure] attribute DOMString media; @@ -28,7 +29,7 @@ interface HTMLLinkElement : HTMLElement { attribute DOMString hreflang; [SetterThrows, Pure] attribute DOMString type; - [PutForwards=value] readonly attribute DOMSettableTokenList sizes; + [PutForwards=value] readonly attribute DOMTokenList sizes; }; HTMLLinkElement implements LinkStyle; diff --git a/dom/webidl/HTMLOutputElement.webidl b/dom/webidl/HTMLOutputElement.webidl index aed8ce381..6ece47fe4 100644 --- a/dom/webidl/HTMLOutputElement.webidl +++ b/dom/webidl/HTMLOutputElement.webidl @@ -14,7 +14,7 @@ // http://www.whatwg.org/specs/web-apps/current-work/#the-output-element interface HTMLOutputElement : HTMLElement { [PutForwards=value, Constant] - readonly attribute DOMSettableTokenList htmlFor; + readonly attribute DOMTokenList htmlFor; readonly attribute HTMLFormElement? form; [SetterThrows, Pure] attribute DOMString name; diff --git a/dom/webidl/HTMLTableCellElement.webidl b/dom/webidl/HTMLTableCellElement.webidl index 052a67c77..e970a5040 100644 --- a/dom/webidl/HTMLTableCellElement.webidl +++ b/dom/webidl/HTMLTableCellElement.webidl @@ -16,7 +16,7 @@ interface HTMLTableCellElement : HTMLElement { attribute unsigned long colSpan; [SetterThrows] attribute unsigned long rowSpan; - //[PutForwards=value] readonly attribute DOMSettableTokenList headers; + //[PutForwards=value] readonly attribute DOMTokenList headers; [SetterThrows] attribute DOMString headers; readonly attribute long cellIndex; diff --git a/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl b/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl index dc6e3239e..1a124b016 100644 --- a/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl +++ b/dom/webidl/TestInterfaceJSMaplikeSetlikeIterable.webidl @@ -50,6 +50,8 @@ interface TestInterfaceSetlikeNode { Pref="dom.expose_test_interfaces"] interface TestInterfaceIterableSingle { iterable; + getter long(unsigned long index); + readonly attribute unsigned long length; }; [Constructor(), diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index cffef9c89..2b3ea1498 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -132,7 +132,6 @@ WEBIDL_FILES = [ 'DOMRect.webidl', 'DOMRectList.webidl', 'DOMRequest.webidl', - 'DOMSettableTokenList.webidl', 'DOMStringList.webidl', 'DOMStringMap.webidl', 'DOMTokenList.webidl',