mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 780151 - Part b: Don't hand out ThisTranslators; r=bz
This commit is contained in:
parent
d19a1ada0a
commit
db5221a631
@ -2446,19 +2446,12 @@ nsDOMClassInfo::Init()
|
||||
nsresult rv = CallGetService(nsIXPConnect::GetCID(), &sXPConnect);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIXPCFunctionThisTranslator> old;
|
||||
|
||||
nsCOMPtr<nsIXPCFunctionThisTranslator> elt = new nsEventListenerThisTranslator();
|
||||
NS_ENSURE_TRUE(elt, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
sXPConnect->SetFunctionThisTranslator(NS_GET_IID(nsIDOMEventListener),
|
||||
elt, getter_AddRefs(old));
|
||||
sXPConnect->SetFunctionThisTranslator(NS_GET_IID(nsIDOMEventListener), elt);
|
||||
|
||||
nsCOMPtr<nsIXPCFunctionThisTranslator> mctl = new nsMutationCallbackThisTranslator();
|
||||
NS_ENSURE_TRUE(elt, NS_ERROR_OUT_OF_MEMORY);
|
||||
|
||||
sXPConnect->SetFunctionThisTranslator(NS_GET_IID(nsIMutationObserverCallback),
|
||||
mctl, getter_AddRefs(old));
|
||||
mctl);
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> sm =
|
||||
do_GetService("@mozilla.org/scriptsecuritymanager;1", &rv);
|
||||
|
@ -288,7 +288,7 @@ interface nsIXPCFunctionThisTranslator : nsISupports
|
||||
{ 0xbd, 0xd6, 0x0, 0x0, 0x64, 0x65, 0x73, 0x74 } }
|
||||
%}
|
||||
|
||||
[uuid(bd300b18-1c34-4589-8285-23a12cc580ea)]
|
||||
[uuid(d94c13ae-7585-4e7b-b7ad-482976bc6f1b)]
|
||||
interface nsIXPConnect : nsISupports
|
||||
{
|
||||
%{ C++
|
||||
@ -514,10 +514,7 @@ interface nsIXPConnect : nsISupports
|
||||
in nsISupports aCOMObj,
|
||||
in nsIIDRef aIID);
|
||||
|
||||
nsIXPCFunctionThisTranslator
|
||||
getFunctionThisTranslator(in nsIIDRef aIID);
|
||||
|
||||
nsIXPCFunctionThisTranslator
|
||||
void
|
||||
setFunctionThisTranslator(in nsIIDRef aIID,
|
||||
in nsIXPCFunctionThisTranslator aTranslator);
|
||||
|
||||
|
@ -1839,7 +1839,7 @@ main(int argc, char **argv, char **envp)
|
||||
#ifdef TEST_TranslateThis
|
||||
nsCOMPtr<nsIXPCFunctionThisTranslator>
|
||||
translator(new nsXPCFunctionThisTranslator);
|
||||
xpc->SetFunctionThisTranslator(NS_GET_IID(nsITestXPCFunctionCallback), translator, nullptr);
|
||||
xpc->SetFunctionThisTranslator(NS_GET_IID(nsITestXPCFunctionCallback), translator);
|
||||
#endif
|
||||
|
||||
nsCOMPtr<nsIJSContextStack> cxstack = do_GetService("@mozilla.org/js/xpc/ContextStack;1");
|
||||
|
@ -1831,46 +1831,20 @@ nsXPConnect::SyncJSContexts(void)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIXPCFunctionThisTranslator setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator); */
|
||||
/* void setFunctionThisTranslator (in nsIIDRef aIID, in nsIXPCFunctionThisTranslator aTranslator); */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::SetFunctionThisTranslator(const nsIID & aIID,
|
||||
nsIXPCFunctionThisTranslator *aTranslator,
|
||||
nsIXPCFunctionThisTranslator **_retval)
|
||||
nsIXPCFunctionThisTranslator *aTranslator)
|
||||
{
|
||||
XPCJSRuntime* rt = GetRuntime();
|
||||
nsIXPCFunctionThisTranslator* old;
|
||||
IID2ThisTranslatorMap* map = rt->GetThisTranslatorMap();
|
||||
|
||||
{
|
||||
XPCAutoLock lock(rt->GetMapLock()); // scoped lock
|
||||
if (_retval) {
|
||||
old = map->Find(aIID);
|
||||
NS_IF_ADDREF(old);
|
||||
*_retval = old;
|
||||
}
|
||||
map->Add(aIID, aTranslator);
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* nsIXPCFunctionThisTranslator getFunctionThisTranslator (in nsIIDRef aIID); */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::GetFunctionThisTranslator(const nsIID & aIID,
|
||||
nsIXPCFunctionThisTranslator **_retval)
|
||||
{
|
||||
XPCJSRuntime* rt = GetRuntime();
|
||||
nsIXPCFunctionThisTranslator* old;
|
||||
IID2ThisTranslatorMap* map = rt->GetThisTranslatorMap();
|
||||
|
||||
{
|
||||
XPCAutoLock lock(rt->GetMapLock()); // scoped lock
|
||||
old = map->Find(aIID);
|
||||
NS_IF_ADDREF(old);
|
||||
*_retval = old;
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void clearAllWrappedNativeSecurityPolicies (); */
|
||||
NS_IMETHODIMP
|
||||
nsXPConnect::ClearAllWrappedNativeSecurityPolicies()
|
||||
|
Loading…
Reference in New Issue
Block a user