mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 832700 - Add private browsing to b2g, API implementation r=ehsan,smaug
This commit is contained in:
parent
012100ceed
commit
5788a6960b
@ -609,6 +609,7 @@ GK_ATOM(mozfullscreenerror, "mozfullscreenerror")
|
||||
GK_ATOM(mozpasspointerevents, "mozpasspointerevents")
|
||||
GK_ATOM(mozpointerlockchange, "mozpointerlockchange")
|
||||
GK_ATOM(mozpointerlockerror, "mozpointerlockerror")
|
||||
GK_ATOM(mozprivatebrowsing, "mozprivatebrowsing")
|
||||
GK_ATOM(moz_opaque, "moz-opaque")
|
||||
GK_ATOM(moz_action_hint, "mozactionhint")
|
||||
GK_ATOM(x_moz_errormessage, "x-moz-errormessage")
|
||||
|
@ -851,6 +851,7 @@ nsDocShell::nsDocShell():
|
||||
#endif
|
||||
mAffectPrivateSessionLifetime(true),
|
||||
mInvisible(false),
|
||||
mHasLoadedNonBlankURI(false),
|
||||
mDefaultLoadFlags(nsIRequest::LOAD_NORMAL),
|
||||
mFrameType(eFrameTypeRegular),
|
||||
mOwnOrContainingAppId(nsIScriptSecurityManager::UNKNOWN_APP_ID),
|
||||
@ -1928,6 +1929,10 @@ nsDocShell::SetCurrentURI(nsIURI *aURI, nsIRequest *aRequest,
|
||||
|
||||
mCurrentURI = NS_TryToMakeImmutable(aURI);
|
||||
|
||||
if (!NS_IsAboutBlank(mCurrentURI)) {
|
||||
mHasLoadedNonBlankURI = true;
|
||||
}
|
||||
|
||||
bool isRoot = false; // Is this the root docshell
|
||||
bool isSubFrame = false; // Is this a subframe navigation?
|
||||
|
||||
@ -2277,6 +2282,15 @@ nsDocShell::SetPrivateBrowsing(bool aUsePrivateBrowsing)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetHasLoadedNonBlankURI(bool* aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
|
||||
*aResult = mHasLoadedNonBlankURI;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetUseRemoteTabs(bool* aUseRemoteTabs)
|
||||
{
|
||||
|
@ -915,6 +915,7 @@ protected:
|
||||
#endif
|
||||
bool mAffectPrivateSessionLifetime;
|
||||
bool mInvisible;
|
||||
bool mHasLoadedNonBlankURI;
|
||||
uint64_t mHistoryID;
|
||||
uint32_t mDefaultLoadFlags;
|
||||
|
||||
|
@ -54,7 +54,7 @@ interface nsITabParent;
|
||||
|
||||
typedef unsigned long nsLoadFlags;
|
||||
|
||||
[scriptable, builtinclass, uuid(2b8e4a50-7744-454d-a05b-debead8070fe)]
|
||||
[scriptable, builtinclass, uuid(23157a63-26fd-44a0-a0f9-fdc64dcc004c)]
|
||||
interface nsIDocShell : nsIDocShellTreeItem
|
||||
{
|
||||
/**
|
||||
@ -1017,4 +1017,11 @@ interface nsIDocShell : nsIDocShellTreeItem
|
||||
|
||||
// URLSearchParams for the window.location is owned by the docShell.
|
||||
[noscript,notxpcom] URLSearchParams getURLSearchParams();
|
||||
|
||||
/**
|
||||
* This attribute determines whether a document which is not about:blank has
|
||||
* already be loaded by this docShell.
|
||||
*/
|
||||
[infallible] readonly attribute boolean hasLoadedNonBlankURI;
|
||||
|
||||
};
|
||||
|
@ -56,3 +56,10 @@ let infos = sendSyncMessage('browser-element-api:call',
|
||||
{ 'msg_name': 'hello' })[0];
|
||||
docShell.QueryInterface(Ci.nsIDocShellTreeItem).name = infos.name;
|
||||
docShell.setFullscreenAllowed(infos.fullscreenAllowed);
|
||||
if (infos.isPrivate) {
|
||||
if (docShell.hasLoadedNonBlankURI) {
|
||||
Cu.reportError("We should not switch to Private Browsing after loading a document.");
|
||||
} else {
|
||||
docShell.QueryInterface(Ci.nsILoadContext).usePrivateBrowsing = true;
|
||||
}
|
||||
}
|
||||
|
@ -76,6 +76,14 @@ CreateIframe(Element* aOpenerFrameElement, const nsAString& aName, bool aRemote)
|
||||
NS_LITERAL_STRING("false"),
|
||||
/* aNotify = */ false);
|
||||
|
||||
// Copy the opener frame's mozprivatebrowsing attribute to the popup frame.
|
||||
nsAutoString mozprivatebrowsing;
|
||||
if (aOpenerFrameElement->GetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing,
|
||||
mozprivatebrowsing)) {
|
||||
popupFrameElement->SetAttr(kNameSpaceID_None, nsGkAtoms::mozprivatebrowsing,
|
||||
mozprivatebrowsing, /* aNotify = */ false);
|
||||
}
|
||||
|
||||
return popupFrameElement.forget();
|
||||
}
|
||||
|
||||
|
@ -389,7 +389,8 @@ BrowserElementParent.prototype = {
|
||||
name: this._frameElement.getAttribute('name'),
|
||||
fullscreenAllowed:
|
||||
this._frameElement.hasAttribute('allowfullscreen') ||
|
||||
this._frameElement.hasAttribute('mozallowfullscreen')
|
||||
this._frameElement.hasAttribute('mozallowfullscreen'),
|
||||
isPrivate: this._frameElement.hasAttribute('mozprivatebrowsing')
|
||||
};
|
||||
},
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user