Fix for bug 741263 (Paris bindings constructors shouldn't abuse reserved identifiers). r=bz.

--HG--
extra : rebase_source : cec6a0ffc58f3d7d262dc9658d52aac424ec715a
This commit is contained in:
Peter Van der Beken 2012-04-26 22:57:33 +02:00
parent c8c5d41176
commit ebb9ed75cf
17 changed files with 72 additions and 67 deletions

View File

@ -177,9 +177,9 @@ public:
return GetOwner();
}
// The WebIDL parser converts constructors into methods called _Constructor.
// The WebIDL constructor.
static already_AddRefed<nsXMLHttpRequest>
_Constructor(nsISupports* aGlobal, ErrorResult& aRv)
Constructor(nsISupports* aGlobal, ErrorResult& aRv)
{
nsCOMPtr<nsPIDOMWindow> window = do_QueryInterface(aGlobal);
nsCOMPtr<nsIScriptObjectPrincipal> principal = do_QueryInterface(aGlobal);

View File

@ -11,11 +11,11 @@ from WebIDL import *
AUTOGENERATED_WARNING_COMMENT = \
"/* THIS FILE IS AUTOGENERATED - DO NOT EDIT */\n\n"
ADDPROPERTY_HOOK_NAME = '_AddProperty'
FINALIZE_HOOK_NAME = '_Finalize'
TRACE_HOOK_NAME = '_Trace'
CONSTRUCT_HOOK_NAME = '_Construct'
HASINSTANCE_HOOK_NAME = '_HasInstance'
ADDPROPERTY_HOOK_NAME = '_addProperty'
FINALIZE_HOOK_NAME = '_finalize'
TRACE_HOOK_NAME = '_trace'
CONSTRUCT_HOOK_NAME = '_constructor'
HASINSTANCE_HOOK_NAME = '_hasInstance'
def replaceFileIfChanged(filename, newContents):
"""
@ -572,9 +572,8 @@ class CGClassConstructHook(CGAbstractStaticMethod):
"""
preArgs = "global, "
name = "_" + self._ctor.identifier.name
nativeName = "_" + MakeNativeName(self._ctor.identifier.name)
nativeName = self.descriptor.binaryNames.get(name, nativeName)
name = MakeNativeName(self._ctor.identifier.name)
nativeName = self.descriptor.binaryNames.get(name, name)
callGenerator = CGMethodCall(preArgs, nativeName, True,
self.descriptor, self._ctor, {})
return preamble + callGenerator.define();

View File

@ -30,7 +30,7 @@ DOMBindingBase::~DOMBindingBase()
}
void
DOMBindingBase::_Trace(JSTracer* aTrc)
DOMBindingBase::_trace(JSTracer* aTrc)
{
JSObject* obj = GetJSObject();
if (obj) {
@ -39,7 +39,7 @@ DOMBindingBase::_Trace(JSTracer* aTrc)
}
void
DOMBindingBase::_Finalize(JSFreeOp* aFop)
DOMBindingBase::_finalize(JSFreeOp* aFop)
{
ClearWrapper();
NS_RELEASE_THIS();

View File

@ -37,10 +37,10 @@ protected:
virtual ~DOMBindingBase();
virtual void
_Trace(JSTracer* aTrc);
_trace(JSTracer* aTrc);
virtual void
_Finalize(JSFreeOp* aFop);
_finalize(JSFreeOp* aFop);
JSContext*
GetJSContextFromContextStack() const;

View File

@ -33,7 +33,7 @@ public:
#endif
void
_Trace(JSTracer* aTrc) const
_trace(JSTracer* aTrc) const
{
if (!PR_CLIST_IS_EMPTY(&mCollectionHead)) {
TraceInternal(aTrc);
@ -41,7 +41,7 @@ public:
}
void
_Finalize(JSFreeOp* aFop)
_finalize(JSFreeOp* aFop)
{
if (!PR_CLIST_IS_EMPTY(&mCollectionHead)) {
FinalizeInternal(aFop);

View File

@ -9,17 +9,17 @@ USING_WORKERS_NAMESPACE
using mozilla::ErrorResult;
void
EventTarget::_Trace(JSTracer* aTrc)
EventTarget::_trace(JSTracer* aTrc)
{
mListenerManager._Trace(aTrc);
DOMBindingBase::_Trace(aTrc);
mListenerManager._trace(aTrc);
DOMBindingBase::_trace(aTrc);
}
void
EventTarget::_Finalize(JSFreeOp* aFop)
EventTarget::_finalize(JSFreeOp* aFop)
{
mListenerManager._Finalize(aFop);
DOMBindingBase::_Finalize(aFop);
mListenerManager._finalize(aFop);
DOMBindingBase::_finalize(aFop);
}
JSObject*

View File

@ -32,10 +32,10 @@ protected:
public:
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
void
AddEventListener(const nsAString& aType, JSObject* aListener,

View File

@ -219,7 +219,7 @@ private:
JS_ASSERT(JS_GetClass(aObj) == Class());
WorkerPrivate* worker = UnwrapDOMObject<WorkerPrivate>(aObj, Class());
if (worker) {
worker->_Finalize(aFop);
worker->_finalize(aFop);
}
}
@ -229,7 +229,7 @@ private:
JS_ASSERT(JS_GetClass(aObj) == Class());
WorkerPrivate* worker = UnwrapDOMObject<WorkerPrivate>(aObj, Class());
if (worker) {
worker->_Trace(aTrc);
worker->_trace(aTrc);
}
}
@ -377,7 +377,7 @@ private:
JS_ASSERT(JS_GetClass(aObj) == Class());
WorkerPrivate* worker = UnwrapDOMObject<WorkerPrivate>(aObj, Class());
if (worker) {
worker->_Finalize(aFop);
worker->_finalize(aFop);
}
}
@ -387,7 +387,7 @@ private:
JS_ASSERT(JS_GetClass(aObj) == Class());
WorkerPrivate* worker = UnwrapDOMObject<WorkerPrivate>(aObj, Class());
if (worker) {
worker->_Trace(aTrc);
worker->_trace(aTrc);
}
}
};

View File

@ -2047,17 +2047,17 @@ WorkerPrivateParent<Derived>::Resume(JSContext* aCx)
template <class Derived>
void
WorkerPrivateParent<Derived>::_Trace(JSTracer* aTrc)
WorkerPrivateParent<Derived>::_trace(JSTracer* aTrc)
{
// This should only happen on the parent thread but we can't assert that
// because it can also happen on the cycle collector thread when this is a
// top-level worker.
EventTarget::_Trace(aTrc);
EventTarget::_trace(aTrc);
}
template <class Derived>
void
WorkerPrivateParent<Derived>::_Finalize(JSFreeOp* aFop)
WorkerPrivateParent<Derived>::_finalize(JSFreeOp* aFop)
{
AssertIsOnParentThread();
@ -2083,7 +2083,7 @@ WorkerPrivateParent<Derived>::_Finalize(JSFreeOp* aFop)
NS_ADDREF(extraSelfRef = this);
}
EventTarget::_Finalize(aFop);
EventTarget::_finalize(aFop);
if (extraSelfRef) {
nsCOMPtr<nsIRunnable> runnable =

View File

@ -258,10 +258,10 @@ public:
Resume(JSContext* aCx);
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
void
Finish(JSContext* aCx)

View File

@ -101,6 +101,9 @@ public:
sProperties, sFunctions, NULL, NULL);
}
using EventTarget::GetEventListener;
using EventTarget::SetEventListener;
protected:
WorkerGlobalScope(JSContext* aCx, WorkerPrivate* aWorker)
: EventTarget(aCx), mWorker(aWorker)
@ -117,24 +120,24 @@ protected:
}
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE
_trace(JSTracer* aTrc) MOZ_OVERRIDE
{
for (int32 i = 0; i < SLOT_COUNT; i++) {
JS_CALL_VALUE_TRACER(aTrc, mSlots[i], "WorkerGlobalScope instance slot");
}
mWorker->TraceInternal(aTrc);
EventTarget::_Trace(aTrc);
EventTarget::_trace(aTrc);
}
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE
{
EventTarget::_Finalize(aFop);
EventTarget::_finalize(aFop);
}
private:
static JSBool
_GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, jsval* aVp)
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, jsval* aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -160,7 +163,7 @@ private:
}
static JSBool
_SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
jsval* aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
@ -614,7 +617,7 @@ JSPropertySpec WorkerGlobalScope::sProperties[] = {
{ sEventStrings[STRING_onerror], STRING_onerror, PROPERTY_FLAGS,
GetOnErrorListener, SetOnErrorListener },
{ sEventStrings[STRING_onclose], STRING_onclose, PROPERTY_FLAGS,
_GetEventListener, _SetEventListener },
GetEventListener, SetEventListener },
{ "navigator", SLOT_navigator, PROPERTY_FLAGS, GetNavigator,
js_GetterOnlyPropertyStub },
{ "self", 0, PROPERTY_FLAGS, GetSelf, js_GetterOnlyPropertyStub },
@ -700,8 +703,11 @@ protected:
}
private:
using EventTarget::GetEventListener;
using EventTarget::SetEventListener;
static JSBool
_GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, jsval* aVp)
GetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, jsval* aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -727,8 +733,8 @@ private:
}
static JSBool
_SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
jsval* aVp)
SetEventListener(JSContext* aCx, JSHandleObject aObj, JSHandleId aIdval, JSBool aStrict,
jsval* aVp)
{
JS_ASSERT(JSID_IS_INT(aIdval));
JS_ASSERT(JSID_TO_INT(aIdval) >= 0 && JSID_TO_INT(aIdval) < STRING_COUNT);
@ -800,7 +806,7 @@ private:
UnwrapDOMObject<DedicatedWorkerGlobalScope>(aObj, Class());
if (scope) {
DestroyProtoOrIfaceCache(aObj);
scope->_Finalize(aFop);
scope->_finalize(aFop);
}
}
@ -812,7 +818,7 @@ private:
UnwrapDOMObject<DedicatedWorkerGlobalScope>(aObj, Class());
if (scope) {
mozilla::dom::TraceProtoOrIfaceCache(aTrc, aObj);
scope->_Trace(aTrc);
scope->_trace(aTrc);
}
}
@ -858,7 +864,7 @@ DOMJSClass DedicatedWorkerGlobalScope::sClass = {
JSPropertySpec DedicatedWorkerGlobalScope::sProperties[] = {
{ sEventStrings[STRING_onmessage], STRING_onmessage, PROPERTY_FLAGS,
_GetEventListener, _SetEventListener },
GetEventListener, SetEventListener },
{ 0, 0, 0, NULL, NULL }
};

View File

@ -1430,25 +1430,25 @@ XMLHttpRequest::~XMLHttpRequest()
}
void
XMLHttpRequest::_Trace(JSTracer* aTrc)
XMLHttpRequest::_trace(JSTracer* aTrc)
{
if (mUpload) {
JS_CALL_OBJECT_TRACER(aTrc, mUpload->GetJSObject(), "mUpload");
}
JS_CALL_VALUE_TRACER(aTrc, mStateData.mResponse, "mResponse");
XMLHttpRequestEventTarget::_Trace(aTrc);
XMLHttpRequestEventTarget::_trace(aTrc);
}
void
XMLHttpRequest::_Finalize(JSFreeOp* aFop)
XMLHttpRequest::_finalize(JSFreeOp* aFop)
{
ReleaseProxy(XHRIsGoingAway);
XMLHttpRequestEventTarget::_Finalize(aFop);
XMLHttpRequestEventTarget::_finalize(aFop);
}
// static
XMLHttpRequest*
XMLHttpRequest::_Constructor(JSContext* aCx, JSObject* aGlobal, ErrorResult& aRv)
XMLHttpRequest::Constructor(JSContext* aCx, JSObject* aGlobal, ErrorResult& aRv)
{
WorkerPrivate* workerPrivate = GetWorkerPrivateFromContext(aCx);
MOZ_ASSERT(workerPrivate);

View File

@ -62,13 +62,13 @@ protected:
public:
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
static XMLHttpRequest*
_Constructor(JSContext* aCx, JSObject* aGlobal, ErrorResult& aRv);
Constructor(JSContext* aCx, JSObject* aGlobal, ErrorResult& aRv);
void
Unpin();

View File

@ -8,13 +8,13 @@
USING_WORKERS_NAMESPACE
void
XMLHttpRequestEventTarget::_Trace(JSTracer* aTrc)
XMLHttpRequestEventTarget::_trace(JSTracer* aTrc)
{
EventTarget::_Trace(aTrc);
EventTarget::_trace(aTrc);
}
void
XMLHttpRequestEventTarget::_Finalize(JSFreeOp* aFop)
XMLHttpRequestEventTarget::_finalize(JSFreeOp* aFop)
{
EventTarget::_Finalize(aFop);
EventTarget::_finalize(aFop);
}

View File

@ -22,10 +22,10 @@ protected:
public:
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
#define IMPL_GETTER_AND_SETTER(_type) \
JSObject* \

View File

@ -20,16 +20,16 @@ XMLHttpRequestUpload::Create(JSContext* aCx, XMLHttpRequest* aXHR)
}
void
XMLHttpRequestUpload::_Trace(JSTracer* aTrc)
XMLHttpRequestUpload::_trace(JSTracer* aTrc)
{
if (mXHR) {
JS_CALL_OBJECT_TRACER(aTrc, mXHR->GetJSObject(), "mXHR");
}
XMLHttpRequestEventTarget::_Trace(aTrc);
XMLHttpRequestEventTarget::_trace(aTrc);
}
void
XMLHttpRequestUpload::_Finalize(JSFreeOp* aFop)
XMLHttpRequestUpload::_finalize(JSFreeOp* aFop)
{
XMLHttpRequestEventTarget::_Finalize(aFop);
XMLHttpRequestEventTarget::_finalize(aFop);
}

View File

@ -29,10 +29,10 @@ public:
Create(JSContext* aCx, XMLHttpRequest* aXHR);
virtual void
_Trace(JSTracer* aTrc) MOZ_OVERRIDE;
_trace(JSTracer* aTrc) MOZ_OVERRIDE;
virtual void
_Finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
_finalize(JSFreeOp* aFop) MOZ_OVERRIDE;
};
END_WORKERS_NAMESPACE