summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMoonchild <moonchild@palemoon.org>2021-04-19 20:47:29 +0000
committerMoonchild <moonchild@palemoon.org>2021-04-19 20:47:29 +0000
commitf3c4230348601056aea9b11b202e8f93821b5b3a (patch)
treeefb7a26701e3adb1be0a57754ddf7bf6e4531b7e
parenta3a9680cef6c0dcc951f8a13937d82679053b25d (diff)
downloaduxp-f3c4230348601056aea9b11b202e8f93821b5b3a.tar.gz
[DOM] Add missing IDL definitions for CSP .nonce attributes.
Apparently Mozilla completely spaced out on this when adding the CSP nonce mechanism, potentially causing web compat issues if scripting relies on being able to get/set nonces through DOM and/or causing CSP policy check issues if websites try to "hide" nonces.
-rw-r--r--dom/html/HTMLLinkElement.h8
-rw-r--r--dom/html/HTMLScriptElement.h8
-rw-r--r--dom/html/HTMLStyleElement.h8
-rw-r--r--dom/webidl/HTMLLinkElement.webidl2
-rw-r--r--dom/webidl/HTMLScriptElement.webidl10
-rw-r--r--dom/webidl/HTMLStyleElement.webidl2
6 files changed, 32 insertions, 6 deletions
diff --git a/dom/html/HTMLLinkElement.h b/dom/html/HTMLLinkElement.h
index 8575d5b49f..aca16d56a4 100644
--- a/dom/html/HTMLLinkElement.h
+++ b/dom/html/HTMLLinkElement.h
@@ -109,6 +109,14 @@ public:
SetHTMLAttr(nsGkAtoms::rel, aRel, aRv);
}
nsDOMTokenList* RelList();
+ void GetNonce(nsAString& aNonce) const
+ {
+ GetHTMLAttr(nsGkAtoms::nonce, aNonce);
+ }
+ void SetNonce(const nsAString& aNonce, ErrorResult& aRv)
+ {
+ SetHTMLAttr(nsGkAtoms::nonce, aNonce, aRv);
+ }
// XPCOM GetMedia is fine.
void SetMedia(const nsAString& aMedia, ErrorResult& aRv)
{
diff --git a/dom/html/HTMLScriptElement.h b/dom/html/HTMLScriptElement.h
index a0c9e47258..a80f0262a1 100644
--- a/dom/html/HTMLScriptElement.h
+++ b/dom/html/HTMLScriptElement.h
@@ -80,6 +80,14 @@ public:
{
SetOrRemoveNullableStringAttr(nsGkAtoms::crossorigin, aCrossOrigin, aError);
}
+ void GetNonce(nsAString& aNonce) const
+ {
+ GetHTMLAttr(nsGkAtoms::nonce, aNonce);
+ }
+ void SetNonce(const nsAString& aNonce, ErrorResult& aRv)
+ {
+ SetHTMLAttr(nsGkAtoms::nonce, aNonce, aRv);
+ }
void GetIntegrity(nsAString& aIntegrity)
{
GetHTMLAttr(nsGkAtoms::integrity, aIntegrity);
diff --git a/dom/html/HTMLStyleElement.h b/dom/html/HTMLStyleElement.h
index 60331dc5df..585047ba38 100644
--- a/dom/html/HTMLStyleElement.h
+++ b/dom/html/HTMLStyleElement.h
@@ -60,6 +60,14 @@ public:
bool Disabled() const;
void SetDisabled(bool aDisabled);
+ void GetNonce(nsAString& aNonce) const
+ {
+ GetHTMLAttr(nsGkAtoms::nonce, aNonce);
+ }
+ void SetNonce(const nsAString& aNonce, ErrorResult& aRv)
+ {
+ SetHTMLAttr(nsGkAtoms::nonce, aNonce, aRv);
+ }
void SetMedia(const nsAString& aMedia, ErrorResult& aError)
{
SetHTMLAttr(nsGkAtoms::media, aMedia, aError);
diff --git a/dom/webidl/HTMLLinkElement.webidl b/dom/webidl/HTMLLinkElement.webidl
index 4fa40d04d0..0089ab84e6 100644
--- a/dom/webidl/HTMLLinkElement.webidl
+++ b/dom/webidl/HTMLLinkElement.webidl
@@ -27,6 +27,8 @@ interface HTMLLinkElement : HTMLElement {
[CEReactions, SetterThrows, Pure]
attribute DOMString media;
[CEReactions, SetterThrows, Pure]
+ attribute DOMString nonce;
+ [CEReactions, SetterThrows, Pure]
attribute DOMString hreflang;
[CEReactions, SetterThrows, Pure]
attribute DOMString type;
diff --git a/dom/webidl/HTMLScriptElement.webidl b/dom/webidl/HTMLScriptElement.webidl
index 286c0673d8..6b48a52443 100644
--- a/dom/webidl/HTMLScriptElement.webidl
+++ b/dom/webidl/HTMLScriptElement.webidl
@@ -26,6 +26,10 @@ interface HTMLScriptElement : HTMLElement {
attribute DOMString? crossOrigin;
[CEReactions, SetterThrows]
attribute DOMString text;
+ [CEReactions, SetterThrows, Pure]
+ attribute DOMString nonce;
+ [CEReactions, SetterThrows, Pure]
+ attribute DOMString integrity;
};
// http://www.whatwg.org/specs/web-apps/current-work/#other-elements,-attributes-and-apis
@@ -35,9 +39,3 @@ partial interface HTMLScriptElement {
[CEReactions, SetterThrows]
attribute DOMString htmlFor;
};
-
-// https://w3c.github.io/webappsec/specs/subresourceintegrity/#htmlscriptelement-1
-partial interface HTMLScriptElement {
- [CEReactions, SetterThrows]
- attribute DOMString integrity;
-};
diff --git a/dom/webidl/HTMLStyleElement.webidl b/dom/webidl/HTMLStyleElement.webidl
index 3cacbf62fd..3f2e0c8630 100644
--- a/dom/webidl/HTMLStyleElement.webidl
+++ b/dom/webidl/HTMLStyleElement.webidl
@@ -15,6 +15,8 @@ interface HTMLStyleElement : HTMLElement {
[CEReactions, SetterThrows, Pure]
attribute DOMString media;
[CEReactions, SetterThrows, Pure]
+ attribute DOMString nonce;
+ [CEReactions, SetterThrows, Pure]
attribute DOMString type;
[SetterThrows, Pure]
attribute boolean scoped;