зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 767065f0560b (bug 937317) WinXP Build Bustage on a CLOSED TREE
This commit is contained in:
Родитель
7ad96865a6
Коммит
928b1a0621
|
@ -9,7 +9,6 @@
|
|||
#include "nsIDocument.h"
|
||||
#include "prprf.h"
|
||||
#include "nsGlobalWindow.h"
|
||||
#include "ScriptSettings.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
using namespace mozilla;
|
||||
|
@ -275,7 +274,7 @@ nsDOMEventTargetHelper::SetEventHandler(nsIAtom* aType,
|
|||
JSObject* callable;
|
||||
if (aValue.isObject() &&
|
||||
JS_ObjectIsCallable(aCx, callable = &aValue.toObject())) {
|
||||
handler = new EventHandlerNonNull(callable, mozilla::dom::GetIncumbentGlobal());
|
||||
handler = new EventHandlerNonNull(callable);
|
||||
}
|
||||
SetEventHandler(aType, EmptyString(), handler);
|
||||
return NS_OK;
|
||||
|
|
|
@ -883,23 +883,19 @@ nsEventListenerManager::CompileEventHandlerInternal(nsListenerStruct *aListenerS
|
|||
JS::Rooted<JSObject*> scope(cx, listener->GetEventScope());
|
||||
context->BindCompiledEventHandler(mTarget, scope, handler, &boundHandler);
|
||||
aListenerStruct = nullptr;
|
||||
// Note - We pass null for aIncumbentGlobal below. We could also pass the
|
||||
// compilation global, but since the handler is guaranteed to be scripted,
|
||||
// there's no need to use an override, since the JS engine will always give
|
||||
// us the right answer.
|
||||
if (!boundHandler) {
|
||||
listener->ForgetHandler();
|
||||
} else if (listener->EventName() == nsGkAtoms::onerror && win) {
|
||||
nsRefPtr<OnErrorEventHandlerNonNull> handlerCallback =
|
||||
new OnErrorEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
|
||||
new OnErrorEventHandlerNonNull(boundHandler);
|
||||
listener->SetHandler(handlerCallback);
|
||||
} else if (listener->EventName() == nsGkAtoms::onbeforeunload && win) {
|
||||
nsRefPtr<OnBeforeUnloadEventHandlerNonNull> handlerCallback =
|
||||
new OnBeforeUnloadEventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
|
||||
new OnBeforeUnloadEventHandlerNonNull(boundHandler);
|
||||
listener->SetHandler(handlerCallback);
|
||||
} else {
|
||||
nsRefPtr<EventHandlerNonNull> handlerCallback =
|
||||
new EventHandlerNonNull(boundHandler, /* aIncumbentGlobal = */ nullptr);
|
||||
new EventHandlerNonNull(boundHandler);
|
||||
listener->SetHandler(handlerCallback);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -322,7 +322,7 @@ nsXBLPrototypeHandler::ExecuteHandler(EventTarget* aTarget,
|
|||
}
|
||||
|
||||
nsRefPtr<EventHandlerNonNull> handlerCallback =
|
||||
new EventHandlerNonNull(bound, /* aIncumbentGlobal = */ nullptr);
|
||||
new EventHandlerNonNull(bound);
|
||||
|
||||
nsEventHandler eventHandler(handlerCallback);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsDOMClassInfo.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "ScriptSettings.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Likely.h"
|
||||
|
||||
|
@ -4939,7 +4938,7 @@ nsGlobalWindow::RequestAnimationFrame(const JS::Value& aCallback,
|
|||
}
|
||||
|
||||
nsRefPtr<FrameRequestCallback> callback =
|
||||
new FrameRequestCallback(&aCallback.toObject(), GetIncumbentGlobal());
|
||||
new FrameRequestCallback(&aCallback.toObject());
|
||||
|
||||
ErrorResult rv;
|
||||
*aHandle = RequestAnimationFrame(*callback, rv);
|
||||
|
@ -13226,7 +13225,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
handler = new EventHandlerNonNull(callable, GetIncumbentGlobal()); \
|
||||
handler = new EventHandlerNonNull(callable); \
|
||||
} \
|
||||
SetOn##name_(handler); \
|
||||
return NS_OK; \
|
||||
|
@ -13256,7 +13255,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
handler = new OnErrorEventHandlerNonNull(callable, GetIncumbentGlobal()); \
|
||||
handler = new OnErrorEventHandlerNonNull(callable); \
|
||||
} \
|
||||
elm->SetEventHandler(handler); \
|
||||
return NS_OK; \
|
||||
|
@ -13287,7 +13286,7 @@ nsGlobalWindow::DisableNetworkEvent(uint32_t aType)
|
|||
JSObject *callable; \
|
||||
if (v.isObject() && \
|
||||
JS_ObjectIsCallable(cx, callable = &v.toObject())) { \
|
||||
handler = new OnBeforeUnloadEventHandlerNonNull(callable, GetIncumbentGlobal()); \
|
||||
handler = new OnBeforeUnloadEventHandlerNonNull(callable); \
|
||||
} \
|
||||
elm->SetEventHandler(handler); \
|
||||
return NS_OK; \
|
||||
|
|
|
@ -360,7 +360,7 @@ nsJSScriptTimeoutHandler::Init(nsGlobalWindow *aWindow, bool *aIsInterval,
|
|||
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
||||
mFunction = new Function(funobj, GetIncumbentGlobal());
|
||||
mFunction = new Function(funobj);
|
||||
|
||||
// Create our arg array. argc is the number of arguments passed
|
||||
// to setTimeout or setInterval; the first two are our callback
|
||||
|
|
|
@ -25,9 +25,8 @@ namespace dom {
|
|||
class CallbackFunction : public CallbackObject
|
||||
{
|
||||
public:
|
||||
explicit CallbackFunction(JSObject* aCallable,
|
||||
nsIGlobalObject* aIncumbentGlobal)
|
||||
: CallbackObject(aCallable, aIncumbentGlobal)
|
||||
explicit CallbackFunction(JSObject* aCallable)
|
||||
: CallbackObject(aCallable)
|
||||
{
|
||||
MOZ_ASSERT(JS_ObjectIsCallable(nullptr, mCallback));
|
||||
}
|
||||
|
|
|
@ -24,9 +24,8 @@ namespace dom {
|
|||
class CallbackInterface : public CallbackObject
|
||||
{
|
||||
public:
|
||||
explicit CallbackInterface(JSObject* aCallback,
|
||||
nsIGlobalObject *aIncumbentGlobal)
|
||||
: CallbackObject(aCallback, aIncumbentGlobal)
|
||||
explicit CallbackInterface(JSObject* aCallback)
|
||||
: CallbackObject(aCallback)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
|
@ -36,11 +36,9 @@ NS_IMPL_CYCLE_COLLECTION_CLASS(CallbackObject)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(CallbackObject)
|
||||
tmp->DropCallback();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIncumbentGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(CallbackObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_SCRIPT_OBJECTS
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIncumbentGlobal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN(CallbackObject)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_JS_MEMBER_CALLBACK(mCallback)
|
||||
|
@ -103,9 +101,6 @@ CallbackObject::CallSetup::CallSetup(CallbackObject* aCallback,
|
|||
}
|
||||
|
||||
mAutoEntryScript.construct(globalObject, mIsMainThread, cx);
|
||||
if (aCallback->IncumbentGlobalOrNull()) {
|
||||
mAutoIncumbentScript.construct(aCallback->IncumbentGlobalOrNull());
|
||||
}
|
||||
|
||||
// Unmark the callable (by invoking Callback() and not the CallbackPreserveColor()
|
||||
// variant), and stick it in a Rooted before it can go gray again.
|
||||
|
@ -209,7 +204,6 @@ CallbackObject::CallSetup::~CallSetup()
|
|||
// But be careful: it might not have been constructed at all!
|
||||
mAc.destroyIfConstructed();
|
||||
|
||||
mAutoIncumbentScript.destroyIfConstructed();
|
||||
mAutoEntryScript.destroyIfConstructed();
|
||||
|
||||
// It is important that this is the last thing we do, after leaving the
|
||||
|
|
|
@ -46,13 +46,9 @@ public:
|
|||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(CallbackObject)
|
||||
|
||||
// The caller may pass a global object which will act as an override for the
|
||||
// incumbent script settings object when the callback is invoked (overriding
|
||||
// the entry point computed from aCallback). If no override is required, the
|
||||
// caller should pass null.
|
||||
explicit CallbackObject(JSObject* aCallback, nsIGlobalObject *aIncumbentGlobal)
|
||||
explicit CallbackObject(JSObject* aCallback)
|
||||
{
|
||||
Init(aCallback, aIncumbentGlobal);
|
||||
Init(aCallback);
|
||||
}
|
||||
|
||||
virtual ~CallbackObject()
|
||||
|
@ -81,11 +77,6 @@ public:
|
|||
return JS::Handle<JSObject*>::fromMarkedLocation(mCallback.address());
|
||||
}
|
||||
|
||||
nsIGlobalObject* IncumbentGlobalOrNull() const
|
||||
{
|
||||
return mIncumbentGlobal;
|
||||
}
|
||||
|
||||
enum ExceptionHandling {
|
||||
// Report any exception and don't throw it to the caller code.
|
||||
eReportExceptions,
|
||||
|
@ -100,19 +91,17 @@ public:
|
|||
protected:
|
||||
explicit CallbackObject(CallbackObject* aCallbackObject)
|
||||
{
|
||||
Init(aCallbackObject->mCallback, aCallbackObject->mIncumbentGlobal);
|
||||
Init(aCallbackObject->mCallback);
|
||||
}
|
||||
|
||||
private:
|
||||
inline void Init(JSObject* aCallback, nsIGlobalObject* aIncumbentGlobal)
|
||||
inline void Init(JSObject* aCallback)
|
||||
{
|
||||
MOZ_ASSERT(aCallback && !mCallback);
|
||||
// Set mCallback before we hold, on the off chance that a GC could somehow
|
||||
// happen in there... (which would be pretty odd, granted).
|
||||
mCallback = aCallback;
|
||||
mozilla::HoldJSObjects(this);
|
||||
|
||||
mIncumbentGlobal = aIncumbentGlobal;
|
||||
}
|
||||
|
||||
CallbackObject(const CallbackObject&) MOZ_DELETE;
|
||||
|
@ -128,7 +117,6 @@ protected:
|
|||
}
|
||||
|
||||
JS::Heap<JSObject*> mCallback;
|
||||
nsCOMPtr<nsIGlobalObject> mIncumbentGlobal;
|
||||
|
||||
class MOZ_STACK_CLASS CallSetup
|
||||
{
|
||||
|
@ -166,7 +154,6 @@ protected:
|
|||
|
||||
// And now members whose construction/destruction order we need to control.
|
||||
Maybe<AutoEntryScript> mAutoEntryScript;
|
||||
Maybe<AutoIncumbentScript> mAutoIncumbentScript;
|
||||
|
||||
// Constructed the rooter within the scope of mCxPusher above, so that it's
|
||||
// always within a request during its lifetime.
|
||||
|
@ -369,8 +356,7 @@ public:
|
|||
|
||||
JSAutoCompartment ac(cx, obj);
|
||||
|
||||
// XXXbholley - This goes away in the next patch.
|
||||
nsRefPtr<WebIDLCallbackT> newCallback = new WebIDLCallbackT(obj, /* aIncumbentGlobal = */ nullptr);
|
||||
nsRefPtr<WebIDLCallbackT> newCallback = new WebIDLCallbackT(obj);
|
||||
return newCallback.forget();
|
||||
}
|
||||
|
||||
|
|
|
@ -3343,7 +3343,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
else:
|
||||
declType = CGGeneric("OwningNonNull<%s>" % name)
|
||||
conversion = (
|
||||
"${declName} = new %s(&${val}.toObject(), mozilla::dom::GetIncumbentGlobal());\n" % name)
|
||||
"${declName} = new %s(&${val}.toObject());\n" % name)
|
||||
|
||||
template = wrapObjectTemplate(conversion, type,
|
||||
"${declName} = nullptr",
|
||||
|
@ -3676,7 +3676,7 @@ for (uint32_t i = 0; i < length; ++i) {
|
|||
else:
|
||||
declType = CGGeneric("OwningNonNull<%s>" % name)
|
||||
conversion = (
|
||||
" ${declName} = new %s(&${val}.toObject(), mozilla::dom::GetIncumbentGlobal());\n" % name)
|
||||
" ${declName} = new %s(&${val}.toObject());\n" % name)
|
||||
|
||||
if allowTreatNonCallableAsNull and type.treatNonCallableAsNull():
|
||||
haveCallable = "JS_ObjectIsCallable(cx, &${val}.toObject())"
|
||||
|
@ -10421,7 +10421,7 @@ class CGJSImplClass(CGBindingImplClass):
|
|||
decorators = "MOZ_FINAL"
|
||||
destructor = None
|
||||
|
||||
baseConstructors=["mImpl(new %s(aJSImplObject, /* aIncumbentGlobal = */ nullptr))" % jsImplName(descriptor.name),
|
||||
baseConstructors=["mImpl(new %s(aJSImplObject))" % jsImplName(descriptor.name),
|
||||
"mParent(aParent)"]
|
||||
parentInterface = descriptor.interface.parent
|
||||
while parentInterface:
|
||||
|
@ -10548,12 +10548,12 @@ class CGCallback(CGClass):
|
|||
|
||||
def getConstructors(self):
|
||||
return [ClassConstructor(
|
||||
[Argument("JSObject*", "aCallback"), Argument("nsIGlobalObject*", "aIncumbentGlobal")],
|
||||
[Argument("JSObject*", "aCallback")],
|
||||
bodyInHeader=True,
|
||||
visibility="public",
|
||||
explicit=True,
|
||||
baseConstructors=[
|
||||
"%s(aCallback, aIncumbentGlobal)" % self.baseName,
|
||||
"%s(aCallback)" % self.baseName
|
||||
])]
|
||||
|
||||
def getMethodImpls(self, method):
|
||||
|
|
Загрузка…
Ссылка в новой задаче