Bug 648801 (new DOM list bindings) - Rename xpc::dom to mozilla::dom::binding. r=bz/jst/mrbkap.

--HG--
extra : rebase_source : 6e27f15c5f0cc83a75cc9b8cb9dec425a37b56b0
This commit is contained in:
Peter Van der Beken 2011-08-20 15:53:32 +02:00
Родитель 271df2ca33
Коммит 74a00a3e05
18 изменённых файлов: 49 добавлений и 44 удалений

Просмотреть файл

@ -187,9 +187,9 @@ NS_IMPL_RELEASE_INHERITED(nsSimpleContentList, nsBaseContentList)
JSObject*
nsSimpleContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *failed)
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope, this, failed);
return mozilla::dom::binding::NodeListBase::create(cx, scope, this, triedToWrap);
}
// nsFormContentList
@ -504,11 +504,11 @@ nsContentList::~nsContentList()
JSObject*
nsContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *failed)
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope,
static_cast<nsIHTMLCollection*>(this),
this, failed);
return mozilla::dom::binding::NodeListBase::create(cx, scope,
static_cast<nsIHTMLCollection*>(this),
this, triedToWrap);
}
DOMCI_DATA(ContentList, nsContentList)

Просмотреть файл

@ -1559,7 +1559,7 @@ JSObject*
nsChildContentList::WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope, this, triedToWrap);
return mozilla::dom::binding::NodeListBase::create(cx, scope, this, triedToWrap);
}
NS_IMETHODIMP

Просмотреть файл

@ -165,7 +165,7 @@ public:
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope, this, this, triedToWrap);
return mozilla::dom::binding::NodeListBase::create(cx, scope, this, this, triedToWrap);
}
nsHTMLFormElement* mForm; // WEAK - the form owns me

Просмотреть файл

@ -87,7 +87,7 @@ public:
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope, this, this, triedToWrap);
return mozilla::dom::binding::NodeListBase::create(cx, scope, this, this, triedToWrap);
}
protected:

Просмотреть файл

@ -118,7 +118,8 @@ public:
virtual JSObject* WrapObject(JSContext *cx, XPCWrappedNativeScope *scope,
bool *triedToWrap)
{
return xpc::dom::NodeListBase::create(cx, scope, this, triedToWrap);
return mozilla::dom::binding::NodeListBase::create(cx, scope, this,
triedToWrap);
}
NS_DECLARE_STATIC_IID_ACCESSOR(NS_ANONYMOUS_CONTENT_LIST_IID)

Просмотреть файл

@ -4184,7 +4184,7 @@ nsDOMClassInfo::Init()
sDisableGlobalScopePollutionSupport =
Preferences::GetBool("browser.dom.global_scope_pollution.disabled");
xpc::dom::Register(sClassInfoData);
mozilla::dom::binding::Register(sClassInfoData);
sIsInitialized = PR_TRUE;
@ -6170,9 +6170,9 @@ nsWindowSH::GlobalResolve(nsGlobalWindow *aWin, JSContext *cx,
// Lookup new DOM bindings.
if (name_struct->mType == nsGlobalNameStruct::eTypeClassConstructor) {
xpc::dom::DefineInterface define =
mozilla::dom::binding::DefineInterface define =
sClassInfoData[name_struct->mDOMClassInfoID].mDefineDOMInterface;
if (define && xpc::dom::DefineConstructor(cx, obj, define, &rv)) {
if (define && mozilla::dom::binding::DefineConstructor(cx, obj, define, &rv)) {
*did_resolve = NS_SUCCEEDED(rv);
return rv;
@ -8427,9 +8427,9 @@ nsHTMLDocumentSH::GetDocumentAllNodeList(JSContext *cx, JSObject *obj,
if (!JSVAL_IS_PRIMITIVE(collection)) {
// We already have a node list in our reserved slot, use it.
JSObject *obj = JSVAL_TO_OBJECT(collection);
if (xpc::dom::NodeList<nsIHTMLCollection>::objIsNodeList(obj)) {
if (mozilla::dom::binding::NodeList<nsIHTMLCollection>::objIsNodeList(obj)) {
nsIHTMLCollection *native =
xpc::dom::NodeList<nsIHTMLCollection>::getNodeList(obj);
mozilla::dom::binding::NodeList<nsIHTMLCollection>::getNodeList(obj);
NS_ADDREF(*nodeList = static_cast<nsContentList*>(native));
}
else {

Просмотреть файл

@ -102,7 +102,7 @@ struct nsDOMClassInfoData
bool mChromeOnly;
bool mDisabled;
// For new style DOM bindings.
xpc::dom::DefineInterface mDefineDOMInterface;
mozilla::dom::binding::DefineInterface mDefineDOMInterface;
#ifdef NS_DEBUG
PRUint32 mDebugID;
#endif

Просмотреть файл

@ -64,10 +64,10 @@ nsWrapperCache::SetWrapper(JSObject* aWrapper)
NS_ASSERTION(aWrapper, "Use ClearWrapper!");
JSObject *obj = GetJSObjectFromBits();
if (obj && xpc::dom::isExpandoObject(obj)) {
NS_ASSERTION(xpc::dom::instanceIsProxy(aWrapper),
if (obj && mozilla::dom::binding::isExpandoObject(obj)) {
NS_ASSERTION(mozilla::dom::binding::instanceIsProxy(aWrapper),
"We have an expando but this isn't a DOM proxy?");
js::SetProxyExtra(aWrapper, xpc::dom::JSPROXYSLOT_EXPANDO,
js::SetProxyExtra(aWrapper, mozilla::dom::binding::JSPROXYSLOT_EXPANDO,
js::ObjectValue(*obj));
}
@ -84,24 +84,24 @@ nsWrapperCache::GetExpandoObjectPreserveColor() const
if (!IsProxy()) {
// If we support non-proxy dom binding objects then this should be:
//return xpc::dom::isExpandoObject(obj) ? obj : js::GetSlot(obj, EXPANDO_SLOT);
//return mozilla::dom::binding::isExpandoObject(obj) ? obj : js::GetSlot(obj, EXPANDO_SLOT);
return NULL;
}
// FIXME unmark gray?
if (xpc::dom::instanceIsProxy(obj)) {
if (mozilla::dom::binding::instanceIsProxy(obj)) {
return GetExpandoFromSlot(obj);
}
return xpc::dom::isExpandoObject(obj) ? obj : NULL;
return mozilla::dom::binding::isExpandoObject(obj) ? obj : NULL;
}
inline JSObject*
nsWrapperCache::GetExpandoFromSlot(JSObject *obj)
{
NS_ASSERTION(xpc::dom::instanceIsProxy(obj),
NS_ASSERTION(mozilla::dom::binding::instanceIsProxy(obj),
"Asking for an expando but this isn't a DOM proxy?");
const js::Value &v = js::GetProxyExtra(obj, xpc::dom::JSPROXYSLOT_EXPANDO);
const js::Value &v = js::GetProxyExtra(obj, mozilla::dom::binding::JSPROXYSLOT_EXPANDO);
return v.isUndefined() ? NULL : v.toObjectOrNull();
}
@ -115,7 +115,7 @@ nsWrapperCache::ClearWrapper()
}
JSObject *expando;
if (xpc::dom::instanceIsProxy(obj)) {
if (mozilla::dom::binding::instanceIsProxy(obj)) {
expando = GetExpandoFromSlot(obj);
}
else {

Просмотреть файл

@ -49,8 +49,9 @@
using namespace js;
namespace xpc {
namespace mozilla {
namespace dom {
namespace binding {
static jsid s_constructor_id = JSID_VOID;
@ -709,7 +710,7 @@ NodeList<T>::getPropertyDescriptor(JSContext *cx, JSObject *proxy, jsid id, bool
return false;
if (desc->obj)
return true;
if (WrapperFactory::IsXrayWrapper(proxy))
if (xpc::WrapperFactory::IsXrayWrapper(proxy))
return resolveNativeName(cx, proxy, id, desc);
return JS_GetPropertyDescriptorById(cx, js::GetObjectProto(proxy), id, JSRESOLVE_QUALIFIED,
desc);
@ -911,7 +912,7 @@ template<class T>
bool
NodeList<T>::resolveNativeName(JSContext *cx, JSObject *proxy, jsid id, PropertyDescriptor *desc)
{
JS_ASSERT(WrapperFactory::IsXrayWrapper(proxy));
JS_ASSERT(xpc::WrapperFactory::IsXrayWrapper(proxy));
for (size_t n = 0; n < NS_ARRAY_LENGTH(sProtoProperties); ++n) {
if (id == sProtoProperties[n].id) {
@ -1074,3 +1075,4 @@ NodeList<nsIHTMLCollection>::getNodeList(JSObject *obj);
}
}
}

Просмотреть файл

@ -48,8 +48,9 @@ class nsINode;
class nsINodeList;
class nsIHTMLCollection;
namespace xpc {
namespace mozilla {
namespace dom {
namespace binding {
inline nsWrapperCache*
GetWrapperCache(nsWrapperCache *cache)
@ -179,6 +180,7 @@ class NodeList : public NodeListBase {
static T *getNodeList(JSObject *obj);
};
}
}
}

Просмотреть файл

@ -909,7 +909,7 @@ nsXPConnect::Traverse(void *p, nsCycleCollectionTraversalCallback &cb)
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "xpc_GetJSPrivate(obj)");
cb.NoteXPCOMChild(static_cast<nsISupports*>(xpc_GetJSPrivate(obj)));
}
else if(xpc::dom::instanceIsProxy(obj))
else if(mozilla::dom::binding::instanceIsProxy(obj))
{
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "js::GetProxyPrivate(obj)");
nsISupports *identity =
@ -1545,7 +1545,7 @@ nsXPConnect::GetNativeOfWrapper(JSContext * aJSContext,
if(obj2)
return (nsISupports*)xpc_GetJSPrivate(obj2);
if(xpc::dom::instanceIsProxy(aJSObj)) {
if(mozilla::dom::binding::instanceIsProxy(aJSObj)) {
// FIXME: Provide a fast non-refcounting way to get the canonical
// nsISupports from the proxy.
nsISupports *supports =
@ -1585,7 +1585,7 @@ nsXPConnect::GetJSObjectOfWrapper(JSContext * aJSContext,
*_retval = obj2;
return NS_OK;
}
if(xpc::dom::instanceIsProxy(aJSObj))
if(mozilla::dom::binding::instanceIsProxy(aJSObj))
{
*_retval = aJSObj;
return NS_OK;

Просмотреть файл

@ -528,7 +528,7 @@ nsJSIID::HasInstance(nsIXPConnectWrappedNative *wrapper,
return NS_ERROR_FAILURE;
}
if (xpc::dom::instanceIsProxy(obj))
if (mozilla::dom::binding::instanceIsProxy(obj))
{
nsISupports *identity =
static_cast<nsISupports*>(js::GetProxyPrivate(obj).toPrivate());

Просмотреть файл

@ -2164,7 +2164,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
JS_SetGCParameterForThread(cx, JSGC_MAX_CODE_CACHE_BYTES, 16 * 1024 * 1024);
{
// Scope the JSAutoRequest so it goes out of scope before calling
// xpc::dom::DefineStaticJSVals.
// mozilla::dom::binding::DefineStaticJSVals.
JSAutoRequest ar(cx);
for(uintN i = 0; i < IDX_TOTAL_COUNT; i++)
{
@ -2179,7 +2179,7 @@ XPCJSRuntime::OnJSContextNew(JSContext *cx)
}
}
ok = xpc::dom::DefineStaticJSVals(cx);
ok = mozilla::dom::binding::DefineStaticJSVals(cx);
}
if (!ok)
return JS_FALSE;

Просмотреть файл

@ -262,10 +262,9 @@ ReportJSRuntimeStats(const IterateData &data, const nsACString &pathPrefix,
} // namespace memory
} // namespace xpconnect
} // namespace mozilla
namespace xpc {
namespace dom {
namespace binding {
extern int HandlerFamily;
inline void* ProxyFamily() { return &HandlerFamily; }
@ -296,7 +295,8 @@ extern bool
DefineConstructor(JSContext *cx, JSObject *obj, DefineInterface aDefine,
nsresult *aResult);
}
}
} // namespace binding
} // namespace dom
} // namespace mozilla
#endif

Просмотреть файл

@ -884,7 +884,7 @@ castNative(JSContext *cx,
}
else
{
NS_ABORT_IF_FALSE(xpc::dom::instanceIsProxy(cur),
NS_ABORT_IF_FALSE(mozilla::dom::binding::instanceIsProxy(cur),
"what kind of wrapper is this?");
native = static_cast<nsISupports*>(js::GetProxyPrivate(cur).toPrivate());
entries = nsnull;
@ -971,7 +971,7 @@ xpc_qsUnwrapArgImpl(JSContext *cx,
XPCWrappedNative *wrapper;
XPCWrappedNativeTearOff *tearoff;
JSObject *obj2;
if(xpc::dom::instanceIsProxy(src))
if(mozilla::dom::binding::instanceIsProxy(src))
{
wrapper = nsnull;
obj2 = src;

Просмотреть файл

@ -61,7 +61,7 @@ xpc_OkToHandOutWrapper(nsWrapperCache *cache)
NS_ABORT_IF_FALSE(cache->IsProxy() || IS_WN_WRAPPER(cache->GetWrapper()),
"Must have proxy or XPCWrappedNative wrapper");
return cache->IsProxy() ?
xpc::dom::instanceIsProxy(cache->GetWrapper()) :
mozilla::dom::binding::instanceIsProxy(cache->GetWrapper()) :
!static_cast<XPCWrappedNative*>(xpc_GetJSPrivate(cache->GetWrapper()))->
NeedsSOW();
}

Просмотреть файл

@ -256,7 +256,7 @@ CanXray(JSObject *obj, bool *proxy)
*proxy = false;
return true;
}
return (*proxy = dom::instanceIsProxy(obj));
return (*proxy = mozilla::dom::binding::instanceIsProxy(obj));
}
JSObject *

Просмотреть файл

@ -456,7 +456,7 @@ XrayToString(JSContext *cx, uintN argc, jsval *vp)
}
nsAutoString result(NS_LITERAL_STRING("[object XrayWrapper "));
if (dom::instanceIsProxy(&js::GetProxyPrivate(wrapper).toObject())) {
if (mozilla::dom::binding::instanceIsProxy(&js::GetProxyPrivate(wrapper).toObject())) {
JSString *wrapperStr = js::GetProxyHandler(wrapper)->obj_toString(cx, wrapper);
size_t length;
const jschar* chars = JS_GetStringCharsAndLength(cx, wrapperStr, &length);