Bug 906901 - Use webIDL dictionaries for BrowerElementParent's event details r=bz
This commit is contained in:
@@ -196,7 +196,6 @@
|
|||||||
@BINPATH@/components/dom_offline.xpt
|
@BINPATH@/components/dom_offline.xpt
|
||||||
@BINPATH@/components/dom_payment.xpt
|
@BINPATH@/components/dom_payment.xpt
|
||||||
@BINPATH@/components/dom_json.xpt
|
@BINPATH@/components/dom_json.xpt
|
||||||
@BINPATH@/components/dom_browserelement.xpt
|
|
||||||
@BINPATH@/components/dom_messages.xpt
|
@BINPATH@/components/dom_messages.xpt
|
||||||
@BINPATH@/components/dom_power.xpt
|
@BINPATH@/components/dom_power.xpt
|
||||||
@BINPATH@/components/dom_quota.xpt
|
@BINPATH@/components/dom_quota.xpt
|
||||||
|
|||||||
@@ -203,7 +203,6 @@
|
|||||||
@BINPATH@/components/dom_indexeddb.xpt
|
@BINPATH@/components/dom_indexeddb.xpt
|
||||||
@BINPATH@/components/dom_offline.xpt
|
@BINPATH@/components/dom_offline.xpt
|
||||||
@BINPATH@/components/dom_json.xpt
|
@BINPATH@/components/dom_json.xpt
|
||||||
@BINPATH@/components/dom_browserelement.xpt
|
|
||||||
@BINPATH@/components/dom_power.xpt
|
@BINPATH@/components/dom_power.xpt
|
||||||
@BINPATH@/components/dom_quota.xpt
|
@BINPATH@/components/dom_quota.xpt
|
||||||
@BINPATH@/components/dom_range.xpt
|
@BINPATH@/components/dom_range.xpt
|
||||||
|
|||||||
@@ -185,8 +185,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include "nsIDOMCameraManager.h"
|
#include "nsIDOMCameraManager.h"
|
||||||
#include "nsIOpenWindowEventDetail.h"
|
|
||||||
#include "nsIAsyncScrollEventDetail.h"
|
|
||||||
#include "nsIDOMGlobalObjectConstructor.h"
|
#include "nsIDOMGlobalObjectConstructor.h"
|
||||||
#include "nsIDOMLockedFile.h"
|
#include "nsIDOMLockedFile.h"
|
||||||
#include "nsDebug.h"
|
#include "nsDebug.h"
|
||||||
@@ -561,11 +559,6 @@ static nsDOMClassInfoData sClassInfoData[] = {
|
|||||||
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(CameraCapabilities, nsDOMGenericSH,
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
||||||
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(OpenWindowEventDetail, nsDOMGenericSH,
|
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(AsyncScrollEventDetail, nsDOMGenericSH,
|
|
||||||
DOM_DEFAULT_SCRIPTABLE_FLAGS)
|
|
||||||
|
|
||||||
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
|
NS_DEFINE_CLASSINFO_DATA(LockedFile, nsEventTargetSH,
|
||||||
EVENTTARGET_SCRIPTABLE_FLAGS)
|
EVENTTARGET_SCRIPTABLE_FLAGS)
|
||||||
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
|
NS_DEFINE_CLASSINFO_DATA(CSSFontFeatureValuesRule, nsDOMGenericSH,
|
||||||
@@ -1447,14 +1440,6 @@ nsDOMClassInfo::Init()
|
|||||||
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
DOM_CLASSINFO_MAP_ENTRY(nsICameraCapabilities)
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(OpenWindowEventDetail, nsIOpenWindowEventDetail)
|
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIOpenWindowEventDetail)
|
|
||||||
DOM_CLASSINFO_MAP_END
|
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(AsyncScrollEventDetail, nsIAsyncScrollEventDetail)
|
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIAsyncScrollEventDetail)
|
|
||||||
DOM_CLASSINFO_MAP_END
|
|
||||||
|
|
||||||
DOM_CLASSINFO_MAP_BEGIN(LockedFile, nsIDOMLockedFile)
|
DOM_CLASSINFO_MAP_BEGIN(LockedFile, nsIDOMLockedFile)
|
||||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
|
DOM_CLASSINFO_MAP_ENTRY(nsIDOMLockedFile)
|
||||||
DOM_CLASSINFO_MAP_END
|
DOM_CLASSINFO_MAP_END
|
||||||
|
|||||||
@@ -143,9 +143,6 @@ DOMCI_CLASS(BluetoothDevice)
|
|||||||
DOMCI_CLASS(CameraControl)
|
DOMCI_CLASS(CameraControl)
|
||||||
DOMCI_CLASS(CameraCapabilities)
|
DOMCI_CLASS(CameraCapabilities)
|
||||||
|
|
||||||
DOMCI_CLASS(OpenWindowEventDetail)
|
|
||||||
DOMCI_CLASS(AsyncScrollEventDetail)
|
|
||||||
|
|
||||||
DOMCI_CLASS(LockedFile)
|
DOMCI_CLASS(LockedFile)
|
||||||
|
|
||||||
DOMCI_CLASS(CSSFontFeatureValuesRule)
|
DOMCI_CLASS(CSSFontFeatureValuesRule)
|
||||||
|
|||||||
@@ -14,16 +14,16 @@
|
|||||||
|
|
||||||
#include "BrowserElementParent.h"
|
#include "BrowserElementParent.h"
|
||||||
#include "mozilla/dom/HTMLIFrameElement.h"
|
#include "mozilla/dom/HTMLIFrameElement.h"
|
||||||
#include "nsOpenWindowEventDetail.h"
|
|
||||||
#include "nsEventDispatcher.h"
|
#include "nsEventDispatcher.h"
|
||||||
#include "nsIDOMCustomEvent.h"
|
#include "nsIDOMCustomEvent.h"
|
||||||
#include "nsIInterfaceRequestorUtils.h"
|
#include "nsIInterfaceRequestorUtils.h"
|
||||||
#include "nsVariant.h"
|
#include "nsVariant.h"
|
||||||
#include "nsAsyncScrollEventDetail.h"
|
#include "mozilla/dom/BrowserElementDictionariesBinding.h"
|
||||||
|
#include "nsCxPusher.h"
|
||||||
|
#include "GeneratedEventClasses.h"
|
||||||
|
|
||||||
using mozilla::dom::Element;
|
using namespace mozilla;
|
||||||
using mozilla::dom::HTMLIFrameElement;
|
using namespace mozilla::dom;
|
||||||
using mozilla::dom::TabParent;
|
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
@@ -72,7 +72,7 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
|
DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
|
||||||
nsISupports *aDetailValue)
|
JSContext* cx, JS::Handle<JS::Value> aDetailValue)
|
||||||
{
|
{
|
||||||
NS_ENSURE_TRUE(aFrameElement, false);
|
NS_ENSURE_TRUE(aFrameElement, false);
|
||||||
nsIPresShell *shell = aFrameElement->OwnerDoc()->GetShell();
|
nsIPresShell *shell = aFrameElement->OwnerDoc()->GetShell();
|
||||||
@@ -87,20 +87,24 @@ DispatchCustomDOMEvent(Element* aFrameElement, const nsAString& aEventName,
|
|||||||
getter_AddRefs(domEvent));
|
getter_AddRefs(domEvent));
|
||||||
NS_ENSURE_TRUE(domEvent, false);
|
NS_ENSURE_TRUE(domEvent, false);
|
||||||
|
|
||||||
nsCOMPtr<nsIWritableVariant> detailVariant = new nsVariant();
|
|
||||||
nsresult rv = detailVariant->SetAsISupports(aDetailValue);
|
|
||||||
NS_ENSURE_SUCCESS(rv, false);
|
|
||||||
nsCOMPtr<nsIDOMCustomEvent> customEvent = do_QueryInterface(domEvent);
|
nsCOMPtr<nsIDOMCustomEvent> customEvent = do_QueryInterface(domEvent);
|
||||||
NS_ENSURE_TRUE(customEvent, false);
|
NS_ENSURE_TRUE(customEvent, false);
|
||||||
customEvent->InitCustomEvent(aEventName,
|
ErrorResult res;
|
||||||
/* bubbles = */ true,
|
CustomEvent* event = static_cast<CustomEvent*>(customEvent.get());
|
||||||
/* cancelable = */ false,
|
event->InitCustomEvent(cx,
|
||||||
detailVariant);
|
aEventName,
|
||||||
|
/* bubbles = */ true,
|
||||||
|
/* cancelable = */ false,
|
||||||
|
aDetailValue,
|
||||||
|
res);
|
||||||
|
if (res.Failed()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
customEvent->SetTrusted(true);
|
customEvent->SetTrusted(true);
|
||||||
// Dispatch the event.
|
// Dispatch the event.
|
||||||
nsEventStatus status = nsEventStatus_eIgnore;
|
nsEventStatus status = nsEventStatus_eIgnore;
|
||||||
rv = nsEventDispatcher::DispatchDOMEvent(aFrameElement, nullptr,
|
nsresult rv = nsEventDispatcher::DispatchDOMEvent(aFrameElement, nullptr,
|
||||||
domEvent, presContext, &status);
|
domEvent, presContext, &status);
|
||||||
return NS_SUCCEEDED(rv);
|
return NS_SUCCEEDED(rv);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,18 +123,36 @@ DispatchOpenWindowEvent(Element* aOpenerFrameElement,
|
|||||||
const nsAString& aFeatures)
|
const nsAString& aFeatures)
|
||||||
{
|
{
|
||||||
// Dispatch a CustomEvent at aOpenerFrameElement with a detail object
|
// Dispatch a CustomEvent at aOpenerFrameElement with a detail object
|
||||||
// (nsIOpenWindowEventDetail) containing aPopupFrameElement, aURL, aName, and
|
// (OpenWindowEventDetail) containing aPopupFrameElement, aURL, aName, and
|
||||||
// aFeatures.
|
// aFeatures.
|
||||||
|
|
||||||
// Create the event's detail object.
|
// Create the event's detail object.
|
||||||
nsRefPtr<nsOpenWindowEventDetail> detail =
|
OpenWindowEventDetailInitializer detail;
|
||||||
new nsOpenWindowEventDetail(aURL, aName, aFeatures,
|
detail.mUrl = aURL;
|
||||||
aPopupFrameElement->AsDOMNode());
|
detail.mName = aName;
|
||||||
|
detail.mFeatures = aFeatures;
|
||||||
|
detail.mFrameElement = aPopupFrameElement;
|
||||||
|
|
||||||
|
AutoJSContext cx;
|
||||||
|
JS::Rooted<JS::Value> val(cx);
|
||||||
|
|
||||||
|
nsIGlobalObject* sgo = aPopupFrameElement->OwnerDoc()->GetScopeObject();
|
||||||
|
if (!sgo) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
|
||||||
|
JSAutoCompartment ac(cx, global);
|
||||||
|
if (!detail.ToObject(cx, global, &val)) {
|
||||||
|
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
bool dispatchSucceeded =
|
bool dispatchSucceeded =
|
||||||
DispatchCustomDOMEvent(aOpenerFrameElement,
|
DispatchCustomDOMEvent(aOpenerFrameElement,
|
||||||
NS_LITERAL_STRING("mozbrowseropenwindow"),
|
NS_LITERAL_STRING("mozbrowseropenwindow"),
|
||||||
detail);
|
cx,
|
||||||
|
val);
|
||||||
|
|
||||||
// If the iframe is not in some document's DOM at this point, the embedder
|
// If the iframe is not in some document's DOM at this point, the embedder
|
||||||
// has "blocked" the popup.
|
// has "blocked" the popup.
|
||||||
@@ -263,13 +285,27 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
|
|||||||
{
|
{
|
||||||
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
|
nsCOMPtr<Element> frameElement = mTabParent->GetOwnerElement();
|
||||||
// Create the event's detail object.
|
// Create the event's detail object.
|
||||||
nsRefPtr<nsAsyncScrollEventDetail> detail =
|
AsyncScrollEventDetailInitializer detail;
|
||||||
new nsAsyncScrollEventDetail(mContentRect.x, mContentRect.y,
|
detail.mLeft = mContentRect.x;
|
||||||
mContentRect.width, mContentRect.height,
|
detail.mTop = mContentRect.y;
|
||||||
mContentSize.width, mContentSize.height);
|
detail.mWidth = mContentRect.width;
|
||||||
|
detail.mHeight = mContentRect.height;
|
||||||
|
detail.mScrollWidth = mContentRect.width;
|
||||||
|
detail.mScrollHeight = mContentRect.height;
|
||||||
|
AutoSafeJSContext cx;
|
||||||
|
JS::Rooted<JS::Value> val(cx);
|
||||||
|
|
||||||
|
// We can get away with a null global here because
|
||||||
|
// AsyncScrollEventDetail only contains numeric values.
|
||||||
|
if (!detail.ToObject(cx, JS::NullPtr(), &val)) {
|
||||||
|
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
|
||||||
DispatchCustomDOMEvent(frameElement,
|
DispatchCustomDOMEvent(frameElement,
|
||||||
NS_LITERAL_STRING("mozbrowserasyncscroll"),
|
NS_LITERAL_STRING("mozbrowserasyncscroll"),
|
||||||
detail);
|
cx,
|
||||||
|
val);
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
*
|
*
|
||||||
* 1) We fire a mozbrowseropenwindow CustomEvent on the opener
|
* 1) We fire a mozbrowseropenwindow CustomEvent on the opener
|
||||||
* iframe element. This event's detail is an instance of
|
* iframe element. This event's detail is an instance of
|
||||||
* nsIOpenWindowEventDetail.
|
* OpenWindowEventDetail.
|
||||||
*
|
*
|
||||||
* 2) The embedder (the document which contains the opener iframe) can accept
|
* 2) The embedder (the document which contains the opener iframe) can accept
|
||||||
* the window.open request by inserting event.detail.frameElement (an iframe
|
* the window.open request by inserting event.detail.frameElement (an iframe
|
||||||
|
|||||||
@@ -6,28 +6,16 @@
|
|||||||
|
|
||||||
TEST_DIRS += ['mochitest']
|
TEST_DIRS += ['mochitest']
|
||||||
|
|
||||||
XPIDL_SOURCES += [
|
|
||||||
'nsIAsyncScrollEventDetail.idl',
|
|
||||||
'nsIOpenWindowEventDetail.idl',
|
|
||||||
]
|
|
||||||
|
|
||||||
XPIDL_MODULE = 'dom_browserelement'
|
XPIDL_MODULE = 'dom_browserelement'
|
||||||
|
|
||||||
MODULE = 'dom'
|
MODULE = 'dom'
|
||||||
|
|
||||||
EXPORTS += [
|
|
||||||
'nsAsyncScrollEventDetail.h',
|
|
||||||
'nsOpenWindowEventDetail.h',
|
|
||||||
]
|
|
||||||
|
|
||||||
EXPORTS.mozilla += [
|
EXPORTS.mozilla += [
|
||||||
'BrowserElementParent.h',
|
'BrowserElementParent.h',
|
||||||
]
|
]
|
||||||
|
|
||||||
CPP_SOURCES += [
|
CPP_SOURCES += [
|
||||||
'BrowserElementParent.cpp',
|
'BrowserElementParent.cpp',
|
||||||
'nsAsyncScrollEventDetail.cpp',
|
|
||||||
'nsOpenWindowEventDetail.cpp',
|
|
||||||
]
|
]
|
||||||
|
|
||||||
EXTRA_COMPONENTS += [
|
EXTRA_COMPONENTS += [
|
||||||
|
|||||||
@@ -1,62 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsAsyncScrollEventDetail.h"
|
|
||||||
#include "nsDOMClassInfoID.h"
|
|
||||||
#include "nsIDOMClassInfo.h"
|
|
||||||
#include "nsIClassInfo.h"
|
|
||||||
#include "nsDOMClassInfo.h"
|
|
||||||
|
|
||||||
NS_IMPL_ADDREF(nsAsyncScrollEventDetail)
|
|
||||||
NS_IMPL_RELEASE(nsAsyncScrollEventDetail)
|
|
||||||
NS_INTERFACE_MAP_BEGIN(nsAsyncScrollEventDetail)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIAsyncScrollEventDetail)
|
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(AsyncScrollEventDetail)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
DOMCI_DATA(AsyncScrollEventDetail, nsAsyncScrollEventDetail)
|
|
||||||
|
|
||||||
/* readonly attribute float top; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetTop(float *aTop)
|
|
||||||
{
|
|
||||||
*aTop = mTop;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute float left; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetLeft(float *aLeft)
|
|
||||||
{
|
|
||||||
*aLeft = mLeft;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute float width; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetWidth(float *aWidth)
|
|
||||||
{
|
|
||||||
*aWidth = mWidth;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute float height; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetHeight(float *aHeight)
|
|
||||||
{
|
|
||||||
*aHeight = mHeight;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute float scrollWidth; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetScrollWidth(float *aScrollWidth)
|
|
||||||
{
|
|
||||||
*aScrollWidth = mScrollWidth;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* readonly attribute float scrollHeight; */
|
|
||||||
NS_IMETHODIMP nsAsyncScrollEventDetail::GetScrollHeight(float *aScrollHeight)
|
|
||||||
{
|
|
||||||
*aScrollHeight = mScrollHeight;
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsIAsyncScrollEventDetail.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When we send a mozbrowserasyncscroll event (an instance of CustomEvent), we
|
|
||||||
* use an instance of this class as the event's detail.
|
|
||||||
*/
|
|
||||||
class nsAsyncScrollEventDetail : public nsIAsyncScrollEventDetail
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsAsyncScrollEventDetail(const float left, const float top,
|
|
||||||
const float width, const float height,
|
|
||||||
const float contentWidth, const float contentHeigh)
|
|
||||||
: mTop(top)
|
|
||||||
, mLeft(left)
|
|
||||||
, mWidth(width)
|
|
||||||
, mHeight(height)
|
|
||||||
, mScrollWidth(contentWidth)
|
|
||||||
, mScrollHeight(contentHeigh)
|
|
||||||
{}
|
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS
|
|
||||||
NS_DECL_NSIASYNCSCROLLEVENTDETAIL
|
|
||||||
|
|
||||||
private:
|
|
||||||
virtual ~nsAsyncScrollEventDetail() {}
|
|
||||||
const float mTop;
|
|
||||||
const float mLeft;
|
|
||||||
const float mWidth;
|
|
||||||
const float mHeight;
|
|
||||||
const float mScrollWidth;
|
|
||||||
const float mScrollHeight;
|
|
||||||
};
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsISupports.idl"
|
|
||||||
|
|
||||||
interface nsIDOMNode;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When we send a mozbrowseropenwindow event (an instance of CustomEvent), we
|
|
||||||
* use an instance of this interface as the event's detail.
|
|
||||||
*/
|
|
||||||
[scriptable, uuid(94377af6-956a-4adf-908b-363f7023ae1a)]
|
|
||||||
interface nsIOpenWindowEventDetail : nsISupports
|
|
||||||
{
|
|
||||||
readonly attribute AString url;
|
|
||||||
readonly attribute AString name;
|
|
||||||
readonly attribute AString features;
|
|
||||||
readonly attribute nsIDOMNode frameElement;
|
|
||||||
};
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsOpenWindowEventDetail.h"
|
|
||||||
#include "nsDOMClassInfoID.h"
|
|
||||||
#include "nsIDOMClassInfo.h"
|
|
||||||
#include "nsIClassInfo.h"
|
|
||||||
#include "nsDOMClassInfo.h"
|
|
||||||
|
|
||||||
NS_IMPL_CYCLE_COLLECTION_1(nsOpenWindowEventDetail, mFrameElement)
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_ADDREF(nsOpenWindowEventDetail)
|
|
||||||
NS_IMPL_CYCLE_COLLECTING_RELEASE(nsOpenWindowEventDetail)
|
|
||||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(nsOpenWindowEventDetail)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
|
||||||
NS_INTERFACE_MAP_ENTRY(nsIOpenWindowEventDetail)
|
|
||||||
NS_DOM_INTERFACE_MAP_ENTRY_CLASSINFO(OpenWindowEventDetail)
|
|
||||||
NS_INTERFACE_MAP_END
|
|
||||||
|
|
||||||
DOMCI_DATA(OpenWindowEventDetail, nsOpenWindowEventDetail)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsOpenWindowEventDetail::GetUrl(nsAString& aOut)
|
|
||||||
{
|
|
||||||
aOut.Assign(mURL);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsOpenWindowEventDetail::GetName(nsAString& aOut)
|
|
||||||
{
|
|
||||||
aOut.Assign(mName);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsOpenWindowEventDetail::GetFeatures(nsAString& aOut)
|
|
||||||
{
|
|
||||||
aOut.Assign(mFeatures);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsOpenWindowEventDetail::GetFrameElement(nsIDOMNode** aOut)
|
|
||||||
{
|
|
||||||
nsCOMPtr<nsIDOMNode> out = mFrameElement;
|
|
||||||
out.forget(aOut);
|
|
||||||
return NS_OK;
|
|
||||||
}
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
/* 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/. */
|
|
||||||
|
|
||||||
#include "nsIOpenWindowEventDetail.h"
|
|
||||||
#include "nsIDOMNode.h"
|
|
||||||
#include "nsCycleCollectionParticipant.h"
|
|
||||||
#include "nsCOMPtr.h"
|
|
||||||
#include "nsString.h"
|
|
||||||
|
|
||||||
/**
|
|
||||||
* When we send a mozbrowseropenwindow event (an instance of CustomEvent), we
|
|
||||||
* use an instance of this class as the event's detail.
|
|
||||||
*/
|
|
||||||
class nsOpenWindowEventDetail : public nsIOpenWindowEventDetail
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
nsOpenWindowEventDetail(const nsAString& aURL,
|
|
||||||
const nsAString& aName,
|
|
||||||
const nsAString& aFeatures,
|
|
||||||
nsIDOMNode* aFrameElement)
|
|
||||||
: mURL(aURL)
|
|
||||||
, mName(aName)
|
|
||||||
, mFeatures(aFeatures)
|
|
||||||
, mFrameElement(aFrameElement)
|
|
||||||
{}
|
|
||||||
|
|
||||||
virtual ~nsOpenWindowEventDetail() {}
|
|
||||||
|
|
||||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
||||||
NS_DECL_CYCLE_COLLECTION_CLASS(nsOpenWindowEventDetail)
|
|
||||||
NS_DECL_NSIOPENWINDOWEVENTDETAIL
|
|
||||||
|
|
||||||
private:
|
|
||||||
const nsString mURL;
|
|
||||||
const nsString mName;
|
|
||||||
const nsString mFeatures;
|
|
||||||
nsCOMPtr<nsIDOMNode> mFrameElement;
|
|
||||||
};
|
|
||||||
@@ -73,7 +73,6 @@ var interfaceNamesInGlobalScope =
|
|||||||
"AnalyserNode",
|
"AnalyserNode",
|
||||||
"AnimationEvent",
|
"AnimationEvent",
|
||||||
"ArchiveRequest",
|
"ArchiveRequest",
|
||||||
"AsyncScrollEventDetail",
|
|
||||||
"Attr",
|
"Attr",
|
||||||
"Audio",
|
"Audio",
|
||||||
"AudioBuffer",
|
"AudioBuffer",
|
||||||
@@ -335,7 +334,6 @@ var interfaceNamesInGlobalScope =
|
|||||||
"OfflineAudioCompletionEvent",
|
"OfflineAudioCompletionEvent",
|
||||||
"OfflineAudioContext",
|
"OfflineAudioContext",
|
||||||
"OfflineResourceList",
|
"OfflineResourceList",
|
||||||
"OpenWindowEventDetail",
|
|
||||||
"Option",
|
"Option",
|
||||||
"OscillatorNode",
|
"OscillatorNode",
|
||||||
"PageTransitionEvent",
|
"PageTransitionEvent",
|
||||||
|
|||||||
24
dom/webidl/BrowserElementDictionaries.webidl
Normal file
24
dom/webidl/BrowserElementDictionaries.webidl
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
/* -*- 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/.
|
||||||
|
*
|
||||||
|
* Copyright © 2012 W3C® (MIT, ERCIM, Keio), All Rights Reserved. W3C
|
||||||
|
* liability, trademark and document use rules apply.
|
||||||
|
*/
|
||||||
|
|
||||||
|
dictionary AsyncScrollEventDetail {
|
||||||
|
float top = 0;
|
||||||
|
float left = 0;
|
||||||
|
float width = 0;
|
||||||
|
float height = 0;
|
||||||
|
float scrollWidth = 0;
|
||||||
|
float scrollHeight = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
dictionary OpenWindowEventDetail {
|
||||||
|
DOMString url = "";
|
||||||
|
DOMString name = "";
|
||||||
|
DOMString features = "";
|
||||||
|
Node? frameElement = null;
|
||||||
|
};
|
||||||
@@ -22,6 +22,8 @@ interface DummyInterface {
|
|||||||
void CameraPictureOptions(optional CameraPictureOptions arg);
|
void CameraPictureOptions(optional CameraPictureOptions arg);
|
||||||
void MmsParameters(optional MmsParameters arg);
|
void MmsParameters(optional MmsParameters arg);
|
||||||
void MmsAttachment(optional MmsAttachment arg);
|
void MmsAttachment(optional MmsAttachment arg);
|
||||||
|
void AsyncScrollEventDetail(optional AsyncScrollEventDetail arg);
|
||||||
|
void OpenWindowEventDetail(optional OpenWindowEventDetail arg);
|
||||||
};
|
};
|
||||||
|
|
||||||
interface DummyInterfaceWorkers {
|
interface DummyInterfaceWorkers {
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ webidl_files = \
|
|||||||
BeforeUnloadEvent.webidl \
|
BeforeUnloadEvent.webidl \
|
||||||
BiquadFilterNode.webidl \
|
BiquadFilterNode.webidl \
|
||||||
Blob.webidl \
|
Blob.webidl \
|
||||||
|
BrowserElementDictionaries.webidl \
|
||||||
CameraManager.webidl \
|
CameraManager.webidl \
|
||||||
CanvasRenderingContext2D.webidl \
|
CanvasRenderingContext2D.webidl \
|
||||||
CaretPosition.webidl \
|
CaretPosition.webidl \
|
||||||
|
|||||||
@@ -150,7 +150,6 @@
|
|||||||
@BINPATH@/components/dom_indexeddb.xpt
|
@BINPATH@/components/dom_indexeddb.xpt
|
||||||
@BINPATH@/components/dom_offline.xpt
|
@BINPATH@/components/dom_offline.xpt
|
||||||
@BINPATH@/components/dom_json.xpt
|
@BINPATH@/components/dom_json.xpt
|
||||||
@BINPATH@/components/dom_browserelement.xpt
|
|
||||||
@BINPATH@/components/dom_payment.xpt
|
@BINPATH@/components/dom_payment.xpt
|
||||||
@BINPATH@/components/dom_power.xpt
|
@BINPATH@/components/dom_power.xpt
|
||||||
@BINPATH@/components/dom_quota.xpt
|
@BINPATH@/components/dom_quota.xpt
|
||||||
|
|||||||
Reference in New Issue
Block a user