Bug 863515 - Expose hasContentOpener on nsITabParent. r=smaug.

hasContentOpener is set to true if a tab happened to be opened
due to content requesting it - for example, a target="_blank" link,
or a window.open.
This commit is contained in:
Mike Conley 2015-05-13 16:44:39 -04:00
parent d4d4e87e2c
commit aeecd32e7b
3 changed files with 25 additions and 1 deletions

View File

@ -5,7 +5,7 @@
#include "domstubs.idl"
[scriptable, uuid(b19038ba-0d75-40d2-be35-742e26d33bf9)]
[scriptable, uuid(4d4576eb-ecfe-47b9-93b8-4121518621ad)]
interface nsITabParent : nsISupports
{
void injectTouchEvent(in AString aType,
@ -26,4 +26,6 @@ interface nsITabParent : nsISupports
void setIsDocShellActive(in bool aIsActive);
readonly attribute uint64_t tabId;
readonly attribute boolean hasContentOpener;
};

View File

@ -284,6 +284,7 @@ TabParent::TabParent(nsIContentParent* aManager,
, mNeedLayerTreeReadyNotification(false)
, mCursor(nsCursor(-1))
, mTabSetsCursor(false)
, mHasContentOpener(false)
{
MOZ_ASSERT(aManager);
}
@ -609,6 +610,11 @@ TabParent::RecvCreateWindow(PBrowserParent* aNewTab,
NS_ENSURE_SUCCESS(rv, false);
TabParent* newTab = TabParent::GetFrom(aNewTab);
MOZ_ASSERT(newTab);
// Content has requested that we open this new content window, so
// we must have an opener.
newTab->SetHasContentOpener(true);
nsCOMPtr<nsIContent> frame(do_QueryInterface(mFrameElement));
@ -2906,6 +2912,19 @@ TabParent::GetTabId(uint64_t* aId)
return NS_OK;
}
NS_IMETHODIMP
TabParent::GetHasContentOpener(bool* aResult)
{
*aResult = mHasContentOpener;
return NS_OK;
}
void
TabParent::SetHasContentOpener(bool aHasContentOpener)
{
mHasContentOpener = aHasContentOpener;
}
class LayerTreeUpdateRunnable final
: public nsRunnable
{

View File

@ -458,6 +458,8 @@ protected:
bool InitBrowserConfiguration(const nsCString& aURI,
BrowserConfiguration& aConfiguration);
void SetHasContentOpener(bool aHasContentOpener);
// IME
static TabParent *mIMETabParent;
nsString mIMECacheText;
@ -605,6 +607,7 @@ private:
nsRefPtr<nsIPresShell> mPresShellWithRefreshListener;
bool mHasContentOpener;
private:
// This is used when APZ needs to find the TabParent associated with a layer
// to dispatch events.