Bug 741347 - Remove nsIXPConnect::DefineDOMQuickStubs, call DOM_DefineQuickStubs directly instead; r=bholley

This commit is contained in:
Ms2ger 2012-04-14 15:05:17 +02:00
parent 9f95d23e65
commit bd900a0e7f
5 changed files with 31 additions and 44 deletions

View File

@ -53,7 +53,9 @@
#include "jsdbgapi.h"
#include "WrapperFactory.h"
#include "AccessCheck.h"
#include "XrayWrapper.h"
#include "xpcpublic.h"
#include "xpcprivate.h"
#include "XPCWrapper.h"
@ -84,8 +86,6 @@
#include "nsIRunnable.h"
#include "nsThreadUtils.h"
#include "nsDOMEventTargetHelper.h"
#include "xpcprivate.h"
#include "XrayWrapper.h"
// General helper includes
#include "nsGlobalWindow.h"
@ -4922,8 +4922,7 @@ nsDOMClassInfo::PostCreatePrototype(JSContext * cx, JSObject * proto)
count++;
}
if (!sXPConnect->DefineDOMQuickStubs(cx, proto, flags,
count, mData->mInterfaces)) {
if (!xpc::DOM_DefineQuickStubs(cx, proto, flags, count, mData->mInterfaces)) {
JS_ClearPendingException(cx);
}

View File

@ -409,7 +409,7 @@ enum nsGCType {
};
%}
[uuid(08ad2253-3ed6-40ed-beec-6472f2d8dc7f)]
[uuid(1239b432-b835-4d28-9dc0-53063cb7f60f)]
interface nsIXPConnect : nsISupports
{
%{ C++
@ -745,30 +745,6 @@ interface nsIXPConnect : nsISupports
*/
void NotifyDidPaint();
/**
* Define quick stubs on the given object, @a proto.
*
* @param cx
* A context. Requires request.
* @param proto
* The (newly created) prototype object for a DOM class. The JS half
* of an XPCWrappedNativeProto.
* @param flags
* Property flags for the quick stub properties--should be either
* JSPROP_ENUMERATE or 0.
* @param interfaceCount
* The number of interfaces the class implements.
* @param interfaceArray
* The interfaces the class implements; interfaceArray and
* interfaceCount are like what nsIClassInfo.getInterfaces returns.
*/
[noscript,notxpcom] boolean defineDOMQuickStubs(
in JSContextPtr cx,
in JSObjectPtr proto,
in PRUint32 flags,
in PRUint32 interfaceCount,
[array, size_is(interfaceCount)] in nsIIDPtr interfaceArray);
%{C++
/**
* Get the object principal for this wrapper. Note that this may well end

View File

@ -2373,18 +2373,6 @@ nsXPConnect::SetReportAllJSExceptions(bool newval)
return NS_OK;
}
/* [noscript, notxpcom] bool defineDOMQuickStubs (in JSContextPtr cx, in JSObjectPtr proto, in PRUint32 flags, in PRUint32 interfaceCount, [array, size_is (interfaceCount)] in nsIIDPtr interfaceArray); */
NS_IMETHODIMP_(bool)
nsXPConnect::DefineDOMQuickStubs(JSContext * cx,
JSObject * proto,
PRUint32 flags,
PRUint32 interfaceCount,
const nsIID * *interfaceArray)
{
return DOM_DefineQuickStubs(cx, proto, flags,
interfaceCount, interfaceArray);
}
/* attribute JSRuntime runtime; */
NS_IMETHODIMP
nsXPConnect::GetRuntime(JSRuntime **runtime)

View File

@ -1274,14 +1274,16 @@ def writeDefiner(f, conf, stringtable, interfaces):
f.write("\n")
# the definer function (entry point to this quick stubs file)
f.write("JSBool %s_DefineQuickStubs(" % conf.name)
f.write("namespace xpc {\n")
f.write("bool %s_DefineQuickStubs(" % conf.name)
f.write("JSContext *cx, JSObject *proto, unsigned flags, PRUint32 count, "
"const nsID **iids)\n"
"{\n")
f.write(" return xpc_qsDefineQuickStubs("
f.write(" return !!xpc_qsDefineQuickStubs("
"cx, proto, flags, count, iids, %d, tableData, %s, %s, %s);\n" % (
size, prop_array_name, func_array_name, table_name))
f.write("}\n\n\n")
f.write("}\n")
f.write("} // namespace xpc\n\n\n")
stubTopTemplate = '''\

View File

@ -228,6 +228,28 @@ nsIPrincipal *GetCompartmentPrincipal(JSCompartment *compartment);
#ifdef DEBUG
void DumpJSHeap(FILE* file);
#endif
/**
* Define quick stubs on the given object, @a proto.
*
* @param cx
* A context. Requires request.
* @param proto
* The (newly created) prototype object for a DOM class. The JS half
* of an XPCWrappedNativeProto.
* @param flags
* Property flags for the quick stub properties--should be either
* JSPROP_ENUMERATE or 0.
* @param interfaceCount
* The number of interfaces the class implements.
* @param interfaceArray
* The interfaces the class implements; interfaceArray and
* interfaceCount are like what nsIClassInfo.getInterfaces returns.
*/
bool
DOM_DefineQuickStubs(JSContext *cx, JSObject *proto, PRUint32 flags,
PRUint32 interfaceCount, const nsIID **interfaceArray);
} // namespace xpc
class nsIMemoryMultiReporterCallback;