mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-30 01:59:29 +00:00
Bug 1110105 - Get rid of -Promise from wantGlobalProperties. r=bholley
This commit is contained in:
parent
3f40e8929c
commit
6ad20c15c2
@ -761,9 +761,7 @@ xpc::GlobalProperties::Parse(JSContext *cx, JS::HandleObject obj)
|
||||
}
|
||||
JSAutoByteString name(cx, nameValue.toString());
|
||||
NS_ENSURE_TRUE(name, false);
|
||||
if (Promise && !strcmp(name.ptr(), "-Promise")) {
|
||||
Promise = false;
|
||||
} else if (!strcmp(name.ptr(), "CSS")) {
|
||||
if (!strcmp(name.ptr(), "CSS")) {
|
||||
CSS = true;
|
||||
} else if (!strcmp(name.ptr(), "indexedDB")) {
|
||||
indexedDB = true;
|
||||
@ -799,9 +797,6 @@ xpc::GlobalProperties::Define(JSContext *cx, JS::HandleObject obj)
|
||||
if (CSS && !dom::CSSBinding::GetConstructorObject(cx, obj))
|
||||
return false;
|
||||
|
||||
if (Promise && !dom::PromiseBinding::GetConstructorObject(cx, obj))
|
||||
return false;
|
||||
|
||||
if (indexedDB && AccessCheck::isChrome(obj) &&
|
||||
!IndexedDatabaseManager::DefineIndexedDB(cx, obj))
|
||||
return false;
|
||||
@ -971,6 +966,11 @@ xpc::CreateSandboxObject(JSContext *cx, MutableHandleValue vp, nsISupports *prin
|
||||
if (!options.globalProperties.Define(cx, sandbox))
|
||||
return NS_ERROR_XPC_UNEXPECTED;
|
||||
|
||||
// Promise is supposed to be part of ES, and therefore should appear on
|
||||
// every global.
|
||||
if (!dom::PromiseBinding::GetConstructorObject(cx, sandbox))
|
||||
return NS_ERROR_XPC_UNEXPECTED;
|
||||
|
||||
// Resolve standard classes eagerly to avoid triggering mirroring hooks for them.
|
||||
if (options.writeToGlobalPrototype && !JS_EnumerateStandardClasses(cx, sandbox))
|
||||
return NS_ERROR_XPC_UNEXPECTED;
|
||||
|
@ -3353,14 +3353,10 @@ struct GlobalProperties {
|
||||
GlobalProperties() {
|
||||
mozilla::PodZero(this);
|
||||
|
||||
// Promise is supposed to be part of ES, and therefore should appear on
|
||||
// every global.
|
||||
Promise = true;
|
||||
}
|
||||
bool Parse(JSContext *cx, JS::HandleObject obj);
|
||||
bool Define(JSContext *cx, JS::HandleObject obj);
|
||||
bool CSS : 1;
|
||||
bool Promise : 1;
|
||||
bool indexedDB : 1;
|
||||
bool XMLHttpRequest : 1;
|
||||
bool TextDecoder : 1;
|
||||
|
@ -4,9 +4,5 @@ function run_test() {
|
||||
sb.do_check_eq = do_check_eq;
|
||||
Cu.evalInSandbox('do_check_eq(typeof new Promise(function(resolve){resolve();}), "object");',
|
||||
sb);
|
||||
sb = new Cu.Sandbox('http://www.example.com',
|
||||
{ wantGlobalProperties: ["-Promise"] });
|
||||
sb.do_check_eq = do_check_eq;
|
||||
Cu.evalInSandbox('do_check_eq(typeof Promise, "undefined");', sb);
|
||||
do_check_eq(typeof new Promise(function(resolve){resolve();}), "object");
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user