Bug 1505601 - Turn nsIDocShell XPIDL const lists into cenums; r=bzbarsky

Turn all const lists and related attributes into cenums, to provide a
vague sense of type safety.

Depends on D11715

Differential Revision: https://phabricator.services.mozilla.com/D11716

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Kyle Machulis 2018-11-28 03:30:56 +00:00
Родитель e821d52f9b
Коммит c241567f0f
15 изменённых файлов: 215 добавлений и 206 удалений

Просмотреть файл

@ -102,7 +102,7 @@ LogDocShellState(nsIDocument* aDocumentNode)
nsAutoCString docShellBusy;
nsCOMPtr<nsIDocShell> docShell = aDocumentNode->GetDocShell();
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
nsIDocShell::BusyFlags busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
docShell->GetBusyFlags(&busyFlags);
if (busyFlags == nsIDocShell::BUSY_FLAGS_NONE) {
printf("'none'");

Просмотреть файл

@ -791,9 +791,9 @@ void
nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
{
// First, verify if this is a subframe.
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
GetSameTypeParent(getter_AddRefs(parentAsItem));
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
nsCOMPtr<nsIDocShellTreeItem> parentAsItem;
GetSameTypeParent(getter_AddRefs(parentAsItem));
nsCOMPtr<nsIDocShell> parentDS(do_QueryInterface(parentAsItem));
if (!parentDS || parentDS == static_cast<nsIDocShell*>(this)) {
// This is the root docshell. If we got here while
@ -813,58 +813,57 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
* back/forward. If the parent was loaded through any other loadType, set the
* child's loadType too accordingly, so that session history does not get
* confused.
*/
*/
// Get the parent's load type
// Get the parent's load type
uint32_t parentLoadType;
parentDS->GetLoadType(&parentLoadType);
parentDS->GetLoadType(&parentLoadType);
// Get the ShEntry for the child from the parent
nsCOMPtr<nsISHEntry> currentSH;
bool oshe = false;
parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
bool dynamicallyAddedChild = mDynamicallyCreated;
// Get the ShEntry for the child from the parent
nsCOMPtr<nsISHEntry> currentSH;
bool oshe = false;
parentDS->GetCurrentSHEntry(getter_AddRefs(currentSH), &oshe);
bool dynamicallyAddedChild = mDynamicallyCreated;
if (!dynamicallyAddedChild && !oshe && currentSH) {
currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
}
if (!dynamicallyAddedChild && !oshe && currentSH) {
currentSH->HasDynamicallyAddedChild(&dynamicallyAddedChild);
}
if (!dynamicallyAddedChild) {
// Only use the old SHEntry, if we're sure enough that
// it wasn't originally for some other frame.
if (!dynamicallyAddedChild) {
// Only use the old SHEntry, if we're sure enough that
// it wasn't originally for some other frame.
nsCOMPtr<nsISHEntry> shEntry;
parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
parentDS->GetChildSHEntry(mChildOffset, getter_AddRefs(shEntry));
aLoadState->SetSHEntry(shEntry);
}
}
// Make some decisions on the child frame's loadType based on the
// parent's loadType, if the subframe hasn't loaded anything into it.
//
// In some cases privileged scripts may try to get the DOMWindow
// reference of this docshell before the loading starts, causing the
// initial about:blank content viewer being created and mCurrentURI being
// set. To handle this case we check if mCurrentURI is about:blank and
// currentSHEntry is null.
nsCOMPtr<nsISHEntry> currentChildEntry;
GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
// Make some decisions on the child frame's loadType based on the
// parent's loadType, if the subframe hasn't loaded anything into it.
//
// In some cases privileged scripts may try to get the DOMWindow
// reference of this docshell before the loading starts, causing the
// initial about:blank content viewer being created and mCurrentURI being
// set. To handle this case we check if mCurrentURI is about:blank and
// currentSHEntry is null.
nsCOMPtr<nsISHEntry> currentChildEntry;
GetCurrentSHEntry(getter_AddRefs(currentChildEntry), &oshe);
if (mCurrentURI && (!NS_IsAboutBlank(mCurrentURI) || currentChildEntry)) {
// This is a pre-existing subframe. If
// 1. The load of this frame was not originally initiated by session
// history directly (i.e. (!shEntry) condition succeeded, but it can
// still be a history load on parent which causes this frame being
// This is a pre-existing subframe. If
// 1. The load of this frame was not originally initiated by session
// history directly (i.e. (!shEntry) condition succeeded, but it can
// still be a history load on parent which causes this frame being
// loaded), which we checked with the above assert, and
// 2. mCurrentURI is not null, nor the initial about:blank,
// it is possible that a parent's onLoadHandler or even self's
// onLoadHandler is loading a new page in this child. Check parent's and
// self's busy flag and if it is set, we don't want this onLoadHandler
// load to get in to session history.
uint32_t parentBusy = BUSY_FLAGS_NONE;
uint32_t selfBusy = BUSY_FLAGS_NONE;
parentDS->GetBusyFlags(&parentBusy);
GetBusyFlags(&selfBusy);
if (parentBusy & BUSY_FLAGS_BUSY ||
selfBusy & BUSY_FLAGS_BUSY) {
// 2. mCurrentURI is not null, nor the initial about:blank,
// it is possible that a parent's onLoadHandler or even self's
// onLoadHandler is loading a new page in this child. Check parent's and
// self's busy flag and if it is set, we don't want this onLoadHandler
// load to get in to session history.
BusyFlags parentBusy = parentDS->GetBusyFlags();
BusyFlags selfBusy = GetBusyFlags();
if (parentBusy & BUSY_FLAGS_BUSY ||
selfBusy & BUSY_FLAGS_BUSY) {
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
aLoadState->SetSHEntry(nullptr);
}
@ -882,9 +881,9 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
// in the onLoadHandler. We don't want this url to get into session
// history. Clear off shEntry, and set load type to
// LOAD_BYPASS_HISTORY.
bool inOnLoadHandler = false;
bool inOnLoadHandler = false;
parentDS->GetIsExecutingOnLoadHandler(&inOnLoadHandler);
if (inOnLoadHandler) {
if (inOnLoadHandler) {
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
aLoadState->SetSHEntry(nullptr);
}
@ -2010,7 +2009,7 @@ nsDocShell::GetMayEnableCharacterEncodingMenu(
}
NS_IMETHODIMP
nsDocShell::GetDocShellEnumerator(int32_t aItemType, int32_t aDirection,
nsDocShell::GetDocShellEnumerator(int32_t aItemType, DocShellEnumeratorDirection aDirection,
nsISimpleEnumerator** aResult)
{
NS_ENSURE_ARG_POINTER(aResult);
@ -2045,14 +2044,14 @@ nsDocShell::GetDocShellEnumerator(int32_t aItemType, int32_t aDirection,
}
NS_IMETHODIMP
nsDocShell::GetAppType(uint32_t* aAppType)
nsDocShell::GetAppType(AppType* aAppType)
{
*aAppType = mAppType;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetAppType(uint32_t aAppType)
nsDocShell::SetAppType(AppType aAppType)
{
mAppType = aAppType;
return NS_OK;
@ -2119,7 +2118,7 @@ nsDocShell::SetMarginHeight(int32_t aHeight)
}
NS_IMETHODIMP
nsDocShell::GetBusyFlags(uint32_t* aBusyFlags)
nsDocShell::GetBusyFlags(BusyFlags* aBusyFlags)
{
NS_ENSURE_ARG_POINTER(aBusyFlags);
@ -2521,18 +2520,20 @@ nsDocShell::SetCustomUserAgent(const nsAString& aCustomUserAgent)
}
NS_IMETHODIMP
nsDocShell::GetTouchEventsOverride(uint32_t* aTouchEventsOverride)
nsDocShell::GetTouchEventsOverride(TouchEventsOverride* aTouchEventsOverride)
{
*aTouchEventsOverride = mTouchEventsOverride;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetTouchEventsOverride(uint32_t aTouchEventsOverride)
nsDocShell::SetTouchEventsOverride(TouchEventsOverride aTouchEventsOverride)
{
if (!(aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE ||
aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_ENABLED ||
aTouchEventsOverride == nsIDocShell::TOUCHEVENTS_OVERRIDE_DISABLED)) {
// We don't have a way to verify this coming from Javascript, so this check is
// still needed.
if (!(aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_NONE ||
aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_ENABLED ||
aTouchEventsOverride == TOUCHEVENTS_OVERRIDE_DISABLED)) {
return NS_ERROR_INVALID_ARG;
}
@ -2549,7 +2550,7 @@ nsDocShell::SetTouchEventsOverride(uint32_t aTouchEventsOverride)
}
NS_IMETHODIMP
nsDocShell::GetMetaViewportOverride(uint32_t* aMetaViewportOverride)
nsDocShell::GetMetaViewportOverride(MetaViewportOverride* aMetaViewportOverride)
{
NS_ENSURE_ARG_POINTER(aMetaViewportOverride);
@ -2558,11 +2559,13 @@ nsDocShell::GetMetaViewportOverride(uint32_t* aMetaViewportOverride)
}
NS_IMETHODIMP
nsDocShell::SetMetaViewportOverride(uint32_t aMetaViewportOverride)
nsDocShell::SetMetaViewportOverride(MetaViewportOverride aMetaViewportOverride)
{
if (!(aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_NONE ||
aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_ENABLED ||
aMetaViewportOverride == nsIDocShell::META_VIEWPORT_OVERRIDE_DISABLED)) {
// We don't have a way to verify this coming from Javascript, so this check is
// still needed.
if (!(aMetaViewportOverride == META_VIEWPORT_OVERRIDE_NONE ||
aMetaViewportOverride == META_VIEWPORT_OVERRIDE_ENABLED ||
aMetaViewportOverride == META_VIEWPORT_OVERRIDE_DISABLED)) {
return NS_ERROR_INVALID_ARG;
}
@ -2827,10 +2830,9 @@ nsDocShell::SetDocLoaderParent(nsDocLoader* aParent)
if (NS_SUCCEEDED(parentAsDocShell->GetDefaultLoadFlags(&flags))) {
SetDefaultLoadFlags(flags);
}
uint32_t touchEventsOverride;
if (NS_SUCCEEDED(parentAsDocShell->GetTouchEventsOverride(&touchEventsOverride))) {
SetTouchEventsOverride(touchEventsOverride);
}
SetTouchEventsOverride(parentAsDocShell->GetTouchEventsOverride());
// We don't need to inherit metaViewportOverride, because the viewport
// is only relevant for the outermost nsDocShell, not for any iframes
// like this that might be embedded within it.
@ -6114,8 +6116,7 @@ nsDocShell::RefreshURI(nsIURI* aURI, nsIPrincipal* aPrincipal,
nsCOMPtr<nsITimerCallback> refreshTimer =
new nsRefreshTimer(this, aURI, aPrincipal, aDelay, aRepeat, aMetaRefresh);
uint32_t busyFlags = 0;
GetBusyFlags(&busyFlags);
BusyFlags busyFlags = GetBusyFlags();
if (!mRefreshURIList) {
mRefreshURIList = nsArray::Create();
@ -6798,7 +6799,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
}
}
// Page has begun to load
mBusyFlags = BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD;
mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_BEFORE_PAGE_LOAD);
if ((aStateFlags & STATE_RESTORING) == 0) {
// Show the progress cursor if the pref is set
@ -6812,7 +6813,7 @@ nsDocShell::OnStateChange(nsIWebProgress* aProgress, nsIRequest* aRequest,
}
} else if ((~aStateFlags & (STATE_TRANSFERRING | STATE_IS_DOCUMENT)) == 0) {
// Page is loading
mBusyFlags = BUSY_FLAGS_BUSY | BUSY_FLAGS_PAGE_LOADING;
mBusyFlags = (BusyFlags)(BUSY_FLAGS_BUSY | BUSY_FLAGS_PAGE_LOADING);
} else if ((aStateFlags & STATE_STOP) && (aStateFlags & STATE_IS_NETWORK)) {
// Page has finished loading
mBusyFlags = BUSY_FLAGS_NONE;
@ -13574,14 +13575,14 @@ nsDocShell::GetCanExecuteScripts(bool* aResult)
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::SetFrameType(uint32_t aFrameType)
nsDocShell::SetFrameType(FrameType aFrameType)
{
mFrameType = aFrameType;
return NS_OK;
}
/* [infallible] */ NS_IMETHODIMP
nsDocShell::GetFrameType(uint32_t* aFrameType)
nsDocShell::GetFrameType(FrameType* aFrameType)
{
*aFrameType = mFrameType;
return NS_OK;
@ -14064,15 +14065,17 @@ nsIDocShell::SetHTMLEditor(HTMLEditor* aHTMLEditor)
}
NS_IMETHODIMP
nsDocShell::GetDisplayMode(uint32_t* aDisplayMode)
nsDocShell::GetDisplayMode(DisplayMode* aDisplayMode)
{
*aDisplayMode = mDisplayMode;
return NS_OK;
}
NS_IMETHODIMP
nsDocShell::SetDisplayMode(uint32_t aDisplayMode)
nsDocShell::SetDisplayMode(DisplayMode aDisplayMode)
{
// We don't have a way to verify this coming from Javascript, so this check is
// still needed.
if (!(aDisplayMode == nsIDocShell::DISPLAY_MODE_BROWSER ||
aDisplayMode == nsIDocShell::DISPLAY_MODE_STANDALONE ||
aDisplayMode == nsIDocShell::DISPLAY_MODE_FULLSCREEN ||

Просмотреть файл

@ -133,38 +133,38 @@ class nsDocShell final
{
public:
enum InternalLoad : uint32_t {
INTERNAL_LOAD_FLAGS_NONE = 0x0,
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL = 0x1,
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 0x2,
INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4,
INTERNAL_LOAD_FLAGS_NONE = 0x0,
INTERNAL_LOAD_FLAGS_INHERIT_PRINCIPAL = 0x1,
INTERNAL_LOAD_FLAGS_DONT_SEND_REFERRER = 0x2,
INTERNAL_LOAD_FLAGS_ALLOW_THIRD_PARTY_FIXUP = 0x4,
// This flag marks the first load in this object
// @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8,
// This flag marks the first load in this object
// @see nsIWebNavigation::LOAD_FLAGS_FIRST_LOAD
INTERNAL_LOAD_FLAGS_FIRST_LOAD = 0x8,
// The set of flags that should not be set before calling into
// nsDocShell::LoadURI and other nsDocShell loading functions.
INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS = 0xf,
// The set of flags that should not be set before calling into
// nsDocShell::LoadURI and other nsDocShell loading functions.
INTERNAL_LOAD_FLAGS_LOADURI_SETUP_FLAGS = 0xf,
INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10,
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20,
INTERNAL_LOAD_FLAGS_BYPASS_CLASSIFIER = 0x10,
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_COOKIES = 0x20,
// Whether the load should be treated as srcdoc load, rather than a URI one.
INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40,
// Whether the load should be treated as srcdoc load, rather than a URI one.
INTERNAL_LOAD_FLAGS_IS_SRCDOC = 0x40,
// Whether this is the load of a frame's original src attribute
INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC = 0x80,
// Whether this is the load of a frame's original src attribute
INTERNAL_LOAD_FLAGS_ORIGINAL_FRAME_SRC = 0x80,
INTERNAL_LOAD_FLAGS_NO_OPENER = 0x100,
INTERNAL_LOAD_FLAGS_NO_OPENER = 0x100,
// Whether a top-level data URI navigation is allowed for that load
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200,
// Whether a top-level data URI navigation is allowed for that load
INTERNAL_LOAD_FLAGS_FORCE_ALLOW_DATA_URI = 0x200,
// Whether the load was triggered by user interaction.
INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED = 0x1000,
};
// Whether the load was triggered by user interaction.
INTERNAL_LOAD_FLAGS_IS_USER_TRIGGERED = 0x1000,
};
// Event type dispatched by RestorePresentation
class RestorePresentationEvent : public mozilla::Runnable
@ -1089,15 +1089,15 @@ private: // data members
int32_t mChildOffset;
uint32_t mSandboxFlags;
uint32_t mBusyFlags;
uint32_t mAppType;
BusyFlags mBusyFlags;
AppType mAppType;
uint32_t mLoadType;
uint32_t mDefaultLoadFlags;
uint32_t mReferrerPolicy;
uint32_t mFailedLoadType;
// Are we a regular frame, a browser frame, or an app frame?
uint32_t mFrameType;
FrameType mFrameType;
// This represents the state of private browsing in the docshell.
// Currently treated as a binary value: 1 - in private mode, 0 - not private mode
@ -1106,17 +1106,9 @@ private: // data members
// origin attribute set.
uint32_t mPrivateBrowsingId;
// This represents the CSS display-mode we are currently using.
// It can be any of the following values from nsIDocShell.idl:
//
// DISPLAY_MODE_BROWSER = 0
// DISPLAY_MODE_MINIMAL_UI = 1
// DISPLAY_MODE_STANDALONE = 2
// DISPLAY_MODE_FULLSCREEN = 3
//
// This is mostly used for media queries. The integer values above
// match those used in nsStyleConsts.h
uint32_t mDisplayMode;
// This represents the CSS display-mode we are currently using. This is mostly
// used for media queries.
DisplayMode mDisplayMode;
// A depth count of how many times NotifyRunToCompletionStart
// has been called without a matching NotifyRunToCompletionStop.
@ -1124,11 +1116,11 @@ private: // data members
// Whether or not touch events are overridden. Possible values are defined
// as constants in the nsIDocShell.idl file.
uint32_t mTouchEventsOverride;
TouchEventsOverride mTouchEventsOverride;
// Whether or not handling of the <meta name="viewport"> tag is overridden.
// Possible values are defined as constants in nsIDocShell.idl.
uint32_t mMetaViewportOverride;
MetaViewportOverride mMetaViewportOverride;
// mFullscreenAllowed stores how we determine whether fullscreen is allowed
// when GetFullscreenAllowed() is called. Fullscreen is allowed in a

Просмотреть файл

@ -323,20 +323,29 @@ interface nsIDocShell : nsIDocShellTreeItem
* @param aDirection - Whether to enumerate forwards or backwards.
*/
const long ENUMERATE_FORWARDS = 0;
const long ENUMERATE_BACKWARDS = 1;
cenum DocShellEnumeratorDirection : 8 {
ENUMERATE_FORWARDS = 0,
ENUMERATE_BACKWARDS = 1
};
nsISimpleEnumerator getDocShellEnumerator(in long aItemType,
in long aDirection);
in nsIDocShell_DocShellEnumeratorDirection aDirection);
/**
* The type of application that created this window
* The type of application that created this window.
*
* DO NOT DELETE, see bug 176166. For firefox, this value will always be
* UNKNOWN. However, it is used heavily in Thunderbird/comm-central and we
* don't really have a great replacement at the moment, so we'll just leave it
* here.
*/
const unsigned long APP_TYPE_UNKNOWN = 0;
const unsigned long APP_TYPE_MAIL = 1;
const unsigned long APP_TYPE_EDITOR = 2;
cenum AppType : 8 {
APP_TYPE_UNKNOWN = 0,
APP_TYPE_MAIL = 1,
APP_TYPE_EDITOR = 2
};
attribute unsigned long appType;
[infallible] attribute nsIDocShell_AppType appType;
/**
* certain dochshells (like the message pane)
@ -384,25 +393,30 @@ interface nsIDocShell : nsIDocShellTreeItem
/**
* Current busy state for DocShell
*/
const unsigned long BUSY_FLAGS_NONE = 0;
const unsigned long BUSY_FLAGS_BUSY = 1;
const unsigned long BUSY_FLAGS_BEFORE_PAGE_LOAD = 2;
const unsigned long BUSY_FLAGS_PAGE_LOADING = 4;
cenum BusyFlags : 8 {
BUSY_FLAGS_NONE = 0,
BUSY_FLAGS_BUSY = 1,
BUSY_FLAGS_BEFORE_PAGE_LOAD = 2,
BUSY_FLAGS_PAGE_LOADING = 4,
};
[infallible] readonly attribute nsIDocShell_BusyFlags busyFlags;
/**
* Load commands for the document
*/
const unsigned long LOAD_CMD_NORMAL = 0x1; // Normal load
const unsigned long LOAD_CMD_RELOAD = 0x2; // Reload
const unsigned long LOAD_CMD_HISTORY = 0x4; // Load from history
const unsigned long LOAD_CMD_PUSHSTATE = 0x8; // History.pushState()
readonly attribute unsigned long busyFlags;
cenum LoadCommand : 8 {
LOAD_CMD_NORMAL = 0x1, // Normal load
LOAD_CMD_RELOAD = 0x2, // Reload
LOAD_CMD_HISTORY = 0x4, // Load from history
LOAD_CMD_PUSHSTATE = 0x8, // History.pushState()
};
/*
* attribute to access the loadtype for the document
* Attribute to access the loadtype for the document. LoadType Enum is
* defined in nsDocShellLoadTypes.h
*/
attribute unsigned long loadType;
[infallible] attribute unsigned long loadType;
/*
* Default load flags (as defined in nsIRequest) that will be set on all
@ -787,10 +801,11 @@ interface nsIDocShell : nsIDocShellTreeItem
/**
* The type of iframe that this docshell lives.
*/
const unsigned long FRAME_TYPE_REGULAR = 0;
const unsigned long FRAME_TYPE_BROWSER = 1;
[infallible] attribute unsigned long frameType;
cenum FrameType : 8 {
FRAME_TYPE_REGULAR = 0,
FRAME_TYPE_BROWSER = 1,
};
[infallible] attribute nsIDocShell_FrameType frameType;
/**
* Returns true if this docshell corresponds to an <iframe mozbrowser>.
@ -1099,45 +1114,51 @@ interface nsIDocShell : nsIDocShellTreeItem
[noscript,nostdcall,notxpcom] nsICommandManager GetCommandManager();
cenum TouchEventsOverride: 8 {
/**
* Override platform/pref default behaviour and force-disable touch events.
*/
TOUCHEVENTS_OVERRIDE_DISABLED = 0,
/**
* Override platform/pref default behaviour and force-enable touch events.
*/
TOUCHEVENTS_OVERRIDE_ENABLED = 1,
/**
* Don't override the platform/pref default behaviour for touch events.
*/
TOUCHEVENTS_OVERRIDE_NONE = 2,
};
/**
* This allows chrome to override the default choice of whether touch events
* are available on a specific docshell. Possible values are listed below.
*/
[infallible] attribute unsigned long touchEventsOverride;
/**
* Override platform/pref default behaviour and force-disable touch events.
*/
const unsigned long TOUCHEVENTS_OVERRIDE_DISABLED = 0;
/**
* Override platform/pref default behaviour and force-enable touch events.
*/
const unsigned long TOUCHEVENTS_OVERRIDE_ENABLED = 1;
/**
* Don't override the platform/pref default behaviour for touch events.
*/
const unsigned long TOUCHEVENTS_OVERRIDE_NONE = 2;
[infallible] attribute nsIDocShell_TouchEventsOverride touchEventsOverride;
cenum MetaViewportOverride: 8 {
/**
* Override platform/pref default behaviour and force-disable support for
* <meta name="viewport">.
*/
META_VIEWPORT_OVERRIDE_DISABLED = 0,
/**
* Override platform/pref default behaviour and force-enable support for
* <meta name="viewport">.
*/
META_VIEWPORT_OVERRIDE_ENABLED = 1,
/**
* Don't override the platform/pref default behaviour for support for
* <meta name="viewport">.
*/
META_VIEWPORT_OVERRIDE_NONE = 2,
};
/**
* Override platform/pref default behaviour and force-disable support for
* <meta name="viewport">.
*/
const unsigned long META_VIEWPORT_OVERRIDE_DISABLED = 0;
/**
* Override platform/pref default behaviour and force-enable support for
* <meta name="viewport">.
*/
const unsigned long META_VIEWPORT_OVERRIDE_ENABLED = 1;
/**
* Don't override the platform/pref default behaviour for support for
* <meta name="viewport">.
*/
const unsigned long META_VIEWPORT_OVERRIDE_NONE = 2;
/**
* This allows chrome to override the default choice of whether the
* <meta name="viewport"> tag is respected in a specific docshell.
* Possible values are listed above.
*/
attribute unsigned long metaViewportOverride;
[infallible] attribute nsIDocShell_MetaViewportOverride metaViewportOverride;
/**
* This value is `true` if its corresponding unit of related browsing contexts
@ -1208,18 +1229,20 @@ interface nsIDocShell : nsIDocShellTreeItem
/**
* Allowed CSS display modes. This needs to be kept in
* sync with similar values in nsStyleConsts.h
* sync with similar values in ServoStyleConsts.h
*/
const unsigned long DISPLAY_MODE_BROWSER = 0;
const unsigned long DISPLAY_MODE_MINIMAL_UI = 1;
const unsigned long DISPLAY_MODE_STANDALONE = 2;
const unsigned long DISPLAY_MODE_FULLSCREEN = 3;
cenum DisplayMode: 8 {
DISPLAY_MODE_BROWSER = 0,
DISPLAY_MODE_MINIMAL_UI = 1,
DISPLAY_MODE_STANDALONE = 2,
DISPLAY_MODE_FULLSCREEN = 3,
};
/**
* Display mode for this docshell. Defaults to DISPLAY_MODE_BROWSER.
* Media queries only look at the value in the top-most docshell.
*/
[infallible] attribute unsigned long displayMode;
[infallible] attribute nsIDocShell_DisplayMode displayMode;
/**
* The message manager for this docshell. This does not throw, but

Просмотреть файл

@ -3443,7 +3443,7 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsINode* aNode,
nsresult rv;
uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
auto appType = nsIDocShell::APP_TYPE_UNKNOWN;
{
nsCOMPtr<nsIDocShellTreeItem> docShellTreeItem = aLoadingDocument->GetDocShell();
@ -3453,8 +3453,8 @@ nsContentUtils::CanLoadImage(nsIURI* aURI, nsINode* aNode,
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
if (!docShell || NS_FAILED(docShell->GetAppType(&appType))) {
appType = nsIDocShell::APP_TYPE_UNKNOWN;
if (docShell) {
appType = docShell->GetAppType();
}
}
}
@ -7669,9 +7669,8 @@ nsContentUtils::PrefetchPreloadEnabled(nsIDocShell* aDocShell)
nsCOMPtr<nsIDocShellTreeItem> parentItem;
do {
uint32_t appType = 0;
nsresult rv = docshell->GetAppType(&appType);
if (NS_FAILED(rv) || appType == nsIDocShell::APP_TYPE_MAIL) {
auto appType = docshell->GetAppType();
if (appType == nsIDocShell::APP_TYPE_MAIL) {
return false; // do not prefetch, preload, preconnect from mailnews
}

Просмотреть файл

@ -3036,9 +3036,8 @@ nsGlobalWindowOuter::GetSanitizedOpener(nsPIDOMWindowOuter* aOpener)
openerDocShell->GetRootTreeItem(getter_AddRefs(openerRootItem));
nsCOMPtr<nsIDocShell> openerRootDocShell(do_QueryInterface(openerRootItem));
if (openerRootDocShell) {
uint32_t appType;
nsresult rv = openerRootDocShell->GetAppType(&appType);
if (NS_SUCCEEDED(rv) && appType != nsIDocShell::APP_TYPE_MAIL) {
nsIDocShell::AppType appType = openerRootDocShell->GetAppType();
if (appType != nsIDocShell::APP_TYPE_MAIL) {
return aOpener;
}
}

Просмотреть файл

@ -3885,13 +3885,12 @@ EventStateManager::UpdateCursor(nsPresContext* aPresContext,
// Check whether or not to show the busy cursor
nsCOMPtr<nsIDocShell> docShell(aPresContext->GetDocShell());
if (!docShell) return;
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
docShell->GetBusyFlags(&busyFlags);
auto busyFlags = docShell->GetBusyFlags();
// Show busy cursor everywhere before page loads
// and just replace the arrow cursor after page starts loading
if (busyFlags & nsIDocShell::BUSY_FLAGS_BUSY &&
(cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT))
(cursor == NS_STYLE_CURSOR_AUTO || cursor == NS_STYLE_CURSOR_DEFAULT))
{
cursor = NS_STYLE_CURSOR_SPINNING;
container = nullptr;

Просмотреть файл

@ -253,9 +253,9 @@ TouchEvent::PrefEnabled(nsIDocShell* aDocShell)
static bool sPrefCached = false;
static int32_t sPrefCacheValue = 0;
uint32_t touchEventsOverride = nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE;
auto touchEventsOverride = nsIDocShell::TOUCHEVENTS_OVERRIDE_NONE;
if (aDocShell) {
aDocShell->GetTouchEventsOverride(&touchEventsOverride);
touchEventsOverride = aDocShell->GetTouchEventsOverride();
}
if (!sPrefCached) {

Просмотреть файл

@ -179,11 +179,7 @@ PresentationResponderLoadingCallback::Init(nsIDocShell* aDocShell)
return NS_ERROR_NOT_AVAILABLE;
}
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
nsresult rv = aDocShell->GetBusyFlags(&busyFlags);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
auto busyFlags = aDocShell->GetBusyFlags();
if ((busyFlags == nsIDocShell::BUSY_FLAGS_NONE) ||
(busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)) {

Просмотреть файл

@ -270,7 +270,7 @@ static bool IsImageLoadInEditorAppType(nsILoadInfo* aLoadInfo)
return false;
}
uint32_t appType = nsIDocShell::APP_TYPE_UNKNOWN;
auto appType = nsIDocShell::APP_TYPE_UNKNOWN;
nsINode* node = aLoadInfo->LoadingNode();
if (!node) {
return false;
@ -288,8 +288,8 @@ static bool IsImageLoadInEditorAppType(nsILoadInfo* aLoadInfo)
nsCOMPtr<nsIDocShellTreeItem> root;
docShellTreeItem->GetRootTreeItem(getter_AddRefs(root));
nsCOMPtr<nsIDocShell> docShell(do_QueryInterface(root));
if (!docShell || NS_FAILED(docShell->GetAppType(&appType))) {
appType = nsIDocShell::APP_TYPE_UNKNOWN;
if (docShell) {
appType = docShell->GetAppType();
}
return appType == nsIDocShell::APP_TYPE_EDITOR;

Просмотреть файл

@ -488,10 +488,9 @@ TextEditor::IsSafeToInsertData(nsIDocument* aSourceDoc)
dsti->GetRootTreeItem(getter_AddRefs(root));
}
nsCOMPtr<nsIDocShell> docShell = do_QueryInterface(root);
uint32_t appType;
if (docShell && NS_SUCCEEDED(docShell->GetAppType(&appType))) {
isSafe = appType == nsIDocShell::APP_TYPE_EDITOR;
}
isSafe = docShell && docShell->GetAppType() == nsIDocShell::APP_TYPE_EDITOR;
if (!isSafe && aSourceDoc) {
nsIPrincipal* srcPrincipal = aSourceDoc->NodePrincipal();
nsIPrincipal* destPrincipal = destdoc->NodePrincipal();

Просмотреть файл

@ -3830,9 +3830,8 @@ nsDocumentViewer::Print(nsIPrintSettings* aPrintSettings,
// Check to see if this document is still busy
// If it is busy and we aren't already "queued" up to print then
// Indicate there is a print pending and cache the args for later
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
if ((NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
(busyFlags != nsIDocShell::BUSY_FLAGS_NONE && busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING)) &&
auto busyFlags = docShell->GetBusyFlags();
if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE && busyFlags & nsIDocShell::BUSY_FLAGS_PAGE_LOADING &&
!mPrintDocIsFullyLoaded) {
if (!mPrintIsPending) {
mCachedPrintSettings = aPrintSettings;

Просмотреть файл

@ -10347,10 +10347,10 @@ nsLayoutUtils::ComputeSystemFont(nsFont* aSystemFont, LookAndFeel::FontID aFontI
/* static */ bool
nsLayoutUtils::ShouldHandleMetaViewport(nsIDocument* aDocument)
{
uint32_t metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
auto metaViewportOverride = nsIDocShell::META_VIEWPORT_OVERRIDE_NONE;
if (aDocument) {
if (nsIDocShell* docShell = aDocument->GetDocShell()) {
docShell->GetMetaViewportOverride(&metaViewportOverride);
metaViewportOverride = docShell->GetMetaViewportOverride();
}
}
switch (metaViewportOverride) {

Просмотреть файл

@ -1049,9 +1049,8 @@ nsPrintJob::PrintPreview(nsIPrintSettings* aPrintSettings,
nsCOMPtr<nsIDocShell> docShell(do_QueryReferent(mContainer));
NS_ENSURE_STATE(docShell);
uint32_t busyFlags = nsIDocShell::BUSY_FLAGS_NONE;
if (NS_FAILED(docShell->GetBusyFlags(&busyFlags)) ||
busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
auto busyFlags = docShell->GetBusyFlags();
if (busyFlags != nsIDocShell::BUSY_FLAGS_NONE) {
CloseProgressDialog(aWebProgressListener);
FirePrintingErrorEvent(NS_ERROR_GFX_PRINTER_DOC_IS_BUSY);
return NS_ERROR_FAILURE;

Просмотреть файл

@ -127,8 +127,9 @@ nsWebBrowserFind::FindNext(bool* aResult)
return NS_ERROR_FAILURE;
}
int32_t enumDirection = mFindBackwards ? nsIDocShell::ENUMERATE_BACKWARDS :
nsIDocShell::ENUMERATE_FORWARDS;
auto enumDirection =
mFindBackwards ? nsIDocShell::ENUMERATE_BACKWARDS :
nsIDocShell::ENUMERATE_FORWARDS;
nsCOMPtr<nsISimpleEnumerator> docShellEnumerator;
rv = rootDocShell->GetDocShellEnumerator(nsIDocShellTreeItem::typeAll,