зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1419597 - Part 6: Remove unused data members from nsGlobalWindowInner, r=smaug
MozReview-Commit-ID: KeZR0knQcbl
This commit is contained in:
Родитель
9ac65ea533
Коммит
c7371d5cc9
|
@ -592,20 +592,11 @@ nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow)
|
|||
mIdleCallbackIndex(-1),
|
||||
mCurrentlyIdle(false),
|
||||
mAddActiveEventFuzzTime(true),
|
||||
mFullScreen(false),
|
||||
mFullscreenMode(false),
|
||||
mIsClosed(false),
|
||||
mInClose(false),
|
||||
mHavePendingClose(false),
|
||||
mHadOriginalOpener(false),
|
||||
mOriginalOpenerWasSecureContext(false),
|
||||
mIsPopupSpam(false),
|
||||
mBlockScriptedClosingFlag(false),
|
||||
mIsSecureContextIfOpenerIgnored(false),
|
||||
mWasOffline(false),
|
||||
mHasHadSlowScript(false),
|
||||
mNotifyIdleObserversIdleOnThaw(false),
|
||||
mNotifyIdleObserversActiveOnThaw(false),
|
||||
mCreatingInnerWindow(false),
|
||||
mIsChrome(false),
|
||||
mCleanMessageManager(false),
|
||||
mNeedsFocus(true),
|
||||
|
@ -616,26 +607,16 @@ nsGlobalWindowInner::nsGlobalWindowInner(nsGlobalWindowOuter *aOuterWindow)
|
|||
mHasVREvents(false),
|
||||
mHasVRDisplayActivateEvents(false),
|
||||
mHasSeenGamepadInput(false),
|
||||
mNotifiedIDDestroyed(false),
|
||||
mAllowScriptsToClose(false),
|
||||
mTopLevelOuterContentWindow(false),
|
||||
mSuspendDepth(0),
|
||||
mFreezeDepth(0),
|
||||
mFocusMethod(0),
|
||||
mSerial(0),
|
||||
mIdleRequestCallbackCounter(1),
|
||||
mIdleRequestExecutor(nullptr),
|
||||
#ifdef DEBUG
|
||||
mSetOpenerWindowCalled(false),
|
||||
#endif
|
||||
mCleanedUp(false),
|
||||
mDialogAbuseCount(0),
|
||||
mAreDialogsEnabled(true),
|
||||
#ifdef DEBUG
|
||||
mIsValidatingTabGroup(false),
|
||||
#endif
|
||||
mCanSkipCCGeneration(0),
|
||||
mAutoActivateVRDisplayID(0),
|
||||
mBeforeUnloadListenerCount(0)
|
||||
{
|
||||
AssertIsOnMainThread();
|
||||
|
@ -949,8 +930,6 @@ nsGlobalWindowInner::CleanUp()
|
|||
mScrollbars = nullptr;
|
||||
mHistory = nullptr;
|
||||
mCustomElements = nullptr;
|
||||
mFrames = nullptr;
|
||||
mWindowUtils = nullptr;
|
||||
mApplicationCache = nullptr;
|
||||
mIndexedDB = nullptr;
|
||||
|
||||
|
@ -973,12 +952,6 @@ nsGlobalWindowInner::CleanUp()
|
|||
mOrientationChangeObserver = nullptr;
|
||||
#endif
|
||||
|
||||
ClearControllers();
|
||||
|
||||
mOpener = nullptr; // Forces Release
|
||||
if (mContext) {
|
||||
mContext = nullptr; // Forces Release
|
||||
}
|
||||
mChromeEventHandler = nullptr; // Forces Release
|
||||
mParentTarget = nullptr;
|
||||
|
||||
|
@ -997,8 +970,6 @@ nsGlobalWindowInner::CleanUp()
|
|||
}
|
||||
}
|
||||
|
||||
mArguments = nullptr;
|
||||
|
||||
CleanupCachedXBLHandlers();
|
||||
|
||||
for (uint32_t i = 0; i < mAudioContexts.Length(); ++i) {
|
||||
|
@ -1016,26 +987,6 @@ nsGlobalWindowInner::CleanUp()
|
|||
mIntlUtils = nullptr;
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::ClearControllers()
|
||||
{
|
||||
if (mControllers) {
|
||||
uint32_t count;
|
||||
mControllers->GetControllerCount(&count);
|
||||
|
||||
while (count--) {
|
||||
nsCOMPtr<nsIController> controller;
|
||||
mControllers->GetControllerAt(count, getter_AddRefs(controller));
|
||||
|
||||
nsCOMPtr<nsIControllerContext> context = do_QueryInterface(controller);
|
||||
if (context)
|
||||
context->SetCommandContext(nullptr);
|
||||
}
|
||||
|
||||
mControllers = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsGlobalWindowInner::FreeInnerObjects()
|
||||
{
|
||||
|
@ -1220,11 +1171,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_DESCRIBE(nsGlobalWindowInner, tmp->mRefCnt.get())
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mControllers)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mReturnValue)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNavigator)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPerformance)
|
||||
|
@ -1254,7 +1200,6 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
|
|||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mLocalStorage)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSessionStorage)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mApplicationCache)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mSuspendedDoc)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIndexedDB)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mDocumentPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTabChild)
|
||||
|
@ -1295,20 +1240,13 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INTERNAL(nsGlobalWindowInner)
|
|||
|
||||
tmp->TraverseHostObjectURIs(cb);
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mBrowserDOMWindow)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mMessageManager)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mGroupMessageManagers)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mChromeFields.mOpenerForInitialContentBrowser)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
||||
tmp->CleanupCachedXBLHandlers();
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mControllers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mArguments)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mReturnValue)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mNavigator)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPerformance)
|
||||
|
@ -1342,7 +1280,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
|||
static_cast<nsDOMOfflineResourceList*>(tmp->mApplicationCache.get())->Disconnect();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mApplicationCache)
|
||||
}
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mSuspendedDoc)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexedDB)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentPrincipal)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mTabChild)
|
||||
|
@ -1383,7 +1320,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
|||
tmp->mClientSource.reset();
|
||||
|
||||
if (tmp->IsChromeWindow()) {
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeFields.mBrowserDOMWindow)
|
||||
if (tmp->mChromeFields.mMessageManager) {
|
||||
static_cast<nsFrameMessageManager*>(
|
||||
tmp->mChromeFields.mMessageManager.get())->Disconnect();
|
||||
|
@ -1391,7 +1327,6 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsGlobalWindowInner)
|
|||
}
|
||||
tmp->DisconnectAndClearGroupMessageManagers();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeFields.mGroupMessageManagers)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChromeFields.mOpenerForInitialContentBrowser)
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_PRESERVED_WRAPPER
|
||||
|
@ -3756,10 +3691,7 @@ nsGlobalWindowInner::NotifyWindowIDDestroyed(const char* aTopic)
|
|||
{
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
new WindowDestroyedEvent(this, mWindowID, aTopic);
|
||||
nsresult rv = Dispatch(TaskCategory::Other, runnable.forget());
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
mNotifiedIDDestroyed = true;
|
||||
}
|
||||
Dispatch(TaskCategory::Other, runnable.forget());
|
||||
}
|
||||
|
||||
// static
|
||||
|
@ -6458,7 +6390,8 @@ nsGlobalWindowInner::EnableOrientationChangeListener()
|
|||
{
|
||||
MOZ_ASSERT(IsInnerWindow());
|
||||
// XXX: mDocShell is never set on the inner window?
|
||||
if (!nsContentUtils::ShouldResistFingerprinting(nullptr) &&
|
||||
nsIDocShell* docShell = nullptr;
|
||||
if (!nsContentUtils::ShouldResistFingerprinting(docShell) &&
|
||||
!mOrientationChangeObserver) {
|
||||
mOrientationChangeObserver =
|
||||
MakeUnique<WindowOrientationObserver>(this);
|
||||
|
|
|
@ -443,11 +443,6 @@ public:
|
|||
|
||||
nsGlobalWindowOuter *GetOuterWindowInternal() const;
|
||||
|
||||
bool IsCreatingInnerWindow() const
|
||||
{
|
||||
return mCreatingInnerWindow;
|
||||
}
|
||||
|
||||
bool IsChromeWindow() const
|
||||
{
|
||||
return mIsChrome;
|
||||
|
@ -507,10 +502,7 @@ public:
|
|||
virtual void DisableTimeChangeNotifications() override;
|
||||
|
||||
bool IsClosedOrClosing() {
|
||||
return (mIsClosed ||
|
||||
mInClose ||
|
||||
mHavePendingClose ||
|
||||
mCleanedUp);
|
||||
return mCleanedUp;
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -535,11 +527,6 @@ public:
|
|||
bool ContainsIdleObserver(nsIIdleObserver* aIdleObserver, uint32_t timeInS);
|
||||
void HandleIdleObserverCallback();
|
||||
|
||||
void AllowScriptsToClose()
|
||||
{
|
||||
mAllowScriptsToClose = true;
|
||||
}
|
||||
|
||||
enum SlowScriptResponse {
|
||||
ContinueSlowScript = 0,
|
||||
ContinueSlowScriptAndKeepNotifying,
|
||||
|
@ -1100,7 +1087,6 @@ protected:
|
|||
// Object Management
|
||||
virtual ~nsGlobalWindowInner();
|
||||
void CleanUp();
|
||||
void ClearControllers();
|
||||
|
||||
void FreeInnerObjects();
|
||||
nsGlobalWindowInner *CallerInnerWindow();
|
||||
|
@ -1285,23 +1271,7 @@ public:
|
|||
void RemoveIdleCallback(mozilla::dom::IdleRequest* aRequest);
|
||||
|
||||
protected:
|
||||
// These members are only used on outer window objects. Make sure
|
||||
// you never set any of these on an inner object!
|
||||
bool mFullScreen : 1;
|
||||
bool mFullscreenMode : 1;
|
||||
bool mIsClosed : 1;
|
||||
bool mInClose : 1;
|
||||
// mHavePendingClose means we've got a termination function set to
|
||||
// close us when the JS stops executing or that we have a close
|
||||
// event posted. If this is set, just ignore window.close() calls.
|
||||
bool mHavePendingClose : 1;
|
||||
bool mHadOriginalOpener : 1;
|
||||
bool mOriginalOpenerWasSecureContext : 1;
|
||||
bool mIsSecureContextIfOpenerIgnored : 1;
|
||||
bool mIsPopupSpam : 1;
|
||||
|
||||
// Indicates whether scripts are allowed to close this window.
|
||||
bool mBlockScriptedClosingFlag : 1;
|
||||
|
||||
// Window offline status. Checked to see if we need to fire offline event
|
||||
bool mWasOffline : 1;
|
||||
|
@ -1315,10 +1285,6 @@ protected:
|
|||
bool mNotifyIdleObserversIdleOnThaw : 1;
|
||||
bool mNotifyIdleObserversActiveOnThaw : 1;
|
||||
|
||||
// Indicates whether we're in the middle of creating an initializing
|
||||
// a new inner window object.
|
||||
bool mCreatingInnerWindow : 1;
|
||||
|
||||
// Fast way to tell if this is a chrome window (without having to QI).
|
||||
bool mIsChrome : 1;
|
||||
|
||||
|
@ -1340,53 +1306,29 @@ protected:
|
|||
// should be displayed.
|
||||
bool mFocusByKeyOccurred : 1;
|
||||
|
||||
// Inner windows only.
|
||||
// Indicates whether this window wants gamepad input events
|
||||
bool mHasGamepad : 1;
|
||||
|
||||
// Inner windows only.
|
||||
// Indicates whether this window wants VR events
|
||||
bool mHasVREvents : 1;
|
||||
|
||||
// Inner windows only.
|
||||
// Indicates whether this window wants VRDisplayActivate events
|
||||
bool mHasVRDisplayActivateEvents : 1;
|
||||
nsCheapSet<nsUint32HashKey> mGamepadIndexSet;
|
||||
nsRefPtrHashtable<nsUint32HashKey, mozilla::dom::Gamepad> mGamepads;
|
||||
bool mHasSeenGamepadInput;
|
||||
|
||||
// whether we've sent the destroy notification for our window id
|
||||
bool mNotifiedIDDestroyed : 1;
|
||||
// whether scripts may close the window,
|
||||
// even if "dom.allow_scripts_to_close_windows" is false.
|
||||
bool mAllowScriptsToClose : 1;
|
||||
|
||||
bool mTopLevelOuterContentWindow : 1;
|
||||
|
||||
nsCOMPtr<nsIScriptContext> mContext;
|
||||
nsWeakPtr mOpener;
|
||||
nsCOMPtr<nsIControllers> mControllers;
|
||||
|
||||
// For |window.arguments|, via |openDialog|.
|
||||
nsCOMPtr<nsIArray> mArguments;
|
||||
|
||||
// Only used in the outer.
|
||||
RefPtr<DialogValueHolder> mReturnValue;
|
||||
|
||||
RefPtr<mozilla::dom::Navigator> mNavigator;
|
||||
RefPtr<nsScreen> mScreen;
|
||||
RefPtr<nsDOMWindowList> mFrames;
|
||||
// All BarProps are inner window only.
|
||||
|
||||
RefPtr<mozilla::dom::BarProp> mMenubar;
|
||||
RefPtr<mozilla::dom::BarProp> mToolbar;
|
||||
RefPtr<mozilla::dom::BarProp> mLocationbar;
|
||||
RefPtr<mozilla::dom::BarProp> mPersonalbar;
|
||||
RefPtr<mozilla::dom::BarProp> mStatusbar;
|
||||
RefPtr<mozilla::dom::BarProp> mScrollbars;
|
||||
RefPtr<nsDOMWindowUtils> mWindowUtils;
|
||||
nsString mStatus;
|
||||
nsString mDefaultStatus;
|
||||
RefPtr<nsGlobalWindowObserver> mObserver; // Inner windows only.
|
||||
|
||||
RefPtr<nsGlobalWindowObserver> mObserver;
|
||||
RefPtr<mozilla::dom::Crypto> mCrypto;
|
||||
RefPtr<mozilla::dom::U2F> mU2F;
|
||||
RefPtr<mozilla::dom::cache::CacheStorage> mCacheStorage;
|
||||
|
@ -1404,13 +1346,11 @@ protected:
|
|||
RefPtr<mozilla::dom::Storage> mLocalStorage;
|
||||
RefPtr<mozilla::dom::Storage> mSessionStorage;
|
||||
|
||||
// These member variable are used only on inner windows.
|
||||
RefPtr<mozilla::EventListenerManager> mListenerManager;
|
||||
RefPtr<mozilla::dom::Location> mLocation;
|
||||
RefPtr<nsHistory> mHistory;
|
||||
RefPtr<mozilla::dom::CustomElementRegistry> mCustomElements;
|
||||
|
||||
// These member variables are used on both inner and the outer windows.
|
||||
nsCOMPtr<nsIPrincipal> mDocumentPrincipal;
|
||||
// mTabChild is only ever populated in the content process.
|
||||
nsCOMPtr<nsITabChild> mTabChild;
|
||||
|
@ -1429,7 +1369,6 @@ protected:
|
|||
RefPtr<IdleRequestExecutor> mIdleRequestExecutor;
|
||||
|
||||
#ifdef DEBUG
|
||||
bool mSetOpenerWindowCalled;
|
||||
nsCOMPtr<nsIURI> mLastOpenedURI;
|
||||
#endif
|
||||
|
||||
|
@ -1440,14 +1379,6 @@ protected:
|
|||
using XBLPrototypeHandlerTable = nsJSThingHashtable<nsPtrHashKey<nsXBLPrototypeHandler>, JSObject*>;
|
||||
mozilla::UniquePtr<XBLPrototypeHandlerTable> mCachedXBLPrototypeHandlers;
|
||||
|
||||
// mSuspendedDoc is only set on outer windows. It's useful when we get matched
|
||||
// EnterModalState/LeaveModalState calls, in which case the outer window is
|
||||
// responsible for unsuspending events on the document. If we don't (for
|
||||
// example, if the outer window is closed before the LeaveModalState call),
|
||||
// then the inner window whose mDoc is our mSuspendedDoc is responsible for
|
||||
// unsuspending it.
|
||||
nsCOMPtr<nsIDocument> mSuspendedDoc;
|
||||
|
||||
RefPtr<mozilla::dom::IDBFactory> mIndexedDB;
|
||||
|
||||
// This counts the number of windows that have been opened in rapid succession
|
||||
|
@ -1475,16 +1406,9 @@ protected:
|
|||
#endif
|
||||
|
||||
#ifdef MOZ_WEBSPEECH
|
||||
// mSpeechSynthesis is only used on inner windows.
|
||||
RefPtr<mozilla::dom::SpeechSynthesis> mSpeechSynthesis;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG
|
||||
// This member is used in the debug only assertions in TabGroup()
|
||||
// to catch cyclic parent/opener trees and not overflow the stack.
|
||||
bool mIsValidatingTabGroup;
|
||||
#endif
|
||||
|
||||
// This is the CC generation the last time we called CanSkip.
|
||||
uint32_t mCanSkipCCGeneration;
|
||||
|
||||
|
@ -1493,11 +1417,7 @@ protected:
|
|||
|
||||
RefPtr<mozilla::dom::VREventObserver> mVREventObserver;
|
||||
|
||||
// When non-zero, the document should receive a vrdisplayactivate event
|
||||
// after loading. The value is the ID of the VRDisplay that content should
|
||||
// begin presentation on.
|
||||
uint32_t mAutoActivateVRDisplayID; // Outer windows only
|
||||
int64_t mBeforeUnloadListenerCount; // Inner windows only
|
||||
int64_t mBeforeUnloadListenerCount;
|
||||
|
||||
RefPtr<mozilla::dom::IntlUtils> mIntlUtils;
|
||||
|
||||
|
@ -1512,14 +1432,8 @@ protected:
|
|||
: mGroupMessageManagers(1)
|
||||
{}
|
||||
|
||||
nsCOMPtr<nsIBrowserDOMWindow> mBrowserDOMWindow;
|
||||
nsCOMPtr<nsIMessageBroadcaster> mMessageManager;
|
||||
nsInterfaceHashtable<nsStringHashKey, nsIMessageBroadcaster> mGroupMessageManagers;
|
||||
// A weak pointer to the nsPresShell that we are doing fullscreen for.
|
||||
// The pointer being set indicates we've set the IsInFullscreenChange
|
||||
// flag on this pres shell.
|
||||
nsWeakPtr mFullscreenPresShell;
|
||||
nsCOMPtr<mozIDOMWindowProxy> mOpenerForInitialContentBrowser;
|
||||
} mChromeFields;
|
||||
|
||||
friend class nsDOMScriptableHelper;
|
||||
|
@ -1577,7 +1491,7 @@ nsGlobalWindowInner::GetContextInternal()
|
|||
return GetOuterWindowInternal()->mContext;
|
||||
}
|
||||
|
||||
return mContext;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
inline nsGlobalWindowOuter*
|
||||
|
|
Загрузка…
Ссылка в новой задаче