mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-07 23:43:37 +00:00
Bug 817473 part 2. Remove no-longer-needed nsNodeSH::PostCreatePrototype. r=peterv
This commit is contained in:
parent
04ee3d8061
commit
d23130821b
@ -1847,8 +1847,6 @@ jsid nsDOMClassInfo::sSelf_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sOpener_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sAll_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sTags_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sBaseURIObject_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sNodePrincipal_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sDocumentURIObject_id=JSID_VOID;
|
||||
jsid nsDOMClassInfo::sWrappedJSObject_id = JSID_VOID;
|
||||
jsid nsDOMClassInfo::sURL_id = JSID_VOID;
|
||||
@ -2119,8 +2117,6 @@ nsDOMClassInfo::DefineStaticJSVals(JSContext *cx)
|
||||
SET_JSID_TO_STRING(sOpener_id, cx, "opener");
|
||||
SET_JSID_TO_STRING(sAll_id, cx, "all");
|
||||
SET_JSID_TO_STRING(sTags_id, cx, "tags");
|
||||
SET_JSID_TO_STRING(sBaseURIObject_id, cx, "baseURIObject");
|
||||
SET_JSID_TO_STRING(sNodePrincipal_id, cx, "nodePrincipal");
|
||||
SET_JSID_TO_STRING(sDocumentURIObject_id,cx,"documentURIObject");
|
||||
SET_JSID_TO_STRING(sWrappedJSObject_id, cx, "wrappedJSObject");
|
||||
SET_JSID_TO_STRING(sURL_id, cx, "URL");
|
||||
@ -5209,8 +5205,6 @@ nsDOMClassInfo::ShutDown()
|
||||
sOpener_id = JSID_VOID;
|
||||
sAll_id = JSID_VOID;
|
||||
sTags_id = JSID_VOID;
|
||||
sBaseURIObject_id = JSID_VOID;
|
||||
sNodePrincipal_id = JSID_VOID;
|
||||
sDocumentURIObject_id=JSID_VOID;
|
||||
sWrappedJSObject_id = JSID_VOID;
|
||||
sOnload_id = JSID_VOID;
|
||||
@ -7739,64 +7733,6 @@ GetterShim(JSContext *cx, JSHandleObject obj, JSHandleId /* unused */, JSMutable
|
||||
return JS_TRUE;
|
||||
}
|
||||
|
||||
// Can't be static so GetterShim will compile
|
||||
nsresult
|
||||
BaseURIObjectGetter(JSContext *cx, JSObject *obj, jsval *vp)
|
||||
{
|
||||
// This function duplicates some of the logic in XPC_WN_HelperGetProperty
|
||||
XPCWrappedNative *wrapper =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
|
||||
|
||||
// The error checks duplicate code in THROW_AND_RETURN_IF_BAD_WRAPPER
|
||||
NS_ENSURE_TRUE(!wrapper || wrapper->IsValid(), NS_ERROR_XPC_HAS_BEEN_SHUTDOWN);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryWrappedNative(wrapper, obj);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
|
||||
|
||||
nsCOMPtr<nsIURI> uri = node->GetBaseURI();
|
||||
return WrapNative(cx, JS_GetGlobalForScopeChain(cx), uri,
|
||||
&NS_GET_IID(nsIURI), true, vp);
|
||||
}
|
||||
|
||||
// Can't be static so GetterShim will compile
|
||||
nsresult
|
||||
NodePrincipalGetter(JSContext *cx, JSObject *obj, jsval *vp)
|
||||
{
|
||||
// This function duplicates some of the logic in XPC_WN_HelperGetProperty
|
||||
XPCWrappedNative *wrapper =
|
||||
XPCWrappedNative::GetWrappedNativeOfJSObject(cx, obj);
|
||||
|
||||
// The error checks duplicate code in THROW_AND_RETURN_IF_BAD_WRAPPER
|
||||
NS_ENSURE_TRUE(!wrapper || wrapper->IsValid(), NS_ERROR_XPC_HAS_BEEN_SHUTDOWN);
|
||||
|
||||
nsCOMPtr<nsINode> node = do_QueryWrappedNative(wrapper, obj);
|
||||
NS_ENSURE_TRUE(node, NS_ERROR_UNEXPECTED);
|
||||
|
||||
return WrapNative(cx, JS_GetGlobalForScopeChain(cx), node->NodePrincipal(),
|
||||
&NS_GET_IID(nsIPrincipal), true, vp);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSH::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||
{
|
||||
// set up our proto first
|
||||
nsresult rv = nsDOMGenericSH::PostCreatePrototype(cx, proto);
|
||||
|
||||
if (xpc::AccessCheck::isChrome(js::GetObjectCompartment(proto))) {
|
||||
// Stick nodePrincipal and baseURIObject properties on there
|
||||
JS_DefinePropertyById(cx, proto, sNodePrincipal_id,
|
||||
JSVAL_VOID, GetterShim<NodePrincipalGetter>,
|
||||
nullptr,
|
||||
JSPROP_READONLY | JSPROP_SHARED);
|
||||
JS_DefinePropertyById(cx, proto, sBaseURIObject_id,
|
||||
JSVAL_VOID, GetterShim<BaseURIObjectGetter>,
|
||||
nullptr,
|
||||
JSPROP_READONLY | JSPROP_SHARED);
|
||||
}
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNodeSH::PreCreate(nsISupports *nativeObj, JSContext *cx, JSObject *globalObj,
|
||||
JSObject **parentObj)
|
||||
@ -8562,6 +8498,7 @@ DocumentURIObjectGetter(JSContext *cx, JSObject *obj, jsval *vp)
|
||||
NS_IMETHODIMP
|
||||
nsDocumentSH::PostCreatePrototype(JSContext * cx, JSObject * proto)
|
||||
{
|
||||
// XXXbz when this goes away, kill GetterShim as well.
|
||||
// set up our proto first
|
||||
nsresult rv = nsNodeSH::PostCreatePrototype(cx, proto);
|
||||
|
||||
|
@ -257,8 +257,6 @@ public:
|
||||
static jsid sOpener_id;
|
||||
static jsid sAll_id;
|
||||
static jsid sTags_id;
|
||||
static jsid sBaseURIObject_id;
|
||||
static jsid sNodePrincipal_id;
|
||||
static jsid sDocumentURIObject_id;
|
||||
static jsid sJava_id;
|
||||
static jsid sPackages_id;
|
||||
@ -525,7 +523,6 @@ protected:
|
||||
public:
|
||||
NS_IMETHOD PreCreate(nsISupports *nativeObj, JSContext *cx,
|
||||
JSObject *globalObj, JSObject **parentObj);
|
||||
NS_IMETHOD PostCreatePrototype(JSContext * cx, JSObject * proto);
|
||||
NS_IMETHOD AddProperty(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
JSObject *obj, jsid id, jsval *vp, bool *_retval);
|
||||
NS_IMETHOD NewResolve(nsIXPConnectWrappedNative *wrapper, JSContext *cx,
|
||||
|
Loading…
x
Reference in New Issue
Block a user