Bug 1862896 - Expose CustomStateSet in DevTools sandbox. r=smaug,devtools-reviewers,ochameau.

This will be used in next patch to customize rendering of CustomStateSet in DevTools.

Differential Revision: https://phabricator.services.mozilla.com/D204596
This commit is contained in:
Nicolas Chevobbe 2024-03-15 06:05:17 +00:00
Родитель ead1d58895
Коммит 342ce5957d
3 изменённых файлов: 10 добавлений и 0 удалений

Просмотреть файл

@ -119,6 +119,7 @@ function Sandbox(options) {
"ChromeUtils",
"CSS",
"CSSRule",
"CustomStateSet",
"DOMParser",
"Element",
"Event",

Просмотреть файл

@ -50,6 +50,7 @@
#include "mozilla/dom/DOMParserBinding.h"
#include "mozilla/dom/DOMTokenListBinding.h"
#include "mozilla/dom/ElementBinding.h"
#include "mozilla/dom/ElementInternalsBinding.h"
#include "mozilla/dom/EventBinding.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/IndexedDatabaseManager.h"
@ -901,6 +902,8 @@ bool xpc::GlobalProperties::Parse(JSContext* cx, JS::HandleObject obj) {
CSS = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "CSSRule")) {
CSSRule = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "CustomStateSet")) {
CustomStateSet = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "Document")) {
Document = true;
} else if (JS_LinearStringEqualsLiteral(nameStr, "Directory")) {
@ -1027,6 +1030,11 @@ bool xpc::GlobalProperties::Define(JSContext* cx, JS::HandleObject obj) {
return false;
}
if (CustomStateSet &&
!dom::CustomStateSet_Binding::GetConstructorObject(cx)) {
return false;
}
if (Directory && !dom::Directory_Binding::GetConstructorObject(cx))
return false;

Просмотреть файл

@ -2191,6 +2191,7 @@ struct GlobalProperties {
bool ChromeUtils : 1;
bool CSS : 1;
bool CSSRule : 1;
bool CustomStateSet : 1;
bool Directory : 1;
bool Document : 1;
bool DOMException : 1;