Bug 1510760, part 1 - Make GetBrowsingContext and GetOuterWindow callable elsewhere. r=peterv

Also fix an existing formatting issue.

Differential Revision: https://phabricator.services.mozilla.com/D37595

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Andrew McCreight 2019-07-18 15:02:45 +00:00
Родитель 200de4509f
Коммит 6307831c6e
3 изменённых файлов: 10 добавлений и 2 удалений

Просмотреть файл

@ -70,7 +70,7 @@ bool GetRemoteOuterWindowProxy(JSContext* aCx, BrowsingContext* aContext,
return !!aRetVal;
}
static BrowsingContext* GetBrowsingContext(JSObject* aProxy) {
BrowsingContext* GetBrowsingContext(JSObject* aProxy) {
MOZ_ASSERT(IsRemoteObjectProxy(aProxy, prototypes::id::Window));
return static_cast<BrowsingContext*>(
RemoteObjectProxyBase::GetNative(aProxy));

Просмотреть файл

@ -493,7 +493,6 @@ class nsOuterWindowProxy : public MaybeCrossOriginObject<js::Wrapper> {
static const nsOuterWindowProxy singleton;
protected:
static nsGlobalWindowOuter* GetOuterWindow(JSObject* proxy) {
nsGlobalWindowOuter* outerWindow =
nsGlobalWindowOuter::FromSupports(static_cast<nsISupports*>(
@ -501,6 +500,7 @@ class nsOuterWindowProxy : public MaybeCrossOriginObject<js::Wrapper> {
return outerWindow;
}
protected:
// False return value means we threw an exception. True return value
// but false "found" means we didn't have a subframe at that index.
bool GetSubframeWindow(JSContext* cx, JS::Handle<JSObject*> proxy,

Просмотреть файл

@ -15,6 +15,8 @@
namespace mozilla {
namespace dom {
class BrowsingContext;
/**
* Base class for RemoteObjectProxy. Implements the pieces of the handler that
* don't depend on properties/methods of the specific WebIDL interface that this
@ -190,6 +192,12 @@ inline bool IsRemoteObjectProxy(JSObject* aObj) {
return RemoteObjectProxyBase::IsRemoteObjectProxy(aObj);
}
/**
* Return the browsing context for this remote outer window proxy.
* Only call this function on remote outer window proxies.
*/
BrowsingContext* GetBrowsingContext(JSObject* aProxy);
} // namespace dom
} // namespace mozilla