Bug 516522 - CPOW: Cross-Process (JavaScript) Object Wrapper. r=mrbkap r=bent sr=jst

This commit is contained in:
Ben Newman
2009-11-06 12:43:39 -08:00
parent b380af2d47
commit 2ce29f5e13
38 changed files with 2372 additions and 18 deletions

View File

@@ -75,6 +75,8 @@
#include "nsIDocShellLoadInfo.h"
#include "nsIBaseWindow.h"
#include "nsContentUtils.h"
#include "nsIXPConnect.h"
#include "nsIJSContextStack.h"
#include "nsUnicharUtils.h"
#include "nsIScriptGlobalObject.h"
#include "nsIScriptSecurityManager.h"
@@ -123,6 +125,8 @@ using namespace mozilla;
using namespace mozilla::dom;
#endif
#include "jsapi.h"
class nsAsyncDocShellDestroyer : public nsRunnable
{
public:
@@ -1594,6 +1598,24 @@ nsFrameLoader::SendCrossProcessKeyEvent(const nsAString& aType,
return NS_ERROR_FAILURE;
}
NS_IMETHODIMP
nsFrameLoader::GetCrossProcessObjectWrapper(nsIVariant** cpow)
{
nsIXPConnect* xpc;
nsIThreadJSContextStack* stack;
JSContext* cx;
JSObject* global;
if ((xpc = nsContentUtils::XPConnect()) &&
(stack = nsContentUtils::ThreadJSContextStack()) &&
NS_SUCCEEDED(stack->Peek(&cx)) && cx &&
mChildProcess->GetGlobalJSObject(cx, &global)) {
return xpc->JSToVariant(cx, OBJECT_TO_JSVAL(global), cpow);
}
return NS_ERROR_NOT_AVAILABLE;
}
nsresult
nsFrameLoader::CreateStaticClone(nsIFrameLoader* aDest)
{