diff --git a/dom/base/Element.cpp b/dom/base/Element.cpp index db2431a2f..502d66c33 100644 --- a/dom/base/Element.cpp +++ b/dom/base/Element.cpp @@ -311,12 +311,18 @@ Element::TabIndex() } void -Element::Focus(mozilla::ErrorResult& aError) +Element::Focus(const FocusOptions& aOptions, ErrorResult& aError) { nsCOMPtr domElement = do_QueryInterface(this); nsIFocusManager* fm = nsFocusManager::GetFocusManager(); + // Also other browsers seem to have the hack to not re-focus (and flush) when + // the element is already focused. + // Until https://github.com/whatwg/html/issues/4512 is clarified, we'll + // maintain interoperatibility by not re-focusing, independent of aOptions. + // I.e., `focus({ preventScroll: true})` followed by `focus( { preventScroll: + // false })` won't re-focus. if (fm && domElement) { - aError = fm->SetFocus(domElement, 0); + aError = fm->SetFocus(domElement, nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions)); } } diff --git a/dom/base/Element.h b/dom/base/Element.h index 341769878..13be3b3ca 100644 --- a/dom/base/Element.h +++ b/dom/base/Element.h @@ -223,7 +223,7 @@ public: /** * Make focus on this element. */ - virtual void Focus(mozilla::ErrorResult& aError); + virtual void Focus(const FocusOptions& aOptions, ErrorResult& aError); /** * Show blur and clear focus. diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index d7e918151..3f300d63b 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -7378,6 +7378,17 @@ nsContentUtils::HasDistributedChildren(nsIContent* aContent) return false; } +// static +bool nsContentUtils::IsNodeInEditableRegion(nsINode* aNode) { + while (aNode) { + if (aNode->IsEditable()) { + return true; + } + aNode = aNode->GetParent(); + } + return false; +} + // static bool nsContentUtils::IsForbiddenRequestHeader(const nsACString& aHeader, diff --git a/dom/base/nsContentUtils.h b/dom/base/nsContentUtils.h index 79483542e..4486cba75 100644 --- a/dom/base/nsContentUtils.h +++ b/dom/base/nsContentUtils.h @@ -2567,6 +2567,13 @@ public: */ static bool GPCEnabled(); + /** + * Returns whether a node has an editable ancestor. + * + * @param aNode The node to test. + */ + static bool IsNodeInEditableRegion(nsINode* aNode); + /** * Returns a LogModule that dump calls from content script are logged to. * This can be enabled with the 'Dump' module, and is useful for synchronizing diff --git a/dom/base/nsFocusManager.cpp b/dom/base/nsFocusManager.cpp index 79ef30014..534c05735 100644 --- a/dom/base/nsFocusManager.cpp +++ b/dom/base/nsFocusManager.cpp @@ -49,6 +49,7 @@ #include "mozilla/ContentEvents.h" #include "mozilla/dom/Element.h" +#include "mozilla/dom/ElementBinding.h" #include "mozilla/dom/ShadowRoot.h" #include "mozilla/dom/HTMLInputElement.h" #include "mozilla/dom/HTMLSlotElement.h" @@ -2999,6 +3000,11 @@ nsFocusManager::DetermineElementToMoveFocus(nsPIDOMWindowOuter* aWindow, return NS_OK; } +uint32_t nsFocusManager::FocusOptionsToFocusManagerFlags( + const mozilla::dom::FocusOptions& aOptions) { + return aOptions.mPreventScroll ? nsIFocusManager::FLAG_NOSCROLL : 0; +} + static bool IsHostOrSlot(nsIContent* aContent) { diff --git a/dom/base/nsFocusManager.h b/dom/base/nsFocusManager.h index 714226ab1..1ce4f9071 100644 --- a/dom/base/nsFocusManager.h +++ b/dom/base/nsFocusManager.h @@ -27,6 +27,7 @@ class nsIMessageBroadcaster; namespace mozilla { namespace dom { +struct FocusOptions; class TabParent; } } @@ -111,6 +112,9 @@ public: static nsIContent* GetFocusedDescendant(nsPIDOMWindowOuter* aWindow, bool aDeep, nsPIDOMWindowOuter** aFocusedWindow); + static uint32_t FocusOptionsToFocusManagerFlags( + const mozilla::dom::FocusOptions& aOptions); + /** * Returns the content node that focus will be redirected to if aContent was * focused. This is used for the special case of certain XUL elements such diff --git a/dom/base/nsGlobalWindow.cpp b/dom/base/nsGlobalWindow.cpp index 5997d3ab7..67b520390 100644 --- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -7388,9 +7388,10 @@ nsGlobalWindow::Confirm(const nsAString& aMessage, already_AddRefed nsGlobalWindow::Fetch(const RequestOrUSVString& aInput, - const RequestInit& aInit, ErrorResult& aRv) + const RequestInit& aInit, + CallerType aCallerType, ErrorResult& aRv) { - return FetchRequest(this, aInput, aInit, aRv); + return FetchRequest(this, aInput, aInit, aCallerType, aRv); } void diff --git a/dom/base/nsGlobalWindow.h b/dom/base/nsGlobalWindow.h index 78053310a..6f5525baa 100644 --- a/dom/base/nsGlobalWindow.h +++ b/dom/base/nsGlobalWindow.h @@ -958,6 +958,7 @@ public: already_AddRefed GetCaches(mozilla::ErrorResult& aRv); already_AddRefed Fetch(const mozilla::dom::RequestOrUSVString& aInput, const mozilla::dom::RequestInit& aInit, + mozilla::dom::CallerType aCallerType, mozilla::ErrorResult& aRv); void PrintOuter(mozilla::ErrorResult& aError); void Print(mozilla::ErrorResult& aError); diff --git a/dom/base/nsIImageLoadingContent.idl b/dom/base/nsIImageLoadingContent.idl index 234571e1b..4b9407045 100644 --- a/dom/base/nsIImageLoadingContent.idl +++ b/dom/base/nsIImageLoadingContent.idl @@ -37,7 +37,7 @@ native Visibility(mozilla::Visibility); * observers to check which request they are getting notifications for. * * Please make sure to update the MozImageLoadingContent WebIDL - * interface to mirror this interface when changing it. + * mixin to mirror this interface when changing it. */ [scriptable, builtinclass, uuid(0357123d-9224-4d12-a47e-868c32689777)] diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 45d503dac..e10513101 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -4475,9 +4475,6 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, isOptional=False, invalidEnumValueFatal=True, defaultValue=None, - treatNullAs="Default", - isEnforceRange=False, - isClamp=False, isNullOrUndefined=False, exceptionCode=None, lenientFloatCode=None, @@ -4555,6 +4552,12 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, # And we can't both be an object and be null or undefined assert not isDefinitelyObject or not isNullOrUndefined + # Types can also have extended attributes, copy them over + isClamp = type.clamp + isEnforceRange = type.enforceRange + if type.treatNullAsEmpty: + treatNullAs = "EmptyString" + # If exceptionCode is not set, we'll just rethrow the exception we got. # Note that we can't just set failureCode to exceptionCode, because setting # failureCode will prevent pending exceptions from being set in cases when @@ -5659,6 +5662,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, undefinedBehavior = "eNull" else: undefinedBehavior = "eStringify" + if type.treatNullAsEmpty: + treatNullAs = "EmptyString" + else: + treatNullAs = "Default" nullBehavior = treatAs[treatNullAs] def getConversionCode(varName): @@ -6302,9 +6309,6 @@ class CGArgumentConverter(CGThing): not self.argument.variadic), invalidEnumValueFatal=self.invalidEnumValueFatal, defaultValue=self.argument.defaultValue, - treatNullAs=self.argument.treatNullAs, - isEnforceRange=self.argument.enforceRange, - isClamp=self.argument.clamp, lenientFloatCode=self.lenientFloatCode, isMember="Variadic" if self.argument.variadic else False, allowTreatNonCallableAsNull=self.argument.allowTreatNonCallableAsNull(), @@ -8385,18 +8389,6 @@ class FakeArgument(): self.variadic = False self.defaultValue = None self._allowTreatNonCallableAsNull = allowTreatNonCallableAsNull - # For FakeArguments generated by maplike/setlike convenience functions, - # we won't have an interfaceMember to pass in. - if interfaceMember: - self.treatNullAs = interfaceMember.treatNullAs - else: - self.treatNullAs = "Default" - if isinstance(interfaceMember, IDLAttribute): - self.enforceRange = interfaceMember.enforceRange - self.clamp = interfaceMember.clamp - else: - self.enforceRange = False - self.clamp = False self.identifier = FakeIdentifier(name) @@ -11117,7 +11109,6 @@ class CGProxySpecialOperation(CGPerSignatureCall): argument = arguments[1] info = getJSToNativeConversionInfo( argument.type, descriptor, - treatNullAs=argument.treatNullAs, sourceDescription=("value being assigned to %s setter" % descriptor.interface.identifier.name)) if argumentHandleValue is None: @@ -12767,8 +12758,6 @@ class CGDictionary(CGThing): getJSToNativeConversionInfo( member.type, descriptorProvider, - isEnforceRange=member.enforceRange, - isClamp=member.clamp, isMember="Dictionary", isOptional=member.canHaveMissingValue(), defaultValue=member.defaultValue, @@ -15649,7 +15638,6 @@ class CGCallbackInterface(CGCallback): class FakeMember(): def __init__(self, name=None): - self.treatNullAs = "Default" if name is not None: self.identifier = FakeIdentifier(name) diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index fc0b7467e..f8a08e118 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -45,7 +45,8 @@ class Configuration(DescriptorProvider): # Our build system doesn't support dep build involving # addition/removal of "implements" statements that appear in a # different .webidl file than their LHS interface. Make sure we - # don't have any of those. + # don't have any of those. See similar block below for partial + # interfaces! # # But whitelist a RHS that is LegacyQueryInterface, # since people shouldn't be adding any of those. @@ -66,6 +67,33 @@ class Configuration(DescriptorProvider): if not thing.isInterface() and not thing.isNamespace(): continue iface = thing + # Our build system doesn't support dep builds involving + # addition/removal of partial interfaces that appear in a different + # .webidl file than the interface they are extending. Make sure we + # don't have any of those. See similar block above for "implements" + # statements! + if not iface.isExternal(): + for partialIface in iface.getPartials(): + if (partialIface.filename() != iface.filename() and + # Unfortunately, NavigatorProperty does exactly the + # thing we're trying to prevent here. I'm not sure how + # to deal with that, short of effectively requiring a + # clobber when NavigatorProperty is added/removed and + # whitelisting the things it outputs here as + # restrictively as I can. + (partialIface.identifier.name != "Navigator" or + len(partialIface.members) != 1 or + partialIface.members[0].location != partialIface.location or + partialIface.members[0].identifier.location.filename() != + "")): + raise TypeError( + "The binding build system doesn't really support " + "partial interfaces which don't appear in the " + "file in which the interface they are extending is " + "defined. Don't do this.\n" + "%s\n" + "%s" % + (partialIface.location, iface.location)) self.interfaces[iface.identifier.name] = iface if iface.identifier.name not in config: # Completely skip consequential interfaces with no descriptor diff --git a/dom/bindings/GenerateCSS2PropertiesWebIDL.py b/dom/bindings/GenerateCSS2PropertiesWebIDL.py index 58ec60c29..7f8e9805b 100644 --- a/dom/bindings/GenerateCSS2PropertiesWebIDL.py +++ b/dom/bindings/GenerateCSS2PropertiesWebIDL.py @@ -13,7 +13,7 @@ from mozbuild import shellutil # (whether camelCase, _underscorePrefixed, etc.) and the given array of # extended attributes. def generateLine(propName, extendedAttrs): - return " [%s] attribute DOMString %s;\n" % (", ".join(extendedAttrs), + return " [%s] attribute [TreatNullAs=EmptyString] DOMString %s;\n" % (", ".join(extendedAttrs), propName) def generate(output, idlFilename, preprocessorHeader): cpp = list(buildconfig.substs['CPP']) @@ -28,7 +28,7 @@ def generate(output, idlFilename, preprocessorHeader): continue # Unfortunately, even some of the getters here are fallible # (e.g. on nsComputedDOMStyle). - extendedAttrs = ["Throws", "TreatNullAs=EmptyString"] + extendedAttrs = ["Throws"] if pref is not "": extendedAttrs.append('Pref="%s"' % pref) diff --git a/dom/bindings/parser/WebIDL.py b/dom/bindings/parser/WebIDL.py index 7d727a9cf..bd49e219d 100644 --- a/dom/bindings/parser/WebIDL.py +++ b/dom/bindings/parser/WebIDL.py @@ -316,7 +316,7 @@ class IDLScope(IDLObject): newObject.location) raise WebIDLError( - "Multiple unresolvable definitions of identifier '%s' in scope '%s%s" + "Multiple unresolvable definitions of identifier '%s' in scope '%s'%s" % (identifier.name, str(self), conflictdesc), []) def _lookupIdentifier(self, identifier): @@ -409,48 +409,11 @@ class IDLObjectWithIdentifier(IDLObject): if parentScope: self.resolve(parentScope) - self.treatNullAs = "Default" - def resolve(self, parentScope): assert isinstance(parentScope, IDLScope) assert isinstance(self.identifier, IDLUnresolvedIdentifier) self.identifier.resolve(parentScope, self) - def checkForStringHandlingExtendedAttributes(self, attrs, - isDictionaryMember=False, - isOptional=False): - """ - A helper function to deal with TreatNullAs. Returns the list - of attrs it didn't handle itself. - """ - assert isinstance(self, IDLArgument) or isinstance(self, IDLAttribute) - unhandledAttrs = list() - for attr in attrs: - if not attr.hasValue(): - unhandledAttrs.append(attr) - continue - - identifier = attr.identifier() - value = attr.value() - if identifier == "TreatNullAs": - if not self.type.isDOMString() or self.type.nullable(): - raise WebIDLError("[TreatNullAs] is only allowed on " - "arguments or attributes whose type is " - "DOMString", - [self.location]) - if isDictionaryMember: - raise WebIDLError("[TreatNullAs] is not allowed for " - "dictionary members", [self.location]) - if value != 'EmptyString': - raise WebIDLError("[TreatNullAs] must take the identifier " - "'EmptyString', not '%s'" % value, - [self.location]) - self.treatNullAs = value - else: - unhandledAttrs.append(attr) - - return unhandledAttrs - class IDLObjectWithScope(IDLObjectWithIdentifier, IDLScope): def __init__(self, location, parentScope, identifier): @@ -595,6 +558,33 @@ class IDLExternalInterface(IDLObjectWithIdentifier, IDLExposureMixins): def _getDependentObjects(self): return set() +class IDLPartialDictionary(IDLObject): + def __init__(self, location, name, members, nonPartialDictionary): + assert isinstance(name, IDLUnresolvedIdentifier) + + IDLObject.__init__(self, location) + self.identifier = name + self.members = members + self._nonPartialDictionary = nonPartialDictionary + self._finished = False + nonPartialDictionary.addPartialDictionary(self) + + def addExtendedAttributes(self, attrs): + pass + + def finish(self, scope): + if self._finished: + return + self._finished = True + + # Need to make sure our non-partial dictionary gets + # finished so it can report cases when we only have partial + # dictionaries. + self._nonPartialDictionary.finish(scope) + + def validate(self): + pass + class IDLPartialInterfaceOrNamespace(IDLObject): def __init__(self, location, name, members, nonPartialInterfaceOrNamespace): @@ -609,7 +599,7 @@ class IDLPartialInterfaceOrNamespace(IDLObject): self._haveSecureContextExtendedAttribute = False self._nonPartialInterfaceOrNamespace = nonPartialInterfaceOrNamespace self._finished = False - nonPartialInterfaceOrNamespace.addPartialInterface(self) + nonPartialInterfaceOrNamespace.addPartial(self) def addExtendedAttributes(self, attrs): for attr in attrs: @@ -681,28 +671,211 @@ def globalNameSetToExposureSet(globalScope, nameSet, exposureSet): exposureSet.update(globalScope.globalNameMapping[name]) -class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): - def __init__(self, location, parentScope, name, parent, members, - isKnownNonPartial): +class IDLInterfaceOrInterfaceMixinOrNamespace(IDLObjectWithScope, IDLExposureMixins): + def __init__(self, location, parentScope, name): assert isinstance(parentScope, IDLScope) assert isinstance(name, IDLUnresolvedIdentifier) + + self._finished = False + self.members = [] + self._partials = [] + self._extendedAttrDict = {} + self._isKnownNonPartial = False + + IDLObjectWithScope.__init__(self, location, parentScope, name) + IDLExposureMixins.__init__(self, location) + + def finish(self, scope): + if not self._isKnownNonPartial: + raise WebIDLError("%s does not have a non-partial declaration" % + str(self), [self.location]) + + IDLExposureMixins.finish(self, scope) + + # Now go ahead and merge in our partials. + for partial in self._partials: + partial.finish(scope) + self.addExtendedAttributes(partial.propagatedExtendedAttrs) + self.members.extend(partial.members) + + def resolveIdentifierConflict(self, scope, identifier, originalObject, newObject): + assert isinstance(scope, IDLScope) + assert isinstance(originalObject, IDLInterfaceMember) + assert isinstance(newObject, IDLInterfaceMember) + + retval = IDLScope.resolveIdentifierConflict(self, scope, identifier, + originalObject, newObject) + + # Might be a ctor, which isn't in self.members + if newObject in self.members: + self.members.remove(newObject) + return retval + + def typeName(self): + if self.isInterface(): + return "interface" + if self.isNamespace(): + return "namespace" + return "interface mixin" + + def getExtendedAttribute(self, name): + return self._extendedAttrDict.get(name, None) + + def setNonPartial(self, location, members): + if self._isKnownNonPartial: + raise WebIDLError("Two non-partial definitions for the " + "same %s" % self.typeName(), + [location, self.location]) + self._isKnownNonPartial = True + # Now make it look like we were parsed at this new location, since + # that's the place where the interface is "really" defined + self.location = location + # Put the new members at the beginning + self.members = members + self.members + + def addPartial(self, partial): + assert self.identifier.name == partial.identifier.name + self._partials.append(partial) + + def getPartials(self): + # Don't let people mutate our guts. + return list(self._partials) + + def finishMembers(self, scope): + # Assuming we've merged in our partials, set the _exposureGlobalNames on + # any members that don't have it set yet. Note that any partial + # interfaces that had [Exposed] set have already set up + # _exposureGlobalNames on all the members coming from them, so this is + # just implementing the "members default to interface or interface mixin + # that defined them" and "partial interfaces or interface mixins default + # to interface or interface mixin they're a partial for" rules from the + # spec. + for m in self.members: + # If m, or the partial m came from, had [Exposed] + # specified, it already has a nonempty exposure global names set. + if len(m._exposureGlobalNames) == 0: + m._exposureGlobalNames.update(self._exposureGlobalNames) + + # resolve() will modify self.members, so we need to iterate + # over a copy of the member list here. + for member in list(self.members): + member.resolve(self) + + for member in self.members: + member.finish(scope) + + # Now that we've finished our members, which has updated their exposure + # sets, make sure they aren't exposed in places where we are not. + for member in self.members: + if not member.exposureSet.issubset(self.exposureSet): + raise WebIDLError("Interface or interface mixin member has " + "larger exposure set than its container", + [member.location, self.location]) + + +class IDLInterfaceMixin(IDLInterfaceOrInterfaceMixinOrNamespace): + def __init__(self, location, parentScope, name, members, isKnownNonPartial): + self.actualExposureGlobalNames = set() + + assert isKnownNonPartial or len(members) == 0 + IDLInterfaceOrInterfaceMixinOrNamespace.__init__(self, location, parentScope, name) + + if isKnownNonPartial: + self.setNonPartial(location, members) + + def __str__(self): + return "Interface mixin '%s'" % self.identifier.name + + def finish(self, scope): + if self._finished: + return + self._finished = True + + # Expose to the globals of interfaces that includes this mixin if this + # mixin has no explicit [Exposed] so that its members can be exposed + # based on the base interface exposure set. + # Make sure this is done before IDLExposureMixins.finish call to + # prevent exposing to PrimaryGlobal by default. + hasImplicitExposure = len(self._exposureGlobalNames) == 0 + if hasImplicitExposure: + self._exposureGlobalNames.update(self.actualExposureGlobalNames) + + IDLInterfaceOrInterfaceMixinOrNamespace.finish(self, scope) + + self.finishMembers(scope) + + def validate(self): + for member in self.members: + + if member.isAttr(): + if member.inherit: + raise WebIDLError("Interface mixin member cannot include " + "an inherited attribute", + [member.location, self.location]) + if member.isStatic(): + raise WebIDLError("Interface mixin member cannot include " + "a static member", + [member.location, self.location]) + + if member.isMethod(): + if member.isStatic(): + raise WebIDLError("Interface mixin member cannot include " + "a static operation", + [member.location, self.location]) + if (member.isGetter() or + member.isSetter() or + member.isDeleter() or + member.isLegacycaller()): + raise WebIDLError("Interface mixin member cannot include a " + "special operation", + [member.location, self.location]) + + def addExtendedAttributes(self, attrs): + for attr in attrs: + identifier = attr.identifier() + + if identifier == "SecureContext": + if not attr.noArguments(): + raise WebIDLError("[%s] must take no arguments" % identifier, + [attr.location]) + # This gets propagated to all our members. + for member in self.members: + if member.getExtendedAttribute("SecureContext"): + raise WebIDLError("[SecureContext] specified on both " + "an interface mixin member and on" + "the interface mixin itself", + [member.location, attr.location]) + member.addExtendedAttributes([attr]) + elif identifier == "Exposed": + convertExposedAttrToGlobalNameSet(attr, + self._exposureGlobalNames) + else: + raise WebIDLError("Unknown extended attribute %s on interface" % identifier, + [attr.location]) + + attrlist = attr.listValue() + self._extendedAttrDict[identifier] = attrlist if len(attrlist) else True + + def _getDependentObjects(self): + return set(self.members) + + +class IDLInterfaceOrNamespace(IDLInterfaceOrInterfaceMixinOrNamespace): + def __init__(self, location, parentScope, name, parent, members, + isKnownNonPartial): assert isKnownNonPartial or not parent assert isKnownNonPartial or len(members) == 0 self.parent = None self._callback = False - self._finished = False - self.members = [] self.maplikeOrSetlikeOrIterable = None - self._partialInterfaces = [] - self._extendedAttrDict = {} # namedConstructors needs deterministic ordering because bindings code # outputs the constructs in the order that namedConstructors enumerates # them. self.namedConstructors = list() self.implementedInterfaces = set() + self.includedMixins = set() self._consequential = False - self._isKnownNonPartial = False # self.interfacesBasedOnSelf is the set of interfaces that inherit from # self or have self as a consequential interface, including self itself. # Used for distinguishability checking. @@ -721,8 +894,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): # interface we're iterating for in order to get its nativeType. self.iterableInterface = None - IDLObjectWithScope.__init__(self, location, parentScope, name) - IDLExposureMixins.__init__(self, location) + IDLInterfaceOrInterfaceMixinOrNamespace.__init__(self, location, parentScope, name) if isKnownNonPartial: self.setNonPartial(location, parent, members) @@ -742,37 +914,13 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): def isIteratorInterface(self): return self.iterableInterface is not None - def resolveIdentifierConflict(self, scope, identifier, originalObject, newObject): - assert isinstance(scope, IDLScope) - assert isinstance(originalObject, IDLInterfaceMember) - assert isinstance(newObject, IDLInterfaceMember) - - retval = IDLScope.resolveIdentifierConflict(self, scope, identifier, - originalObject, newObject) - - # Might be a ctor, which isn't in self.members - if newObject in self.members: - self.members.remove(newObject) - return retval - def finish(self, scope): if self._finished: return self._finished = True - if not self._isKnownNonPartial: - raise WebIDLError("Interface %s does not have a non-partial " - "declaration" % self.identifier.name, - [self.location]) - - IDLExposureMixins.finish(self, scope) - - # Now go ahead and merge in our partial interfaces. - for partial in self._partialInterfaces: - partial.finish(scope) - self.addExtendedAttributes(partial.propagatedExtendedAttrs) - self.members.extend(partial.members) + IDLInterfaceOrInterfaceMixinOrNamespace.finish(self, scope) # Generate maplike/setlike interface members. Since generated members # need to be treated like regular interface members, do this before @@ -795,19 +943,6 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): # our required methods in Codegen. Generate members now. self.maplikeOrSetlikeOrIterable.expand(self.members, self.isJSImplemented()) - # Now that we've merged in our partial interfaces, set the - # _exposureGlobalNames on any members that don't have it set yet. Note - # that any partial interfaces that had [Exposed] set have already set up - # _exposureGlobalNames on all the members coming from them, so this is - # just implementing the "members default to interface that defined them" - # and "partial interfaces default to interface they're a partial for" - # rules from the spec. - for m in self.members: - # If m, or the partial interface m came from, had [Exposed] - # specified, it already has a nonempty exposure global names set. - if len(m._exposureGlobalNames) == 0: - m._exposureGlobalNames.update(self._exposureGlobalNames) - assert not self.parent or isinstance(self.parent, IDLIdentifierPlaceholder) parent = self.parent.finish(scope) if self.parent else None if parent and isinstance(parent, IDLExternalInterface): @@ -816,7 +951,11 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): (self.identifier.name, self.parent.identifier.name), [self.location]) - assert not parent or isinstance(parent, IDLInterface) + if parent and not isinstance(parent, IDLInterface): + raise WebIDLError("%s inherits from %s which is not an interface " % + (self.identifier.name, + self.parent.identifier.name), + [self.location, parent.location]) self.parent = parent @@ -903,6 +1042,8 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): for iface in self.implementedInterfaces: iface.finish(scope) + for mixin in self.includedMixins: + mixin.finish(scope) cycleInGraph = self.findInterfaceLoopPoint(self) if cycleInGraph: @@ -917,24 +1058,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): # And that we're not consequential. assert not self.isConsequential() - # Now resolve() and finish() our members before importing the - # ones from our implemented interfaces. - - # resolve() will modify self.members, so we need to iterate - # over a copy of the member list here. - for member in list(self.members): - member.resolve(self) - - for member in self.members: - member.finish(scope) - - # Now that we've finished our members, which has updated their exposure - # sets, make sure they aren't exposed in places where we are not. - for member in self.members: - if not member.exposureSet.issubset(self.exposureSet): - raise WebIDLError("Interface member has larger exposure set " - "than the interface itself", - [member.location, self.location]) + self.finishMembers(scope) ctor = self.ctor() if ctor is not None: @@ -988,6 +1112,10 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): self.members.extend(additionalMembers) iface.interfacesImplementingSelf.add(self) + for mixin in sorted(self.includedMixins, + key=lambda x: x.identifier.name): + self.members.extend(mixin.members) + for ancestor in self.getInheritedInterfaces(): ancestor.interfacesBasedOnSelf.add(self) if (ancestor.maplikeOrSetlikeOrIterable is not None and @@ -1407,6 +1535,10 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): assert(isinstance(implementedInterface, IDLInterface)) self.implementedInterfaces.add(implementedInterface) + def addIncludedMixin(self, includedMixin): + assert(isinstance(includedMixin, IDLInterfaceMixin)) + self.includedMixins.add(includedMixin) + def getInheritedInterfaces(self): """ Returns a list of the interfaces this interface inherits from @@ -1456,29 +1588,11 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): return loopPoint return None - def getExtendedAttribute(self, name): - return self._extendedAttrDict.get(name, None) - def setNonPartial(self, location, parent, members): assert not parent or isinstance(parent, IDLIdentifierPlaceholder) - if self._isKnownNonPartial: - raise WebIDLError("Two non-partial definitions for the " - "same %s" % - ("interface" if self.isInterface() - else "namespace"), - [location, self.location]) - self._isKnownNonPartial = True - # Now make it look like we were parsed at this new location, since - # that's the place where the interface is "really" defined - self.location = location + IDLInterfaceOrInterfaceMixinOrNamespace.setNonPartial(self, location, members) assert not self.parent self.parent = parent - # Put the new members at the beginning - self.members = members + self.members - - def addPartialInterface(self, partial): - assert self.identifier.name == partial.identifier.name - self._partialInterfaces.append(partial) def getJSImplementation(self): classId = self.getExtendedAttribute("JSImplementation") @@ -1541,6 +1655,7 @@ class IDLInterfaceOrNamespace(IDLObjectWithScope, IDLExposureMixins): def _getDependentObjects(self): deps = set(self.members) deps.update(self.implementedInterfaces) + deps.update(self.includedMixins) if self.parent: deps.add(self.parent) return deps @@ -1798,6 +1913,7 @@ class IDLDictionary(IDLObjectWithScope): self.parent = parent self._finished = False self.members = list(members) + self._partialDictionaries = [] IDLObjectWithScope.__init__(self, location, parentScope, name) @@ -1834,6 +1950,11 @@ class IDLDictionary(IDLObjectWithScope): # looking at them. self.parent.finish(scope) + # Now go ahead and merge in our partial dictionaries. + for partial in self._partialDictionaries: + partial.finish(scope) + self.members.extend(partial.members) + for member in self.members: member.resolve(self) if not member.isComplete(): @@ -1935,6 +2056,9 @@ class IDLDictionary(IDLObjectWithScope): deps.add(self.parent) return deps + def addPartialDictionary(self, partial): + assert self.identifier.name == partial.identifier.name + self._partialDictionaries.append(partial) class IDLEnum(IDLObjectWithIdentifier): def __init__(self, location, parentScope, name, values): @@ -2008,9 +2132,15 @@ class IDLType(IDLObject): IDLObject.__init__(self, location) self.name = name self.builtin = False + self.clamp = False + self.treatNullAsEmpty = False + self.enforceRange = False + self._extendedAttrDict = {} def __eq__(self, other): - return other and self.builtin == other.builtin and self.name == other.name + return (other and self.builtin == other.builtin and self.name == other.name and + self.clamp == other.clamp and self.enforceRange == other.enforceRange and + self.treatNullAsEmpty == other.treatNullAsEmpty) def __ne__(self, other): return not self == other @@ -2136,8 +2266,14 @@ class IDLType(IDLObject): assert self.tag() == IDLType.Tags.callback return self.nullable() and self.inner.callback._treatNonObjectAsNull - def addExtendedAttributes(self, attrs): - assert len(attrs) == 0 + def withExtendedAttributes(self, attrs): + if len(attrs) > 0: + raise WebIDLError("Extended attributes on types only supported for builtins", + [attrs[0].location, self.location]) + return self + + def getExtendedAttribute(self, name): + return self._extendedAttrDict.get(name, None) def resolveType(self, parentScope): pass @@ -2158,8 +2294,9 @@ class IDLUnresolvedType(IDLType): Unresolved types are interface types """ - def __init__(self, location, name): + def __init__(self, location, name, attrs=[]): IDLType.__init__(self, location, name) + self.extraTypeAttributes = attrs def isComplete(self): return False @@ -2181,7 +2318,7 @@ class IDLUnresolvedType(IDLType): typedefType = IDLTypedefType(self.location, obj.innerType, obj.identifier) assert not typedefType.isComplete() - return typedefType.complete(scope) + return typedefType.complete(scope).withExtendedAttributes(self.extraTypeAttributes) elif obj.isCallback() and not obj.isInterface(): assert self.name.name == obj.identifier.name return IDLCallbackType(self.location, obj) @@ -2189,6 +2326,9 @@ class IDLUnresolvedType(IDLType): name = self.name.resolve(scope, None) return IDLWrapperType(self.location, obj) + def withExtendedAttributes(self, attrs): + return IDLUnresolvedType(self.location, self.name, attrs) + def isDistinguishableFrom(self, other): raise TypeError("Can't tell whether an unresolved type is or is not " "distinguishable from other things") @@ -2690,12 +2830,17 @@ class IDLTypedefType(IDLType): def _getDependentObjects(self): return self.inner._getDependentObjects() + def withExtendedAttributes(self, attrs): + return IDLTypedefType(self.location, self.inner.withExtendedAttributes(attrs), self.name) + class IDLTypedef(IDLObjectWithIdentifier): def __init__(self, location, parentScope, innerType, name): + # Set self.innerType first, because IDLObjectWithIdentifier.__init__ + # will call our __str__, which wants to use it. + self.innerType = innerType identifier = IDLUnresolvedIdentifier(location, name) IDLObjectWithIdentifier.__init__(self, location, parentScope, identifier) - self.innerType = innerType def __str__(self): return "Typedef %s %s" % (self.identifier.name, self.innerType) @@ -2994,10 +3139,59 @@ class IDLBuiltinType(IDLType): Types.ReadableStream: IDLType.Tags.interface, } - def __init__(self, location, name, type): + def __init__(self, location, name, type, clamp=False, enforceRange=False, treatNullAsEmpty=False, + attrLocation=[]): + """ + The mutually exclusive clamp/enforceRange/treatNullAsEmpty arguments are used to create instances + of this type with the appropriate attributes attached. Use .clamped(), .rangeEnforced(), and .treatNullAs(). + + attrLocation is an array of source locations of these attributes for error reporting. + """ IDLType.__init__(self, location, name) self.builtin = True self._typeTag = type + self._clamped = None + self._rangeEnforced = None + self._withTreatNullAs = None + if self.isNumeric(): + if clamp: + self.clamp = True + self.name = "Clamped" + self.name + self._extendedAttrDict["Clamp"] = True + elif enforceRange: + self.enforceRange = True + self.name = "RangeEnforced" + self.name + self._extendedAttrDict["EnforceRange"] = True + elif clamp or enforceRange: + raise WebIDLError("Non-numeric types cannot be [Clamp] or [EnforceRange]", attrLocation) + if self.isDOMString(): + if treatNullAsEmpty: + self.treatNullAsEmpty = True + self.name = "NullIsEmpty" + self.name + self._extendedAttrDict["TreatNullAs"] = ["EmptyString"] + elif treatNullAsEmpty: + raise WebIDLError("Non-string types cannot be [TreatNullAs]", attrLocation) + + def clamped(self, attrLocation): + if not self._clamped: + self._clamped = IDLBuiltinType(self.location, self.name, + self._typeTag, clamp=True, + attrLocation=attrLocation) + return self._clamped + + def rangeEnforced(self, attrLocation): + if not self._rangeEnforced: + self._rangeEnforced = IDLBuiltinType(self.location, self.name, + self._typeTag, enforceRange=True, + attrLocation=attrLocation) + return self._rangeEnforced + + def withTreatNullAs(self, attrLocation): + if not self._withTreatNullAs: + self._withTreatNullAs = IDLBuiltinType(self.location, self.name, + self._typeTag, treatNullAsEmpty=True, + attrLocation=attrLocation) + return self._withTreatNullAs def isPrimitive(self): return self._typeTag <= IDLBuiltinType.Types.double @@ -3133,6 +3327,45 @@ class IDLBuiltinType(IDLType): def _getDependentObjects(self): return set() + def withExtendedAttributes(self, attrs): + ret = self + for attribute in attrs: + identifier = attribute.identifier() + if identifier == "Clamp": + if not attribute.noArguments(): + raise WebIDLError("[Clamp] must take no arguments", + [attribute.location]) + if ret.enforceRange or self.enforceRange: + raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive", + [self.location, attribute.location]) + ret = self.clamped([self.location, attribute.location]) + elif identifier == "EnforceRange": + if not attribute.noArguments(): + raise WebIDLError("[EnforceRange] must take no arguments", + [attribute.location]) + if ret.clamp or self.clamp: + raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive", + [self.location, attribute.location]) + ret = self.rangeEnforced([self.location, attribute.location]) + elif identifier == "TreatNullAs": + if not self.isDOMString(): + raise WebIDLError("[TreatNullAs] only allowed on DOMStrings", + [self.location, attribute.location]) + assert not self.nullable() + if not attribute.hasValue(): + raise WebIDLError("[TreatNullAs] must take an identifier argument" + [attribute.location]) + value = attribute.value() + if value != 'EmptyString': + raise WebIDLError("[TreatNullAs] must take the identifier " + "'EmptyString', not '%s'" % value, + [attribute.location]) + ret = self.withTreatNullAs([self.location, attribute.location]) + else: + raise WebIDLError("Unhandled extended attribute on type", + [self.location, attribute.location]) + return ret + BuiltinTypes = { IDLBuiltinType.Types.byte: IDLBuiltinType(BuiltinLocation(""), "Byte", @@ -3347,6 +3580,10 @@ class IDLValue(IDLObject): # extra normalization step. assert self.type.isDOMString() return self + elif self.type.isDOMString() and type.treatNullAsEmpty: + # TreatNullAsEmpty is a different type for resolution reasons, + # however once you have a value it doesn't matter + return self elif self.type.isString() and type.isByteString(): # Allow ByteStrings to use a default value like DOMString. # No coercion is required as Codegen.py will handle the @@ -3973,8 +4210,6 @@ class IDLAttribute(IDLInterfaceMember): self.lenientThis = False self._unforgeable = False self.stringifier = stringifier - self.enforceRange = False - self.clamp = False self.slotIndices = None assert maplikeOrSetlike is None or isinstance(maplikeOrSetlike, IDLMaplikeOrSetlike) self.maplikeOrSetlike = maplikeOrSetlike @@ -4010,6 +4245,9 @@ class IDLAttribute(IDLInterfaceMember): assert not isinstance(t.name, IDLUnresolvedIdentifier) self.type = t + if self.readonly and (self.type.clamp or self.type.enforceRange or self.type.treatNullAsEmpty): + raise WebIDLError("A readonly attribute cannot be [Clamp] or [EnforceRange]", + [self.location]) if self.type.isDictionary() and not self.getExtendedAttribute("Cached"): raise WebIDLError("An attribute cannot be of a dictionary type", [self.location]) @@ -4212,16 +4450,6 @@ class IDLAttribute(IDLInterfaceMember): raise WebIDLError("[LenientFloat] used on an attribute with a " "non-restricted-float type", [attr.location, self.location]) - elif identifier == "EnforceRange": - if self.readonly: - raise WebIDLError("[EnforceRange] used on a readonly attribute", - [attr.location, self.location]) - self.enforceRange = True - elif identifier == "Clamp": - if self.readonly: - raise WebIDLError("[Clamp] used on a readonly attribute", - [attr.location, self.location]) - self.clamp = True elif identifier == "StoreInSlot": if self.getExtendedAttribute("Cached"): raise WebIDLError("[StoreInSlot] and [Cached] must not be " @@ -4321,10 +4549,6 @@ class IDLAttribute(IDLInterfaceMember): self.type.resolveType(parentScope) IDLObjectWithIdentifier.resolve(self, parentScope) - def addExtendedAttributes(self, attrs): - attrs = self.checkForStringHandlingExtendedAttributes(attrs) - IDLInterfaceMember.addExtendedAttributes(self, attrs) - def hasLenientThis(self): return self.lenientThis @@ -4344,7 +4568,7 @@ class IDLAttribute(IDLInterfaceMember): class IDLArgument(IDLObjectWithIdentifier): - def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False): + def __init__(self, location, identifier, type, optional=False, defaultValue=None, variadic=False, dictionaryMember=False, allowTypeAttributes=False): IDLObjectWithIdentifier.__init__(self, location, None, identifier) assert isinstance(type, IDLType) @@ -4355,37 +4579,19 @@ class IDLArgument(IDLObjectWithIdentifier): self.variadic = variadic self.dictionaryMember = dictionaryMember self._isComplete = False - self.enforceRange = False - self.clamp = False self._allowTreatNonCallableAsNull = False self._extendedAttrDict = {} + self.allowTypeAttributes = allowTypeAttributes assert not variadic or optional assert not variadic or not defaultValue def addExtendedAttributes(self, attrs): - attrs = self.checkForStringHandlingExtendedAttributes( - attrs, - isDictionaryMember=self.dictionaryMember, - isOptional=self.optional) for attribute in attrs: identifier = attribute.identifier() - if identifier == "Clamp": - if not attribute.noArguments(): - raise WebIDLError("[Clamp] must take no arguments", - [attribute.location]) - if self.enforceRange: - raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive", - [self.location]) - self.clamp = True - elif identifier == "EnforceRange": - if not attribute.noArguments(): - raise WebIDLError("[EnforceRange] must take no arguments", - [attribute.location]) - if self.clamp: - raise WebIDLError("[EnforceRange] and [Clamp] are mutually exclusive", - [self.location]) - self.enforceRange = True + if self.allowTypeAttributes and (identifier == "EnforceRange" or identifier == "Clamp" or + identifier == "TreatNullAs"): + self.type = self.type.withExtendedAttributes([attribute]) elif identifier == "TreatNonCallableAsNull": self._allowTreatNonCallableAsNull = True elif (self.dictionaryMember and @@ -4436,6 +4642,8 @@ class IDLArgument(IDLObjectWithIdentifier): # codegen doesn't have to special-case this. self.defaultValue = IDLUndefinedValue(self.location) + if self.dictionaryMember and self.type.treatNullAsEmpty: + raise WebIDLError("Dictionary members cannot be [TreatNullAs]", [self.location]) # Now do the coercing thing; this needs to happen after the # above creation of a default value. if self.defaultValue: @@ -4566,6 +4774,9 @@ class IDLMethodOverload: deps.add(self.returnType) return deps + def includesRestrictedFloatArgument(self): + return any(arg.type.includesRestrictedFloat() for arg in self.arguments) + class IDLMethod(IDLInterfaceMember, IDLScope): @@ -4750,10 +4961,25 @@ class IDLMethod(IDLInterfaceMember, IDLScope): def addOverload(self, method): assert len(method._overloads) == 1 - if self._extendedAttrDict != method ._extendedAttrDict: - raise WebIDLError("Extended attributes differ on different " - "overloads of %s" % method.identifier, - [self.location, method.location]) + if self._extendedAttrDict != method._extendedAttrDict: + extendedAttrDiff = set(self._extendedAttrDict.keys()) ^ set(method._extendedAttrDict.keys()) + + if extendedAttrDiff == { "LenientFloat" }: + if "LenientFloat" not in self._extendedAttrDict: + for overload in self._overloads: + if overload.includesRestrictedFloatArgument(): + raise WebIDLError("Restricted float behavior differs on different " + "overloads of %s" % method.identifier, + [overload.location, method.location]) + self._extendedAttrDict["LenientFloat"] = method._extendedAttrDict["LenientFloat"] + elif method._overloads[0].includesRestrictedFloatArgument(): + raise WebIDLError("Restricted float behavior differs on different " + "overloads of %s" % method.identifier, + [self.location, method.location]) + else: + raise WebIDLError("Extended attributes differ on different " + "overloads of %s" % method.identifier, + [self.location, method.location]) self._overloads.extend(method._overloads) @@ -4900,16 +5126,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope): raise WebIDLError("StaticClassOverride can be applied to static" " methods on JS-implemented classes only.", [self.location]) - if self.getExtendedAttribute("LenientFloat"): - assert len(self.signatures()) >= 1 - found = False - for sig in self.signatures(): - if any(arg.type.includesRestrictedFloat() for arg in sig[1]): - found = True - if not found: - raise WebIDLError("[LenientFloat] used on an operation with no " - "restricted float type arguments", - [self.location]) def overloadsForArgCount(self, argc): return [overload for overload in self._overloads if @@ -4982,11 +5198,15 @@ class IDLMethod(IDLInterfaceMember, IDLScope): [attr.location, self.location]) elif identifier == "LenientFloat": # This is called before we've done overload resolution - assert len(self.signatures()) == 1 - sig = self.signatures()[0] - if not sig[0].isVoid(): + overloads = self._overloads + assert len(overloads) == 1 + if not overloads[0].returnType.isVoid(): raise WebIDLError("[LenientFloat] used on a non-void method", [attr.location, self.location]) + if not overloads[0].includesRestrictedFloatArgument(): + raise WebIDLError("[LenientFloat] used on an operation with no " + "restricted float type arguments", + [attr.location, self.location]) elif identifier == "Exposed": convertExposedAttrToGlobalNameSet(attr, self._exposureGlobalNames) elif (identifier == "CrossOriginCallable" or @@ -5114,6 +5334,53 @@ class IDLImplementsStatement(IDLObject): def addExtendedAttributes(self, attrs): assert len(attrs) == 0 +class IDLIncludesStatement(IDLObject): + def __init__(self, location, interface, mixin): + IDLObject.__init__(self, location) + self.interface = interface + self.mixin = mixin + self._finished = False + + def finish(self, scope): + if self._finished: + return + self._finished = True + assert(isinstance(self.interface, IDLIdentifierPlaceholder)) + assert(isinstance(self.mixin, IDLIdentifierPlaceholder)) + interface = self.interface.finish(scope) + mixin = self.mixin.finish(scope) + # NOTE: we depend on not setting self.interface and + # self.mixin here to keep track of the original + # locations. + if not isinstance(interface, IDLInterface): + raise WebIDLError("Left-hand side of 'includes' is not an " + "interface", + [self.interface.location, interface.location]) + if interface.isCallback(): + raise WebIDLError("Left-hand side of 'includes' is a callback " + "interface", + [self.interface.location, interface.location]) + if not isinstance(mixin, IDLInterfaceMixin): + raise WebIDLError("Right-hand side of 'includes' is not an " + "interface mixin", + [self.mixin.location, mixin.location]) + if len(interface._exposureGlobalNames) != 0: + mixin.actualExposureGlobalNames.update(interface._exposureGlobalNames) + else: + mixin.actualExposureGlobalNames.add(scope.primaryGlobalName) + + interface.addIncludedMixin(mixin) + self.interface = interface + self.mixin = mixin + + def validate(self): + pass + + def addExtendedAttributes(self, attrs): + if len(attrs) != 0: + raise WebIDLError("There are no extended attributes that are " + "allowed on includes statements", + [attrs[0].location, self.location]) class IDLExtendedAttribute(IDLObject): """ @@ -5210,12 +5477,14 @@ class Tokenizer(object): "module": "MODULE", "interface": "INTERFACE", "partial": "PARTIAL", + "mixin": "MIXIN", "dictionary": "DICTIONARY", "exception": "EXCEPTION", "enum": "ENUM", "callback": "CALLBACK", "typedef": "TYPEDEF", "implements": "IMPLEMENTS", + "includes": "INCLUDES", "const": "CONST", "null": "NULL", "true": "TRUE", @@ -5285,7 +5554,7 @@ class Tokenizer(object): [Location(lexer=self.lexer, lineno=self.lexer.lineno, lexpos=self.lexer.lexpos, - filename=self.filename)]) + filename=self._filename)]) def __init__(self, outputdir, lexer=None): if lexer: @@ -5371,7 +5640,7 @@ class Parser(Tokenizer): def p_Definition(self, p): """ - Definition : CallbackOrInterface + Definition : CallbackOrInterfaceOrMixin | Namespace | Partial | Dictionary @@ -5379,13 +5648,14 @@ class Parser(Tokenizer): | Enum | Typedef | ImplementsStatement + | IncludesStatement """ p[0] = p[1] assert p[1] # We might not have implemented something ... - def p_CallbackOrInterfaceCallback(self, p): + def p_CallbackOrInterfaceOrMixinCallback(self, p): """ - CallbackOrInterface : CALLBACK CallbackRestOrInterface + CallbackOrInterfaceOrMixin : CALLBACK CallbackRestOrInterface """ if p[2].isInterface(): assert isinstance(p[2], IDLInterface) @@ -5393,16 +5663,16 @@ class Parser(Tokenizer): p[0] = p[2] - def p_CallbackOrInterfaceInterface(self, p): + def p_CallbackOrInterfaceOrMixinInterfaceOrMixin(self, p): """ - CallbackOrInterface : Interface + CallbackOrInterfaceOrMixin : INTERFACE InterfaceOrMixin """ - p[0] = p[1] + p[0] = p[2] def p_CallbackRestOrInterface(self, p): """ CallbackRestOrInterface : CallbackRest - | Interface + | CallbackInterface """ assert p[1] p[0] = p[1] @@ -5410,9 +5680,10 @@ class Parser(Tokenizer): def handleNonPartialObject(self, location, identifier, constructor, constructorArgs, nonPartialArgs): """ - This handles non-partial objects (interfaces and namespaces) by - checking for an existing partial object, and promoting it to - non-partial as needed. The return value is the non-partial object. + This handles non-partial objects (interfaces, namespaces and + dictionaries) by checking for an existing partial object, and promoting + it to non-partial as needed. The return value is the non-partial + object. constructorArgs are all the args for the constructor except the last one: isKnownNonPartial. @@ -5442,14 +5713,27 @@ class Parser(Tokenizer): # True for isKnownNonPartial return constructor(*(constructorArgs + [True])) - def p_Interface(self, p): + def p_InterfaceOrMixin(self, p): """ - Interface : INTERFACE IDENTIFIER Inheritance LBRACE InterfaceMembers RBRACE SEMICOLON + InterfaceOrMixin : InterfaceRest + | MixinRest + """ + p[0] = p[1] + + def p_CallbackInterface(self, p): + """ + CallbackInterface : INTERFACE InterfaceRest + """ + p[0] = p[2] + + def p_InterfaceRest(self, p): + """ + InterfaceRest : IDENTIFIER Inheritance LBRACE InterfaceMembers RBRACE SEMICOLON """ location = self.getLocation(p, 1) - identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) - members = p[5] - parent = p[3] + identifier = IDLUnresolvedIdentifier(location, p[1]) + members = p[4] + parent = p[2] p[0] = self.handleNonPartialObject( location, identifier, IDLInterface, @@ -5458,10 +5742,10 @@ class Parser(Tokenizer): def p_InterfaceForwardDecl(self, p): """ - Interface : INTERFACE IDENTIFIER SEMICOLON + InterfaceRest : IDENTIFIER SEMICOLON """ location = self.getLocation(p, 1) - identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) + identifier = IDLUnresolvedIdentifier(location, p[1]) try: if self.globalScope()._lookupIdentifier(identifier): @@ -5479,6 +5763,19 @@ class Parser(Tokenizer): p[0] = IDLExternalInterface(location, self.globalScope(), identifier) + def p_MixinRest(self, p): + """ + MixinRest : MIXIN IDENTIFIER LBRACE MixinMembers RBRACE SEMICOLON + """ + location = self.getLocation(p, 1) + identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) + members = p[4] + + p[0] = self.handleNonPartialObject( + location, identifier, IDLInterfaceMixin, + [location, self.globalScope(), identifier, members], + [location, members]) + def p_Namespace(self, p): """ Namespace : NAMESPACE IDENTIFIER LBRACE InterfaceMembers RBRACE SEMICOLON @@ -5498,10 +5795,16 @@ class Parser(Tokenizer): """ p[0] = p[2] + def p_PartialDefinitionInterface(self, p): + """ + PartialDefinition : INTERFACE PartialInterfaceOrPartialMixin + """ + p[0] = p[2] + def p_PartialDefinition(self, p): """ - PartialDefinition : PartialInterface - | PartialNamespace + PartialDefinition : PartialNamespace + | PartialDictionary """ p[0] = p[1] @@ -5509,17 +5812,17 @@ class Parser(Tokenizer): nonPartialConstructorArgs, partialConstructorArgs): """ - This handles partial objects (interfaces and namespaces) by checking for - an existing non-partial object, and adding ourselves to it as needed. - The return value is our partial object. For now we just use - IDLPartialInterfaceOrNamespace for partial objects. + This handles partial objects (interfaces, namespaces and dictionaries) + by checking for an existing non-partial object, and adding ourselves to + it as needed. The return value is our partial object. We use + IDLPartialInterfaceOrNamespace for partial interfaces or namespaces, + and IDLPartialDictionary for partial dictionaries. nonPartialConstructorArgs are all the args for the non-partial constructor except the last two: members and isKnownNonPartial. - partialConstructorArgs are the arguments for the - IDLPartialInterfaceOrNamespace constructor, except the last one (the - non-partial object). + partialConstructorArgs are the arguments for the partial object + constructor, except the last one (the non-partial object). """ # The name of the class starts with "IDL", so strip that off. # Also, starts with a capital letter after that, so nix that @@ -5543,22 +5846,53 @@ class Parser(Tokenizer): if not nonPartialObject: nonPartialObject = nonPartialConstructor( # No members, False for isKnownNonPartial - *(nonPartialConstructorArgs + [[], False])) - partialInterface = IDLPartialInterfaceOrNamespace( - *(partialConstructorArgs + [nonPartialObject])) - return partialInterface + *(nonPartialConstructorArgs), members=[], isKnownNonPartial=False) - def p_PartialInterface(self, p): + partialObject = None + if isinstance(nonPartialObject, IDLDictionary): + partialObject = IDLPartialDictionary( + *(partialConstructorArgs + [nonPartialObject])) + elif isinstance(nonPartialObject, (IDLInterface, IDLInterfaceMixin, IDLNamespace)): + partialObject = IDLPartialInterfaceOrNamespace( + *(partialConstructorArgs + [nonPartialObject])) + else: + raise WebIDLError("Unknown partial object type %s" % + type(partialObject), + [location]) + + return partialObject + + def p_PartialInterfaceOrPartialMixin(self, p): """ - PartialInterface : INTERFACE IDENTIFIER LBRACE InterfaceMembers RBRACE SEMICOLON + PartialInterfaceOrPartialMixin : PartialInterfaceRest + | PartialMixinRest + """ + p[0] = p[1] + + def p_PartialInterfaceRest(self, p): + """ + PartialInterfaceRest : IDENTIFIER LBRACE InterfaceMembers RBRACE SEMICOLON + """ + location = self.getLocation(p, 1) + identifier = IDLUnresolvedIdentifier(location, p[1]) + members = p[3] + + p[0] = self.handlePartialObject( + location, identifier, IDLInterface, + [location, self.globalScope(), identifier, None], + [location, identifier, members]) + + def p_PartialMixinRest(self, p): + """ + PartialMixinRest : MIXIN IDENTIFIER LBRACE MixinMembers RBRACE SEMICOLON """ location = self.getLocation(p, 1) identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) members = p[4] p[0] = self.handlePartialObject( - location, identifier, IDLInterface, - [location, self.globalScope(), identifier, None], + location, identifier, IDLInterfaceMixin, + [location, self.globalScope(), identifier], [location, identifier, members]) def p_PartialNamespace(self, p): @@ -5574,6 +5908,19 @@ class Parser(Tokenizer): [location, self.globalScope(), identifier], [location, identifier, members]) + def p_PartialDictionary(self, p): + """ + PartialDictionary : DICTIONARY IDENTIFIER LBRACE DictionaryMembers RBRACE SEMICOLON + """ + location = self.getLocation(p, 1) + identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) + members = p[4] + + p[0] = self.handlePartialObject( + location, identifier, IDLDictionary, + [location, self.globalScope(), identifier], + [location, identifier, members]) + def p_Inheritance(self, p): """ Inheritance : COLON ScopedName @@ -5590,7 +5937,7 @@ class Parser(Tokenizer): """ InterfaceMembers : ExtendedAttributeList InterfaceMember InterfaceMembers """ - p[0] = [p[2]] if p[2] else [] + p[0] = [p[2]] assert not p[1] or p[2] p[2].addExtendedAttributes(p[1]) @@ -5610,6 +5957,31 @@ class Parser(Tokenizer): """ p[0] = p[1] + def p_MixinMembersEmpty(self, p): + """ + MixinMembers : + """ + p[0] = [] + + def p_MixinMembers(self, p): + """ + MixinMembers : ExtendedAttributeList MixinMember MixinMembers + """ + p[0] = [p[2]] + + assert not p[1] or p[2] + p[2].addExtendedAttributes(p[1]) + + p[0].extend(p[3]) + + def p_MixinMember(self, p): + """ + MixinMember : Const + | Attribute + | Operation + """ + p[0] = p[1] + def p_Dictionary(self, p): """ Dictionary : DICTIONARY IDENTIFIER Inheritance LBRACE DictionaryMembers RBRACE SEMICOLON @@ -5628,31 +6000,42 @@ class Parser(Tokenizer): # We're at the end of the list p[0] = [] return - # Add our extended attributes p[2].addExtendedAttributes(p[1]) p[0] = [p[2]] p[0].extend(p[3]) - def p_DictionaryMember(self, p): + def p_DictionaryMemberRequired(self, p): """ - DictionaryMember : Required Type IDENTIFIER Default SEMICOLON + DictionaryMember : REQUIRED TypeWithExtendedAttributes IDENTIFIER SEMICOLON """ - # These quack a lot like optional arguments, so just treat them that way. + # These quack a lot like required arguments, so just treat them that way. t = p[2] assert isinstance(t, IDLType) identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3]) - defaultValue = p[4] - optional = not p[1] - - if not optional and defaultValue: - raise WebIDLError("Required dictionary members can't have a default value.", - [self.getLocation(p, 4)]) p[0] = IDLArgument(self.getLocation(p, 3), identifier, t, - optional=optional, - defaultValue=defaultValue, variadic=False, + optional=False, + defaultValue=None, variadic=False, dictionaryMember=True) + def p_DictionaryMember(self, p): + """ + DictionaryMember : Type IDENTIFIER Default SEMICOLON + """ + # These quack a lot like optional arguments, so just treat them that way. + t = p[1] + assert isinstance(t, IDLType) + identifier = IDLUnresolvedIdentifier(self.getLocation(p, 2), p[2]) + defaultValue = p[3] + + # Any attributes that precede this may apply to the type, so + # we configure the argument to forward type attributes down instead of producing + # a parse error + p[0] = IDLArgument(self.getLocation(p, 2), identifier, t, + optional=True, + defaultValue=defaultValue, variadic=False, + dictionaryMember=True, allowTypeAttributes=True) + def p_Default(self, p): """ Default : EQUALS DefaultValue @@ -5674,6 +6057,12 @@ class Parser(Tokenizer): assert len(p) == 3 # Must be [] p[0] = IDLEmptySequenceValue(self.getLocation(p, 1)) + def p_DefaultValueNull(self, p): + """ + DefaultValue : NULL + """ + p[0] = IDLNullValue(self.getLocation(p, 1)) + def p_Exception(self, p): """ Exception : EXCEPTION IDENTIFIER Inheritance LBRACE ExceptionMembers RBRACE SEMICOLON @@ -5740,7 +6129,7 @@ class Parser(Tokenizer): def p_Typedef(self, p): """ - Typedef : TYPEDEF Type IDENTIFIER SEMICOLON + Typedef : TYPEDEF TypeWithExtendedAttributes IDENTIFIER SEMICOLON """ typedef = IDLTypedef(self.getLocation(p, 1), self.globalScope(), p[2], p[3]) @@ -5756,6 +6145,15 @@ class Parser(Tokenizer): p[0] = IDLImplementsStatement(self.getLocation(p, 1), implementor, implementee) + def p_IncludesStatement(self, p): + """ + IncludesStatement : ScopedName INCLUDES ScopedName SEMICOLON + """ + assert(p[2] == "includes") + interface = IDLIdentifierPlaceholder(self.getLocation(p, 1), p[1]) + mixin = IDLIdentifierPlaceholder(self.getLocation(p, 3), p[3]) + p[0] = IDLIncludesStatement(self.getLocation(p, 1), interface, mixin) + def p_Const(self, p): """ Const : CONST ConstType IDENTIFIER EQUALS ConstValue SEMICOLON @@ -5803,12 +6201,6 @@ class Parser(Tokenizer): stringType = BuiltinTypes[IDLBuiltinType.Types.domstring] p[0] = IDLValue(location, stringType, p[1]) - def p_ConstValueNull(self, p): - """ - ConstValue : NULL - """ - p[0] = IDLNullValue(self.getLocation(p, 1)) - def p_BooleanLiteralTrue(self, p): """ BooleanLiteral : TRUE @@ -5833,8 +6225,8 @@ class Parser(Tokenizer): def p_Iterable(self, p): """ - Iterable : ITERABLE LT Type GT SEMICOLON - | ITERABLE LT Type COMMA Type GT SEMICOLON + Iterable : ITERABLE LT TypeWithExtendedAttributes GT SEMICOLON + | ITERABLE LT TypeWithExtendedAttributes COMMA Type GT SEMICOLON """ location = self.getLocation(p, 2) identifier = IDLUnresolvedIdentifier(location, "__iterable", @@ -5864,7 +6256,7 @@ class Parser(Tokenizer): def p_Maplike(self, p): """ - Maplike : ReadOnly MAPLIKE LT Type COMMA Type GT SEMICOLON + Maplike : ReadOnly MAPLIKE LT TypeWithExtendedAttributes COMMA TypeWithExtendedAttributes GT SEMICOLON """ readonly = p[1] maplikeOrSetlikeType = p[2] @@ -5902,7 +6294,7 @@ class Parser(Tokenizer): def p_AttributeRest(self, p): """ - AttributeRest : ReadOnly ATTRIBUTE Type AttributeName SEMICOLON + AttributeRest : ReadOnly ATTRIBUTE TypeWithExtendedAttributes AttributeName SEMICOLON """ location = self.getLocation(p, 2) readonly = p[1] @@ -6181,32 +6573,46 @@ class Parser(Tokenizer): def p_Argument(self, p): """ - Argument : ExtendedAttributeList Optional Type Ellipsis ArgumentName Default + Argument : ExtendedAttributeList ArgumentRest """ - t = p[3] + p[0] = p[2] + p[0].addExtendedAttributes(p[1]) + + def p_ArgumentRestOptional(self, p): + """ + ArgumentRest : OPTIONAL TypeWithExtendedAttributes ArgumentName Default + """ + t = p[2] assert isinstance(t, IDLType) - identifier = IDLUnresolvedIdentifier(self.getLocation(p, 5), p[5]) + identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3]) - optional = p[2] - variadic = p[4] - defaultValue = p[6] - - if not optional and defaultValue: - raise WebIDLError("Mandatory arguments can't have a default value.", - [self.getLocation(p, 6)]) + defaultValue = p[4] # We can't test t.isAny() here and give it a default value as needed, # since at this point t is not a fully resolved type yet (e.g. it might # be a typedef). We'll handle the 'any' case in IDLArgument.complete. - if variadic: - if optional: - raise WebIDLError("Variadic arguments should not be marked optional.", - [self.getLocation(p, 2)]) - optional = variadic + p[0] = IDLArgument(self.getLocation(p, 3), identifier, t, True, defaultValue, False) - p[0] = IDLArgument(self.getLocation(p, 5), identifier, t, optional, defaultValue, variadic) - p[0].addExtendedAttributes(p[1]) + def p_ArgumentRest(self, p): + """ + ArgumentRest : Type Ellipsis ArgumentName + """ + t = p[1] + assert isinstance(t, IDLType) + identifier = IDLUnresolvedIdentifier(self.getLocation(p, 3), p[3]) + + variadic = p[2] + + # We can't test t.isAny() here and give it a default value as needed, + # since at this point t is not a fully resolved type yet (e.g. it might + # be a typedef). We'll handle the 'any' case in IDLArgument.complete. + + # variadic implies optional + # Any attributes that precede this may apply to the type, so + # we configure the argument to forward type attributes down instead of producing + # a parse error + p[0] = IDLArgument(self.getLocation(p, 3), identifier, t, variadic, None, variadic, allowTypeAttributes=True) def p_ArgumentName(self, p): """ @@ -6247,30 +6653,6 @@ class Parser(Tokenizer): """ p[0] = p[1] - def p_Optional(self, p): - """ - Optional : OPTIONAL - """ - p[0] = True - - def p_OptionalEmpty(self, p): - """ - Optional : - """ - p[0] = False - - def p_Required(self, p): - """ - Required : REQUIRED - """ - p[0] = True - - def p_RequiredEmpty(self, p): - """ - Required : - """ - p[0] = False - def p_Ellipsis(self, p): """ Ellipsis : ELLIPSIS @@ -6413,6 +6795,12 @@ class Parser(Tokenizer): """ p[0] = self.handleNullable(p[1], p[2]) + def p_TypeWithExtendedAttributes(self, p): + """ + TypeWithExtendedAttributes : ExtendedAttributeList Type + """ + p[0] = p[2].withExtendedAttributes(p[1]) + def p_SingleTypeNonAnyType(self, p): """ SingleType : NonAnyType @@ -6435,9 +6823,9 @@ class Parser(Tokenizer): def p_UnionMemberTypeNonAnyType(self, p): """ - UnionMemberType : NonAnyType + UnionMemberType : ExtendedAttributeList NonAnyType """ - p[0] = p[1] + p[0] = p[2].withExtendedAttributes(p[1]) def p_UnionMemberType(self, p): """ @@ -6487,7 +6875,7 @@ class Parser(Tokenizer): def p_NonAnyTypeSequenceType(self, p): """ - NonAnyType : SEQUENCE LT Type GT Null + NonAnyType : SEQUENCE LT TypeWithExtendedAttributes GT Null """ innerType = p[3] type = IDLSequenceType(self.getLocation(p, 1), innerType) @@ -6503,7 +6891,7 @@ class Parser(Tokenizer): def p_NonAnyTypeRecordType(self, p): """ - NonAnyType : RECORD LT StringType COMMA Type GT Null + NonAnyType : RECORD LT StringType COMMA TypeWithExtendedAttributes GT Null """ keyType = p[3] valueType = p[5] @@ -6551,19 +6939,17 @@ class Parser(Tokenizer): def p_ConstType(self, p): """ - ConstType : PrimitiveType Null + ConstType : PrimitiveType """ - type = BuiltinTypes[p[1]] - p[0] = self.handleNullable(type, p[2]) + p[0] = BuiltinTypes[p[1]] def p_ConstTypeIdentifier(self, p): """ - ConstType : IDENTIFIER Null + ConstType : IDENTIFIER """ identifier = IDLUnresolvedIdentifier(self.getLocation(p, 1), p[1]) - type = IDLUnresolvedType(self.getLocation(p, 1), identifier) - p[0] = self.handleNullable(type, p[2]) + p[0] = IDLUnresolvedType(self.getLocation(p, 1), identifier) def p_PrimitiveTypeUint(self, p): """ @@ -6923,10 +7309,17 @@ class Parser(Tokenizer): # XXX khuey hates this bit and wants to nuke it from orbit. implementsStatements = [p for p in self._productions if isinstance(p, IDLImplementsStatement)] + # Make sure we finish IDLIncludesStatements before we finish the + # IDLInterfaces. + includesStatements = [p for p in self._productions if + isinstance(p, IDLIncludesStatement)] otherStatements = [p for p in self._productions if - not isinstance(p, IDLImplementsStatement)] + not isinstance(p, (IDLImplementsStatement, + IDLIncludesStatement))] for production in implementsStatements: production.finish(self.globalScope()) + for production in includesStatements: + production.finish(self.globalScope()) for production in otherStatements: production.finish(self.globalScope()) diff --git a/dom/cache/Cache.cpp b/dom/cache/Cache.cpp index 3a15c746f..786e9cd77 100644 --- a/dom/cache/Cache.cpp +++ b/dom/cache/Cache.cpp @@ -329,7 +329,7 @@ Cache::MatchAll(JSContext* aCx, const Optional& aRequest, already_AddRefed Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest, - ErrorResult& aRv) + CallerType aCallerType, ErrorResult& aRv) { if (NS_WARN_IF(!mActor)) { aRv.Throw(NS_ERROR_UNEXPECTED); @@ -359,12 +359,13 @@ Cache::Add(JSContext* aContext, const RequestOrUSVString& aRequest, } requestList.AppendElement(Move(request)); - return AddAll(global, Move(requestList), aRv); + return AddAll(global, Move(requestList), aCallerType, aRv); } already_AddRefed Cache::AddAll(JSContext* aContext, const Sequence& aRequestList, + CallerType aCallerType, ErrorResult& aRv) { if (NS_WARN_IF(!mActor)) { @@ -408,7 +409,7 @@ Cache::AddAll(JSContext* aContext, requestList.AppendElement(Move(request)); } - return AddAll(global, Move(requestList), aRv); + return AddAll(global, Move(requestList), aCallerType, aRv); } already_AddRefed @@ -601,7 +602,8 @@ Cache::ExecuteOp(AutoChildOpArgs& aOpArgs, ErrorResult& aRv) already_AddRefed Cache::AddAll(const GlobalObject& aGlobal, - nsTArray>&& aRequestList, ErrorResult& aRv) + nsTArray>&& aRequestList, + CallerType aCallerType, ErrorResult& aRv) { MOZ_DIAGNOSTIC_ASSERT(mActor); @@ -627,7 +629,7 @@ Cache::AddAll(const GlobalObject& aGlobal, RequestOrUSVString requestOrString; requestOrString.SetAsRequest() = aRequestList[i]; RefPtr fetch = FetchRequest(mGlobal, requestOrString, - RequestInit(), aRv); + RequestInit(), aCallerType, aRv); if (NS_WARN_IF(aRv.Failed())) { return nullptr; } diff --git a/dom/cache/Cache.h b/dom/cache/Cache.h index 8adff9101..4c4dd0bd2 100644 --- a/dom/cache/Cache.h +++ b/dom/cache/Cache.h @@ -29,6 +29,7 @@ class RequestOrUSVString; class Response; template class Optional; template class Sequence; +enum class CallerType : uint32_t; namespace cache { @@ -51,10 +52,11 @@ public: const CacheQueryOptions& aOptions, ErrorResult& aRv); already_AddRefed Add(JSContext* aContext, const RequestOrUSVString& aRequest, - ErrorResult& aRv); + CallerType aCallerType, ErrorResult& aRv); already_AddRefed AddAll(JSContext* aContext, - const Sequence& aRequests, ErrorResult& aRv); + const Sequence& aRequests, + CallerType aCallerType, ErrorResult& aRv); already_AddRefed Put(JSContext* aCx, const RequestOrUSVString& aRequest, Response& aResponse, ErrorResult& aRv); @@ -98,7 +100,7 @@ private: already_AddRefed AddAll(const GlobalObject& aGlobal, nsTArray>&& aRequestList, - ErrorResult& aRv); + CallerType aCallerType, ErrorResult& aRv); already_AddRefed PutAll(JSContext* aCx, const nsTArray>& aRequestList, diff --git a/dom/fetch/Fetch.cpp b/dom/fetch/Fetch.cpp index 74875f19b..213d9563b 100644 --- a/dom/fetch/Fetch.cpp +++ b/dom/fetch/Fetch.cpp @@ -21,6 +21,7 @@ #include "nsStringStream.h" #include "mozilla/ErrorResult.h" +#include "mozilla/dom/BindingDeclarations.h" #include "mozilla/dom/BodyUtil.h" #include "mozilla/dom/DOMError.h" #include "mozilla/dom/Exceptions.h" @@ -317,7 +318,7 @@ public: already_AddRefed FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, - const RequestInit& aInit, ErrorResult& aRv) + const RequestInit& aInit, CallerType aCallerType, ErrorResult& aRv) { RefPtr p = Promise::Create(aGlobal, aRv); if (NS_WARN_IF(aRv.Failed())) { @@ -325,12 +326,10 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, } // Double check that we have chrome privileges if the Request's content - // policy type has been overridden. Note, we must do this before - // entering the global below. Otherwise the IsCallerChrome() will - // always fail. + // policy type has been overridden. MOZ_ASSERT_IF(aInput.IsRequest() && aInput.GetAsRequest().IsContentPolicyTypeOverridden(), - nsContentUtils::IsCallerChrome()); + aCallerType == CallerType::System); AutoJSAPI jsapi; if (!jsapi.Init(aGlobal)) { diff --git a/dom/fetch/Fetch.h b/dom/fetch/Fetch.h index f9ddde2b7..5604e4a84 100644 --- a/dom/fetch/Fetch.h +++ b/dom/fetch/Fetch.h @@ -36,6 +36,7 @@ class InternalRequest; class OwningBlobOrArrayBufferViewOrArrayBufferOrFormDataOrURLSearchParamsOrUSVString; struct ReadableStream; class RequestOrUSVString; +enum class CallerType : uint32_t; namespace workers { class WorkerPrivate; @@ -43,7 +44,8 @@ class WorkerPrivate; already_AddRefed FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput, - const RequestInit& aInit, ErrorResult& aRv); + const RequestInit& aInit, CallerType aCallerType, + ErrorResult& aRv); nsresult UpdateRequestReferrer(nsIGlobalObject* aGlobal, InternalRequest* aRequest); diff --git a/dom/html/HTMLInputElement.cpp b/dom/html/HTMLInputElement.cpp index 6578a049b..73aaa1350 100644 --- a/dom/html/HTMLInputElement.cpp +++ b/dom/html/HTMLInputElement.cpp @@ -3537,7 +3537,7 @@ HTMLInputElement::Blur(ErrorResult& aError) } void -HTMLInputElement::Focus(ErrorResult& aError) +HTMLInputElement::Focus(const FocusOptions& aOptions, ErrorResult& aError) { if (mType == NS_FORM_INPUT_NUMBER) { // Focus our anonymous text control, if we have one. @@ -3547,7 +3547,7 @@ HTMLInputElement::Focus(ErrorResult& aError) RefPtr textControl = numberControlFrame->GetAnonTextControl(); if (textControl) { - textControl->Focus(aError); + textControl->Focus(aOptions, aError); return; } } @@ -3563,7 +3563,7 @@ HTMLInputElement::Focus(ErrorResult& aError) } if (mType != NS_FORM_INPUT_FILE) { - nsGenericHTMLElement::Focus(aError); + nsGenericHTMLElement::Focus(aOptions, aError); return; } diff --git a/dom/html/HTMLInputElement.h b/dom/html/HTMLInputElement.h index e67567b35..c6ef28630 100644 --- a/dom/html/HTMLInputElement.h +++ b/dom/html/HTMLInputElement.h @@ -136,7 +136,8 @@ public: virtual int32_t TabIndexDefault() override; using nsGenericHTMLElement::Focus; virtual void Blur(ErrorResult& aError) override; - virtual void Focus(ErrorResult& aError) override; + virtual void Focus(const FocusOptions& aOptions, + ErrorResult& aError) override; // nsINode #if !defined(ANDROID) && !defined(XP_MACOSX) diff --git a/dom/html/HTMLLabelElement.cpp b/dom/html/HTMLLabelElement.cpp index dad2c43e9..61a001448 100644 --- a/dom/html/HTMLLabelElement.cpp +++ b/dom/html/HTMLLabelElement.cpp @@ -94,14 +94,15 @@ HTMLLabelElement::GetForm() const } void -HTMLLabelElement::Focus(ErrorResult& aError) +HTMLLabelElement::Focus(const FocusOptions& aOptions, + ErrorResult& aError) { // retarget the focus method at the for content nsIFocusManager* fm = nsFocusManager::GetFocusManager(); if (fm) { nsCOMPtr elem = do_QueryObject(GetLabeledElement()); if (elem) - fm->SetFocus(elem, 0); + fm->SetFocus(elem, nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions)); } } diff --git a/dom/html/HTMLLabelElement.h b/dom/html/HTMLLabelElement.h index c8385fc53..b795bbd4f 100644 --- a/dom/html/HTMLLabelElement.h +++ b/dom/html/HTMLLabelElement.h @@ -57,7 +57,8 @@ public: } using nsGenericHTMLElement::Focus; - virtual void Focus(mozilla::ErrorResult& aError) override; + virtual void Focus(const FocusOptions& aOptions, + ErrorResult& aError) override; virtual bool IsDisabled() const override { return false; } diff --git a/dom/html/HTMLLegendElement.cpp b/dom/html/HTMLLegendElement.cpp index 3f329de42..087104d44 100644 --- a/dom/html/HTMLLegendElement.cpp +++ b/dom/html/HTMLLegendElement.cpp @@ -87,7 +87,8 @@ HTMLLegendElement::UnbindFromTree(bool aDeep, bool aNullParent) } void -HTMLLegendElement::Focus(ErrorResult& aError) +HTMLLegendElement::Focus(const FocusOptions& aOptions, + ErrorResult& aError) { nsIFrame* frame = GetPrimaryFrame(); if (!frame) { @@ -96,7 +97,7 @@ HTMLLegendElement::Focus(ErrorResult& aError) int32_t tabIndex; if (frame->IsFocusable(&tabIndex, false)) { - nsGenericHTMLElement::Focus(aError); + nsGenericHTMLElement::Focus(aOptions, aError); return; } @@ -109,7 +110,8 @@ HTMLLegendElement::Focus(ErrorResult& aError) nsCOMPtr result; aError = fm->MoveFocus(nullptr, this, nsIFocusManager::MOVEFOCUS_FORWARD, - nsIFocusManager::FLAG_NOPARENTFRAME, + nsIFocusManager::FLAG_NOPARENTFRAME | + nsFocusManager::FocusOptionsToFocusManagerFlags(aOptions), getter_AddRefs(result)); } @@ -117,9 +119,10 @@ bool HTMLLegendElement::PerformAccesskey(bool aKeyCausesActivation, bool aIsTrustedEvent) { - // just use the same behaviour as the focus method + FocusOptions options; ErrorResult rv; - Focus(rv); + + Focus(options, rv); return NS_SUCCEEDED(rv.StealNSResult()); } diff --git a/dom/html/HTMLLegendElement.h b/dom/html/HTMLLegendElement.h index 0b476c119..d2b208e74 100644 --- a/dom/html/HTMLLegendElement.h +++ b/dom/html/HTMLLegendElement.h @@ -25,7 +25,8 @@ public: NS_IMPL_FROMCONTENT_HTML_WITH_TAG(HTMLLegendElement, legend) using nsGenericHTMLElement::Focus; - virtual void Focus(ErrorResult& aError) override; + virtual void Focus(const FocusOptions& aOptions, + ErrorResult& aError) override; virtual bool PerformAccesskey(bool aKeyCausesActivation, bool aIsTrustedEvent) override; diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 24cd34aa7..97a0d3110 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -150,8 +150,9 @@ public: // If something is focused in the same document, ignore autofocus. if (!fm->GetFocusedContent() || fm->GetFocusedContent()->OwnerDoc() != document) { - mozilla::ErrorResult rv; - mElement->Focus(rv); + FocusOptions options; + ErrorResult rv; + mElement->Focus(options, rv); return rv.StealNSResult(); } diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 6d5029d97..a401596d4 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -432,8 +432,9 @@ public: return rv.StealNSResult(); } NS_IMETHOD Focus() final override { + mozilla::dom::FocusOptions options; mozilla::ErrorResult rv; - Focus(rv); + Focus(options, rv); return rv.StealNSResult(); } NS_IMETHOD GetDraggable(bool* aDraggable) final override { diff --git a/dom/mathml/nsMathMLElement.cpp b/dom/mathml/MathMLElement.cpp similarity index 86% rename from dom/mathml/nsMathMLElement.cpp rename to dom/mathml/MathMLElement.cpp index ab77ffd7a..3fba6303c 100644 --- a/dom/mathml/nsMathMLElement.cpp +++ b/dom/mathml/MathMLElement.cpp @@ -5,10 +5,12 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" + #include "base/compiler_specific.h" #include "mozilla/ArrayUtils.h" #include "nsGkAtoms.h" +#include "nsIContentInlines.h" #include "nsITableCellLayout.h" // for MAX_COLSPAN / MAX_ROWSPAN #include "nsCRT.h" #include "nsLayoutStylesheetCache.h" @@ -27,7 +29,8 @@ #include "mozilla/EventDispatcher.h" #include "mozilla/EventStates.h" -#include "mozilla/dom/ElementBinding.h" +#include "mozilla/EventListenerManager.h" // for EventListenerManager +#include "mozilla/dom/MathMLElementBinding.h" using namespace mozilla; using namespace mozilla::dom; @@ -35,7 +38,7 @@ using namespace mozilla::dom; //---------------------------------------------------------------------- // nsISupports methods: -NS_IMPL_ISUPPORTS_INHERITED(nsMathMLElement, nsMathMLElementBase, +NS_IMPL_ISUPPORTS_INHERITED(MathMLElement, MathMLElementBase, nsIDOMElement, nsIDOMNode, Link) static nsresult @@ -76,28 +79,28 @@ ReportParseErrorNoTag(const nsString& aValue, "AttributeParsingErrorNoTag", argv, 2); } -nsMathMLElement::nsMathMLElement(already_AddRefed& aNodeInfo) -: nsMathMLElementBase(aNodeInfo), +MathMLElement::MathMLElement(already_AddRefed& aNodeInfo) +: MathMLElementBase(aNodeInfo), ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)), mIncrementScriptLevel(false) { } -nsMathMLElement::nsMathMLElement(already_AddRefed&& aNodeInfo) -: nsMathMLElementBase(aNodeInfo), +MathMLElement::MathMLElement(already_AddRefed&& aNodeInfo) +: MathMLElementBase(aNodeInfo), ALLOW_THIS_IN_INITIALIZER_LIST(Link(this)), mIncrementScriptLevel(false) { } nsresult -nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, - nsIContent* aBindingParent, - bool aCompileEventHandlers) +MathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, + nsIContent* aBindingParent, + bool aCompileEventHandlers) { Link::ResetLinkState(false, Link::ElementHasHref()); - nsresult rv = nsMathMLElementBase::BindToTree(aDocument, aParent, + nsresult rv = MathMLElementBase::BindToTree(aDocument, aParent, aBindingParent, aCompileEventHandlers); NS_ENSURE_SUCCESS(rv, rv); @@ -131,7 +134,7 @@ nsMathMLElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, } void -nsMathMLElement::UnbindFromTree(bool aDeep, bool aNullParent) +MathMLElement::UnbindFromTree(bool aDeep, bool aNullParent) { // If this link is ever reinserted into a document, it might // be under a different xml:base, so forget the cached state now. @@ -142,14 +145,14 @@ nsMathMLElement::UnbindFromTree(bool aDeep, bool aNullParent) doc->UnregisterPendingLinkUpdate(this); } - nsMathMLElementBase::UnbindFromTree(aDeep, aNullParent); + MathMLElementBase::UnbindFromTree(aDeep, aNullParent); } bool -nsMathMLElement::ParseAttribute(int32_t aNamespaceID, - nsIAtom* aAttribute, - const nsAString& aValue, - nsAttrValue& aResult) +MathMLElement::ParseAttribute(int32_t aNamespaceID, + nsIAtom* aAttribute, + const nsAString& aValue, + nsAttrValue& aResult) { MOZ_ASSERT(IsMathMLElement()); if (aNamespaceID == kNameSpaceID_None) { @@ -167,6 +170,9 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID, aAttribute == nsGkAtoms::mathbackground_) { return aResult.ParseColor(aValue); } + if (aAttribute == nsGkAtoms::tabindex) { + return aResult.ParseIntValue(aValue); + } if (mNodeInfo->Equals(nsGkAtoms::mtd_)) { if (aAttribute == nsGkAtoms::columnspan_) { aResult.ParseClampedNonNegativeInt(aValue, 1, 1, MAX_COLSPAN); @@ -179,8 +185,8 @@ nsMathMLElement::ParseAttribute(int32_t aNamespaceID, } } - return nsMathMLElementBase::ParseAttribute(aNamespaceID, aAttribute, - aValue, aResult); + return MathMLElementBase::ParseAttribute(aNamespaceID, aAttribute, + aValue, aResult); } static Element::MappedAttributeEntry sMtableStyles[] = { @@ -219,7 +225,7 @@ static Element::MappedAttributeEntry sDirStyles[] = { }; bool -nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const +MathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const { MOZ_ASSERT(IsMathMLElement()); @@ -288,7 +294,7 @@ nsMathMLElement::IsAttributeMapped(const nsIAtom* aAttribute) const } nsMapRuleToAttributesFunc -nsMathMLElement::GetAttributeMappingFunction() const +MathMLElement::GetAttributeMappingFunction() const { // It doesn't really matter what our tag is here, because only attributes // that satisfy IsAttributeMapped will be stored in the mapped attributes @@ -297,9 +303,9 @@ nsMathMLElement::GetAttributeMappingFunction() const } /* static */ bool -nsMathMLElement::ParseNamedSpaceValue(const nsString& aString, - nsCSSValue& aCSSValue, - uint32_t aFlags) +MathMLElement::ParseNamedSpaceValue(const nsString& aString, + nsCSSValue& aCSSValue, + uint32_t aFlags) { int32_t i = 0; // See if it is one of the 'namedspace' (ranging -7/18em, -6/18, ... 7/18em) @@ -379,10 +385,10 @@ nsMathMLElement::ParseNamedSpaceValue(const nsString& aString, // number)" // /* static */ bool -nsMathMLElement::ParseNumericValue(const nsString& aString, - nsCSSValue& aCSSValue, - uint32_t aFlags, - nsIDocument* aDocument) +MathMLElement::ParseNumericValue(const nsString& aString, + nsCSSValue& aCSSValue, + uint32_t aFlags, + nsIDocument* aDocument) { nsAutoString str(aString); str.CompressWhitespace(); // aString is const in this code... @@ -430,6 +436,13 @@ nsMathMLElement::ParseNumericValue(const nsString& aString, number.Append(c); } + if (gotDot && str[i - 1] == '.') { + if (!(aFlags & PARSE_SUPPRESS_WARNINGS)) { + ReportLengthParseError(aString, aDocument); + } + return false; // Number ending with a dot. + } + // Convert number to floating point nsresult errorCode; float floatValue = number.ToFloat(&errorCode); @@ -500,8 +513,8 @@ nsMathMLElement::ParseNumericValue(const nsString& aString, } void -nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, - nsRuleData* aData) +MathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, + nsRuleData* aData) { if (aData->mSIDs & NS_STYLE_INHERIT_BIT(Font)) { // scriptsizemultiplier @@ -919,7 +932,7 @@ nsMathMLElement::MapMathMLAttributesInto(const nsMappedAttributes* aAttributes, } nsresult -nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) +MathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) { nsresult rv = Element::GetEventTargetParent(aVisitor); NS_ENSURE_SUCCESS(rv, rv); @@ -928,30 +941,30 @@ nsMathMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) } nsresult -nsMathMLElement::PostHandleEvent(EventChainPostVisitor& aVisitor) +MathMLElement::PostHandleEvent(EventChainPostVisitor& aVisitor) { return PostHandleEventForLinks(aVisitor); } -NS_IMPL_ELEMENT_CLONE(nsMathMLElement) +NS_IMPL_ELEMENT_CLONE(MathMLElement) EventStates -nsMathMLElement::IntrinsicState() const +MathMLElement::IntrinsicState() const { - return Link::LinkState() | nsMathMLElementBase::IntrinsicState() | + return Link::LinkState() | MathMLElementBase::IntrinsicState() | (mIncrementScriptLevel ? NS_EVENT_STATE_INCREMENT_SCRIPT_LEVEL : EventStates()); } bool -nsMathMLElement::IsNodeOfType(uint32_t aFlags) const +MathMLElement::IsNodeOfType(uint32_t aFlags) const { return !(aFlags & ~eCONTENT); } void -nsMathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel, - bool aNotify) +MathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel, + bool aNotify) { if (aIncrementScriptLevel == mIncrementScriptLevel) return; @@ -962,26 +975,55 @@ nsMathMLElement::SetIncrementScriptLevel(bool aIncrementScriptLevel, UpdateState(true); } -bool -nsMathMLElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) +int32_t +MathMLElement::TabIndexDefault() { nsCOMPtr uri; - if (IsLink(getter_AddRefs(uri))) { + return IsLink(getter_AddRefs(uri)) ? 0 : -1; +} + +// XXX Bug 1586011: Share logic with other element classes. +bool +MathMLElement::IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) +{ + nsIDocument* doc = GetComposedDoc(); + if (!doc || doc->HasFlag(NODE_IS_EDITABLE)) { + // In designMode documents we only allow focusing the document. if (aTabIndex) { - *aTabIndex = ((sTabFocusModel & eTabFocus_linksMask) == 0 ? -1 : 0); + *aTabIndex = -1; } - return true; + return false; } + int32_t tabIndex = TabIndex(); if (aTabIndex) { + *aTabIndex = tabIndex; + } + + nsCOMPtr uri; + if (!IsLink(getter_AddRefs(uri))) { + // If a tabindex is specified at all we're focusable + return HasAttr(kNameSpaceID_None, nsGkAtoms::tabindex); + } + + // Links that are in an editable region should never be focusable, even if + // they are in a contenteditable="false" region. + if (nsContentUtils::IsNodeInEditableRegion(this)) { + if (aTabIndex) { + *aTabIndex = -1; + } + return false; + } + + if (aTabIndex && (sTabFocusModel & eTabFocus_linksMask) == 0) { *aTabIndex = -1; } - return false; + return true; } bool -nsMathMLElement::IsLink(nsIURI** aURI) const +MathMLElement::IsLink(nsIURI** aURI) const { // http://www.w3.org/TR/2010/REC-MathML3-20101021/chapter6.html#interf.link // The REC says that the following elements should not be linking elements: @@ -1052,7 +1094,7 @@ nsMathMLElement::IsLink(nsIURI** aURI) const } void -nsMathMLElement::GetLinkTarget(nsAString& aTarget) +MathMLElement::GetLinkTarget(nsAString& aTarget) { const nsAttrValue* target = mAttrsAndChildren.GetAttr(nsGkAtoms::target, kNameSpaceID_XLink); @@ -1078,14 +1120,59 @@ nsMathMLElement::GetLinkTarget(nsAString& aTarget) } already_AddRefed -nsMathMLElement::GetHrefURI() const +MathMLElement::GetHrefURI() const { nsCOMPtr hrefURI; return IsLink(getter_AddRefs(hrefURI)) ? hrefURI.forget() : nullptr; } +// XXX Bug 1586014: Share logic with other element classes. +void +MathMLElement::RecompileScriptEventListeners() { + int32_t i, count = mAttrsAndChildren.AttrCount(); + for (i = 0; i < count; ++i) { + const nsAttrName* name = mAttrsAndChildren.AttrNameAt(i); + + // Eventlistenener-attributes are always in the null namespace + if (!name->IsAtom()) { + continue; + } + + nsIAtom* attr = name->Atom(); + if (!IsEventAttributeName(attr)) { + continue; + } + + nsAutoString value; + GetAttr(kNameSpaceID_None, attr, value); + SetEventHandler(attr, value, true); + } +} + +bool +MathMLElement::IsEventAttributeNameInternal(nsIAtom* aName) { + // The intent is to align MathML event attributes on HTML5, so the flag + // EventNameType_HTML is used here. + return nsContentUtils::IsEventAttributeName(aName, EventNameType_HTML); +} + nsresult -nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, +MathMLElement::BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName, + const nsAttrValueOrString* aValue, + bool aNotify) { + if (aNamespaceID == kNameSpaceID_None) { + if (!aValue && IsEventAttributeName(aName)) { + if (EventListenerManager* manager = GetExistingListenerManager()) { + manager->RemoveEventHandler(aName, EmptyString()); + } + } + } + + return MathMLElementBase::BeforeSetAttr(aNamespaceID, aName, aValue, aNotify); +} + +nsresult +MathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, const nsAttrValue* aOldValue, nsIPrincipal* aSubjectPrincipal, @@ -1106,13 +1193,22 @@ nsMathMLElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, Link::ResetLinkState(aNotify, aValue || Link::ElementHasHref()); } - return nsMathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue, - aOldValue, aSubjectPrincipal, - aNotify); + if (aNameSpaceID == kNameSpaceID_None) { + if (IsEventAttributeName(aName) && aValue) { + MOZ_ASSERT(aValue->Type() == nsAttrValue::eString, + "Expected string value for script body"); + nsresult rv = SetEventHandler(aName, aValue->GetStringValue()); + NS_ENSURE_SUCCESS(rv, rv); + } + } + + return MathMLElementBase::AfterSetAttr(aNameSpaceID, aName, aValue, + aOldValue, aSubjectPrincipal, + aNotify); } JSObject* -nsMathMLElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) +MathMLElement::WrapNode(JSContext *aCx, JS::Handle aGivenProto) { - return ElementBinding::Wrap(aCx, this, aGivenProto); + return MathMLElementBinding::Wrap(aCx, this, aGivenProto); } diff --git a/dom/mathml/nsMathMLElement.h b/dom/mathml/MathMLElement.h similarity index 77% rename from dom/mathml/nsMathMLElement.h rename to dom/mathml/MathMLElement.h index 7752b2cc8..05b822551 100644 --- a/dom/mathml/nsMathMLElement.h +++ b/dom/mathml/MathMLElement.h @@ -4,8 +4,8 @@ * 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 nsMathMLElement_h -#define nsMathMLElement_h +#ifndef mozilla_dom_MathMLElement_h_ +#define mozilla_dom_MathMLElement_h_ #include "mozilla/Attributes.h" #include "mozilla/dom/Element.h" @@ -16,28 +16,30 @@ class nsCSSValue; -typedef nsMappedAttributeElement nsMathMLElementBase; - namespace mozilla { class EventChainPostVisitor; class EventChainPreVisitor; -} // namespace mozilla +namespace dom { + +typedef nsMappedAttributeElement MathMLElementBase; /* * The base class for MathML elements. */ -class nsMathMLElement final : public nsMathMLElementBase, - public nsIDOMElement, - public mozilla::dom::Link +class MathMLElement final : public MathMLElementBase, + public nsIDOMElement, + public mozilla::dom::Link { public: - explicit nsMathMLElement(already_AddRefed& aNodeInfo); - explicit nsMathMLElement(already_AddRefed&& aNodeInfo); + explicit MathMLElement(already_AddRefed& aNodeInfo); + explicit MathMLElement(already_AddRefed&& aNodeInfo); - // Implementation of nsISupports is inherited from nsMathMLElementBase + // Implementation of nsISupports is inherited from MathMLElementBase NS_DECL_ISUPPORTS_INHERITED - // Forward implementations of parent interfaces of nsMathMLElement to + NS_IMPL_FROMCONTENT(MathMLElement, kNameSpaceID_MathML) + + // Forward implementations of parent interfaces of MathMLElement to // our base class NS_FORWARD_NSIDOMNODE_TO_NSINODE NS_FORWARD_NSIDOMELEMENT_TO_GENERIC @@ -89,6 +91,7 @@ public: return mIncrementScriptLevel; } + int32_t TabIndexDefault() final; virtual bool IsFocusableInternal(int32_t* aTabIndex, bool aWithMouse) override; virtual bool IsLink(nsIURI** aURI) const override; virtual void GetLinkTarget(nsAString& aTarget) override; @@ -96,11 +99,16 @@ public: virtual nsIDOMNode* AsDOMNode() override { return this; } + void RecompileScriptEventListeners() override; + bool IsEventAttributeNameInternal(nsIAtom* aName); + protected: - virtual ~nsMathMLElement() {} + virtual ~MathMLElement() {} virtual JSObject* WrapNode(JSContext *aCx, JS::Handle aGivenProto) override; + nsresult BeforeSetAttr(int32_t aNamespaceID, nsIAtom* aName, + const nsAttrValueOrString* aValue, bool aNotify) override; virtual nsresult AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, const nsAttrValue* aOldValue, @@ -111,4 +119,7 @@ private: bool mIncrementScriptLevel; }; -#endif // nsMathMLElement_h +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_MathMLElement_h_ diff --git a/dom/mathml/nsMathMLElementFactory.cpp b/dom/mathml/MathMLElementFactory.cpp similarity index 86% rename from dom/mathml/nsMathMLElementFactory.cpp rename to dom/mathml/MathMLElementFactory.cpp index 9f45afec8..e3fb705ed 100644 --- a/dom/mathml/nsMathMLElementFactory.cpp +++ b/dom/mathml/MathMLElementFactory.cpp @@ -6,7 +6,7 @@ #include "nsContentCreatorFunctions.h" #include "nsGkAtoms.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" using namespace mozilla::dom; @@ -14,6 +14,6 @@ using namespace mozilla::dom; nsresult NS_NewMathMLElement(Element** aResult, already_AddRefed&& aNodeInfo) { - NS_ADDREF(*aResult = new nsMathMLElement(aNodeInfo)); + NS_ADDREF(*aResult = new MathMLElement(aNodeInfo)); return NS_OK; } diff --git a/dom/mathml/moz.build b/dom/mathml/moz.build index 307c1603e..be5a645ac 100644 --- a/dom/mathml/moz.build +++ b/dom/mathml/moz.build @@ -4,9 +4,13 @@ # 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/. +EXPORTS.mozilla.dom += [ + 'MathMLElement.h', +] + UNIFIED_SOURCES += [ - 'nsMathMLElement.cpp', - 'nsMathMLElementFactory.cpp', + 'MathMLElement.cpp', + 'MathMLElementFactory.cpp', ] include('/ipc/chromium/chromium-config.mozbuild') diff --git a/dom/webidl/AbstractWorker.webidl b/dom/webidl/AbstractWorker.webidl index 7ea6e367b..28f5dce58 100644 --- a/dom/webidl/AbstractWorker.webidl +++ b/dom/webidl/AbstractWorker.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[NoInterfaceObject, Exposed=(Window,Worker,System)] -interface AbstractWorker { +[Exposed=(Window,Worker)] +interface mixin AbstractWorker { attribute EventHandler onerror; }; diff --git a/dom/webidl/AnalyserNode.webidl b/dom/webidl/AnalyserNode.webidl index b185c972a..141a837e6 100644 --- a/dom/webidl/AnalyserNode.webidl +++ b/dom/webidl/AnalyserNode.webidl @@ -45,4 +45,4 @@ interface AnalyserNode : AudioNode { }; // Mozilla extension -AnalyserNode implements AudioNodePassThrough; +AnalyserNode includes AudioNodePassThrough; diff --git a/dom/webidl/Animatable.webidl b/dom/webidl/Animatable.webidl index decc13960..d1f1a7161 100644 --- a/dom/webidl/Animatable.webidl +++ b/dom/webidl/Animatable.webidl @@ -18,8 +18,7 @@ dictionary AnimationFilter { boolean subtree = false; }; -[NoInterfaceObject] -interface Animatable { +interface mixin Animatable { [Func="nsDocument::IsElementAnimateEnabled", Throws] Animation animate(object? keyframes, optional UnrestrictedDoubleOrKeyframeAnimationOptions options); diff --git a/dom/webidl/AudioBufferSourceNode.webidl b/dom/webidl/AudioBufferSourceNode.webidl index 455b269cf..3ea5d4b04 100644 --- a/dom/webidl/AudioBufferSourceNode.webidl +++ b/dom/webidl/AudioBufferSourceNode.webidl @@ -38,4 +38,4 @@ interface AudioBufferSourceNode : AudioScheduledSourceNode { }; // Mozilla extensions -AudioBufferSourceNode implements AudioNodePassThrough; +AudioBufferSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/AudioNode.webidl b/dom/webidl/AudioNode.webidl index f8d22feaf..5189f66e7 100644 --- a/dom/webidl/AudioNode.webidl +++ b/dom/webidl/AudioNode.webidl @@ -67,8 +67,7 @@ partial interface AudioNode { [ChromeOnly] readonly attribute unsigned long id; }; -[NoInterfaceObject] -interface AudioNodePassThrough { +interface mixin AudioNodePassThrough { [ChromeOnly] attribute boolean passThrough; }; diff --git a/dom/webidl/BiquadFilterNode.webidl b/dom/webidl/BiquadFilterNode.webidl index c9ac0f0b9..3e84018d3 100644 --- a/dom/webidl/BiquadFilterNode.webidl +++ b/dom/webidl/BiquadFilterNode.webidl @@ -46,5 +46,5 @@ interface BiquadFilterNode : AudioNode { }; // Mozilla extension -BiquadFilterNode implements AudioNodePassThrough; +BiquadFilterNode includes AudioNodePassThrough; diff --git a/dom/webidl/Blob.webidl b/dom/webidl/Blob.webidl index 4df66630d..fbe74eab8 100644 --- a/dom/webidl/Blob.webidl +++ b/dom/webidl/Blob.webidl @@ -27,8 +27,8 @@ interface Blob { //slice Blob into byte-ranged chunks [Throws] - Blob slice([Clamp] optional long long start, - [Clamp] optional long long end, + Blob slice(optional [Clamp] long long start, + optional [Clamp] long long end, optional DOMString contentType = ""); // void close(); TODO bug 1048325 diff --git a/dom/webidl/BrowserElement.webidl b/dom/webidl/BrowserElement.webidl index 97e82f6af..6341e4bb2 100644 --- a/dom/webidl/BrowserElement.webidl +++ b/dom/webidl/BrowserElement.webidl @@ -19,15 +19,7 @@ dictionary BrowserElementExecuteScriptOptions { DOMString? origin; }; -[NoInterfaceObject] -interface BrowserElement { -}; - -BrowserElement implements BrowserElementCommon; -BrowserElement implements BrowserElementPrivileged; - -[NoInterfaceObject] -interface BrowserElementCommon { +interface mixin BrowserElementCommon { [Throws, Pref="dom.mozBrowserFramesEnabled", ChromeOnly] @@ -60,7 +52,7 @@ interface BrowserElementCommon { }; [NoInterfaceObject] -interface BrowserElementPrivileged { +interface BrowserElement { [Throws, Pref="dom.mozBrowserFramesEnabled", ChromeOnly] @@ -171,3 +163,6 @@ interface BrowserElementPrivileged { DOMRequest getWebManifest(); }; + +BrowserElement includes BrowserElementCommon; + diff --git a/dom/webidl/BrowserElementAudioChannel.webidl b/dom/webidl/BrowserElementAudioChannel.webidl index 55dbe3fb4..e0b006b57 100644 --- a/dom/webidl/BrowserElementAudioChannel.webidl +++ b/dom/webidl/BrowserElementAudioChannel.webidl @@ -29,7 +29,7 @@ interface BrowserElementAudioChannel : EventTarget { DOMRequest isActive(); }; -partial interface BrowserElementPrivileged { +interface mixin BrowserElementPrivileged { [Pure, Cached, Throws, Pref="dom.mozBrowserFramesEnabled", ChromeOnly] diff --git a/dom/webidl/CSSPseudoElement.webidl b/dom/webidl/CSSPseudoElement.webidl index 250bef03c..f2fe804fc 100644 --- a/dom/webidl/CSSPseudoElement.webidl +++ b/dom/webidl/CSSPseudoElement.webidl @@ -22,4 +22,4 @@ interface CSSPseudoElement { }; // https://w3c.github.io/web-animations/#extensions-to-the-pseudoelement-interface -CSSPseudoElement implements Animatable; +CSSPseudoElement includes Animatable; diff --git a/dom/webidl/CSSStyleDeclaration.webidl b/dom/webidl/CSSStyleDeclaration.webidl index b672c0dd3..16ac6b1b8 100644 --- a/dom/webidl/CSSStyleDeclaration.webidl +++ b/dom/webidl/CSSStyleDeclaration.webidl @@ -21,7 +21,7 @@ interface CSSStyleDeclaration { CSSValue? getPropertyCSSValue(DOMString property); DOMString getPropertyPriority(DOMString property); [CEReactions, Throws] - void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, [TreatNullAs=EmptyString] optional DOMString priority = ""); + void setProperty(DOMString property, [TreatNullAs=EmptyString] DOMString value, optional [TreatNullAs=EmptyString] DOMString priority = ""); [CEReactions, Throws] DOMString removeProperty(DOMString property); diff --git a/dom/webidl/Cache.webidl b/dom/webidl/Cache.webidl index b2c698bb0..ed2cb8873 100644 --- a/dom/webidl/Cache.webidl +++ b/dom/webidl/Cache.webidl @@ -17,9 +17,9 @@ interface Cache { Promise match(RequestInfo request, optional CacheQueryOptions options); [NewObject] Promise> matchAll(optional RequestInfo request, optional CacheQueryOptions options); - [NewObject] + [NewObject, NeedsCallerType] Promise add(RequestInfo request); - [NewObject] + [NewObject, NeedsCallerType] Promise addAll(sequence requests); [NewObject] Promise put(RequestInfo request, Response response); diff --git a/dom/webidl/CanvasRenderingContext2D.webidl b/dom/webidl/CanvasRenderingContext2D.webidl index 723b83f65..b856dc693 100644 --- a/dom/webidl/CanvasRenderingContext2D.webidl +++ b/dom/webidl/CanvasRenderingContext2D.webidl @@ -139,9 +139,9 @@ CanvasRenderingContext2D implements CanvasUserInterface; CanvasRenderingContext2D implements CanvasText; CanvasRenderingContext2D implements CanvasDrawImage; CanvasRenderingContext2D implements CanvasImageData; -CanvasRenderingContext2D implements CanvasPathDrawingStyles; +CanvasRenderingContext2D includes CanvasPathDrawingStyles; CanvasRenderingContext2D implements CanvasTextDrawingStyles; -CanvasRenderingContext2D implements CanvasPathMethods; +CanvasRenderingContext2D includes CanvasPathMethods; CanvasRenderingContext2D implements CanvasHitRegions; @@ -169,7 +169,7 @@ interface CanvasTransform { DOMMatrix getTransform(); [Throws, LenientFloat] void setTransform(double a, double b, double c, double d, double e, double f); - [Throws, LenientFloat] + [Throws] void setTransform(optional DOMMatrix2DInit transform); [Throws] void resetTransform(); @@ -291,8 +291,7 @@ interface CanvasImageData { void putImageData(ImageData imagedata, double dx, double dy, double dirtyX, double dirtyY, double dirtyWidth, double dirtyHeight); }; -[NoInterfaceObject] -interface CanvasPathDrawingStyles { +interface mixin CanvasPathDrawingStyles { // line caps/joins [LenientFloat] attribute double lineWidth; // (default 1) @@ -317,8 +316,7 @@ interface CanvasTextDrawingStyles { attribute DOMString textBaseline; // "top", "hanging", "middle", "alphabetic", "ideographic", "bottom" (default: "alphabetic") }; -[NoInterfaceObject] -interface CanvasPathMethods { +interface mixin CanvasPathMethods { // shared path API methods void closePath(); [LenientFloat] @@ -402,4 +400,4 @@ interface Path2D { [Throws] void addPath(Path2D path, optional DOMMatrix2DInit transformation); }; -Path2D implements CanvasPathMethods; +Path2D includes CanvasPathMethods; diff --git a/dom/webidl/CharacterData.webidl b/dom/webidl/CharacterData.webidl index 8d6a214e5..d5e7e38f5 100644 --- a/dom/webidl/CharacterData.webidl +++ b/dom/webidl/CharacterData.webidl @@ -11,8 +11,8 @@ */ interface CharacterData : Node { - [TreatNullAs=EmptyString, Pure, SetterThrows] - attribute DOMString data; + [Pure, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString data; [Pure] readonly attribute unsigned long length; [Throws] @@ -27,5 +27,5 @@ interface CharacterData : Node { void replaceData(unsigned long offset, unsigned long count, DOMString data); }; -CharacterData implements ChildNode; -CharacterData implements NonDocumentTypeChildNode; +CharacterData includes ChildNode; +CharacterData includes NonDocumentTypeChildNode; diff --git a/dom/webidl/ChildNode.webidl b/dom/webidl/ChildNode.webidl index ae36cd93e..3b1254638 100644 --- a/dom/webidl/ChildNode.webidl +++ b/dom/webidl/ChildNode.webidl @@ -7,8 +7,7 @@ * http://dom.spec.whatwg.org/#interface-childnode */ -[NoInterfaceObject] -interface ChildNode { +interface mixin ChildNode { [CEReactions, Throws, Unscopable] void before((Node or DOMString)... nodes); [CEReactions, Throws, Unscopable] @@ -19,8 +18,7 @@ interface ChildNode { void remove(); }; -[NoInterfaceObject] -interface NonDocumentTypeChildNode { +interface mixin NonDocumentTypeChildNode { [Pure] readonly attribute Element? previousElementSibling; [Pure] diff --git a/dom/webidl/ConvolverNode.webidl b/dom/webidl/ConvolverNode.webidl index 0e0e1137c..5bc8d1029 100644 --- a/dom/webidl/ConvolverNode.webidl +++ b/dom/webidl/ConvolverNode.webidl @@ -26,5 +26,5 @@ interface ConvolverNode : AudioNode { }; // Mozilla extension -ConvolverNode implements AudioNodePassThrough; +ConvolverNode includes AudioNodePassThrough; diff --git a/dom/webidl/Crypto.webidl b/dom/webidl/Crypto.webidl index 2ef7b5d21..b0e3602f1 100644 --- a/dom/webidl/Crypto.webidl +++ b/dom/webidl/Crypto.webidl @@ -7,8 +7,8 @@ * https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html#crypto-interface */ -[NoInterfaceObject, Exposed=(Window,Worker)] -interface GlobalCrypto { +[Exposed=(Window,Worker)] +interface mixin GlobalCrypto { [Throws] readonly attribute Crypto crypto; }; diff --git a/dom/webidl/DOMCursor.webidl b/dom/webidl/DOMCursor.webidl index f5d0447ea..4b7b44321 100644 --- a/dom/webidl/DOMCursor.webidl +++ b/dom/webidl/DOMCursor.webidl @@ -10,4 +10,4 @@ interface DOMCursor : EventTarget { void continue(); }; -DOMCursor implements DOMRequestShared; +DOMCursor includes DOMRequestShared; diff --git a/dom/webidl/DOMException.webidl b/dom/webidl/DOMException.webidl index e91e20cca..48886edec 100644 --- a/dom/webidl/DOMException.webidl +++ b/dom/webidl/DOMException.webidl @@ -15,9 +15,7 @@ interface StackFrame; -[NoInterfaceObject, - Exposed=(Window,Worker)] -interface ExceptionMembers +interface mixin ExceptionMembers { // A custom message set by the thrower. LenientThis so it can be // gotten on the prototype, which Error.prototype.toString will do @@ -68,7 +66,7 @@ interface Exception { stringifier; }; -Exception implements ExceptionMembers; +Exception includes ExceptionMembers; // XXXkhuey this is an 'exception', not an interface, but we don't have any // parser or codegen mechanisms for dealing with exceptions. @@ -107,4 +105,4 @@ interface DOMException { // XXXkhuey copy all of Gecko's non-standard stuff onto DOMException, but leave // the prototype chain sane. -DOMException implements ExceptionMembers; +DOMException includes ExceptionMembers; diff --git a/dom/webidl/DOMRequest.webidl b/dom/webidl/DOMRequest.webidl index 60dc022a4..1e0d2b782 100644 --- a/dom/webidl/DOMRequest.webidl +++ b/dom/webidl/DOMRequest.webidl @@ -5,8 +5,8 @@ enum DOMRequestReadyState { "pending", "done" }; -[Exposed=(Window,Worker,System), NoInterfaceObject] -interface DOMRequestShared { +[Exposed=(Window,Worker)] +interface mixin DOMRequestShared { readonly attribute DOMRequestReadyState readyState; readonly attribute any result; @@ -26,4 +26,4 @@ interface DOMRequest : EventTarget { [TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null); }; -DOMRequest implements DOMRequestShared; +DOMRequest includes DOMRequestShared; diff --git a/dom/webidl/DelayNode.webidl b/dom/webidl/DelayNode.webidl index 02575bc58..05408801f 100644 --- a/dom/webidl/DelayNode.webidl +++ b/dom/webidl/DelayNode.webidl @@ -24,5 +24,5 @@ interface DelayNode : AudioNode { }; // Mozilla extension -DelayNode implements AudioNodePassThrough; +DelayNode includes AudioNodePassThrough; diff --git a/dom/webidl/Document.webidl b/dom/webidl/Document.webidl index 94403fd75..7d7645e7b 100644 --- a/dom/webidl/Document.webidl +++ b/dom/webidl/Document.webidl @@ -451,12 +451,12 @@ partial interface Document { readonly attribute FlashClassification documentFlashClassification; }; -Document implements XPathEvaluator; -Document implements GlobalEventHandlers; -Document implements DocumentAndElementEventHandlers; -Document implements TouchEventHandlers; -Document implements ParentNode; -Document implements OnErrorEventHandlerForNodes; -Document implements GeometryUtils; -Document implements FontFaceSource; -Document implements DocumentOrShadowRoot; +Document includes XPathEvaluatorMixin; +Document includes GlobalEventHandlers; +Document includes DocumentAndElementEventHandlers; +Document includes TouchEventHandlers; +Document includes ParentNode; +Document includes OnErrorEventHandlerForNodes; +Document includes GeometryUtils; +Document includes FontFaceSource; +Document includes DocumentOrShadowRoot; diff --git a/dom/webidl/DocumentFragment.webidl b/dom/webidl/DocumentFragment.webidl index 0f814666f..68a69c514 100644 --- a/dom/webidl/DocumentFragment.webidl +++ b/dom/webidl/DocumentFragment.webidl @@ -24,4 +24,4 @@ partial interface DocumentFragment { NodeList querySelectorAll(DOMString selectors); }; -DocumentFragment implements ParentNode; +DocumentFragment includes ParentNode; diff --git a/dom/webidl/DocumentOrShadowRoot.webidl b/dom/webidl/DocumentOrShadowRoot.webidl index f42f005c8..33a758c1d 100644 --- a/dom/webidl/DocumentOrShadowRoot.webidl +++ b/dom/webidl/DocumentOrShadowRoot.webidl @@ -8,8 +8,7 @@ * http://w3c.github.io/webcomponents/spec/shadow/#extensions-to-the-documentorshadowroot-mixin */ -[NoInterfaceObject] -interface DocumentOrShadowRoot { +interface mixin DocumentOrShadowRoot { // Not implemented yet: bug 1430308. // Selection? getSelection(); Element? elementFromPoint (float x, float y); diff --git a/dom/webidl/DocumentType.webidl b/dom/webidl/DocumentType.webidl index 89190266f..b19b319c2 100644 --- a/dom/webidl/DocumentType.webidl +++ b/dom/webidl/DocumentType.webidl @@ -16,4 +16,4 @@ interface DocumentType : Node { readonly attribute DOMString systemId; }; -DocumentType implements ChildNode; +DocumentType includes ChildNode; diff --git a/dom/webidl/DynamicsCompressorNode.webidl b/dom/webidl/DynamicsCompressorNode.webidl index 78170756a..798c414d0 100644 --- a/dom/webidl/DynamicsCompressorNode.webidl +++ b/dom/webidl/DynamicsCompressorNode.webidl @@ -32,5 +32,5 @@ interface DynamicsCompressorNode : AudioNode { }; // Mozilla extension -DynamicsCompressorNode implements AudioNodePassThrough; +DynamicsCompressorNode includes AudioNodePassThrough; diff --git a/dom/webidl/Element.webidl b/dom/webidl/Element.webidl index b92eb63d0..60d05d4ac 100644 --- a/dom/webidl/Element.webidl +++ b/dom/webidl/Element.webidl @@ -169,6 +169,29 @@ interface Element : Node { sequence getGridFragments(); }; +// https://drafts.csswg.org/cssom/#the-elementcssinlinestyle-mixin +interface mixin ElementCSSInlineStyle { + [SameObject, PutForwards=cssText] + readonly attribute CSSStyleDeclaration style; +}; + +// https://html.spec.whatwg.org/#focus-management-apis +dictionary FocusOptions { + boolean preventScroll = false; +}; + +interface mixin HTMLOrForeignElement { + [SameObject] readonly attribute DOMStringMap dataset; + // See bug 1389421 + // attribute DOMString nonce; // intentionally no [CEReactions] + + // See bug 1575154 + // [CEReactions] attribute boolean autofocus; + [CEReactions, SetterThrows, Pure] attribute long tabIndex; + [Throws] void focus(optional FocusOptions options); + [Throws] void blur(); +}; + // http://dev.w3.org/csswg/cssom-view/ enum ScrollLogicalPosition { "start", "center", "end", "nearest" }; dictionary ScrollIntoViewOptions : ScrollOptions { @@ -218,10 +241,10 @@ partial interface Element { // http://domparsing.spec.whatwg.org/#extensions-to-the-element-interface partial interface Element { - [CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString] - attribute DOMString innerHTML; - [CEReactions, Pure,SetterThrows,TreatNullAs=EmptyString] - attribute DOMString outerHTML; + [CEReactions, Pure, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString innerHTML; + [CEReactions, Pure, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString outerHTML; [CEReactions, Throws] void insertAdjacentHTML(DOMString position, DOMString text); }; @@ -252,11 +275,11 @@ partial interface Element { attribute DOMString slot; }; -Element implements ChildNode; -Element implements NonDocumentTypeChildNode; -Element implements ParentNode; -Element implements Animatable; -Element implements GeometryUtils; +Element includes ChildNode; +Element includes NonDocumentTypeChildNode; +Element includes ParentNode; +Element includes Animatable; +Element includes GeometryUtils; // https://fullscreen.spec.whatwg.org/#api partial interface Element { diff --git a/dom/webidl/EventHandler.webidl b/dom/webidl/EventHandler.webidl index 88ad6dcb3..567d8c37a 100644 --- a/dom/webidl/EventHandler.webidl +++ b/dom/webidl/EventHandler.webidl @@ -24,8 +24,7 @@ typedef OnBeforeUnloadEventHandlerNonNull? OnBeforeUnloadEventHandler; callback OnErrorEventHandlerNonNull = boolean ((Event or DOMString) event, optional DOMString source, optional unsigned long lineno, optional unsigned long column, optional any error); typedef OnErrorEventHandlerNonNull? OnErrorEventHandler; -[NoInterfaceObject] -interface GlobalEventHandlers { +interface mixin GlobalEventHandlers { attribute EventHandler onabort; attribute EventHandler onblur; // We think the spec is wrong here. See OnErrorEventHandlerForNodes/Window @@ -146,8 +145,7 @@ interface GlobalEventHandlers { attribute EventHandler onwebkittransitionend; }; -[NoInterfaceObject] -interface WindowEventHandlers { +interface mixin WindowEventHandlers { attribute EventHandler onafterprint; attribute EventHandler onbeforeprint; attribute OnBeforeUnloadEventHandler onbeforeunload; @@ -165,11 +163,10 @@ interface WindowEventHandlers { attribute EventHandler onunload; }; -[NoInterfaceObject] -interface DocumentAndElementEventHandlers { - attribute EventHandler oncopy; - attribute EventHandler oncut; - attribute EventHandler onpaste; +interface mixin DocumentAndElementEventHandlers { + attribute EventHandler oncopy; + attribute EventHandler oncut; + attribute EventHandler onpaste; }; // The spec has |attribute OnErrorEventHandler onerror;| on @@ -177,12 +174,10 @@ interface DocumentAndElementEventHandlers { // whether an ErrorEvent was fired. We don't do that, and until we do we'll // need to distinguish between onerror on Window or on nodes. -[NoInterfaceObject] -interface OnErrorEventHandlerForNodes { +interface mixin OnErrorEventHandlerForNodes { attribute EventHandler onerror; }; -[NoInterfaceObject] -interface OnErrorEventHandlerForWindow { +interface mixin OnErrorEventHandlerForWindow { attribute OnErrorEventHandler onerror; }; diff --git a/dom/webidl/Fetch.webidl b/dom/webidl/Fetch.webidl index bbb1faf7f..927ddf905 100644 --- a/dom/webidl/Fetch.webidl +++ b/dom/webidl/Fetch.webidl @@ -10,8 +10,7 @@ typedef object JSON; typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; -[NoInterfaceObject, Exposed=(Window,Worker)] -interface Body { +interface mixin Body { readonly attribute boolean bodyUsed; [Throws] Promise arrayBuffer(); diff --git a/dom/webidl/FontFaceSource.webidl b/dom/webidl/FontFaceSource.webidl index 96e1c6d76..0c5c29904 100644 --- a/dom/webidl/FontFaceSource.webidl +++ b/dom/webidl/FontFaceSource.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface FontFaceSource { +interface mixin FontFaceSource { [Pref="layout.css.font-loading-api.enabled"] readonly attribute FontFaceSet fonts; diff --git a/dom/webidl/GainNode.webidl b/dom/webidl/GainNode.webidl index 04bba87cb..029a7d266 100644 --- a/dom/webidl/GainNode.webidl +++ b/dom/webidl/GainNode.webidl @@ -23,5 +23,5 @@ interface GainNode : AudioNode { }; // Mozilla extension -GainNode implements AudioNodePassThrough; +GainNode includes AudioNodePassThrough; diff --git a/dom/webidl/GeometryUtils.webidl b/dom/webidl/GeometryUtils.webidl index 7a468baa1..4ef9fdbbb 100644 --- a/dom/webidl/GeometryUtils.webidl +++ b/dom/webidl/GeometryUtils.webidl @@ -21,8 +21,7 @@ dictionary ConvertCoordinateOptions { CSSBoxType toBox = "border"; }; -[NoInterfaceObject] -interface GeometryUtils { +interface mixin GeometryUtils { [Throws, Func="nsINode::HasBoxQuadsSupport"] sequence getBoxQuads(optional BoxQuadOptions options); [Throws, Pref="layout.css.convertFromNode.enabled"] @@ -33,6 +32,6 @@ interface GeometryUtils { DOMPoint convertPointFromNode(DOMPointInit point, GeometryNode from, optional ConvertCoordinateOptions options); }; -// PseudoElement implements GeometryUtils; +// PseudoElement includes GeometryUtils; typedef (Text or Element /* or PseudoElement */ or Document) GeometryNode; diff --git a/dom/webidl/HTMLAnchorElement.webidl b/dom/webidl/HTMLAnchorElement.webidl index 0326dff6a..ffc5a5ab7 100644 --- a/dom/webidl/HTMLAnchorElement.webidl +++ b/dom/webidl/HTMLAnchorElement.webidl @@ -35,7 +35,7 @@ interface HTMLAnchorElement : HTMLElement { attribute DOMString text; }; -HTMLAnchorElement implements HTMLHyperlinkElementUtils; +HTMLAnchorElement includes HTMLHyperlinkElementUtils; // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis partial interface HTMLAnchorElement { diff --git a/dom/webidl/HTMLAppletElement.webidl b/dom/webidl/HTMLAppletElement.webidl index d75c42d15..6478e2ba8 100644 --- a/dom/webidl/HTMLAppletElement.webidl +++ b/dom/webidl/HTMLAppletElement.webidl @@ -38,6 +38,6 @@ interface HTMLAppletElement : HTMLElement { attribute DOMString width; }; -HTMLAppletElement implements MozImageLoadingContent; -HTMLAppletElement implements MozFrameLoaderOwner; -HTMLAppletElement implements MozObjectLoadingContent; +HTMLAppletElement includes MozImageLoadingContent; +HTMLAppletElement includes MozFrameLoaderOwner; +HTMLAppletElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLAreaElement.webidl b/dom/webidl/HTMLAreaElement.webidl index 0980d178a..37524b7f8 100644 --- a/dom/webidl/HTMLAreaElement.webidl +++ b/dom/webidl/HTMLAreaElement.webidl @@ -35,7 +35,7 @@ interface HTMLAreaElement : HTMLElement { readonly attribute DOMTokenList relList; }; -HTMLAreaElement implements HTMLHyperlinkElementUtils; +HTMLAreaElement includes HTMLHyperlinkElementUtils; // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis partial interface HTMLAreaElement { diff --git a/dom/webidl/HTMLBodyElement.webidl b/dom/webidl/HTMLBodyElement.webidl index f89c287d7..f7f426e88 100644 --- a/dom/webidl/HTMLBodyElement.webidl +++ b/dom/webidl/HTMLBodyElement.webidl @@ -16,18 +16,18 @@ interface HTMLBodyElement : HTMLElement { }; partial interface HTMLBodyElement { - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString text; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString link; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString vLink; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString aLink; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString bgColor; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString text; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString link; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString vLink; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString aLink; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString bgColor; [CEReactions, SetterThrows] attribute DOMString background; }; -HTMLBodyElement implements WindowEventHandlers; +HTMLBodyElement includes WindowEventHandlers; diff --git a/dom/webidl/HTMLDocument.webidl b/dom/webidl/HTMLDocument.webidl index dc869f311..453dfdf4a 100644 --- a/dom/webidl/HTMLDocument.webidl +++ b/dom/webidl/HTMLDocument.webidl @@ -58,11 +58,11 @@ interface HTMLDocument : Document { [Throws] DOMString queryCommandValue(DOMString commandId); - [CEReactions, TreatNullAs=EmptyString] attribute DOMString fgColor; - [CEReactions, TreatNullAs=EmptyString] attribute DOMString linkColor; - [CEReactions, TreatNullAs=EmptyString] attribute DOMString vlinkColor; - [CEReactions, TreatNullAs=EmptyString] attribute DOMString alinkColor; - [CEReactions, TreatNullAs=EmptyString] attribute DOMString bgColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString fgColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString linkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString vlinkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString alinkColor; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString bgColor; [Pure] readonly attribute HTMLCollection anchors; diff --git a/dom/webidl/HTMLElement.webidl b/dom/webidl/HTMLElement.webidl index 26f4dc0e2..168bebc19 100644 --- a/dom/webidl/HTMLElement.webidl +++ b/dom/webidl/HTMLElement.webidl @@ -22,23 +22,15 @@ interface HTMLElement : Element { // attribute boolean translate; [CEReactions, SetterThrows, Pure] attribute DOMString dir; - [Constant] - readonly attribute DOMStringMap dataset; - [CEReactions, GetterThrows, Pure, TreatNullAs=EmptyString] - attribute DOMString innerText; + [CEReactions, GetterThrows, Pure] + attribute [TreatNullAs=EmptyString] DOMString innerText; // user interaction [CEReactions, SetterThrows, Pure] attribute boolean hidden; [NeedsCallerType] void click(); - [CEReactions, SetterThrows, Pure] - attribute long tabIndex; - [Throws] - void focus(); - [Throws] - void blur(); [CEReactions, SetterThrows, Pure] attribute DOMString accessKey; [Pure] @@ -62,10 +54,6 @@ interface HTMLElement : Element { //readonly attribute boolean? commandHidden; //readonly attribute boolean? commandDisabled; //readonly attribute boolean? commandChecked; - - // styling - [PutForwards=cssText, Constant] - readonly attribute CSSStyleDeclaration style; }; // http://dev.w3.org/csswg/cssom-view/#extensions-to-the-htmlelement-interface @@ -85,8 +73,7 @@ partial interface HTMLElement { attribute boolean scrollgrab; }; -[NoInterfaceObject] -interface TouchEventHandlers { +interface mixin TouchEventHandlers { [Func="nsGenericHTMLElement::TouchEventsEnabled"] attribute EventHandler ontouchstart; [Func="nsGenericHTMLElement::TouchEventsEnabled"] @@ -97,9 +84,11 @@ interface TouchEventHandlers { attribute EventHandler ontouchcancel; }; -HTMLElement implements GlobalEventHandlers; -HTMLElement implements DocumentAndElementEventHandlers; -HTMLElement implements TouchEventHandlers; -HTMLElement implements OnErrorEventHandlerForNodes; +HTMLElement includes GlobalEventHandlers; +HTMLElement includes HTMLOrForeignElement; +HTMLElement includes DocumentAndElementEventHandlers; +HTMLElement includes ElementCSSInlineStyle; +HTMLElement includes TouchEventHandlers; +HTMLElement includes OnErrorEventHandlerForNodes; interface HTMLUnknownElement : HTMLElement {}; diff --git a/dom/webidl/HTMLEmbedElement.webidl b/dom/webidl/HTMLEmbedElement.webidl index bb6b5c0ea..f55ff35e8 100644 --- a/dom/webidl/HTMLEmbedElement.webidl +++ b/dom/webidl/HTMLEmbedElement.webidl @@ -39,6 +39,6 @@ partial interface HTMLEmbedElement { Document? getSVGDocument(); }; -HTMLEmbedElement implements MozImageLoadingContent; -HTMLEmbedElement implements MozFrameLoaderOwner; -HTMLEmbedElement implements MozObjectLoadingContent; +HTMLEmbedElement includes MozImageLoadingContent; +HTMLEmbedElement includes MozFrameLoaderOwner; +HTMLEmbedElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLFontElement.webidl b/dom/webidl/HTMLFontElement.webidl index 8db6d3246..0887f4b2d 100644 --- a/dom/webidl/HTMLFontElement.webidl +++ b/dom/webidl/HTMLFontElement.webidl @@ -13,7 +13,7 @@ [HTMLConstructor] interface HTMLFontElement : HTMLElement { - [CEReactions, TreatNullAs=EmptyString, SetterThrows] attribute DOMString color; + [CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString color; [CEReactions, SetterThrows] attribute DOMString face; [CEReactions, SetterThrows] attribute DOMString size; }; diff --git a/dom/webidl/HTMLFrameElement.webidl b/dom/webidl/HTMLFrameElement.webidl index 40c302a99..9120fbead 100644 --- a/dom/webidl/HTMLFrameElement.webidl +++ b/dom/webidl/HTMLFrameElement.webidl @@ -29,10 +29,10 @@ interface HTMLFrameElement : HTMLElement { readonly attribute Document? contentDocument; readonly attribute WindowProxy? contentWindow; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString marginHeight; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString marginWidth; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString marginHeight; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString marginWidth; }; -HTMLFrameElement implements MozFrameLoaderOwner; +HTMLFrameElement includes MozFrameLoaderOwner; diff --git a/dom/webidl/HTMLFrameSetElement.webidl b/dom/webidl/HTMLFrameSetElement.webidl index afc4465d1..d80f28675 100644 --- a/dom/webidl/HTMLFrameSetElement.webidl +++ b/dom/webidl/HTMLFrameSetElement.webidl @@ -19,4 +19,4 @@ interface HTMLFrameSetElement : HTMLElement { attribute DOMString rows; }; -HTMLFrameSetElement implements WindowEventHandlers; +HTMLFrameSetElement includes WindowEventHandlers; diff --git a/dom/webidl/HTMLHyperlinkElementUtils.webidl b/dom/webidl/HTMLHyperlinkElementUtils.webidl index ae53fd75e..bd6967b95 100644 --- a/dom/webidl/HTMLHyperlinkElementUtils.webidl +++ b/dom/webidl/HTMLHyperlinkElementUtils.webidl @@ -10,8 +10,7 @@ * and create derivative works of this document. */ -[NoInterfaceObject] -interface HTMLHyperlinkElementUtils { +interface mixin HTMLHyperlinkElementUtils { // Bug 824857: no support for stringifier attributes yet. // stringifier attribute USVString href; diff --git a/dom/webidl/HTMLIFrameElement.webidl b/dom/webidl/HTMLIFrameElement.webidl index f5f8d9b06..56a073aad 100644 --- a/dom/webidl/HTMLIFrameElement.webidl +++ b/dom/webidl/HTMLIFrameElement.webidl @@ -45,10 +45,10 @@ partial interface HTMLIFrameElement { [CEReactions, SetterThrows, Pure] attribute DOMString longDesc; - [CEReactions, TreatNullAs=EmptyString, SetterThrows, Pure] - attribute DOMString marginHeight; - [CEReactions, TreatNullAs=EmptyString, SetterThrows, Pure] - attribute DOMString marginWidth; + [CEReactions, SetterThrows, Pure] + attribute [TreatNullAs=EmptyString] DOMString marginHeight; + [CEReactions, SetterThrows, Pure] + attribute [TreatNullAs=EmptyString] DOMString marginWidth; }; partial interface HTMLIFrameElement { @@ -59,9 +59,9 @@ partial interface HTMLIFrameElement { partial interface HTMLIFrameElement { // nsIDOMMozBrowserFrame - [ChromeOnly,SetterThrows] + [ChromeOnly, SetterThrows] attribute boolean mozbrowser; }; -HTMLIFrameElement implements MozFrameLoaderOwner; +HTMLIFrameElement includes MozFrameLoaderOwner; HTMLIFrameElement implements BrowserElement; diff --git a/dom/webidl/HTMLImageElement.webidl b/dom/webidl/HTMLImageElement.webidl index 8696b89d2..46dcd897b 100644 --- a/dom/webidl/HTMLImageElement.webidl +++ b/dom/webidl/HTMLImageElement.webidl @@ -55,7 +55,7 @@ partial interface HTMLImageElement { [CEReactions, SetterThrows] attribute DOMString longDesc; - [CEReactions, TreatNullAs=EmptyString,SetterThrows] attribute DOMString border; + [CEReactions, SetterThrows] attribute [TreatNullAs=EmptyString] DOMString border; }; // [Update me: not in whatwg spec yet] @@ -77,8 +77,7 @@ partial interface HTMLImageElement { readonly attribute long y; }; -[NoInterfaceObject] -interface MozImageLoadingContent { +interface mixin MozImageLoadingContent { // Mirrored chrome-only nsIImageLoadingContent methods. Please make sure // to update this list if nsIImageLoadingContent changes. [ChromeOnly] @@ -108,4 +107,4 @@ interface MozImageLoadingContent { void forceImageState(boolean aForce, unsigned long long aState); }; -HTMLImageElement implements MozImageLoadingContent; +HTMLImageElement includes MozImageLoadingContent; diff --git a/dom/webidl/HTMLInputElement.webidl b/dom/webidl/HTMLInputElement.webidl index 0f3dee4ac..b85dc7159 100644 --- a/dom/webidl/HTMLInputElement.webidl +++ b/dom/webidl/HTMLInputElement.webidl @@ -89,8 +89,8 @@ interface HTMLInputElement : HTMLElement { attribute DOMString type; [CEReactions, Pure, SetterThrows] attribute DOMString defaultValue; - [CEReactions, Pure, TreatNullAs=EmptyString, SetterThrows, NeedsCallerType] - attribute DOMString value; + [CEReactions, Pure, SetterThrows, NeedsCallerType] + attribute [TreatNullAs=EmptyString] DOMString value; [Throws, Func="HTMLInputElement::ValueAsDateEnabled"] attribute Date? valueAsDate; [CEReactions, Pure, SetterThrows] @@ -226,14 +226,13 @@ partial interface HTMLInputElement { void chooseDirectory(); }; -[NoInterfaceObject] -interface MozPhonetic { +interface mixin MozPhonetic { [Pure, ChromeOnly] readonly attribute DOMString phonetic; }; -HTMLInputElement implements MozImageLoadingContent; -HTMLInputElement implements MozPhonetic; +HTMLInputElement includes MozImageLoadingContent; +HTMLInputElement includes MozPhonetic; // Webkit/Blink partial interface HTMLInputElement { diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl index da4827de1..685f1e7c8 100644 --- a/dom/webidl/HTMLLinkElement.webidl +++ b/dom/webidl/HTMLLinkElement.webidl @@ -36,7 +36,7 @@ interface HTMLLinkElement : HTMLElement { attribute DOMString referrerPolicy; [PutForwards=value] readonly attribute DOMTokenList sizes; }; -HTMLLinkElement implements LinkStyle; +HTMLLinkElement includes LinkStyle; // http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis partial interface HTMLLinkElement { diff --git a/dom/webidl/HTMLObjectElement.webidl b/dom/webidl/HTMLObjectElement.webidl index b8c51b98c..4589f76e3 100644 --- a/dom/webidl/HTMLObjectElement.webidl +++ b/dom/webidl/HTMLObjectElement.webidl @@ -67,8 +67,8 @@ partial interface HTMLObjectElement { [CEReactions, Pure, SetterThrows] attribute DOMString codeType; - [CEReactions, TreatNullAs=EmptyString, Pure, SetterThrows] - attribute DOMString border; + [CEReactions, Pure, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString border; }; partial interface HTMLObjectElement { @@ -77,8 +77,7 @@ partial interface HTMLObjectElement { Document? getSVGDocument(); }; -[NoInterfaceObject] -interface MozObjectLoadingContent { +interface mixin MozObjectLoadingContent { // Mirrored chrome-only scriptable nsIObjectLoadingContent methods. Please // make sure to update this list if nsIObjectLoadingContent changes. Also, // make sure everything on here is [ChromeOnly]. @@ -217,6 +216,6 @@ dictionary MozPluginParameter { DOMString value = ""; }; -HTMLObjectElement implements MozImageLoadingContent; -HTMLObjectElement implements MozFrameLoaderOwner; -HTMLObjectElement implements MozObjectLoadingContent; +HTMLObjectElement includes MozImageLoadingContent; +HTMLObjectElement includes MozFrameLoaderOwner; +HTMLObjectElement includes MozObjectLoadingContent; diff --git a/dom/webidl/HTMLStyleElement.webidl b/dom/webidl/HTMLStyleElement.webidl index 3f2e0c863..da21a4ea9 100644 --- a/dom/webidl/HTMLStyleElement.webidl +++ b/dom/webidl/HTMLStyleElement.webidl @@ -21,5 +21,5 @@ interface HTMLStyleElement : HTMLElement { [SetterThrows, Pure] attribute boolean scoped; }; -HTMLStyleElement implements LinkStyle; +HTMLStyleElement includes LinkStyle; diff --git a/dom/webidl/HTMLTableCellElement.webidl b/dom/webidl/HTMLTableCellElement.webidl index aff94914f..9e46075b6 100644 --- a/dom/webidl/HTMLTableCellElement.webidl +++ b/dom/webidl/HTMLTableCellElement.webidl @@ -48,6 +48,6 @@ partial interface HTMLTableCellElement { [CEReactions, SetterThrows] attribute DOMString vAlign; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString bgColor; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString bgColor; }; diff --git a/dom/webidl/HTMLTableElement.webidl b/dom/webidl/HTMLTableElement.webidl index f81e00041..4ce5a94c6 100644 --- a/dom/webidl/HTMLTableElement.webidl +++ b/dom/webidl/HTMLTableElement.webidl @@ -53,10 +53,10 @@ partial interface HTMLTableElement { [CEReactions, SetterThrows] attribute DOMString width; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString bgColor; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString cellPadding; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString cellSpacing; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString bgColor; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString cellPadding; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString cellSpacing; }; diff --git a/dom/webidl/HTMLTableRowElement.webidl b/dom/webidl/HTMLTableRowElement.webidl index 153d271f1..d8ecaf30e 100644 --- a/dom/webidl/HTMLTableRowElement.webidl +++ b/dom/webidl/HTMLTableRowElement.webidl @@ -32,6 +32,6 @@ partial interface HTMLTableRowElement { [CEReactions, SetterThrows] attribute DOMString vAlign; - [CEReactions, TreatNullAs=EmptyString, SetterThrows] - attribute DOMString bgColor; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString bgColor; }; diff --git a/dom/webidl/HTMLTextAreaElement.webidl b/dom/webidl/HTMLTextAreaElement.webidl index 5eb31b1df..f3f520082 100644 --- a/dom/webidl/HTMLTextAreaElement.webidl +++ b/dom/webidl/HTMLTextAreaElement.webidl @@ -48,7 +48,7 @@ interface HTMLTextAreaElement : HTMLElement { readonly attribute DOMString type; [CEReactions, SetterThrows, Pure] attribute DOMString defaultValue; - [CEReactions, TreatNullAs=EmptyString] attribute DOMString value; + [CEReactions] attribute [TreatNullAs=EmptyString] DOMString value; readonly attribute unsigned long textLength; readonly attribute boolean willValidate; diff --git a/dom/webidl/IDBIndex.webidl b/dom/webidl/IDBIndex.webidl index 0e436650a..a1fdaef2a 100644 --- a/dom/webidl/IDBIndex.webidl +++ b/dom/webidl/IDBIndex.webidl @@ -58,14 +58,14 @@ interface IDBIndex { partial interface IDBIndex { [Throws] - IDBRequest mozGetAll (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest mozGetAll (optional any key, optional [EnforceRange] unsigned long limit); [Throws] - IDBRequest mozGetAllKeys (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest mozGetAllKeys (optional any key, optional [EnforceRange] unsigned long limit); [Throws] - IDBRequest getAll (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); [Throws] - IDBRequest getAllKeys (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); }; diff --git a/dom/webidl/IDBKeyRange.webidl b/dom/webidl/IDBKeyRange.webidl index 1caba7618..18650e666 100644 --- a/dom/webidl/IDBKeyRange.webidl +++ b/dom/webidl/IDBKeyRange.webidl @@ -20,7 +20,7 @@ interface IDBKeyRange { [Constant] readonly attribute boolean upperOpen; [Throws] - boolean includes(any key); + boolean _includes(any key); [NewObject, Throws] diff --git a/dom/webidl/IDBObjectStore.webidl b/dom/webidl/IDBObjectStore.webidl index a06ac8897..3a799151a 100644 --- a/dom/webidl/IDBObjectStore.webidl +++ b/dom/webidl/IDBObjectStore.webidl @@ -61,13 +61,13 @@ interface IDBObjectStore { partial interface IDBObjectStore { // Success fires IDBTransactionEvent, result == array of values for given keys [Throws] - IDBRequest mozGetAll (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest mozGetAll (optional any key, optional [EnforceRange] unsigned long limit); [Throws] - IDBRequest getAll (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest getAll (optional any key, optional [EnforceRange] unsigned long limit); [Throws] - IDBRequest getAllKeys (optional any key, [EnforceRange] optional unsigned long limit); + IDBRequest getAllKeys (optional any key, optional [EnforceRange] unsigned long limit); [Throws] IDBRequest openKeyCursor (optional any range, optional IDBCursorDirection direction = "next"); diff --git a/dom/webidl/IIRFilterNode.webidl b/dom/webidl/IIRFilterNode.webidl index 8a0057944..d41a7be4a 100644 --- a/dom/webidl/IIRFilterNode.webidl +++ b/dom/webidl/IIRFilterNode.webidl @@ -21,4 +21,4 @@ interface IIRFilterNode : AudioNode { }; // Mozilla extension -IIRFilterNode implements AudioNodePassThrough; +IIRFilterNode includes AudioNodePassThrough; diff --git a/dom/webidl/LegacyQueryInterface.webidl b/dom/webidl/LegacyQueryInterface.webidl index a2f7b9dc6..82db47fb5 100644 --- a/dom/webidl/LegacyQueryInterface.webidl +++ b/dom/webidl/LegacyQueryInterface.webidl @@ -7,86 +7,83 @@ interface nsISupports; interface IID; -[NoInterfaceObject, - // Need Exposed here, because this is a mixin onto things like Event - // that are exposed in workers. - Exposed=(Window,Worker,System)] -interface LegacyQueryInterface { +[Exposed=Window] +interface mixin LegacyQueryInterface { // Legacy QueryInterface, only exposed to chrome or XBL code on the // main thread. [Exposed=Window] nsISupports queryInterface(IID iid); }; -Attr implements LegacyQueryInterface; -BarProp implements LegacyQueryInterface; -BoxObject implements LegacyQueryInterface; -CaretPosition implements LegacyQueryInterface; -Comment implements LegacyQueryInterface; -Crypto implements LegacyQueryInterface; -CSSMozDocumentRule implements LegacyQueryInterface; -CSSPrimitiveValue implements LegacyQueryInterface; -CSSStyleDeclaration implements LegacyQueryInterface; -CSSStyleRule implements LegacyQueryInterface; -CSSValueList implements LegacyQueryInterface; -DOMImplementation implements LegacyQueryInterface; -DOMParser implements LegacyQueryInterface; -DOMStringMap implements LegacyQueryInterface; -DOMTokenList implements LegacyQueryInterface; -Document implements LegacyQueryInterface; -DocumentFragment implements LegacyQueryInterface; -DocumentType implements LegacyQueryInterface; -Element implements LegacyQueryInterface; -Event implements LegacyQueryInterface; -EventSource implements LegacyQueryInterface; -FileList implements LegacyQueryInterface; -FormData implements LegacyQueryInterface; -HTMLCollection implements LegacyQueryInterface; -History implements LegacyQueryInterface; -MimeTypeArray implements LegacyQueryInterface; -NamedNodeMap implements LegacyQueryInterface; -MutationObserver implements LegacyQueryInterface; -MutationRecord implements LegacyQueryInterface; -Navigator implements LegacyQueryInterface; -NodeIterator implements LegacyQueryInterface; -NodeList implements LegacyQueryInterface; -Notification implements LegacyQueryInterface; -OfflineResourceList implements LegacyQueryInterface; -PaintRequest implements LegacyQueryInterface; -PaintRequestList implements LegacyQueryInterface; -Performance implements LegacyQueryInterface; -Plugin implements LegacyQueryInterface; -PluginArray implements LegacyQueryInterface; -ProcessingInstruction implements LegacyQueryInterface; -Range implements LegacyQueryInterface; -Rect implements LegacyQueryInterface; -Selection implements LegacyQueryInterface; -SVGAnimatedEnumeration implements LegacyQueryInterface; -SVGAnimatedInteger implements LegacyQueryInterface; -SVGAnimatedNumber implements LegacyQueryInterface; -SVGAnimatedNumberList implements LegacyQueryInterface; -SVGAnimatedPreserveAspectRatio implements LegacyQueryInterface; -SVGAnimatedString implements LegacyQueryInterface; -SVGLengthList implements LegacyQueryInterface; -SVGNumberList implements LegacyQueryInterface; -SVGPathSegList implements LegacyQueryInterface; -SVGPoint implements LegacyQueryInterface; -SVGPointList implements LegacyQueryInterface; -SVGPreserveAspectRatio implements LegacyQueryInterface; -SVGRect implements LegacyQueryInterface; -SVGStringList implements LegacyQueryInterface; -SVGTransformList implements LegacyQueryInterface; -Screen implements LegacyQueryInterface; -StyleSheet implements LegacyQueryInterface; -Text implements LegacyQueryInterface; -Touch implements LegacyQueryInterface; -TouchList implements LegacyQueryInterface; -TreeColumns implements LegacyQueryInterface; -TreeWalker implements LegacyQueryInterface; -ValidityState implements LegacyQueryInterface; -WebSocket implements LegacyQueryInterface; -Window implements LegacyQueryInterface; -XMLHttpRequest implements LegacyQueryInterface; -XMLHttpRequestUpload implements LegacyQueryInterface; -XMLSerializer implements LegacyQueryInterface; -XPathEvaluator implements LegacyQueryInterface; +Attr includes LegacyQueryInterface; +BarProp includes LegacyQueryInterface; +BoxObject includes LegacyQueryInterface; +CaretPosition includes LegacyQueryInterface; +Comment includes LegacyQueryInterface; +Crypto includes LegacyQueryInterface; +CSSMozDocumentRule includes LegacyQueryInterface; +CSSPrimitiveValue includes LegacyQueryInterface; +CSSStyleDeclaration includes LegacyQueryInterface; +CSSStyleRule includes LegacyQueryInterface; +CSSValueList includes LegacyQueryInterface; +DOMImplementation includes LegacyQueryInterface; +DOMParser includes LegacyQueryInterface; +DOMStringMap includes LegacyQueryInterface; +DOMTokenList includes LegacyQueryInterface; +Document includes LegacyQueryInterface; +DocumentFragment includes LegacyQueryInterface; +DocumentType includes LegacyQueryInterface; +Element includes LegacyQueryInterface; +Event includes LegacyQueryInterface; +EventSource includes LegacyQueryInterface; +FileList includes LegacyQueryInterface; +FormData includes LegacyQueryInterface; +HTMLCollection includes LegacyQueryInterface; +History includes LegacyQueryInterface; +MimeTypeArray includes LegacyQueryInterface; +NamedNodeMap includes LegacyQueryInterface; +MutationObserver includes LegacyQueryInterface; +MutationRecord includes LegacyQueryInterface; +Navigator includes LegacyQueryInterface; +NodeIterator includes LegacyQueryInterface; +NodeList includes LegacyQueryInterface; +Notification includes LegacyQueryInterface; +OfflineResourceList includes LegacyQueryInterface; +PaintRequest includes LegacyQueryInterface; +PaintRequestList includes LegacyQueryInterface; +Performance includes LegacyQueryInterface; +Plugin includes LegacyQueryInterface; +PluginArray includes LegacyQueryInterface; +ProcessingInstruction includes LegacyQueryInterface; +Range includes LegacyQueryInterface; +Rect includes LegacyQueryInterface; +Selection includes LegacyQueryInterface; +SVGAnimatedEnumeration includes LegacyQueryInterface; +SVGAnimatedInteger includes LegacyQueryInterface; +SVGAnimatedNumber includes LegacyQueryInterface; +SVGAnimatedNumberList includes LegacyQueryInterface; +SVGAnimatedPreserveAspectRatio includes LegacyQueryInterface; +SVGAnimatedString includes LegacyQueryInterface; +SVGLengthList includes LegacyQueryInterface; +SVGNumberList includes LegacyQueryInterface; +SVGPathSegList includes LegacyQueryInterface; +SVGPoint includes LegacyQueryInterface; +SVGPointList includes LegacyQueryInterface; +SVGPreserveAspectRatio includes LegacyQueryInterface; +SVGRect includes LegacyQueryInterface; +SVGStringList includes LegacyQueryInterface; +SVGTransformList includes LegacyQueryInterface; +Screen includes LegacyQueryInterface; +StyleSheet includes LegacyQueryInterface; +Text includes LegacyQueryInterface; +Touch includes LegacyQueryInterface; +TouchList includes LegacyQueryInterface; +TreeColumns includes LegacyQueryInterface; +TreeWalker includes LegacyQueryInterface; +ValidityState includes LegacyQueryInterface; +WebSocket includes LegacyQueryInterface; +Window includes LegacyQueryInterface; +XMLHttpRequest includes LegacyQueryInterface; +XMLHttpRequestUpload includes LegacyQueryInterface; +XMLSerializer includes LegacyQueryInterface; +XPathEvaluator includes LegacyQueryInterface; diff --git a/dom/webidl/LinkStyle.webidl b/dom/webidl/LinkStyle.webidl index db0bc031a..6bfde7b25 100644 --- a/dom/webidl/LinkStyle.webidl +++ b/dom/webidl/LinkStyle.webidl @@ -7,8 +7,7 @@ * http://dev.w3.org/csswg/cssom/#the-linkstyle-interface */ -[NoInterfaceObject] -interface LinkStyle { +interface mixin LinkStyle { readonly attribute StyleSheet? sheet; }; diff --git a/dom/webidl/MathMLElement.webidl b/dom/webidl/MathMLElement.webidl new file mode 100644 index 000000000..e370eda2b --- /dev/null +++ b/dom/webidl/MathMLElement.webidl @@ -0,0 +1,19 @@ +/* -*- 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://mathml-refresh.github.io/mathml-core/ + * + * Copyright © 2019 W3C® (MIT, ERCIM, Keio, Beihang). W3C liability, trademark + * and permissive document license rules apply. + */ + +[Exposed=Window] +interface MathMLElement : Element { }; +MathMLElement includes GlobalEventHandlers; +MathMLElement includes HTMLOrForeignElement; +MathMLElement includes DocumentAndElementEventHandlers; +MathMLElement includes ElementCSSInlineStyle; +MathMLElement includes TouchEventHandlers; \ No newline at end of file diff --git a/dom/webidl/MediaElementAudioSourceNode.webidl b/dom/webidl/MediaElementAudioSourceNode.webidl index 37de32536..e10506f70 100644 --- a/dom/webidl/MediaElementAudioSourceNode.webidl +++ b/dom/webidl/MediaElementAudioSourceNode.webidl @@ -21,5 +21,5 @@ interface MediaElementAudioSourceNode : AudioNode { }; // Mozilla extensions -MediaElementAudioSourceNode implements AudioNodePassThrough; +MediaElementAudioSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/MediaList.webidl b/dom/webidl/MediaList.webidl index 44e733190..71be47c73 100644 --- a/dom/webidl/MediaList.webidl +++ b/dom/webidl/MediaList.webidl @@ -7,8 +7,7 @@ [ArrayClass] interface MediaList { - [TreatNullAs=EmptyString] - attribute DOMString mediaText; + attribute [TreatNullAs=EmptyString] DOMString mediaText; readonly attribute unsigned long length; getter DOMString? item(unsigned long index); diff --git a/dom/webidl/MediaStreamAudioSourceNode.webidl b/dom/webidl/MediaStreamAudioSourceNode.webidl index 06727a5da..9ded1b12f 100644 --- a/dom/webidl/MediaStreamAudioSourceNode.webidl +++ b/dom/webidl/MediaStreamAudioSourceNode.webidl @@ -21,5 +21,5 @@ interface MediaStreamAudioSourceNode : AudioNode { }; // Mozilla extensions -MediaStreamAudioSourceNode implements AudioNodePassThrough; +MediaStreamAudioSourceNode includes AudioNodePassThrough; diff --git a/dom/webidl/MessagePort.webidl b/dom/webidl/MessagePort.webidl index 0b36c47d9..bb2c00f23 100644 --- a/dom/webidl/MessagePort.webidl +++ b/dom/webidl/MessagePort.webidl @@ -20,7 +20,6 @@ interface MessagePort : EventTarget { // event handlers attribute EventHandler onmessage; }; -// MessagePort implements Transferable; // Used to declare which objects should be transferred. dictionary StructuredSerializeOptions { diff --git a/dom/webidl/Navigator.webidl b/dom/webidl/Navigator.webidl index 903cea3bf..579e777d7 100644 --- a/dom/webidl/Navigator.webidl +++ b/dom/webidl/Navigator.webidl @@ -26,18 +26,17 @@ interface Navigator { // objects implementing this interface also implement the interfaces given below }; -Navigator implements NavigatorID; -Navigator implements NavigatorLanguage; -Navigator implements NavigatorOnLine; -Navigator implements NavigatorContentUtils; -Navigator implements NavigatorStorageUtils; -Navigator implements NavigatorConcurrentHardware; -Navigator implements NavigatorStorage; -Navigator implements NavigatorGlobalPrivacyControl; -Navigator implements NavigatorAutomationInformation; +Navigator includes NavigatorID; +Navigator includes NavigatorLanguage; +Navigator includes NavigatorOnLine; +Navigator includes NavigatorContentUtils; +Navigator includes NavigatorStorageUtils; +Navigator includes NavigatorConcurrentHardware; +Navigator includes NavigatorStorage; +Navigator includes NavigatorGlobalPrivacyControl; +Navigator includes NavigatorAutomationInformation; -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorID { +interface mixin NavigatorID { // WebKit/Blink/Trident/Presto support this (hardcoded "Mozilla"). [Constant, Cached] readonly attribute DOMString appCodeName; // constant "Mozilla" @@ -57,8 +56,7 @@ interface NavigatorID { boolean taintEnabled(); // constant false }; -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorLanguage { +interface mixin NavigatorLanguage { // These two attributes are cached because this interface is also implemented // by Workernavigator and this way we don't have to go back to the @@ -71,13 +69,11 @@ interface NavigatorLanguage { readonly attribute sequence languages; }; -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorOnLine { +interface mixin NavigatorOnLine { readonly attribute boolean onLine; }; -[NoInterfaceObject] -interface NavigatorContentUtils { +interface mixin NavigatorContentUtils { // content handler registration [Throws] void registerProtocolHandler(DOMString scheme, DOMString url, DOMString title); @@ -90,14 +86,13 @@ interface NavigatorContentUtils { //void unregisterContentHandler(DOMString mimeType, DOMString url); }; -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorStorage { +[SecureContext] +interface mixin NavigatorStorage { [Func="mozilla::dom::StorageManager::PrefEnabled"] readonly attribute StorageManager storage; }; -[NoInterfaceObject] -interface NavigatorStorageUtils { +interface mixin NavigatorStorageUtils { // NOT IMPLEMENTED //void yieldForStorageUpdates(); }; @@ -117,18 +112,17 @@ partial interface Navigator { }; // https://globalprivacycontrol.github.io/gpc-spec/ -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorGlobalPrivacyControl { +[Exposed=(Window,Worker)] +interface mixin NavigatorGlobalPrivacyControl { readonly attribute boolean globalPrivacyControl; }; // http://www.w3.org/TR/geolocation-API/#geolocation_interface -[NoInterfaceObject] -interface NavigatorGeolocation { +interface mixin NavigatorGeolocation { [Throws, Pref="geo.enabled"] readonly attribute Geolocation geolocation; }; -Navigator implements NavigatorGeolocation; +Navigator includes NavigatorGeolocation; // http://www.w3.org/TR/battery-status/#navigatorbattery-interface partial interface Navigator { @@ -371,8 +365,7 @@ partial interface Navigator { }; #endif -[NoInterfaceObject, Exposed=(Window,Worker)] -interface NavigatorConcurrentHardware { +interface mixin NavigatorConcurrentHardware { readonly attribute unsigned long long hardwareConcurrency; }; @@ -388,8 +381,7 @@ partial interface Navigator { }; // https://w3c.github.io/webdriver/webdriver-spec.html#interface -[NoInterfaceObject, Exposed=Window] -interface NavigatorAutomationInformation { +interface mixin NavigatorAutomationInformation { [Pref="dom.webdriver.enabled"] readonly attribute boolean webdriver; }; diff --git a/dom/webidl/Notification.webidl b/dom/webidl/Notification.webidl index 7a55a52ae..06d6898d7 100644 --- a/dom/webidl/Notification.webidl +++ b/dom/webidl/Notification.webidl @@ -4,7 +4,7 @@ * You can obtain one at http://mozilla.org/MPL/2.0/. * * The origin of this IDL file is - * http://notifications.spec.whatwg.org/ + * https://notifications.spec.whatwg.org/ * * Copyright: * To the extent possible under law, the editors have waived all copyright and @@ -96,10 +96,3 @@ enum NotificationDirection { "ltr", "rtl" }; - -partial interface ServiceWorkerRegistration { - [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"] - Promise showNotification(DOMString title, optional NotificationOptions options); - [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"] - Promise> getNotifications(optional GetNotificationOptions filter); -}; diff --git a/dom/webidl/NotificationEvent.webidl b/dom/webidl/NotificationEvent.webidl index 3f25cf1b8..47a30349c 100644 --- a/dom/webidl/NotificationEvent.webidl +++ b/dom/webidl/NotificationEvent.webidl @@ -20,8 +20,3 @@ interface NotificationEvent : ExtendableEvent { dictionary NotificationEventInit : ExtendableEventInit { required Notification notification; }; - -partial interface ServiceWorkerGlobalScope { - attribute EventHandler onnotificationclick; - attribute EventHandler onnotificationclose; -}; diff --git a/dom/webidl/OffscreenCanvas.webidl b/dom/webidl/OffscreenCanvas.webidl index ffe2b9147..172e88bdb 100644 --- a/dom/webidl/OffscreenCanvas.webidl +++ b/dom/webidl/OffscreenCanvas.webidl @@ -26,4 +26,3 @@ interface OffscreenCanvas : EventTarget { optional any encoderOptions); }; -// OffscreenCanvas implements Transferable; diff --git a/dom/webidl/OscillatorNode.webidl b/dom/webidl/OscillatorNode.webidl index acf75a818..34ec027b8 100644 --- a/dom/webidl/OscillatorNode.webidl +++ b/dom/webidl/OscillatorNode.webidl @@ -39,4 +39,4 @@ interface OscillatorNode : AudioScheduledSourceNode { }; // Mozilla extensions -OscillatorNode implements AudioNodePassThrough; +OscillatorNode includes AudioNodePassThrough; diff --git a/dom/webidl/PannerNode.webidl b/dom/webidl/PannerNode.webidl index d562dccdf..74b74bc45 100644 --- a/dom/webidl/PannerNode.webidl +++ b/dom/webidl/PannerNode.webidl @@ -75,5 +75,5 @@ interface PannerNode : AudioNode { }; // Mozilla extension -PannerNode implements AudioNodePassThrough; +PannerNode includes AudioNodePassThrough; diff --git a/dom/webidl/ParentNode.webidl b/dom/webidl/ParentNode.webidl index 6aa555744..c116709f3 100644 --- a/dom/webidl/ParentNode.webidl +++ b/dom/webidl/ParentNode.webidl @@ -7,8 +7,7 @@ * http://dom.spec.whatwg.org/#interface-parentnode */ -[NoInterfaceObject] -interface ParentNode { +interface mixin ParentNode { [Constant] readonly attribute HTMLCollection children; [Pure] diff --git a/dom/webidl/ProcessingInstruction.webidl b/dom/webidl/ProcessingInstruction.webidl index 8f376c1c3..c90d00045 100644 --- a/dom/webidl/ProcessingInstruction.webidl +++ b/dom/webidl/ProcessingInstruction.webidl @@ -13,3 +13,6 @@ interface ProcessingInstruction : CharacterData { readonly attribute DOMString target; }; + +// https://drafts.csswg.org/cssom/#requirements-on-user-agents-implementing-the-xml-stylesheet-processing-instruction +// ProcessingInstruction includes LinkStyle; \ No newline at end of file diff --git a/dom/webidl/Request.webidl b/dom/webidl/Request.webidl index 1b9cb1e90..ea9087d65 100644 --- a/dom/webidl/Request.webidl +++ b/dom/webidl/Request.webidl @@ -38,7 +38,7 @@ interface Request { [ChromeOnly] void overrideContentPolicyType(nsContentPolicyType context); }; -Request implements Body; +Request includes Body; dictionary RequestInit { ByteString method; diff --git a/dom/webidl/Response.webidl b/dom/webidl/Response.webidl index 0f4c99dba..f7dcc43a9 100644 --- a/dom/webidl/Response.webidl +++ b/dom/webidl/Response.webidl @@ -30,7 +30,7 @@ interface Response { [ChromeOnly, NewObject, Throws] Response cloneUnfiltered(); }; -Response implements Body; +Response includes Body; // This should be part of Body but we don't want to expose body to request yet. partial interface Response { diff --git a/dom/webidl/SVGAElement.webidl b/dom/webidl/SVGAElement.webidl index f15866911..31c4deb56 100644 --- a/dom/webidl/SVGAElement.webidl +++ b/dom/webidl/SVGAElement.webidl @@ -17,5 +17,5 @@ interface SVGAElement : SVGGraphicsElement { attribute DOMString download; }; -SVGAElement implements SVGURIReference; +SVGAElement includes SVGURIReference; diff --git a/dom/webidl/SVGAnimatedPathData.webidl b/dom/webidl/SVGAnimatedPathData.webidl index 08f10f721..e1db92b0f 100644 --- a/dom/webidl/SVGAnimatedPathData.webidl +++ b/dom/webidl/SVGAnimatedPathData.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGAnimatedPathData { +interface mixin SVGAnimatedPathData { readonly attribute SVGPathSegList pathSegList; //readonly attribute SVGPathSegList normalizedPathSegList; readonly attribute SVGPathSegList animatedPathSegList; diff --git a/dom/webidl/SVGAnimatedPoints.webidl b/dom/webidl/SVGAnimatedPoints.webidl index 891ca4bc0..1ce8fe416 100644 --- a/dom/webidl/SVGAnimatedPoints.webidl +++ b/dom/webidl/SVGAnimatedPoints.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGAnimatedPoints { +interface mixin SVGAnimatedPoints { [Constant] readonly attribute SVGPointList points; [Constant] diff --git a/dom/webidl/SVGAnimationElement.webidl b/dom/webidl/SVGAnimationElement.webidl index 4f9a95fe3..4cd75b696 100644 --- a/dom/webidl/SVGAnimationElement.webidl +++ b/dom/webidl/SVGAnimationElement.webidl @@ -30,5 +30,5 @@ interface SVGAnimationElement : SVGElement { void endElementAt(float offset); }; -SVGAnimationElement implements SVGTests; +SVGAnimationElement includes SVGTests; diff --git a/dom/webidl/SVGClipPathElement.webidl b/dom/webidl/SVGClipPathElement.webidl index b6c5081e4..87d7c3e35 100644 --- a/dom/webidl/SVGClipPathElement.webidl +++ b/dom/webidl/SVGClipPathElement.webidl @@ -17,5 +17,5 @@ interface SVGClipPathElement : SVGElement { readonly attribute SVGAnimatedTransformList transform; }; -SVGClipPathElement implements SVGUnitTypeValues; +SVGClipPathElement includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGElement.webidl b/dom/webidl/SVGElement.webidl index a01be3788..592685a27 100644 --- a/dom/webidl/SVGElement.webidl +++ b/dom/webidl/SVGElement.webidl @@ -15,20 +15,14 @@ interface SVGElement : Element { [Constant] readonly attribute SVGAnimatedString className; - [SameObject] readonly attribute DOMStringMap dataset; - [PutForwards=cssText, Constant] - readonly attribute CSSStyleDeclaration style; readonly attribute SVGSVGElement? ownerSVGElement; readonly attribute SVGElement? viewportElement; - - [SetterThrows, Pure] - attribute long tabIndex; - [Throws] void focus(); - [Throws] void blur(); }; -SVGElement implements GlobalEventHandlers; -SVGElement implements DocumentAndElementEventHandlers; -SVGElement implements TouchEventHandlers; -SVGElement implements OnErrorEventHandlerForNodes; +SVGElement includes GlobalEventHandlers; +SVGElement includes HTMLOrForeignElement; +SVGElement includes DocumentAndElementEventHandlers; +SVGElement includes ElementCSSInlineStyle; +SVGElement includes TouchEventHandlers; +SVGElement includes OnErrorEventHandlerForNodes; diff --git a/dom/webidl/SVGFEBlendElement.webidl b/dom/webidl/SVGFEBlendElement.webidl index 5cd469bd5..412970b44 100644 --- a/dom/webidl/SVGFEBlendElement.webidl +++ b/dom/webidl/SVGFEBlendElement.webidl @@ -38,4 +38,4 @@ interface SVGFEBlendElement : SVGElement { readonly attribute SVGAnimatedEnumeration mode; }; -SVGFEBlendElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEBlendElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEColorMatrixElement.webidl b/dom/webidl/SVGFEColorMatrixElement.webidl index 61d91040d..05a7b6a79 100644 --- a/dom/webidl/SVGFEColorMatrixElement.webidl +++ b/dom/webidl/SVGFEColorMatrixElement.webidl @@ -27,4 +27,4 @@ interface SVGFEColorMatrixElement : SVGElement { readonly attribute SVGAnimatedNumberList values; }; -SVGFEColorMatrixElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEColorMatrixElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEComponentTransferElement.webidl b/dom/webidl/SVGFEComponentTransferElement.webidl index 6cf6f6d65..df8dab5f8 100644 --- a/dom/webidl/SVGFEComponentTransferElement.webidl +++ b/dom/webidl/SVGFEComponentTransferElement.webidl @@ -15,4 +15,4 @@ interface SVGFEComponentTransferElement : SVGElement { readonly attribute SVGAnimatedString in1; }; -SVGFEComponentTransferElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEComponentTransferElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFECompositeElement.webidl b/dom/webidl/SVGFECompositeElement.webidl index 3ab983fe0..dd0b001d1 100644 --- a/dom/webidl/SVGFECompositeElement.webidl +++ b/dom/webidl/SVGFECompositeElement.webidl @@ -37,4 +37,4 @@ interface SVGFECompositeElement : SVGElement { readonly attribute SVGAnimatedNumber k4; }; -SVGFECompositeElement implements SVGFilterPrimitiveStandardAttributes; +SVGFECompositeElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEConvolveMatrixElement.webidl b/dom/webidl/SVGFEConvolveMatrixElement.webidl index 27d8e80e7..d07c14e2f 100644 --- a/dom/webidl/SVGFEConvolveMatrixElement.webidl +++ b/dom/webidl/SVGFEConvolveMatrixElement.webidl @@ -44,4 +44,4 @@ interface SVGFEConvolveMatrixElement : SVGElement { readonly attribute SVGAnimatedBoolean preserveAlpha; }; -SVGFEConvolveMatrixElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEConvolveMatrixElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDiffuseLightingElement.webidl b/dom/webidl/SVGFEDiffuseLightingElement.webidl index fb89721d8..e11a07a6f 100644 --- a/dom/webidl/SVGFEDiffuseLightingElement.webidl +++ b/dom/webidl/SVGFEDiffuseLightingElement.webidl @@ -23,4 +23,4 @@ interface SVGFEDiffuseLightingElement : SVGElement { readonly attribute SVGAnimatedNumber kernelUnitLengthY; }; -SVGFEDiffuseLightingElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEDiffuseLightingElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDisplacementMapElement.webidl b/dom/webidl/SVGFEDisplacementMapElement.webidl index 461faff91..1e5dfbf7e 100644 --- a/dom/webidl/SVGFEDisplacementMapElement.webidl +++ b/dom/webidl/SVGFEDisplacementMapElement.webidl @@ -31,4 +31,4 @@ interface SVGFEDisplacementMapElement : SVGElement { readonly attribute SVGAnimatedEnumeration yChannelSelector; }; -SVGFEDisplacementMapElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEDisplacementMapElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEDropShadowElement.webidl b/dom/webidl/SVGFEDropShadowElement.webidl index b858fc91c..822443676 100644 --- a/dom/webidl/SVGFEDropShadowElement.webidl +++ b/dom/webidl/SVGFEDropShadowElement.webidl @@ -25,4 +25,4 @@ interface SVGFEDropShadowElement : SVGElement { void setStdDeviation(float stdDeviationX, float stdDeviationY); }; -SVGFEDropShadowElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEDropShadowElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEFloodElement.webidl b/dom/webidl/SVGFEFloodElement.webidl index 51d9539ff..e26800091 100644 --- a/dom/webidl/SVGFEFloodElement.webidl +++ b/dom/webidl/SVGFEFloodElement.webidl @@ -13,4 +13,4 @@ interface SVGFEFloodElement : SVGElement { }; -SVGFEFloodElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEFloodElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEGaussianBlurElement.webidl b/dom/webidl/SVGFEGaussianBlurElement.webidl index db2101b53..58e9deea7 100644 --- a/dom/webidl/SVGFEGaussianBlurElement.webidl +++ b/dom/webidl/SVGFEGaussianBlurElement.webidl @@ -21,4 +21,4 @@ interface SVGFEGaussianBlurElement : SVGElement { void setStdDeviation(float stdDeviationX, float stdDeviationY); }; -SVGFEGaussianBlurElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEGaussianBlurElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEImageElement.webidl b/dom/webidl/SVGFEImageElement.webidl index 3262c0d8a..5ef70da3a 100644 --- a/dom/webidl/SVGFEImageElement.webidl +++ b/dom/webidl/SVGFEImageElement.webidl @@ -15,5 +15,5 @@ interface SVGFEImageElement : SVGElement { readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; }; -SVGFEImageElement implements SVGFilterPrimitiveStandardAttributes; -SVGFEImageElement implements SVGURIReference; +SVGFEImageElement includes SVGFilterPrimitiveStandardAttributes; +SVGFEImageElement includes SVGURIReference; diff --git a/dom/webidl/SVGFEMergeElement.webidl b/dom/webidl/SVGFEMergeElement.webidl index adafbba9a..ff1932bb7 100644 --- a/dom/webidl/SVGFEMergeElement.webidl +++ b/dom/webidl/SVGFEMergeElement.webidl @@ -13,4 +13,4 @@ interface SVGFEMergeElement : SVGElement { }; -SVGFEMergeElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEMergeElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEMorphologyElement.webidl b/dom/webidl/SVGFEMorphologyElement.webidl index 82910a6fa..ee28b8a2d 100644 --- a/dom/webidl/SVGFEMorphologyElement.webidl +++ b/dom/webidl/SVGFEMorphologyElement.webidl @@ -27,4 +27,4 @@ interface SVGFEMorphologyElement : SVGElement { readonly attribute SVGAnimatedNumber radiusY; }; -SVGFEMorphologyElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEMorphologyElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFEOffsetElement.webidl b/dom/webidl/SVGFEOffsetElement.webidl index 90132d528..f4921cac5 100644 --- a/dom/webidl/SVGFEOffsetElement.webidl +++ b/dom/webidl/SVGFEOffsetElement.webidl @@ -19,4 +19,4 @@ interface SVGFEOffsetElement : SVGElement { readonly attribute SVGAnimatedNumber dy; }; -SVGFEOffsetElement implements SVGFilterPrimitiveStandardAttributes; +SVGFEOffsetElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFESpecularLightingElement.webidl b/dom/webidl/SVGFESpecularLightingElement.webidl index 42b6b0e9c..ca4852686 100644 --- a/dom/webidl/SVGFESpecularLightingElement.webidl +++ b/dom/webidl/SVGFESpecularLightingElement.webidl @@ -25,4 +25,4 @@ interface SVGFESpecularLightingElement : SVGElement { readonly attribute SVGAnimatedNumber kernelUnitLengthY; }; -SVGFESpecularLightingElement implements SVGFilterPrimitiveStandardAttributes; +SVGFESpecularLightingElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFETileElement.webidl b/dom/webidl/SVGFETileElement.webidl index 38cad6040..42f3f8734 100644 --- a/dom/webidl/SVGFETileElement.webidl +++ b/dom/webidl/SVGFETileElement.webidl @@ -15,4 +15,4 @@ interface SVGFETileElement : SVGElement { readonly attribute SVGAnimatedString in1; }; -SVGFETileElement implements SVGFilterPrimitiveStandardAttributes; +SVGFETileElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFETurbulenceElement.webidl b/dom/webidl/SVGFETurbulenceElement.webidl index 45c9d468b..f12d8c1b8 100644 --- a/dom/webidl/SVGFETurbulenceElement.webidl +++ b/dom/webidl/SVGFETurbulenceElement.webidl @@ -36,4 +36,4 @@ interface SVGFETurbulenceElement : SVGElement { readonly attribute SVGAnimatedEnumeration type; }; -SVGFETurbulenceElement implements SVGFilterPrimitiveStandardAttributes; +SVGFETurbulenceElement includes SVGFilterPrimitiveStandardAttributes; diff --git a/dom/webidl/SVGFilterElement.webidl b/dom/webidl/SVGFilterElement.webidl index aa4d4d196..b7aafeced 100644 --- a/dom/webidl/SVGFilterElement.webidl +++ b/dom/webidl/SVGFilterElement.webidl @@ -27,6 +27,6 @@ interface SVGFilterElement : SVGElement { // ImageData apply(ImageData source); }; -SVGFilterElement implements SVGURIReference; -SVGFilterElement implements SVGUnitTypeValues; +SVGFilterElement includes SVGURIReference; +SVGFilterElement includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl b/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl index 331950586..02fa882d8 100644 --- a/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl +++ b/dom/webidl/SVGFilterPrimitiveStandardAttributes.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGFilterPrimitiveStandardAttributes { +interface mixin SVGFilterPrimitiveStandardAttributes { [Constant] readonly attribute SVGAnimatedLength x; [Constant] diff --git a/dom/webidl/SVGFitToViewBox.webidl b/dom/webidl/SVGFitToViewBox.webidl index 881e658d2..dc92a36ee 100644 --- a/dom/webidl/SVGFitToViewBox.webidl +++ b/dom/webidl/SVGFitToViewBox.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGFitToViewBox { +interface mixin SVGFitToViewBox { [Constant] readonly attribute SVGAnimatedRect viewBox; [Constant] diff --git a/dom/webidl/SVGGradientElement.webidl b/dom/webidl/SVGGradientElement.webidl index e1e969061..8785db949 100644 --- a/dom/webidl/SVGGradientElement.webidl +++ b/dom/webidl/SVGGradientElement.webidl @@ -26,5 +26,5 @@ interface SVGGradientElement : SVGElement { readonly attribute SVGAnimatedEnumeration spreadMethod; }; -SVGGradientElement implements SVGURIReference; -SVGGradientElement implements SVGUnitTypeValues; +SVGGradientElement includes SVGURIReference; +SVGGradientElement includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGGraphicsElement.webidl b/dom/webidl/SVGGraphicsElement.webidl index 74af1f673..c27d7ed51 100644 --- a/dom/webidl/SVGGraphicsElement.webidl +++ b/dom/webidl/SVGGraphicsElement.webidl @@ -33,4 +33,4 @@ interface SVGGraphicsElement : SVGElement { SVGMatrix getTransformToElement(SVGGraphicsElement element); }; -SVGGraphicsElement implements SVGTests; +SVGGraphicsElement includes SVGTests; diff --git a/dom/webidl/SVGImageElement.webidl b/dom/webidl/SVGImageElement.webidl index 67dab60f5..a3c3786cb 100644 --- a/dom/webidl/SVGImageElement.webidl +++ b/dom/webidl/SVGImageElement.webidl @@ -23,6 +23,6 @@ interface SVGImageElement : SVGGraphicsElement { readonly attribute SVGAnimatedPreserveAspectRatio preserveAspectRatio; }; -SVGImageElement implements MozImageLoadingContent; -SVGImageElement implements SVGURIReference; +SVGImageElement includes MozImageLoadingContent; +SVGImageElement includes SVGURIReference; diff --git a/dom/webidl/SVGMPathElement.webidl b/dom/webidl/SVGMPathElement.webidl index 7165b6cf7..f1ca4c3c3 100644 --- a/dom/webidl/SVGMPathElement.webidl +++ b/dom/webidl/SVGMPathElement.webidl @@ -13,5 +13,5 @@ interface SVGMPathElement : SVGElement { }; -SVGMPathElement implements SVGURIReference; +SVGMPathElement includes SVGURIReference; diff --git a/dom/webidl/SVGMarkerElement.webidl b/dom/webidl/SVGMarkerElement.webidl index a4f819b2d..b69c8037a 100644 --- a/dom/webidl/SVGMarkerElement.webidl +++ b/dom/webidl/SVGMarkerElement.webidl @@ -42,5 +42,5 @@ interface SVGMarkerElement : SVGElement { void setOrientToAngle(SVGAngle angle); }; -SVGMarkerElement implements SVGFitToViewBox; +SVGMarkerElement includes SVGFitToViewBox; diff --git a/dom/webidl/SVGMaskElement.webidl b/dom/webidl/SVGMaskElement.webidl index 3b00b0d55..5a9eab050 100644 --- a/dom/webidl/SVGMaskElement.webidl +++ b/dom/webidl/SVGMaskElement.webidl @@ -30,5 +30,5 @@ interface SVGMaskElement : SVGElement { readonly attribute SVGAnimatedLength height; }; -SVGMaskElement implements SVGUnitTypeValues; +SVGMaskElement includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGPathElement.webidl b/dom/webidl/SVGPathElement.webidl index 9732d3cfe..cc6861864 100644 --- a/dom/webidl/SVGPathElement.webidl +++ b/dom/webidl/SVGPathElement.webidl @@ -52,5 +52,5 @@ interface SVGPathElement : SVGGeometryElement { SVGPathSegCurvetoQuadraticSmoothRel createSVGPathSegCurvetoQuadraticSmoothRel(float x, float y); }; -SVGPathElement implements SVGAnimatedPathData; +SVGPathElement includes SVGAnimatedPathData; diff --git a/dom/webidl/SVGPatternElement.webidl b/dom/webidl/SVGPatternElement.webidl index 2a549799e..a18ffebd6 100644 --- a/dom/webidl/SVGPatternElement.webidl +++ b/dom/webidl/SVGPatternElement.webidl @@ -27,6 +27,6 @@ interface SVGPatternElement : SVGElement { readonly attribute SVGAnimatedLength height; }; -SVGPatternElement implements SVGFitToViewBox; -SVGPatternElement implements SVGURIReference; -SVGPatternElement implements SVGUnitTypeValues; +SVGPatternElement includes SVGFitToViewBox; +SVGPatternElement includes SVGURIReference; +SVGPatternElement includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGPolygonElement.webidl b/dom/webidl/SVGPolygonElement.webidl index 6c720c931..d76d8e803 100644 --- a/dom/webidl/SVGPolygonElement.webidl +++ b/dom/webidl/SVGPolygonElement.webidl @@ -13,5 +13,5 @@ interface SVGPolygonElement : SVGGraphicsElement { }; -SVGPolygonElement implements SVGAnimatedPoints; +SVGPolygonElement includes SVGAnimatedPoints; diff --git a/dom/webidl/SVGPolylineElement.webidl b/dom/webidl/SVGPolylineElement.webidl index ca2df3a08..e1cc9f7fa 100644 --- a/dom/webidl/SVGPolylineElement.webidl +++ b/dom/webidl/SVGPolylineElement.webidl @@ -13,5 +13,5 @@ interface SVGPolylineElement : SVGGraphicsElement { }; -SVGPolylineElement implements SVGAnimatedPoints; +SVGPolylineElement includes SVGAnimatedPoints; diff --git a/dom/webidl/SVGSVGElement.webidl b/dom/webidl/SVGSVGElement.webidl index afe63dbb2..0f1488b0f 100644 --- a/dom/webidl/SVGSVGElement.webidl +++ b/dom/webidl/SVGSVGElement.webidl @@ -75,6 +75,6 @@ interface SVGSVGElement : SVGGraphicsElement { Element? getElementById(DOMString elementId); }; -SVGSVGElement implements SVGFitToViewBox; -SVGSVGElement implements SVGZoomAndPanValues; +SVGSVGElement includes SVGFitToViewBox; +SVGSVGElement includes SVGZoomAndPanValues; diff --git a/dom/webidl/SVGScriptElement.webidl b/dom/webidl/SVGScriptElement.webidl index 41bbe065b..d21be8403 100644 --- a/dom/webidl/SVGScriptElement.webidl +++ b/dom/webidl/SVGScriptElement.webidl @@ -19,5 +19,5 @@ interface SVGScriptElement : SVGElement { attribute DOMString? crossOrigin; }; -SVGScriptElement implements SVGURIReference; +SVGScriptElement includes SVGURIReference; diff --git a/dom/webidl/SVGStyleElement.webidl b/dom/webidl/SVGStyleElement.webidl index d66b2ed6e..37e794f21 100644 --- a/dom/webidl/SVGStyleElement.webidl +++ b/dom/webidl/SVGStyleElement.webidl @@ -22,5 +22,5 @@ interface SVGStyleElement : SVGElement { [SetterThrows] attribute boolean scoped; }; -SVGStyleElement implements LinkStyle; +SVGStyleElement includes LinkStyle; diff --git a/dom/webidl/SVGSymbolElement.webidl b/dom/webidl/SVGSymbolElement.webidl index ece2c5a3f..6cd35429c 100644 --- a/dom/webidl/SVGSymbolElement.webidl +++ b/dom/webidl/SVGSymbolElement.webidl @@ -13,5 +13,5 @@ interface SVGSymbolElement : SVGElement { }; -SVGSymbolElement implements SVGFitToViewBox; -SVGSymbolElement implements SVGTests; +SVGSymbolElement includes SVGFitToViewBox; +SVGSymbolElement includes SVGTests; diff --git a/dom/webidl/SVGTests.webidl b/dom/webidl/SVGTests.webidl index e3c38242b..341979e19 100644 --- a/dom/webidl/SVGTests.webidl +++ b/dom/webidl/SVGTests.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGTests { +interface mixin SVGTests { readonly attribute SVGStringList requiredFeatures; readonly attribute SVGStringList requiredExtensions; diff --git a/dom/webidl/SVGTextPathElement.webidl b/dom/webidl/SVGTextPathElement.webidl index 73a50f3ff..27694aaa1 100644 --- a/dom/webidl/SVGTextPathElement.webidl +++ b/dom/webidl/SVGTextPathElement.webidl @@ -30,5 +30,5 @@ interface SVGTextPathElement : SVGTextContentElement { readonly attribute SVGAnimatedEnumeration spacing; }; -SVGTextPathElement implements SVGURIReference; +SVGTextPathElement includes SVGURIReference; diff --git a/dom/webidl/SVGURIReference.webidl b/dom/webidl/SVGURIReference.webidl index 11f94c191..b1f33c407 100644 --- a/dom/webidl/SVGURIReference.webidl +++ b/dom/webidl/SVGURIReference.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGURIReference { +interface mixin SVGURIReference { [Constant] readonly attribute SVGAnimatedString href; }; diff --git a/dom/webidl/SVGUnitTypeValues.webidl b/dom/webidl/SVGUnitTypeValues.webidl index 6a1a33e61..a1b9c25f4 100644 --- a/dom/webidl/SVGUnitTypeValues.webidl +++ b/dom/webidl/SVGUnitTypeValues.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGUnitTypeValues { +interface mixin SVGUnitTypeValues { // Unit Types const unsigned short SVG_UNIT_TYPE_UNKNOWN = 0; const unsigned short SVG_UNIT_TYPE_USERSPACEONUSE = 1; diff --git a/dom/webidl/SVGUnitTypes.webidl b/dom/webidl/SVGUnitTypes.webidl index fc12c1188..6caf9f06d 100644 --- a/dom/webidl/SVGUnitTypes.webidl +++ b/dom/webidl/SVGUnitTypes.webidl @@ -13,4 +13,4 @@ interface SVGUnitTypes { }; -SVGUnitTypes implements SVGUnitTypeValues; +SVGUnitTypes includes SVGUnitTypeValues; diff --git a/dom/webidl/SVGUseElement.webidl b/dom/webidl/SVGUseElement.webidl index 8e7a6fd8c..0443ee6a2 100644 --- a/dom/webidl/SVGUseElement.webidl +++ b/dom/webidl/SVGUseElement.webidl @@ -23,4 +23,4 @@ interface SVGUseElement : SVGGraphicsElement { //readonly attribute SVGElementInstance animatedInstanceRoot; }; -SVGUseElement implements SVGURIReference; +SVGUseElement includes SVGURIReference; diff --git a/dom/webidl/SVGViewElement.webidl b/dom/webidl/SVGViewElement.webidl index 42d988059..ea9900037 100644 --- a/dom/webidl/SVGViewElement.webidl +++ b/dom/webidl/SVGViewElement.webidl @@ -14,6 +14,6 @@ interface SVGViewElement : SVGElement { readonly attribute SVGStringList viewTarget; }; -SVGViewElement implements SVGFitToViewBox; -SVGViewElement implements SVGZoomAndPanValues; +SVGViewElement includes SVGFitToViewBox; +SVGViewElement includes SVGZoomAndPanValues; diff --git a/dom/webidl/SVGZoomAndPan.webidl b/dom/webidl/SVGZoomAndPan.webidl index bb5ee780a..115e7e76b 100644 --- a/dom/webidl/SVGZoomAndPan.webidl +++ b/dom/webidl/SVGZoomAndPan.webidl @@ -13,4 +13,4 @@ interface SVGZoomAndPan { }; -SVGZoomAndPan implements SVGZoomAndPanValues; +SVGZoomAndPan includes SVGZoomAndPanValues; diff --git a/dom/webidl/SVGZoomAndPanValues.webidl b/dom/webidl/SVGZoomAndPanValues.webidl index a09653f0b..832ba9600 100644 --- a/dom/webidl/SVGZoomAndPanValues.webidl +++ b/dom/webidl/SVGZoomAndPanValues.webidl @@ -10,8 +10,7 @@ * liability, trademark and document use rules apply. */ -[NoInterfaceObject] -interface SVGZoomAndPanValues { +interface mixin SVGZoomAndPanValues { // Zoom and Pan Types const unsigned short SVG_ZOOMANDPAN_UNKNOWN = 0; diff --git a/dom/webidl/ScriptProcessorNode.webidl b/dom/webidl/ScriptProcessorNode.webidl index 81c02443f..7063ad820 100644 --- a/dom/webidl/ScriptProcessorNode.webidl +++ b/dom/webidl/ScriptProcessorNode.webidl @@ -20,5 +20,5 @@ interface ScriptProcessorNode : AudioNode { }; // Mozilla extension -ScriptProcessorNode implements AudioNodePassThrough; +ScriptProcessorNode includes AudioNodePassThrough; diff --git a/dom/webidl/ServiceWorker.webidl b/dom/webidl/ServiceWorker.webidl index ff80fafc2..e4ccf0c66 100644 --- a/dom/webidl/ServiceWorker.webidl +++ b/dom/webidl/ServiceWorker.webidl @@ -25,7 +25,7 @@ interface ServiceWorker : EventTarget { void postMessage(any message, optional StructuredSerializeOptions options); }; -ServiceWorker implements AbstractWorker; +ServiceWorker includes AbstractWorker; enum ServiceWorkerState { "installing", diff --git a/dom/webidl/ServiceWorkerGlobalScope.webidl b/dom/webidl/ServiceWorkerGlobalScope.webidl index b59bf0aa0..76e47230e 100644 --- a/dom/webidl/ServiceWorkerGlobalScope.webidl +++ b/dom/webidl/ServiceWorkerGlobalScope.webidl @@ -5,6 +5,8 @@ * * The origin of this IDL file is * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html + * http://w3c.github.io/push-api/ + * https://notifications.spec.whatwg.org/ * * You are granted a license to use, reproduce and create derivative works of * this document. @@ -34,3 +36,8 @@ partial interface ServiceWorkerGlobalScope { attribute EventHandler onpushsubscriptionchange; }; +// https://notifications.spec.whatwg.org/ +partial interface ServiceWorkerGlobalScope { + attribute EventHandler onnotificationclick; + attribute EventHandler onnotificationclose; +}; diff --git a/dom/webidl/ServiceWorkerRegistration.webidl b/dom/webidl/ServiceWorkerRegistration.webidl index 04d0af3f4..f00126667 100644 --- a/dom/webidl/ServiceWorkerRegistration.webidl +++ b/dom/webidl/ServiceWorkerRegistration.webidl @@ -5,7 +5,8 @@ * * The origin of this IDL file is * http://slightlyoff.github.io/ServiceWorker/spec/service_worker/index.html - * + * https://w3c.github.io/push-api/ + * https://notifications.spec.whatwg.org/ */ [Func="mozilla::dom::ServiceWorkerRegistration::Visible", @@ -27,7 +28,16 @@ interface ServiceWorkerRegistration : EventTarget { attribute EventHandler onupdatefound; }; +// https://w3c.github.io/push-api/ partial interface ServiceWorkerRegistration { [Throws, Exposed=(Window,Worker), Func="nsContentUtils::PushEnabled"] readonly attribute PushManager pushManager; }; + +// https://notifications.spec.whatwg.org/ +partial interface ServiceWorkerRegistration { + [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"] + Promise showNotification(DOMString title, optional NotificationOptions options); + [Throws, Func="mozilla::dom::ServiceWorkerRegistration::NotificationAPIVisible"] + Promise> getNotifications(optional GetNotificationOptions filter); +}; diff --git a/dom/webidl/ShadowRoot.webidl b/dom/webidl/ShadowRoot.webidl index 388f8e150..de99332d6 100644 --- a/dom/webidl/ShadowRoot.webidl +++ b/dom/webidl/ShadowRoot.webidl @@ -29,7 +29,8 @@ interface ShadowRoot : DocumentFragment HTMLCollection getElementsByTagName(DOMString localName); HTMLCollection getElementsByTagNameNS(DOMString? namespace, DOMString localName); HTMLCollection getElementsByClassName(DOMString classNames); - [CEReactions, SetterThrows, TreatNullAs=EmptyString] - attribute DOMString innerHTML; + [CEReactions, SetterThrows] + attribute [TreatNullAs=EmptyString] DOMString innerHTML; }; +ShadowRoot includes DocumentOrShadowRoot; diff --git a/dom/webidl/SharedWorker.webidl b/dom/webidl/SharedWorker.webidl index 042fa4af9..afab65f18 100644 --- a/dom/webidl/SharedWorker.webidl +++ b/dom/webidl/SharedWorker.webidl @@ -9,4 +9,4 @@ interface SharedWorker : EventTarget { readonly attribute MessagePort port; }; -SharedWorker implements AbstractWorker; +SharedWorker includes AbstractWorker; diff --git a/dom/webidl/StereoPannerNode.webidl b/dom/webidl/StereoPannerNode.webidl index 9b8b3e2f8..616cd5ce1 100644 --- a/dom/webidl/StereoPannerNode.webidl +++ b/dom/webidl/StereoPannerNode.webidl @@ -21,5 +21,5 @@ interface StereoPannerNode : AudioNode { }; // Mozilla extension -StereoPannerNode implements AudioNodePassThrough; +StereoPannerNode includes AudioNodePassThrough; diff --git a/dom/webidl/SubtleCrypto.webidl b/dom/webidl/SubtleCrypto.webidl index 328447ee7..98e6bf090 100644 --- a/dom/webidl/SubtleCrypto.webidl +++ b/dom/webidl/SubtleCrypto.webidl @@ -24,7 +24,7 @@ dictionary AesCbcParams : Algorithm { dictionary AesCtrParams : Algorithm { required BufferSource counter; - [EnforceRange] required octet length; + required [EnforceRange] octet length; }; dictionary AesGcmParams : Algorithm { @@ -39,7 +39,7 @@ dictionary HmacImportParams : Algorithm { dictionary Pbkdf2Params : Algorithm { required BufferSource salt; - [EnforceRange] required unsigned long iterations; + required [EnforceRange] unsigned long iterations; required AlgorithmIdentifier hash; }; @@ -48,7 +48,7 @@ dictionary RsaHashedImportParams { }; dictionary AesKeyGenParams : Algorithm { - [EnforceRange] required unsigned short length; + required [EnforceRange] unsigned short length; }; dictionary HmacKeyGenParams : Algorithm { @@ -57,7 +57,7 @@ dictionary HmacKeyGenParams : Algorithm { }; dictionary RsaHashedKeyGenParams : Algorithm { - [EnforceRange] required unsigned long modulusLength; + required [EnforceRange] unsigned long modulusLength; required BigInteger publicExponent; required AlgorithmIdentifier hash; }; @@ -67,7 +67,7 @@ dictionary RsaOaepParams : Algorithm { }; dictionary RsaPssParams : Algorithm { - [EnforceRange] required unsigned long saltLength; + required [EnforceRange] unsigned long saltLength; }; dictionary DhKeyGenParams : Algorithm { @@ -80,7 +80,7 @@ dictionary EcKeyGenParams : Algorithm { }; dictionary AesDerivedKeyParams : Algorithm { - [EnforceRange] required unsigned long length; + required [EnforceRange] unsigned long length; }; dictionary HmacDerivedKeyParams : HmacImportParams { diff --git a/dom/webidl/Text.webidl b/dom/webidl/Text.webidl index fb7b5d685..4eab4771e 100644 --- a/dom/webidl/Text.webidl +++ b/dom/webidl/Text.webidl @@ -23,4 +23,4 @@ partial interface Text { readonly attribute HTMLSlotElement? assignedSlot; }; -Text implements GeometryUtils; +Text includes GeometryUtils; diff --git a/dom/webidl/U2F.webidl b/dom/webidl/U2F.webidl index 961b7a723..69b0e5421 100644 --- a/dom/webidl/U2F.webidl +++ b/dom/webidl/U2F.webidl @@ -10,8 +10,7 @@ * https://fidoalliance.org/specs/fido-u2f-v1.0-nfc-bt-amendment-20150514/fido-u2f-javascript-api.html */ -[NoInterfaceObject] -interface GlobalU2F { +interface mixin GlobalU2F { [Throws, Pref="security.webauth.u2f"] readonly attribute U2F u2f; }; diff --git a/dom/webidl/WaveShaperNode.webidl b/dom/webidl/WaveShaperNode.webidl index 0bea44c8c..59fdc9336 100644 --- a/dom/webidl/WaveShaperNode.webidl +++ b/dom/webidl/WaveShaperNode.webidl @@ -32,5 +32,5 @@ interface WaveShaperNode : AudioNode { }; // Mozilla extension -WaveShaperNode implements AudioNodePassThrough; +WaveShaperNode includes AudioNodePassThrough; diff --git a/dom/webidl/WebGL2RenderingContext.webidl b/dom/webidl/WebGL2RenderingContext.webidl index 34c71a65d..d025ea98f 100644 --- a/dom/webidl/WebGL2RenderingContext.webidl +++ b/dom/webidl/WebGL2RenderingContext.webidl @@ -31,8 +31,7 @@ interface WebGL2RenderingContext { }; -[NoInterfaceObject] -interface WebGL2RenderingContextBase +interface mixin WebGL2RenderingContextBase { const GLenum READ_BUFFER = 0x0C02; const GLenum UNPACK_ROW_LENGTH = 0x0CF2; @@ -693,8 +692,8 @@ interface WebGL2RenderingContextBase void bindVertexArray(WebGLVertexArrayObject? array); }; -WebGL2RenderingContextBase implements WebGLRenderingContextBase; -WebGL2RenderingContext implements WebGL2RenderingContextBase; +WebGL2RenderingContext includes WebGLRenderingContextBase; +WebGL2RenderingContext includes WebGL2RenderingContextBase; [NoInterfaceObject] interface EXT_color_buffer_float { diff --git a/dom/webidl/WebGLRenderingContext.webidl b/dom/webidl/WebGLRenderingContext.webidl index 2fa09571c..b3d7126c3 100644 --- a/dom/webidl/WebGLRenderingContext.webidl +++ b/dom/webidl/WebGLRenderingContext.webidl @@ -105,9 +105,9 @@ typedef (Int32Array or sequence) Int32List; // Shared interface for the things that WebGLRenderingContext and // WebGL2RenderingContext have in common. This doesn't have all the things they // have in common, because we don't support splitting multiple overloads of the -// same method across separate interfaces and pulling them in with "implements". -[Exposed=(Window, Worker), NoInterfaceObject] -interface WebGLRenderingContextBase { +// same method across separate interfaces and pulling them in with "includes". +[Exposed=(Window, Worker)] +interface mixin WebGLRenderingContextBase { /* ClearBufferMask */ const GLenum DEPTH_BUFFER_BIT = 0x00000100; const GLenum STENCIL_BUFFER_BIT = 0x00000400; @@ -797,7 +797,7 @@ interface WebGLRenderingContext { void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose, Float32List data); }; -WebGLRenderingContext implements WebGLRenderingContextBase; +WebGLRenderingContext includes WebGLRenderingContextBase; // For OffscreenCanvas // Reference: https://wiki.whatwg.org/wiki/OffscreenCanvas diff --git a/dom/webidl/WebSocket.webidl b/dom/webidl/WebSocket.webidl index 492e366ba..eed40d790 100644 --- a/dom/webidl/WebSocket.webidl +++ b/dom/webidl/WebSocket.webidl @@ -43,7 +43,7 @@ interface WebSocket : EventTarget { readonly attribute DOMString protocol; [Throws] - void close([Clamp] optional unsigned short code, optional DOMString reason); + void close(optional [Clamp] unsigned short code, optional DOMString reason); // messaging diff --git a/dom/webidl/Window.webidl b/dom/webidl/Window.webidl index b500faba9..0eba49671 100644 --- a/dom/webidl/Window.webidl +++ b/dom/webidl/Window.webidl @@ -65,7 +65,7 @@ interface nsIDOMCrypto; [Replaceable, Throws, CrossOriginReadable] readonly attribute WindowProxy? parent; [Throws, NeedsSubjectPrincipal] readonly attribute Element? frameElement; //[Throws] WindowProxy? open(optional USVString url = "about:blank", optional DOMString target = "_blank", [TreatNullAs=EmptyString] optional DOMString features = ""); - [Throws, UnsafeInPrerendering] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", [TreatNullAs=EmptyString] optional DOMString features = ""); + [Throws] WindowProxy? open(optional DOMString url = "", optional DOMString target = "", optional [TreatNullAs=EmptyString] DOMString features = ""); getter object (DOMString name); // the user agent @@ -92,8 +92,8 @@ interface nsIDOMCrypto; // also has obsolete members }; -Window implements GlobalEventHandlers; -Window implements WindowEventHandlers; +Window includes GlobalEventHandlers; +Window includes WindowEventHandlers; // https://www.w3.org/TR/appmanifest/#onappinstalled-attribute partial interface Window { @@ -102,19 +102,17 @@ partial interface Window { }; // http://www.whatwg.org/specs/web-apps/current-work/ -[NoInterfaceObject] -interface WindowSessionStorage { +interface mixin WindowSessionStorage { //[Throws] readonly attribute Storage sessionStorage; [Throws] readonly attribute Storage? sessionStorage; }; -Window implements WindowSessionStorage; +Window includes WindowSessionStorage; // http://www.whatwg.org/specs/web-apps/current-work/ -[NoInterfaceObject] -interface WindowLocalStorage { +interface mixin WindowLocalStorage { [Throws] readonly attribute Storage? localStorage; }; -Window implements WindowLocalStorage; +Window includes WindowLocalStorage; // http://www.whatwg.org/specs/web-apps/current-work/ partial interface Window { @@ -230,19 +228,18 @@ partial interface Window { }; // https://dvcs.w3.org/hg/webcrypto-api/raw-file/tip/spec/Overview.html -Window implements GlobalCrypto; +Window includes GlobalCrypto; // https://fidoalliance.org/specifications/download/ -Window implements GlobalU2F; +Window includes GlobalU2F; #ifdef MOZ_WEBSPEECH // http://dvcs.w3.org/hg/speech-api/raw-file/tip/speechapi.html -[NoInterfaceObject] -interface SpeechSynthesisGetter { +interface mixin SpeechSynthesisGetter { [Throws, Pref="media.webspeech.synth.enabled"] readonly attribute SpeechSynthesis speechSynthesis; }; -Window implements SpeechSynthesisGetter; +Window includes SpeechSynthesisGetter; #endif // http://www.whatwg.org/specs/web-apps/current-work/ @@ -380,9 +377,9 @@ partial interface Window { readonly attribute WindowRoot? windowRoot; }; -Window implements TouchEventHandlers; +Window includes TouchEventHandlers; -Window implements OnErrorEventHandlerForWindow; +Window includes OnErrorEventHandlerForWindow; #if defined(MOZ_WIDGET_ANDROID) || defined(MOZ_WIDGET_GONK) // https://compat.spec.whatwg.org/#windoworientation-interface @@ -492,7 +489,7 @@ partial interface Window { }; Window implements ChromeWindow; -Window implements WindowOrWorkerGlobalScope; +Window includes WindowOrWorkerGlobalScope; partial interface Window { [Throws, Pref="dom.requestIdleCallback.enabled"] diff --git a/dom/webidl/WindowOrWorkerGlobalScope.webidl b/dom/webidl/WindowOrWorkerGlobalScope.webidl index 2989bc15c..1611021e5 100644 --- a/dom/webidl/WindowOrWorkerGlobalScope.webidl +++ b/dom/webidl/WindowOrWorkerGlobalScope.webidl @@ -11,8 +11,8 @@ */ // https://html.spec.whatwg.org/multipage/webappapis.html#windoworworkerglobalscope-mixin -[NoInterfaceObject, Exposed=(Window,Worker)] -interface WindowOrWorkerGlobalScope { +[Exposed=(Window,Worker)] +interface mixin WindowOrWorkerGlobalScope { // .origin on Window or Worker globals [Replaceable] readonly attribute USVString origin; @@ -51,24 +51,25 @@ interface WindowOrWorkerGlobalScope { }; // https://fetch.spec.whatwg.org/#fetch-method -partial interface WindowOrWorkerGlobalScope { - [NewObject] Promise fetch(RequestInfo input, optional RequestInit init); +partial interface mixin WindowOrWorkerGlobalScope { + [NewObject, NeedsCallerType] + Promise fetch(RequestInfo input, optional RequestInit init); }; // https://w3c.github.io/webappsec-secure-contexts/#monkey-patching-global-object -partial interface WindowOrWorkerGlobalScope { +partial interface mixin WindowOrWorkerGlobalScope { readonly attribute boolean isSecureContext; }; // http://w3c.github.io/IndexedDB/#factory-interface -partial interface WindowOrWorkerGlobalScope { +partial interface mixin WindowOrWorkerGlobalScope { // readonly attribute IDBFactory indexedDB; [Throws] readonly attribute IDBFactory? indexedDB; }; // https://w3c.github.io/ServiceWorker/#self-caches -partial interface WindowOrWorkerGlobalScope { +partial interface mixin WindowOrWorkerGlobalScope { [Throws, Func="mozilla::dom::cache::CacheStorage::PrefEnabled", SameObject] readonly attribute CacheStorage caches; }; diff --git a/dom/webidl/Worker.webidl b/dom/webidl/Worker.webidl index c13357cd7..423a57214 100644 --- a/dom/webidl/Worker.webidl +++ b/dom/webidl/Worker.webidl @@ -26,7 +26,7 @@ interface Worker : EventTarget { attribute EventHandler onmessage; }; -Worker implements AbstractWorker; +Worker includes AbstractWorker; [Constructor(DOMString scriptURL), Func="mozilla::dom::workers::ChromeWorkerPrivate::WorkerAvailable", diff --git a/dom/webidl/WorkerGlobalScope.webidl b/dom/webidl/WorkerGlobalScope.webidl index 7afba6c36..239a0c072 100644 --- a/dom/webidl/WorkerGlobalScope.webidl +++ b/dom/webidl/WorkerGlobalScope.webidl @@ -37,8 +37,8 @@ partial interface WorkerGlobalScope { readonly attribute WorkerNavigator navigator; }; -WorkerGlobalScope implements GlobalCrypto; -WorkerGlobalScope implements WindowOrWorkerGlobalScope; +WorkerGlobalScope includes GlobalCrypto; +WorkerGlobalScope includes WindowOrWorkerGlobalScope; // Not implemented yet: bug 1072107. // WorkerGlobalScope implements FontFaceSource; diff --git a/dom/webidl/WorkerNavigator.webidl b/dom/webidl/WorkerNavigator.webidl index 52a0ac055..7b0f585d5 100644 --- a/dom/webidl/WorkerNavigator.webidl +++ b/dom/webidl/WorkerNavigator.webidl @@ -7,12 +7,12 @@ interface WorkerNavigator { }; -WorkerNavigator implements NavigatorID; -WorkerNavigator implements NavigatorLanguage; -WorkerNavigator implements NavigatorOnLine; -WorkerNavigator implements NavigatorConcurrentHardware; -WorkerNavigator implements NavigatorStorage; -WorkerNavigator implements NavigatorGlobalPrivacyControl; +WorkerNavigator includes NavigatorID; +WorkerNavigator includes NavigatorLanguage; +WorkerNavigator includes NavigatorOnLine; +WorkerNavigator includes NavigatorConcurrentHardware; +WorkerNavigator includes NavigatorStorage; +WorkerNavigator includes NavigatorGlobalPrivacyControl; // http://wicg.github.io/netinfo/#extensions-to-the-navigator-interface [Exposed=(Worker)] diff --git a/dom/webidl/Worklet.webidl b/dom/webidl/Worklet.webidl index 7f003779f..c6923fa89 100644 --- a/dom/webidl/Worklet.webidl +++ b/dom/webidl/Worklet.webidl @@ -9,6 +9,6 @@ [Pref="dom.worklet.enabled"] interface Worklet { - [NewObject, Throws] + [NewObject, Throws, NeedsCallerType] Promise import(USVString moduleURL); }; diff --git a/dom/webidl/XPathEvaluator.webidl b/dom/webidl/XPathEvaluator.webidl index 9e5cc7574..85315186b 100644 --- a/dom/webidl/XPathEvaluator.webidl +++ b/dom/webidl/XPathEvaluator.webidl @@ -6,6 +6,10 @@ [Constructor] interface XPathEvaluator { +}; +XPathEvaluator includes XPathEvaluatorMixin; + +interface mixin XPathEvaluatorMixin { // Based on nsIDOMXPathEvaluator [NewObject, Throws] XPathExpression createExpression(DOMString expression, diff --git a/dom/webidl/XULElement.webidl b/dom/webidl/XULElement.webidl index 5e1b67758..f03de5fea 100644 --- a/dom/webidl/XULElement.webidl +++ b/dom/webidl/XULElement.webidl @@ -93,10 +93,6 @@ interface XULElement : Element { [Throws] readonly attribute BoxObject? boxObject; - [Throws] - void focus(); - [Throws] - void blur(); [NeedsCallerType] void click(); void doCommand(); @@ -109,13 +105,10 @@ interface XULElement : Element { NodeList getElementsByAttributeNS(DOMString namespaceURI, DOMString name, DOMString value); - [Constant] - readonly attribute CSSStyleDeclaration style; }; // And the things from nsIFrameLoaderOwner -[NoInterfaceObject] -interface MozFrameLoaderOwner { +interface mixin MozFrameLoaderOwner { [ChromeOnly] readonly attribute MozFrameLoader? frameLoader; @@ -132,7 +125,9 @@ interface MozFrameLoaderOwner { void swapFrameLoaders(HTMLIFrameElement aOtherLoaderOwner); }; -XULElement implements GlobalEventHandlers; -XULElement implements TouchEventHandlers; -XULElement implements MozFrameLoaderOwner; -XULElement implements OnErrorEventHandlerForNodes; +XULElement includes GlobalEventHandlers; +XULElement includes ElementCSSInlineStyle; +XULElement includes HTMLOrForeignElement; +XULElement includes TouchEventHandlers; +XULElement includes MozFrameLoaderOwner; +XULElement includes OnErrorEventHandlerForNodes; diff --git a/dom/webidl/moz.build b/dom/webidl/moz.build index da49468f6..da3d2a4b4 100644 --- a/dom/webidl/moz.build +++ b/dom/webidl/moz.build @@ -307,6 +307,7 @@ WEBIDL_FILES = [ 'ListBoxObject.webidl', 'LocalMediaStream.webidl', 'Location.webidl', + 'MathMLElement.webidl', 'MediaDeviceInfo.webidl', 'MediaDevices.webidl', 'MediaElementAudioSourceNode.webidl', diff --git a/dom/workers/WorkerScope.cpp b/dom/workers/WorkerScope.cpp index 8198529ab..adf1fba09 100644 --- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -409,10 +409,10 @@ WorkerGlobalScope::GetPerformance() } already_AddRefed -WorkerGlobalScope::Fetch(const RequestOrUSVString& aInput, - const RequestInit& aInit, ErrorResult& aRv) +WorkerGlobalScope::Fetch(const RequestOrUSVString& aInput, const RequestInit& aInit, + CallerType aCallerType, ErrorResult& aRv) { - return FetchRequest(this, aInput, aInit, aRv); + return FetchRequest(this, aInput, aInit, aCallerType, aRv); } already_AddRefed diff --git a/dom/workers/WorkerScope.h b/dom/workers/WorkerScope.h index 896ceef32..3409e9e42 100644 --- a/dom/workers/WorkerScope.h +++ b/dom/workers/WorkerScope.h @@ -31,6 +31,7 @@ class RequestOrUSVString; class ServiceWorkerRegistration; class WorkerLocation; class WorkerNavigator; +enum class CallerType : uint32_t; namespace cache { @@ -166,7 +167,8 @@ public: } already_AddRefed - Fetch(const RequestOrUSVString& aInput, const RequestInit& aInit, ErrorResult& aRv); + Fetch(const RequestOrUSVString& aInput, const RequestInit& aInit, + CallerType aCallerType, ErrorResult& aRv); already_AddRefed GetIndexedDB(ErrorResult& aErrorResult); diff --git a/dom/worklet/Worklet.cpp b/dom/worklet/Worklet.cpp index 1721f74bf..d69378d30 100644 --- a/dom/worklet/Worklet.cpp +++ b/dom/worklet/Worklet.cpp @@ -35,7 +35,8 @@ public: NS_DECL_ISUPPORTS static already_AddRefed - Fetch(Worklet* aWorklet, const nsAString& aModuleURL, ErrorResult& aRv) + Fetch(Worklet* aWorklet, const nsAString& aModuleURL, CallerType aCallerType, + ErrorResult& aRv) { MOZ_ASSERT(aWorklet); @@ -87,7 +88,8 @@ public: RequestInit init; - RefPtr fetchPromise = FetchRequest(global, request, init, aRv); + RefPtr fetchPromise = + FetchRequest(global, request, init, aCallerType, aRv); if (NS_WARN_IF(aRv.Failed())) { promise->MaybeReject(aRv); return promise.forget(); @@ -349,9 +351,10 @@ Worklet::WrapObject(JSContext* aCx, JS::Handle aGivenProto) } already_AddRefed -Worklet::Import(const nsAString& aModuleURL, ErrorResult& aRv) +Worklet::Import(const nsAString& aModuleURL, CallerType aCallerType, + ErrorResult& aRv) { - return WorkletFetchHandler::Fetch(this, aModuleURL, aRv); + return WorkletFetchHandler::Fetch(this, aModuleURL, aCallerType, aRv); } WorkletGlobalScope* diff --git a/dom/worklet/Worklet.h b/dom/worklet/Worklet.h index 48e03eca7..50e4fec9e 100644 --- a/dom/worklet/Worklet.h +++ b/dom/worklet/Worklet.h @@ -22,6 +22,7 @@ namespace dom { class Promise; class WorkletGlobalScope; class WorkletFetchHandler; +enum class CallerType : uint32_t; class Worklet final : public nsISupports , public nsWrapperCache @@ -47,7 +48,8 @@ public: WrapObject(JSContext* aCx, JS::Handle aGivenProto) override; already_AddRefed - Import(const nsAString& aModuleURL, ErrorResult& aRv); + Import(const nsAString& aModuleURL, CallerType aCallerType, + ErrorResult& aRv); WorkletGlobalScope* GetOrCreateGlobalScope(JSContext* aCx); diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 76382f979..8ce3c7188 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -289,9 +289,12 @@ SandboxFetch(JSContext* cx, JS::HandleObject scope, const CallArgs& args) if (!global) { return false; } + dom::CallerType callerType = nsContentUtils::IsSystemCaller(cx) ? + dom::CallerType::System : dom::CallerType::NonSystem; ErrorResult rv; RefPtr response = - FetchRequest(global, Constify(request), Constify(options), rv); + FetchRequest(global, Constify(request), Constify(options), + callerType, rv); if (rv.MaybeSetPendingException(cx)) { return false; } diff --git a/layout/forms/nsNumberControlFrame.cpp b/layout/forms/nsNumberControlFrame.cpp index 32b1900d6..173b71f97 100644 --- a/layout/forms/nsNumberControlFrame.cpp +++ b/layout/forms/nsNumberControlFrame.cpp @@ -308,7 +308,11 @@ public: NS_IMETHOD Run() override { if (mNumber->AsElement()->State().HasState(NS_EVENT_STATE_FOCUS)) { - HTMLInputElement::FromContent(mTextField)->Focus(); + // This job shouldn't be triggered by a WebIDL interface, hence the + // default options can be used. + FocusOptions options; + ErrorResult rv; + HTMLInputElement::FromContent(mTextField)->Focus(options, rv); } return NS_OK; @@ -595,7 +599,11 @@ nsNumberControlFrame::HandleFocusEvent(WidgetEvent* aEvent) if (aEvent->mOriginalTarget != mTextField) { // Move focus to our text field RefPtr textField = HTMLInputElement::FromContent(mTextField); - textField->Focus(); + // Use default FocusOptions, because this method isn't supposed to be called + // from a WebIDL interface. + FocusOptions options; + ErrorResult rv; + textField->Focus(options, rv); } } diff --git a/layout/mathml/mathml.css b/layout/mathml/mathml.css index 44a4c31c9..cac0b1dea 100644 --- a/layout/mathml/mathml.css +++ b/layout/mathml/mathml.css @@ -62,17 +62,22 @@ ms[rquote]:after { } /**************************************************************************/ -/* Links */ +/* Links and focusable elements */ /**************************************************************************/ :any-link { text-decoration: none !important; } +*:-moz-focusring { + /* Don't specify the outline-color, we should always use initial value. */ + outline: 1px dotted; +} + /**************************************************************************/ /* attributes common to all tags */ /**************************************************************************/ -/* These attributes are mapped to style in nsMathMLElement.cpp: +/* These attributes are mapped to style in MathMLElement.cpp: - background -> background (deprecated) - color -> color (deprecated) diff --git a/layout/mathml/nsMathMLContainerFrame.cpp b/layout/mathml/nsMathMLContainerFrame.cpp index bd2eb3652..64993ee55 100644 --- a/layout/mathml/nsMathMLContainerFrame.cpp +++ b/layout/mathml/nsMathMLContainerFrame.cpp @@ -20,7 +20,7 @@ #include "mozilla/Likely.h" #include "nsIScriptError.h" #include "nsContentUtils.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" using namespace mozilla; using namespace mozilla::gfx; @@ -1337,7 +1337,7 @@ nsMathMLContainerFrame::SetIncrementScriptLevel(int32_t aChildIndex, bool aIncre nsIContent* content = child->GetContent(); if (!content->IsMathMLElement()) return; - nsMathMLElement* element = static_cast(content); + mozilla::dom::MathMLElement* element = static_cast(content); if (element->GetIncrementScriptLevel() == aIncrement) return; diff --git a/layout/mathml/nsMathMLFrame.cpp b/layout/mathml/nsMathMLFrame.cpp index f927e2a01..8f8ebf614 100644 --- a/layout/mathml/nsMathMLFrame.cpp +++ b/layout/mathml/nsMathMLFrame.cpp @@ -11,7 +11,7 @@ #include "nsNameSpaceManager.h" #include "nsMathMLChar.h" #include "nsCSSPseudoElements.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include "gfxMathTable.h" // used to map attributes into CSS rules @@ -253,8 +253,8 @@ nsMathMLFrame::ParseNumericValue(const nsString& aString, { nsCSSValue cssValue; - if (!nsMathMLElement::ParseNumericValue(aString, cssValue, aFlags, - aPresContext->Document())) { + if (!dom::MathMLElement::ParseNumericValue(aString, cssValue, aFlags, + aPresContext->Document())) { // Invalid attribute value. aLengthValue remains unchanged, so the default // length value is used. return; diff --git a/layout/mathml/nsMathMLmfracFrame.cpp b/layout/mathml/nsMathMLmfracFrame.cpp index 61ef8ba55..6ba39a93a 100644 --- a/layout/mathml/nsMathMLmfracFrame.cpp +++ b/layout/mathml/nsMathMLmfracFrame.cpp @@ -14,7 +14,7 @@ #include "nsRenderingContext.h" #include "nsDisplayList.h" #include "gfxContext.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include #include "gfxMathTable.h" @@ -135,7 +135,7 @@ nsMathMLmfracFrame::CalcLineThickness(nsPresContext* aPresContext, // length value lineThickness = defaultThickness; ParseNumericValue(aThicknessAttribute, &lineThickness, - nsMathMLElement::PARSE_ALLOW_UNITLESS, + dom::MathMLElement::PARSE_ALLOW_UNITLESS, aPresContext, aStyleContext, aFontSizeInflation); } } diff --git a/layout/mathml/nsMathMLmoFrame.cpp b/layout/mathml/nsMathMLmoFrame.cpp index 3ef7b88d0..1607118f9 100644 --- a/layout/mathml/nsMathMLmoFrame.cpp +++ b/layout/mathml/nsMathMLmoFrame.cpp @@ -8,7 +8,7 @@ #include "nsRenderingContext.h" #include "nsContentUtils.h" #include "nsFrameSelection.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include // @@ -398,8 +398,8 @@ nsMathMLmoFrame::ProcessOperatorData() mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::lspace_, value); if (!value.IsEmpty()) { nsCSSValue cssValue; - if (nsMathMLElement::ParseNumericValue(value, cssValue, 0, - mContent->OwnerDoc())) { + if (dom::MathMLElement::ParseNumericValue(value, cssValue, 0, + mContent->OwnerDoc())) { if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue()) leadingSpace = 0; else if (cssValue.IsLengthUnit()) @@ -425,8 +425,8 @@ nsMathMLmoFrame::ProcessOperatorData() mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::rspace_, value); if (!value.IsEmpty()) { nsCSSValue cssValue; - if (nsMathMLElement::ParseNumericValue(value, cssValue, 0, - mContent->OwnerDoc())) { + if (dom::MathMLElement::ParseNumericValue(value, cssValue, 0, + mContent->OwnerDoc())) { if ((eCSSUnit_Number == cssValue.GetUnit()) && !cssValue.GetFloatValue()) trailingSpace = 0; else if (cssValue.IsLengthUnit()) @@ -509,10 +509,9 @@ nsMathMLmoFrame::ProcessOperatorData() mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::minsize_, value); if (!value.IsEmpty()) { nsCSSValue cssValue; - if (nsMathMLElement::ParseNumericValue(value, cssValue, - nsMathMLElement:: - PARSE_ALLOW_UNITLESS, - mContent->OwnerDoc())) { + if (dom::MathMLElement::ParseNumericValue(value, cssValue, + dom::MathMLElement::PARSE_ALLOW_UNITLESS, + mContent->OwnerDoc())) { nsCSSUnit unit = cssValue.GetUnit(); if (eCSSUnit_Number == unit) mMinSize = cssValue.GetFloatValue(); @@ -542,10 +541,9 @@ nsMathMLmoFrame::ProcessOperatorData() mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::maxsize_, value); if (!value.IsEmpty()) { nsCSSValue cssValue; - if (nsMathMLElement::ParseNumericValue(value, cssValue, - nsMathMLElement:: - PARSE_ALLOW_UNITLESS, - mContent->OwnerDoc())) { + if (dom::MathMLElement::ParseNumericValue(value, cssValue, + dom::MathMLElement::PARSE_ALLOW_UNITLESS, + mContent->OwnerDoc())) { nsCSSUnit unit = cssValue.GetUnit(); if (eCSSUnit_Number == unit) mMaxSize = cssValue.GetFloatValue(); diff --git a/layout/mathml/nsMathMLmpaddedFrame.cpp b/layout/mathml/nsMathMLmpaddedFrame.cpp index 5b2e8282f..62739aedc 100644 --- a/layout/mathml/nsMathMLmpaddedFrame.cpp +++ b/layout/mathml/nsMathMLmpaddedFrame.cpp @@ -5,7 +5,7 @@ #include "nsMathMLmpaddedFrame.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include "mozilla/gfx/2D.h" #include @@ -211,9 +211,8 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, else if (!gotPercent) { // percentage can only apply to a pseudo-unit // see if the unit is a named-space - if (nsMathMLElement::ParseNamedSpaceValue(unit, aCSSValue, - nsMathMLElement:: - PARSE_ALLOW_NEGATIVE)) { + if (dom::MathMLElement::ParseNamedSpaceValue(unit, aCSSValue, + dom::MathMLElement::PARSE_ALLOW_NEGATIVE)) { // re-scale properly, and we know that the unit of the named-space is 'em' floatValue *= aCSSValue.GetFloatValue(); aCSSValue.SetFloatValue(floatValue, eCSSUnit_EM); @@ -225,9 +224,9 @@ nsMathMLmpaddedFrame::ParseAttribute(nsString& aString, // We are not supposed to have a unitless, percent, negative or namedspace // value here. number.Append(unit); // leave the sign out if it was there - if (nsMathMLElement::ParseNumericValue(number, aCSSValue, - nsMathMLElement:: - PARSE_SUPPRESS_WARNINGS, nullptr)) + if (dom::MathMLElement::ParseNumericValue(number, aCSSValue, + dom::MathMLElement::PARSE_SUPPRESS_WARNINGS, + nullptr)) return true; } diff --git a/layout/mathml/nsMathMLmspaceFrame.cpp b/layout/mathml/nsMathMLmspaceFrame.cpp index 54f2f325a..c3e2c5b21 100644 --- a/layout/mathml/nsMathMLmspaceFrame.cpp +++ b/layout/mathml/nsMathMLmspaceFrame.cpp @@ -4,7 +4,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "nsMathMLmspaceFrame.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include "mozilla/gfx/2D.h" #include @@ -53,7 +53,7 @@ nsMathMLmspaceFrame::ProcessAttributes(nsPresContext* aPresContext) mContent->GetAttr(kNameSpaceID_None, nsGkAtoms::width, value); if (!value.IsEmpty()) { ParseNumericValue(value, &mWidth, - nsMathMLElement::PARSE_ALLOW_NEGATIVE, + mozilla::dom::MathMLElement::PARSE_ALLOW_NEGATIVE, aPresContext, mStyleContext, fontSizeInflation); } diff --git a/layout/mathml/nsMathMLmtableFrame.cpp b/layout/mathml/nsMathMLmtableFrame.cpp index 9d10c21af..976fc712d 100644 --- a/layout/mathml/nsMathMLmtableFrame.cpp +++ b/layout/mathml/nsMathMLmtableFrame.cpp @@ -10,7 +10,7 @@ #include "nsNameSpaceManager.h" #include "nsRenderingContext.h" #include "nsCSSRendering.h" -#include "nsMathMLElement.h" +#include "mozilla/dom/MathMLElement.h" #include "nsTArray.h" #include "nsTableFrame.h" @@ -471,7 +471,7 @@ ExtractSpacingValues(const nsAString& aString, newValue = aDefaultValue0; } nsMathMLFrame::ParseNumericValue(valueString, &newValue, - nsMathMLElement::PARSE_ALLOW_UNITLESS, + mozilla::dom::MathMLElement::PARSE_ALLOW_UNITLESS, presContext, styleContext, aFontSizeInflation); aSpacingArray.AppendElement(newValue);