зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1721123 - Expose AbortController in Sandbox. r=smaug.
AbortController can be used to remove multiple event listeners in a single call, and that's a pattern the DevTools team want to start using. As some of DevTools code run in a Sandbox, we couldn't instantiate AbortController there so far. This patch exposes the AbortController in the Sandbox so instances can be created. Differential Revision: https://phabricator.services.mozilla.com/D120193
This commit is contained in:
Родитель
7448c66839
Коммит
b5f1a3988d
|
@ -35,6 +35,7 @@
|
|||
#include "xpc_make_class.h"
|
||||
#include "XPCWrapper.h"
|
||||
#include "Crypto.h"
|
||||
#include "mozilla/dom/AbortControllerBinding.h"
|
||||
#include "mozilla/dom/AutoEntryScript.h"
|
||||
#include "mozilla/dom/BindingCallContext.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
@ -844,7 +845,10 @@ bool xpc::GlobalProperties::Parse(JSContext* cx, JS::HandleObject obj) {
|
|||
if (!nameStr) {
|
||||
return false;
|
||||
}
|
||||
if (JS_LinearStringEqualsLiteral(nameStr, "Blob")) {
|
||||
|
||||
if (JS_LinearStringEqualsLiteral(nameStr, "AbortController")) {
|
||||
AbortController = true;
|
||||
} else if (JS_LinearStringEqualsLiteral(nameStr, "Blob")) {
|
||||
Blob = true;
|
||||
} else if (JS_LinearStringEqualsLiteral(nameStr, "ChromeUtils")) {
|
||||
ChromeUtils = true;
|
||||
|
@ -947,6 +951,11 @@ bool xpc::GlobalProperties::Define(JSContext* cx, JS::HandleObject obj) {
|
|||
// This function holds common properties not exposed automatically but able
|
||||
// to be requested either in |Cu.importGlobalProperties| or
|
||||
// |wantGlobalProperties| of a sandbox.
|
||||
if (AbortController &&
|
||||
!dom::AbortController_Binding::GetConstructorObject(cx)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (Blob && !dom::Blob_Binding::GetConstructorObject(cx)) return false;
|
||||
|
||||
if (ChromeUtils && !dom::ChromeUtils_Binding::GetConstructorObject(cx)) {
|
||||
|
|
|
@ -2215,6 +2215,7 @@ struct GlobalProperties {
|
|||
bool DefineInSandbox(JSContext* cx, JS::HandleObject obj);
|
||||
|
||||
// Interface objects we can expose.
|
||||
bool AbortController : 1;
|
||||
bool Blob : 1;
|
||||
bool ChromeUtils : 1;
|
||||
bool CSS : 1;
|
||||
|
|
Загрузка…
Ссылка в новой задаче