Bug 1082839 - WebIDL for WindowRoot, r=peterv

--HG--
extra : rebase_source : 035e2752e12f31b78accae45eb1534c4dc31b690
This commit is contained in:
Olli Pettay 2014-10-18 02:05:16 +03:00
parent 70e9956b23
commit b4e25b3aa6
5 changed files with 32 additions and 6 deletions

View File

@ -6,6 +6,7 @@
#include "mozilla/BasicEvents.h"
#include "mozilla/EventDispatcher.h"
#include "mozilla/EventListenerManager.h"
#include "mozilla/dom/WindowRootBinding.h"
#include "nsCOMPtr.h"
#include "nsWindowRoot.h"
#include "nsPIDOMWindow.h"
@ -20,7 +21,7 @@
#include "nsIDOMHTMLTextAreaElement.h"
#include "nsIControllers.h"
#include "nsIController.h"
#include "xpcpublic.h"
#include "nsCycleCollectionParticipant.h"
#ifdef MOZ_XUL
@ -33,7 +34,6 @@ using namespace mozilla::dom;
nsWindowRoot::nsWindowRoot(nsPIDOMWindow* aWindow)
{
mWindow = aWindow;
SetIsNotDOMBinding();
}
nsWindowRoot::~nsWindowRoot()
@ -293,6 +293,18 @@ nsWindowRoot::SetPopupNode(nsIDOMNode* aNode)
mPopupNode = aNode;
}
nsIGlobalObject*
nsWindowRoot::GetParentObject()
{
return xpc::NativeGlobal(xpc::PrivilegedJunkScope());
}
JSObject*
nsWindowRoot::WrapObject(JSContext* aCx)
{
return mozilla::dom::WindowRootBinding::Wrap(aCx, this);
}
///////////////////////////////////////////////////////////////////////////////////
already_AddRefed<EventTarget>

View File

@ -10,6 +10,7 @@
class nsPIDOMWindow;
class nsIDOMEventListener;
class nsIDOMEvent;
class nsIGlobalObject;
namespace mozilla {
class EventChainPostVisitor;
@ -61,10 +62,9 @@ public:
virtual mozilla::dom::EventTarget* GetParentTarget() MOZ_OVERRIDE { return mParent; }
virtual nsIDOMWindow* GetOwnerGlobal() MOZ_OVERRIDE;
virtual JSObject* WrapObject(JSContext* cx) MOZ_OVERRIDE
{
MOZ_CRASH("nsWindowRoot doesn't use DOM bindings!");
}
nsIGlobalObject* GetParentObject();
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_AMBIGUOUS(nsWindowRoot,
nsIDOMEventTarget)

View File

@ -1475,6 +1475,10 @@ DOMInterfaces = {
'workers': True
}],
'WindowRoot': {
'nativeType': 'nsWindowRoot'
},
'Worker': {
'headerFile': 'mozilla/dom/WorkerPrivate.h',
'nativeType': 'mozilla::dom::workers::WorkerPrivate',

View File

@ -0,0 +1,9 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
* You can obtain one at http://mozilla.org/MPL/2.0/.
*/
[ChromeOnly]
interface WindowRoot : EventTarget {
};

View File

@ -524,6 +524,7 @@ WEBIDL_FILES = [
'WebSocket.webidl',
'WheelEvent.webidl',
'WifiOptions.webidl',
'WindowRoot.webidl',
'Worker.webidl',
'WorkerGlobalScope.webidl',
'WorkerLocation.webidl',