mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1015887 - Expose realFrameElement to Chrome JS. r=bholley
This commit is contained in:
parent
621c8bd6f3
commit
1d5d9aa7f3
@ -967,6 +967,7 @@ public:
|
||||
void SizeToContent(mozilla::ErrorResult& aError);
|
||||
nsIDOMCrypto* GetCrypto(mozilla::ErrorResult& aError);
|
||||
nsIControllers* GetControllers(mozilla::ErrorResult& aError);
|
||||
mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError);
|
||||
float GetMozInnerScreenX(mozilla::ErrorResult& aError);
|
||||
float GetMozInnerScreenY(mozilla::ErrorResult& aError);
|
||||
float GetDevicePixelRatio(mozilla::ErrorResult& aError);
|
||||
@ -1374,8 +1375,6 @@ protected:
|
||||
|
||||
nsGlobalWindow* InnerForSetTimeoutOrInterval(mozilla::ErrorResult& aError);
|
||||
|
||||
mozilla::dom::Element* GetRealFrameElement(mozilla::ErrorResult& aError);
|
||||
|
||||
void PostMessageMoz(JSContext* aCx, JS::Handle<JS::Value> aMessage,
|
||||
const nsAString& aTargetOrigin,
|
||||
JS::Handle<JS::Value> aTransfer,
|
||||
|
@ -285,6 +285,8 @@ partial interface Window {
|
||||
// XXX Shouldn't this be in nsIDOMChromeWindow?
|
||||
[ChromeOnly, Replaceable, Throws] readonly attribute MozControllers controllers;
|
||||
|
||||
[ChromeOnly, Throws] readonly attribute Element? realFrameElement;
|
||||
|
||||
[Throws] readonly attribute float mozInnerScreenX;
|
||||
[Throws] readonly attribute float mozInnerScreenY;
|
||||
[Throws] readonly attribute float devicePixelRatio;
|
||||
|
@ -81,6 +81,7 @@ const char* const XPCJSRuntime::mStrings[] = {
|
||||
"__exposedProps__", // IDX_EXPOSEDPROPS
|
||||
"eval", // IDX_EVAL
|
||||
"controllers", // IDX_CONTROLLERS
|
||||
"realFrameElement", // IDX_REALFRAMEELEMENT
|
||||
};
|
||||
|
||||
/***************************************************************************/
|
||||
|
@ -479,6 +479,7 @@ public:
|
||||
IDX_EXPOSEDPROPS ,
|
||||
IDX_EVAL ,
|
||||
IDX_CONTROLLERS ,
|
||||
IDX_REALFRAMEELEMENT ,
|
||||
IDX_TOTAL_COUNT // just a count of the above
|
||||
};
|
||||
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "nsIContent.h"
|
||||
#include "nsIControllers.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "nsContentUtils.h"
|
||||
|
||||
#include "XPCWrapper.h"
|
||||
@ -1090,6 +1091,28 @@ XPCWrappedNativeXrayTraits::resolveNativeProperty(JSContext *cx, HandleObject wr
|
||||
return true;
|
||||
}
|
||||
|
||||
// The |realFrameElement| property is accessible as a [ChromeOnly] property
|
||||
// on Window.WebIDL, and [noscript] in XPIDL. Chrome needs to see this over
|
||||
// Xray, so we need to special-case it until we move |Window| to WebIDL.
|
||||
if (id == GetRTIdByIndex(cx, XPCJSRuntime::IDX_REALFRAMEELEMENT) &&
|
||||
AccessCheck::isChrome(wrapper) &&
|
||||
(win = AsWindow(cx, wrapper)))
|
||||
{
|
||||
ErrorResult rv;
|
||||
Element* f = win->GetRealFrameElement(rv);
|
||||
if (!f) {
|
||||
desc.object().set(nullptr);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!WrapNewBindingObject(cx, f, desc.value())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
desc.object().set(wrapper);
|
||||
return true;
|
||||
}
|
||||
|
||||
XPCNativeInterface *iface;
|
||||
XPCNativeMember *member;
|
||||
XPCWrappedNative *wn = getWN(wrapper);
|
||||
|
Loading…
Reference in New Issue
Block a user