mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Backed out changeset 060a9d9fc1c6 from a CLOSED TREE since it seems to depend on afc1cf222996 or 1bafff5720a8 that I just backed out
This commit is contained in:
parent
29dc82d8e8
commit
3b5b986d0b
@ -1109,29 +1109,14 @@ nsFrameLoader::SwapWithOtherLoader(nsFrameLoader* aOther,
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool ourContentBoundary, otherContentBoundary;
|
||||
ourDocshell->GetIsContentBoundary(&ourContentBoundary);
|
||||
otherDocshell->GetIsContentBoundary(&otherContentBoundary);
|
||||
if (ourContentBoundary != otherContentBoundary) {
|
||||
bool weAreBrowserFrame = false;
|
||||
bool otherIsBrowserFrame = false;
|
||||
ourDocshell->GetIsBrowserFrame(&weAreBrowserFrame);
|
||||
otherDocshell->GetIsBrowserFrame(&otherIsBrowserFrame);
|
||||
if (weAreBrowserFrame != otherIsBrowserFrame) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
if (ourContentBoundary) {
|
||||
bool ourIsBrowser, otherIsBrowser;
|
||||
ourDocshell->GetIsBrowserElement(&ourIsBrowser);
|
||||
otherDocshell->GetIsBrowserElement(&otherIsBrowser);
|
||||
if (ourIsBrowser != otherIsBrowser) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
bool ourIsApp, otherIsApp;
|
||||
ourDocshell->GetIsApp(&ourIsApp);
|
||||
otherDocshell->GetIsApp(&otherIsApp);
|
||||
if (ourIsApp != otherIsApp) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
}
|
||||
|
||||
if (mInSwap || aOther->mInSwap) {
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
@ -1578,7 +1563,7 @@ nsFrameLoader::MaybeCreateDocShell()
|
||||
EnsureMessageManager();
|
||||
|
||||
if (OwnerIsBrowserFrame()) {
|
||||
mDocShell->SetIsBrowser();
|
||||
mDocShell->SetIsBrowserFrame(true);
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
|
@ -311,9 +311,9 @@ bool nsDSURIContentListener::CheckOneFrameOptionsPolicy(nsIRequest *request,
|
||||
parentDocShellItem) {
|
||||
|
||||
nsCOMPtr<nsIDocShell> curDocShell = do_QueryInterface(curDocShellItem);
|
||||
bool isContentBoundary;
|
||||
curDocShell->GetIsContentBoundary(&isContentBoundary);
|
||||
if (isContentBoundary) {
|
||||
bool browserFrame = false;
|
||||
curDocShell->GetIsBrowserFrame(&browserFrame);
|
||||
if (browserFrame) {
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -12023,106 +12023,51 @@ nsDocShell::GetCanExecuteScripts(bool *aResult)
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetIsBrowser()
|
||||
nsDocShell::GetIsBrowserFrame(bool *aOut)
|
||||
{
|
||||
if (mIsBrowserFrame) {
|
||||
NS_ERROR("You should not call SetIsBrowser() more than once.");
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
mIsBrowserFrame = true;
|
||||
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(GetAsSupports(this),
|
||||
"docshell-marked-as-browser-frame", NULL);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
NS_ENSURE_ARG_POINTER(aOut);
|
||||
*aOut = mIsBrowserFrame;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsDocShell::FrameType
|
||||
nsDocShell::GetInheritedFrameType()
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::SetIsBrowserFrame(bool aValue)
|
||||
{
|
||||
FrameType type = GetFrameType();
|
||||
// Disallow transitions from browser frame to not-browser-frame. Once a
|
||||
// browser frame, always a browser frame. (Otherwise, observers of
|
||||
// docshell-marked-as-browser-frame would have to distinguish between
|
||||
// newly-created browser frames and frames which went from true to false back
|
||||
// to true.)
|
||||
NS_ENSURE_STATE(!mIsBrowserFrame || aValue);
|
||||
|
||||
if (type != eFrameTypeRegular) {
|
||||
return type;
|
||||
bool wasBrowserFrame = mIsBrowserFrame;
|
||||
mIsBrowserFrame = aValue;
|
||||
if (aValue && !wasBrowserFrame) {
|
||||
nsCOMPtr<nsIObserverService> os = services::GetObserverService();
|
||||
if (os) {
|
||||
os->NotifyObservers(GetAsSupports(this),
|
||||
"docshell-marked-as-browser-frame", NULL);
|
||||
}
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetContainedInBrowserFrame(bool *aOut)
|
||||
{
|
||||
*aOut = false;
|
||||
|
||||
if (mIsBrowserFrame) {
|
||||
*aOut = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
|
||||
GetSameTypeParent(getter_AddRefs(parentAsItem));
|
||||
|
||||
nsCOMPtr<nsIDocShell> parent = do_QueryInterface(parentAsItem);
|
||||
if (!parent) {
|
||||
return eFrameTypeRegular;
|
||||
}
|
||||
|
||||
return static_cast<nsDocShell*>(parent.get())->GetInheritedFrameType();
|
||||
}
|
||||
|
||||
nsDocShell::FrameType
|
||||
nsDocShell::GetFrameType()
|
||||
{
|
||||
return mIsBrowserFrame ? eFrameTypeBrowser : eFrameTypeRegular;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsBrowserElement(bool* aIsBrowser)
|
||||
{
|
||||
*aIsBrowser = (GetFrameType() == eFrameTypeBrowser);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsApp(bool* aIsApp)
|
||||
{
|
||||
*aIsApp = (GetFrameType() == eFrameTypeApp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsContentBoundary(bool* aIsContentBoundary)
|
||||
{
|
||||
switch (GetFrameType()) {
|
||||
case eFrameTypeRegular:
|
||||
*aIsContentBoundary = false;
|
||||
break;
|
||||
case eFrameTypeBrowser:
|
||||
case eFrameTypeApp:
|
||||
*aIsContentBoundary = true;
|
||||
break;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsInBrowserElement(bool* aIsInBrowserElement)
|
||||
{
|
||||
*aIsInBrowserElement = (GetInheritedFrameType() == eFrameTypeBrowser);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsInApp(bool* aIsInApp)
|
||||
{
|
||||
*aIsInApp = (GetInheritedFrameType() == eFrameTypeApp);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::GetIsBelowContentBoundary(bool* aIsInContentBoundary)
|
||||
{
|
||||
switch (GetInheritedFrameType()) {
|
||||
case eFrameTypeRegular:
|
||||
*aIsInContentBoundary = false;
|
||||
break;
|
||||
case eFrameTypeBrowser:
|
||||
case eFrameTypeApp:
|
||||
*aIsInContentBoundary = true;
|
||||
break;
|
||||
if (parent) {
|
||||
return parent->GetContainedInBrowserFrame(aOut);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -664,15 +664,6 @@ protected:
|
||||
|
||||
bool JustStartedNetworkLoad();
|
||||
|
||||
enum FrameType {
|
||||
eFrameTypeRegular = 0x0, // 0000
|
||||
eFrameTypeBrowser = 0x1, // 0001
|
||||
eFrameTypeApp = 0x2 // 0010
|
||||
};
|
||||
|
||||
FrameType GetInheritedFrameType();
|
||||
FrameType GetFrameType();
|
||||
|
||||
// hash of session storages, keyed by domain
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorage> mStorages;
|
||||
|
||||
|
@ -39,7 +39,7 @@ interface nsIWebBrowserPrint;
|
||||
interface nsIVariant;
|
||||
interface nsIPrivacyTransitionObserver;
|
||||
|
||||
[scriptable, builtinclass, uuid(57889367-590b-4ea2-a345-5211253babf5)]
|
||||
[scriptable, builtinclass, uuid(89ea9f32-18ec-413b-9e2c-ce9a4c851b1c)]
|
||||
interface nsIDocShell : nsISupports
|
||||
{
|
||||
/**
|
||||
@ -589,45 +589,21 @@ interface nsIDocShell : nsISupports
|
||||
*/
|
||||
void addWeakPrivacyTransitionObserver(in nsIPrivacyTransitionObserver obs);
|
||||
|
||||
/**
|
||||
* Mark the docshell as a browser frame.
|
||||
* This should be used for <iframe mozbrowser> but not for <iframe mozapp>.
|
||||
/*
|
||||
* Is this docshell a browser frame (i.e., does it correspond to an <iframe
|
||||
* mozbrowser>)? The frameloader is responsible for setting this property
|
||||
* when it initializes the docshell.
|
||||
*
|
||||
* This method should not be called more than once.
|
||||
* If so, this docshell should act like a chrome/content boundary for the
|
||||
* purposes of window.top and window.parent.
|
||||
*
|
||||
* See also nsIMozBrowserFrame.
|
||||
*/
|
||||
void setIsBrowser();
|
||||
attribute bool isBrowserFrame;
|
||||
|
||||
/**
|
||||
* Returns true iff the docshell is marked as a browser frame.
|
||||
/*
|
||||
* Is this docshell contained in an <iframe mozbrowser>, either directly or
|
||||
* indirectly?
|
||||
*/
|
||||
readonly attribute boolean isBrowserElement;
|
||||
|
||||
/**
|
||||
* Returns true iif the docshell is marked as an app frame.
|
||||
*/
|
||||
readonly attribute boolean isApp;
|
||||
|
||||
/**
|
||||
* Returns true iif the docshell is marked as a type that behaves like a
|
||||
* content boundary.
|
||||
*/
|
||||
readonly attribute boolean isContentBoundary;
|
||||
|
||||
/**
|
||||
* Returns true iif the docshell is inside a browser element.
|
||||
*/
|
||||
readonly attribute boolean isInBrowserElement;
|
||||
|
||||
/**
|
||||
* Returns true iif the docshell is inside an application.
|
||||
* However, it will return false if the docshell is inside a browser element
|
||||
* that is inside an application.
|
||||
*/
|
||||
readonly attribute boolean isInApp;
|
||||
|
||||
/**
|
||||
* Returns if the docshell has a docshell that behaves as a content boundary
|
||||
* in his parent hierarchy.
|
||||
*/
|
||||
readonly attribute boolean isBelowContentBoundary;
|
||||
readonly attribute bool containedInBrowserFrame;
|
||||
};
|
||||
|
@ -2965,9 +2965,9 @@ nsGlobalWindow::GetScriptableParent(nsIDOMWindow** aParent)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isContentBoundary = false;
|
||||
mDocShell->GetIsContentBoundary(&isContentBoundary);
|
||||
if (isContentBoundary) {
|
||||
bool isMozBrowser = false;
|
||||
mDocShell->GetIsBrowserFrame(&isMozBrowser);
|
||||
if (isMozBrowser) {
|
||||
nsCOMPtr<nsIDOMWindow> parent = static_cast<nsIDOMWindow*>(this);
|
||||
parent.swap(*aParent);
|
||||
return NS_OK;
|
||||
@ -6451,13 +6451,12 @@ nsGlobalWindow::Close()
|
||||
{
|
||||
FORWARD_TO_OUTER(Close, (), NS_ERROR_NOT_INITIALIZED);
|
||||
|
||||
bool isContentBoundary = false;
|
||||
bool isMozBrowser = false;
|
||||
if (mDocShell) {
|
||||
mDocShell->GetIsContentBoundary(&isContentBoundary);
|
||||
mDocShell->GetIsBrowserFrame(&isMozBrowser);
|
||||
}
|
||||
|
||||
if ((!isContentBoundary && IsFrame()) ||
|
||||
!mDocShell || IsInModalState()) {
|
||||
if ((!isMozBrowser && IsFrame()) || !mDocShell || IsInModalState()) {
|
||||
// window.close() is called on a frame in a frameset, on a window
|
||||
// that's already closed, or on a window for which there's
|
||||
// currently a modal dialog open. Ignore such calls.
|
||||
@ -6986,9 +6985,9 @@ nsGlobalWindow::GetScriptableFrameElement(nsIDOMElement** aFrameElement)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool isContentBoundary = false;
|
||||
mDocShell->GetIsContentBoundary(&isContentBoundary);
|
||||
if (isContentBoundary) {
|
||||
bool isMozBrowser = false;
|
||||
mDocShell->GetIsBrowserFrame(&isMozBrowser);
|
||||
if (isMozBrowser) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -62,7 +62,7 @@ BrowserElementChild.prototype = {
|
||||
|
||||
BrowserElementPromptService.mapWindowToBrowserElementChild(content, this);
|
||||
|
||||
docShell.setIsBrowser();
|
||||
docShell.isBrowserFrame = true;
|
||||
docShell.QueryInterface(Ci.nsIWebProgress)
|
||||
.addProgressListener(this._progressListener,
|
||||
Ci.nsIWebProgress.NOTIFY_LOCATION |
|
||||
|
@ -337,12 +337,12 @@ TabChild::ProvideWindow(nsIDOMWindow* aParent, PRUint32 aChromeFlags,
|
||||
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
||||
// and return its window here.
|
||||
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
||||
bool isInContentBoundary = false;
|
||||
bool inBrowserFrame = false;
|
||||
if (docshell) {
|
||||
docshell->GetIsBelowContentBoundary(&isInContentBoundary);
|
||||
docshell->GetContainedInBrowserFrame(&inBrowserFrame);
|
||||
}
|
||||
|
||||
if (isInContentBoundary &&
|
||||
if (inBrowserFrame &&
|
||||
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {
|
||||
|
@ -243,7 +243,7 @@ function makeHiddenFrame() {
|
||||
// TODO: disable media (bug 759964)
|
||||
|
||||
// Mark this docShell as a "browserFrame", to break script access to e.g. window.top
|
||||
docShell.setIsBrowser();
|
||||
docShell.isBrowserFrame = true;
|
||||
|
||||
return iframe;
|
||||
}
|
||||
|
@ -93,7 +93,7 @@ Sandbox.prototype = {
|
||||
.getInterface(Ci.nsIDocShell);
|
||||
|
||||
// Mark this docShell as a "browserFrame", to break script access to e.g. window.top
|
||||
docShell.setIsBrowser();
|
||||
docShell.isBrowserFrame = true;
|
||||
|
||||
// Stop about:blank from being loaded.
|
||||
docShell.stop(Ci.nsIWebNavigation.STOP_NETWORK);
|
||||
|
@ -842,12 +842,12 @@ nsContentTreeOwner::ProvideWindow(nsIDOMWindow* aParent,
|
||||
// open a modal-type window, we're going to create a new <iframe mozbrowser>
|
||||
// and return its window here.
|
||||
nsCOMPtr<nsIDocShell> docshell = do_GetInterface(aParent);
|
||||
bool isInContentBoundary = false;
|
||||
bool inBrowserFrame = false;
|
||||
if (docshell) {
|
||||
docshell->GetIsBelowContentBoundary(&isInContentBoundary);
|
||||
docshell->GetContainedInBrowserFrame(&inBrowserFrame);
|
||||
}
|
||||
|
||||
if (isInContentBoundary &&
|
||||
if (inBrowserFrame &&
|
||||
!(aChromeFlags & (nsIWebBrowserChrome::CHROME_MODAL |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_DIALOG |
|
||||
nsIWebBrowserChrome::CHROME_OPENAS_CHROME))) {
|
||||
|
Loading…
Reference in New Issue
Block a user