зеркало из https://github.com/mozilla/gecko-dev.git
Back out 2 changesets (bug 1152902) for Gu bustage
CLOSED TREE Backed out changeset 462f2f668259 (bug 1152902) Backed out changeset 1c5ed66652c3 (bug 1152902)
This commit is contained in:
Родитель
779ce8a8fd
Коммит
11411ee0a4
|
@ -8604,26 +8604,6 @@ class CGStaticMethodJitinfo(CGGeneric):
|
|||
IDLToCIdentifier(method.identifier.name))))
|
||||
|
||||
|
||||
class CGMethodIdentityTest(CGAbstractMethod):
|
||||
"""
|
||||
A class to generate a method-identity test for a given IDL operation.
|
||||
"""
|
||||
def __init__(self, descriptor, method):
|
||||
self.method = method
|
||||
name = "Is%sMethod" % MakeNativeName(method.identifier.name)
|
||||
CGAbstractMethod.__init__(self, descriptor, name, 'bool',
|
||||
[Argument('JS::Handle<JSObject*>', 'aObj')])
|
||||
|
||||
def definition_body(self):
|
||||
return dedent(
|
||||
"""
|
||||
MOZ_ASSERT(aObj);
|
||||
return js::IsFunctionObject(aObj) &&
|
||||
js::FunctionObjectIsNative(aObj) &&
|
||||
FUNCTION_VALUE_TO_JITINFO(JS::ObjectValue(*aObj)) == &%s_methodinfo;
|
||||
""" % IDLToCIdentifier(self.method.identifier.name))
|
||||
|
||||
|
||||
def getEnumValueName(value):
|
||||
# Some enum values can be empty strings. Others might have weird
|
||||
# characters in them. Deal with the former by returning "_empty",
|
||||
|
@ -11220,8 +11200,6 @@ class CGDescriptor(CGThing):
|
|||
cgThings.append(CGMemberJITInfo(descriptor, m))
|
||||
if props.isCrossOriginMethod:
|
||||
crossOriginMethods.add(m.identifier.name)
|
||||
if m.getExtendedAttribute("MethodIdentityTestable"):
|
||||
cgThings.append(CGMethodIdentityTest(descriptor, m))
|
||||
elif m.isAttr():
|
||||
if m.stringifier:
|
||||
raise TypeError("Stringifier attributes not supported yet. "
|
||||
|
|
|
@ -4163,8 +4163,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
|
|||
identifier == "Func" or
|
||||
identifier == "AvailableIn" or
|
||||
identifier == "CheckPermissions" or
|
||||
identifier == "BinaryName" or
|
||||
identifier == "MethodIdentityTestable"):
|
||||
identifier == "BinaryName"):
|
||||
# Known attributes that we don't need to do anything with here
|
||||
pass
|
||||
else:
|
||||
|
|
|
@ -201,8 +201,6 @@ protected:
|
|||
ThreadsafeAutoJSContext cx;
|
||||
JS::Rooted<JSObject*> wrapper(cx, mPromise->GetWrapper());
|
||||
MOZ_ASSERT(wrapper); // It was preserved!
|
||||
// If we ever change which compartment we're working in here, make sure to
|
||||
// fix the fast-path for resolved-with-a-Promise in ResolveInternal.
|
||||
JSAutoCompartment ac(cx, wrapper);
|
||||
|
||||
JS::Rooted<JSObject*> resolveFunc(cx,
|
||||
|
@ -1200,35 +1198,6 @@ Promise::ResolveInternal(JSContext* aCx,
|
|||
if (then.isObject() && JS::IsCallable(&then.toObject())) {
|
||||
// This is the then() function of the thenable aValueObj.
|
||||
JS::Rooted<JSObject*> thenObj(aCx, &then.toObject());
|
||||
|
||||
// Add a fast path for the case when we're resolved with an actual
|
||||
// Promise. This has two requirements:
|
||||
//
|
||||
// 1) valueObj is a Promise.
|
||||
// 2) thenObj is a JSFunction backed by our actual Promise::Then
|
||||
// implementation.
|
||||
//
|
||||
// If those requirements are satisfied, then we know exactly what
|
||||
// thenObj.call(valueObj) will do, so we can optimize a bit and avoid ever
|
||||
// entering JS for this stuff.
|
||||
Promise* nextPromise;
|
||||
if (PromiseBinding::IsThenMethod(thenObj) &&
|
||||
NS_SUCCEEDED(UNWRAP_OBJECT(Promise, valueObj, nextPromise))) {
|
||||
// If we were taking the codepath that involves ThenableResolverTask and
|
||||
// PromiseInit below, then eventually, in ThenableResolverTask::Run, we
|
||||
// would create some JSFunctions in the compartment of
|
||||
// this->GetWrapper() and pass them to the PromiseInit. So by the time
|
||||
// we'd see the resolution value it would be wrapped into the
|
||||
// compartment of this->GetWrapper(). The global of that compartment is
|
||||
// this->GetGlobalJSObject(), so use that as the global for
|
||||
// ResolvePromiseCallback/RejectPromiseCallback.
|
||||
JS::Rooted<JSObject*> glob(aCx, GlobalJSObject());
|
||||
nsRefPtr<PromiseCallback> resolveCb = new ResolvePromiseCallback(this, glob);
|
||||
nsRefPtr<PromiseCallback> rejectCb = new RejectPromiseCallback(this, glob);
|
||||
nextPromise->AppendCallbacks(resolveCb, rejectCb);
|
||||
return;
|
||||
}
|
||||
|
||||
nsRefPtr<PromiseInit> thenCallback =
|
||||
new PromiseInit(thenObj, mozilla::dom::GetIncumbentGlobal());
|
||||
nsRefPtr<ThenableResolverTask> task =
|
||||
|
|
|
@ -34,7 +34,7 @@ interface _Promise {
|
|||
|
||||
// The [TreatNonCallableAsNull] annotation is required since then() should do
|
||||
// nothing instead of throwing errors when non-callable arguments are passed.
|
||||
[NewObject, MethodIdentityTestable]
|
||||
[NewObject]
|
||||
Promise<any> then([TreatNonCallableAsNull] optional AnyCallback? fulfillCallback = null,
|
||||
[TreatNonCallableAsNull] optional AnyCallback? rejectCallback = null);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче