Backed out changesets 4a19dcbc7e7a and 4907115e02e3 (bug 1029248) for non-unified bustage.

CLOSED TREE
This commit is contained in:
Ryan VanderMeulen 2014-07-03 13:19:29 -04:00
parent 7b37054094
commit fb6f81f8fb
8 changed files with 12 additions and 29 deletions

View File

@ -1898,10 +1898,11 @@ InterfaceHasInstance(JSContext* cx, JS::Handle<JSObject*> obj,
return true;
}
if (jsipc::IsWrappedCPOW(instance)) {
JS::Rooted<JSObject*> unwrapped(cx, js::CheckedUnwrap(instance, true));
if (unwrapped && jsipc::IsCPOW(unwrapped)) {
bool boolp = false;
if (!jsipc::DOMInstanceOf(cx, js::CheckedUnwrap(instance), clasp->mPrototypeID,
clasp->mDepth, &boolp)) {
if (!jsipc::DOMInstanceOf(cx, unwrapped, clasp->mPrototypeID,
clasp->mDepth, &boolp)) {
return false;
}
*bp = boolp;

View File

@ -676,15 +676,6 @@ IsCPOW(JSObject *obj)
return IsProxy(obj) && GetProxyHandler(obj) == &CPOWProxyHandler::singleton;
}
bool
IsWrappedCPOW(JSObject *obj)
{
JSObject *unwrapped = js::CheckedUnwrap(obj, true);
if (!unwrapped)
return false;
return IsCPOW(unwrapped);
}
nsresult
InstanceOf(JSObject *proxy, const nsID *id, bool *bp)
{

View File

@ -144,9 +144,6 @@ class WrapperOwner : public virtual JavaScriptShared
bool
IsCPOW(JSObject *obj);
bool
IsWrappedCPOW(JSObject *obj);
nsresult
InstanceOf(JSObject *obj, const nsID *id, bool *bp);

View File

@ -3113,7 +3113,7 @@ nsXPCComponents_Utils::IsCrossProcessWrapper(HandleValue obj, bool *out)
if (obj.isPrimitive())
return NS_ERROR_INVALID_ARG;
*out = jsipc::IsWrappedCPOW(&obj.toObject());
*out = jsipc::IsCPOW(js::CheckedUnwrap(&obj.toObject()));
return NS_OK;
}

View File

@ -65,8 +65,8 @@ UnwrapNativeCPOW(nsISupports* wrapper)
{
nsCOMPtr<nsIXPConnectWrappedJS> underware = do_QueryInterface(wrapper);
if (underware) {
JSObject *mainObj = underware->GetJSObject();
if (mainObj && mozilla::jsipc::IsWrappedCPOW(mainObj))
JSObject* mainObj = underware->GetJSObject();
if (mainObj && mozilla::jsipc::IsCPOW(mainObj))
return mainObj;
}
return nullptr;

View File

@ -12,7 +12,6 @@
#include "nsCxPusher.h"
#include "nsContentUtils.h"
#include "nsThreadUtils.h"
#include "JavaScriptParent.h"
using namespace mozilla;
@ -335,9 +334,7 @@ nsXPCWrappedJS::GetNewOrUsed(JS::HandleObject jsObj,
return NS_ERROR_FAILURE;
}
bool allowNonScriptable = mozilla::jsipc::IsWrappedCPOW(jsObj);
nsRefPtr<nsXPCWrappedJSClass> clasp = nsXPCWrappedJSClass::GetNewOrUsed(cx, aIID,
allowNonScriptable);
nsRefPtr<nsXPCWrappedJSClass> clasp = nsXPCWrappedJSClass::GetNewOrUsed(cx, aIID);
if (!clasp)
return NS_ERROR_FAILURE;

View File

@ -90,7 +90,7 @@ bool xpc_IsReportableErrorCode(nsresult code)
// static
already_AddRefed<nsXPCWrappedJSClass>
nsXPCWrappedJSClass::GetNewOrUsed(JSContext* cx, REFNSIID aIID, bool allowNonScriptable)
nsXPCWrappedJSClass::GetNewOrUsed(JSContext* cx, REFNSIID aIID)
{
XPCJSRuntime* rt = nsXPConnect::GetRuntimeInstance();
IID2WrappedJSClassMap* map = rt->GetWrappedJSClassMap();
@ -101,7 +101,7 @@ nsXPCWrappedJSClass::GetNewOrUsed(JSContext* cx, REFNSIID aIID, bool allowNonScr
nsXPConnect::XPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
if (info) {
bool canScript, isBuiltin;
if (NS_SUCCEEDED(info->IsScriptable(&canScript)) && (canScript || allowNonScriptable) &&
if (NS_SUCCEEDED(info->IsScriptable(&canScript)) && canScript &&
NS_SUCCEEDED(info->IsBuiltinClass(&isBuiltin)) && !isBuiltin &&
nsXPConnect::IsISupportsDescendant(info))
{
@ -202,14 +202,12 @@ nsXPCWrappedJSClass::CallQueryInterfaceOnJSObject(JSContext* cx,
// implement intentionally (for security) unscriptable interfaces.
// We so often ask for nsISupports that we can short-circuit the test...
if (!aIID.Equals(NS_GET_IID(nsISupports))) {
bool allowNonScriptable = mozilla::jsipc::IsWrappedCPOW(jsobj);
nsCOMPtr<nsIInterfaceInfo> info;
nsXPConnect::XPConnect()->GetInfoForIID(&aIID, getter_AddRefs(info));
if (!info)
return nullptr;
bool canScript, isBuiltin;
if (NS_FAILED(info->IsScriptable(&canScript)) || (!canScript && !allowNonScriptable) ||
if (NS_FAILED(info->IsScriptable(&canScript)) || !canScript ||
NS_FAILED(info->IsBuiltinClass(&isBuiltin)) || isBuiltin)
return nullptr;
}

View File

@ -2241,8 +2241,7 @@ public:
static already_AddRefed<nsXPCWrappedJSClass>
GetNewOrUsed(JSContext* cx,
REFNSIID aIID,
bool allowNonScriptable = false);
REFNSIID aIID);
REFNSIID GetIID() const {return mIID;}
XPCJSRuntime* GetRuntime() const {return mRuntime;}