Bug 1188256 part 6 - Expose PromiseDebugging to plain mochitest via SpecialPowers. r=bzbarsky

Depends on D5852

Differential Revision: https://phabricator.services.mozilla.com/D5858

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Xidorn Quan 2018-09-14 22:43:54 +00:00
parent d78346013f
commit 1ee5079242
3 changed files with 15 additions and 3 deletions

View File

@ -48,6 +48,7 @@
#include "mozilla/dom/NodeBinding.h" #include "mozilla/dom/NodeBinding.h"
#include "mozilla/dom/NodeFilterBinding.h" #include "mozilla/dom/NodeFilterBinding.h"
#include "mozilla/dom/PromiseBinding.h" #include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/PromiseDebuggingBinding.h"
#include "mozilla/dom/RequestBinding.h" #include "mozilla/dom/RequestBinding.h"
#include "mozilla/dom/ResponseBinding.h" #include "mozilla/dom/ResponseBinding.h"
#ifdef MOZ_WEBRTC #ifdef MOZ_WEBRTC
@ -906,6 +907,8 @@ xpc::GlobalProperties::Parse(JSContext* cx, JS::HandleObject obj)
Node = true; Node = true;
} else if (JS_FlatStringEqualsAscii(nameStr, "NodeFilter")) { } else if (JS_FlatStringEqualsAscii(nameStr, "NodeFilter")) {
NodeFilter = true; NodeFilter = true;
} else if (JS_FlatStringEqualsAscii(nameStr, "PromiseDebugging")) {
PromiseDebugging = true;
} else if (JS_FlatStringEqualsAscii(nameStr, "TextDecoder")) { } else if (JS_FlatStringEqualsAscii(nameStr, "TextDecoder")) {
TextDecoder = true; TextDecoder = true;
} else if (JS_FlatStringEqualsAscii(nameStr, "TextEncoder")) { } else if (JS_FlatStringEqualsAscii(nameStr, "TextEncoder")) {
@ -1018,6 +1021,11 @@ xpc::GlobalProperties::Define(JSContext* cx, JS::HandleObject obj)
return false; return false;
} }
if (PromiseDebugging &&
!dom::PromiseDebugging_Binding::GetConstructorObject(cx)) {
return false;
}
if (TextDecoder && if (TextDecoder &&
!dom::TextDecoder_Binding::GetConstructorObject(cx)) !dom::TextDecoder_Binding::GetConstructorObject(cx))
return false; return false;

View File

@ -2630,6 +2630,7 @@ struct GlobalProperties {
bool MessageChannel: 1; bool MessageChannel: 1;
bool Node : 1; bool Node : 1;
bool NodeFilter : 1; bool NodeFilter : 1;
bool PromiseDebugging : 1;
bool TextDecoder : 1; bool TextDecoder : 1;
bool TextEncoder : 1; bool TextEncoder : 1;
bool URL : 1; bool URL : 1;

View File

@ -38,10 +38,11 @@ ChromeUtils.defineModuleGetter(this, "PerTestCoverageUtils",
"resource://testing-common/PerTestCoverageUtils.jsm"); "resource://testing-common/PerTestCoverageUtils.jsm");
try { try {
Cu.importGlobalProperties(["DOMParser", "File", "InspectorUtils", "NodeFilter"]); Cu.importGlobalProperties(["DOMParser", "File", "InspectorUtils",
"NodeFilter", "PromiseDebugging"]);
} catch (e) { } catch (e) {
// We are in window scope hence DOMParser, File, InspectorUtils and NodeFilter // We are in window scope hence DOMParser, File, InspectorUtils, NodeFilter,
// are already defined, So do nothing. // and PromiseDebugging are already defined, So do nothing.
} }
// Allow stuff from this scope to be accessed from non-privileged scopes. This // Allow stuff from this scope to be accessed from non-privileged scopes. This
@ -692,6 +693,8 @@ SpecialPowersAPI.prototype = {
get InspectorUtils() { return wrapPrivileged(InspectorUtils); }, get InspectorUtils() { return wrapPrivileged(InspectorUtils); },
get PromiseDebugging() { return wrapPrivileged(PromiseDebugging); },
waitForCrashes(aExpectingProcessCrash) { waitForCrashes(aExpectingProcessCrash) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
if (!aExpectingProcessCrash) { if (!aExpectingProcessCrash) {