Bug 1706179 - Add HTMLMetaElement.media. r=smaug

We don't use it because we don't use theme-color, but some sites are
starting to rely on it (comment 4) and it is trivial to support.

Differential Revision: https://phabricator.services.mozilla.com/D156667
This commit is contained in:
Emilio Cobos Álvarez 2022-09-07 12:24:18 +00:00
parent 684a24a549
commit 54e3830cb2
3 changed files with 8 additions and 9 deletions

View File

@ -53,9 +53,12 @@ class HTMLMetaElement final : public nsGenericHTMLElement {
void SetScheme(const nsAString& aScheme, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::scheme, aScheme, aRv);
}
void GetMedia(nsAString& aValue) { GetHTMLAttr(nsGkAtoms::media, aValue); }
void SetMedia(const nsAString& aMedia, ErrorResult& aRv) {
SetHTMLAttr(nsGkAtoms::media, aMedia, aRv);
}
virtual JSObject* WrapNode(JSContext* aCx,
JS::Handle<JSObject*> aGivenProto) override;
JSObject* WrapNode(JSContext*, JS::Handle<JSObject*> aGivenProto) override;
protected:
virtual ~HTMLMetaElement();

View File

@ -11,7 +11,7 @@
* and create derivative works of this document.
*/
// http://www.whatwg.org/specs/web-apps/current-work/#the-meta-element
// https://html.spec.whatwg.org/#the-meta-element
[Exposed=Window]
interface HTMLMetaElement : HTMLElement {
[HTMLConstructor] constructor();
@ -22,6 +22,8 @@ interface HTMLMetaElement : HTMLElement {
attribute DOMString httpEquiv;
[CEReactions, SetterThrows, Pure]
attribute DOMString content;
[CEReactions, SetterThrows, Pure]
attribute DOMString media;
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis

View File

@ -674,12 +674,6 @@ prefs: [dom.security.featurePolicy.experimental.enabled:true, dom.security.featu
[HTMLElement interface: document.createElement("noscript") must inherit property "oncontextrestored" with the proper type]
expected: FAIL
[HTMLMetaElement interface: attribute media]
expected: FAIL
[HTMLMetaElement interface: document.createElement("meta") must inherit property "media" with the proper type]
expected: FAIL
[HTMLLinkElement interface: attribute blocking]
expected: FAIL