mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-19 08:15:31 +00:00
Bug 1642425: Part 2 - Remove IsFrame() from GlobalWindow(Inner|Outer). r=smaug
It does not return sensible values under Fission. Differential Revision: https://phabricator.services.mozilla.com/D77701
This commit is contained in:
parent
4b1ac04706
commit
316de88922
@ -306,12 +306,13 @@ class BrowsingContext : public nsILoadContext, public nsWrapperCache {
|
||||
bool IsChrome() const { return !IsContent(); }
|
||||
|
||||
bool IsTop() const { return !GetParent(); }
|
||||
bool IsFrame() const { return !IsTop(); }
|
||||
|
||||
bool IsTopContent() const { return IsContent() && !GetParent(); }
|
||||
bool IsTopContent() const { return IsContent() && IsTop(); }
|
||||
|
||||
bool IsInSubtreeOf(BrowsingContext* aContext);
|
||||
|
||||
bool IsContentSubframe() const { return IsContent() && GetParent(); }
|
||||
bool IsContentSubframe() const { return IsContent() && IsFrame(); }
|
||||
uint64_t Id() const { return mBrowsingContextId; }
|
||||
|
||||
BrowsingContext* GetParent() const;
|
||||
|
@ -934,7 +934,7 @@ class nsDocShell final : public nsDocLoader,
|
||||
// Determine if this type of load should update history.
|
||||
static bool ShouldUpdateGlobalHistory(uint32_t aLoadType);
|
||||
void UpdateGlobalHistoryTitle(nsIURI* aURI);
|
||||
bool IsFrame() { return mBrowsingContext->GetParent(); }
|
||||
bool IsFrame() { return mBrowsingContext->IsFrame(); }
|
||||
bool CanSetOriginAttributes();
|
||||
bool ShouldBlockLoadingForBackButton();
|
||||
bool ShouldDiscardLayoutState(nsIHttpChannel* aChannel);
|
||||
|
@ -6995,7 +6995,8 @@ void nsGlobalWindowInner::SetReplaceableWindowCoord(
|
||||
* just treat this the way we would an IDL replaceable property.
|
||||
*/
|
||||
nsGlobalWindowOuter* outer = GetOuterWindowInternal();
|
||||
if (!outer || !outer->CanMoveResizeWindows(aCallerType) || outer->IsFrame()) {
|
||||
if (!outer || !outer->CanMoveResizeWindows(aCallerType) ||
|
||||
mBrowsingContext->IsFrame()) {
|
||||
RedefineProperty(aCx, aPropName, aValue, aError);
|
||||
return;
|
||||
}
|
||||
|
@ -1094,8 +1094,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
|
||||
void ScrollTo(const mozilla::CSSIntPoint& aScroll,
|
||||
const mozilla::dom::ScrollOptions& aOptions);
|
||||
|
||||
bool IsFrame();
|
||||
|
||||
already_AddRefed<nsIWidget> GetMainWidget();
|
||||
nsIWidget* GetNearestWidget() const;
|
||||
|
||||
@ -1500,8 +1498,4 @@ inline bool nsGlobalWindowInner::IsPopupSpamWindow() {
|
||||
return GetOuterWindowInternal()->mIsPopupSpam;
|
||||
}
|
||||
|
||||
inline bool nsGlobalWindowInner::IsFrame() {
|
||||
return GetInProcessParentInternal() != nullptr;
|
||||
}
|
||||
|
||||
#endif /* nsGlobalWindowInner_h___ */
|
||||
|
@ -1686,10 +1686,10 @@ nsresult nsGlobalWindowOuter::EnsureScriptEnvironment() {
|
||||
"No cached wrapper, but we have an inner window?");
|
||||
NS_ASSERTION(!mContext, "Will overwrite mContext!");
|
||||
|
||||
// If this window is a [i]frame, don't bother GC'ing when the frame's context
|
||||
// If this window is an [i]frame, don't bother GC'ing when the frame's context
|
||||
// is destroyed since a GC will happen when the frameset or host document is
|
||||
// destroyed anyway.
|
||||
mContext = new nsJSContext(!IsFrame(), this);
|
||||
mContext = new nsJSContext(mBrowsingContext->IsTop(), this);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
@ -5268,7 +5268,7 @@ void nsGlobalWindowOuter::MoveToOuter(int32_t aXPos, int32_t aYPos,
|
||||
* prevent window.moveTo() by exiting early
|
||||
*/
|
||||
|
||||
if (!CanMoveResizeWindows(aCallerType) || IsFrame()) {
|
||||
if (!CanMoveResizeWindows(aCallerType) || mBrowsingContext->IsFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5325,7 +5325,7 @@ void nsGlobalWindowOuter::MoveByOuter(int32_t aXDif, int32_t aYDif,
|
||||
* prevent window.moveBy() by exiting early
|
||||
*/
|
||||
|
||||
if (!CanMoveResizeWindows(aCallerType) || IsFrame()) {
|
||||
if (!CanMoveResizeWindows(aCallerType) || mBrowsingContext->IsFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5376,7 +5376,7 @@ void nsGlobalWindowOuter::ResizeToOuter(int32_t aWidth, int32_t aHeight,
|
||||
* prevent window.resizeTo() by exiting early
|
||||
*/
|
||||
|
||||
if (!CanMoveResizeWindows(aCallerType) || IsFrame()) {
|
||||
if (!CanMoveResizeWindows(aCallerType) || mBrowsingContext->IsFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5404,7 +5404,7 @@ void nsGlobalWindowOuter::ResizeByOuter(int32_t aWidthDif, int32_t aHeightDif,
|
||||
* prevent window.resizeBy() by exiting early
|
||||
*/
|
||||
|
||||
if (!CanMoveResizeWindows(aCallerType) || IsFrame()) {
|
||||
if (!CanMoveResizeWindows(aCallerType) || mBrowsingContext->IsFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -5450,7 +5450,7 @@ void nsGlobalWindowOuter::SizeToContentOuter(CallerType aCallerType,
|
||||
* prevent window.sizeToContent() by exiting early
|
||||
*/
|
||||
|
||||
if (!CanMoveResizeWindows(aCallerType) || IsFrame()) {
|
||||
if (!CanMoveResizeWindows(aCallerType) || mBrowsingContext->IsFrame()) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -6066,7 +6066,7 @@ bool nsGlobalWindowOuter::CanClose() {
|
||||
}
|
||||
|
||||
void nsGlobalWindowOuter::CloseOuter(bool aTrustedCaller) {
|
||||
if (!mDocShell || IsInModalState() || IsFrame()) {
|
||||
if (!mDocShell || IsInModalState() || mBrowsingContext->IsFrame()) {
|
||||
// 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.
|
||||
@ -6162,7 +6162,7 @@ nsresult nsGlobalWindowOuter::Close() {
|
||||
void nsGlobalWindowOuter::ForceClose() {
|
||||
MOZ_ASSERT(XRE_GetProcessType() == GeckoProcessType_Default);
|
||||
|
||||
if (IsFrame() || !mDocShell) {
|
||||
if (mBrowsingContext->IsFrame() || !mDocShell) {
|
||||
// This may be a frame in a frameset, or a window that's already closed.
|
||||
// Ignore such calls.
|
||||
return;
|
||||
|
@ -851,8 +851,6 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
|
||||
nsRect GetInnerScreenRect();
|
||||
static Maybe<mozilla::CSSIntSize> GetRDMDeviceSize(const Document& aDocument);
|
||||
|
||||
bool IsFrame();
|
||||
|
||||
// Outer windows only.
|
||||
// If aLookForCallerOnJSStack is true, this method will look at the JS stack
|
||||
// to determine who the caller is. If it's false, it'll use |this| as the
|
||||
@ -1186,10 +1184,6 @@ inline nsGlobalWindowInner* nsGlobalWindowOuter::EnsureInnerWindowInternal() {
|
||||
return nsGlobalWindowInner::Cast(EnsureInnerWindow());
|
||||
}
|
||||
|
||||
inline bool nsGlobalWindowOuter::IsFrame() {
|
||||
return GetInProcessParentInternal() != nullptr;
|
||||
}
|
||||
|
||||
inline void nsGlobalWindowOuter::MaybeClearInnerWindow(
|
||||
nsGlobalWindowInner* aExpectedInner) {
|
||||
if (mInnerWindow == aExpectedInner) {
|
||||
|
@ -230,10 +230,13 @@ LoadInfo::LoadInfo(
|
||||
|
||||
mDocumentHasLoaded = innerWindow->IsDocumentLoaded();
|
||||
|
||||
if (innerWindow->IsFrame()) {
|
||||
if (bc->IsFrame()) {
|
||||
// For resources within iframes, we actually want the
|
||||
// top-level document's flag, not the iframe document's.
|
||||
mDocumentHasLoaded = false;
|
||||
// FIXME: This is not Fission-compatible. The flag needs to be moved
|
||||
// from the document to the WindowContext, and the check updated
|
||||
// accordingly.
|
||||
nsGlobalWindowOuter* topOuter =
|
||||
innerWindow->GetInProcessScriptableTopInternal();
|
||||
if (topOuter) {
|
||||
|
Loading…
Reference in New Issue
Block a user