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
This commit is contained in:
Kyle Machulis
2018-11-28 03:30:56 +00:00
parent 41c3435c93
commit f293508546
15 changed files with 215 additions and 206 deletions

View File

@@ -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'");

View File

@@ -859,10 +859,9 @@ nsDocShell::MaybeHandleSubframeHistory(nsDocShellLoadState* aLoadState)
// 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);
BusyFlags parentBusy = parentDS->GetBusyFlags();
BusyFlags selfBusy = GetBusyFlags();
if (parentBusy & BUSY_FLAGS_BUSY ||
selfBusy & BUSY_FLAGS_BUSY) {
aLoadState->SetLoadType(LOAD_NORMAL_REPLACE);
@@ -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 ||

View File

@@ -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

View File

@@ -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">.
*/
const unsigned long META_VIEWPORT_OVERRIDE_DISABLED = 0;
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;
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;
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

View File

@@ -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
}

View File

@@ -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;
}
}

View File

@@ -3885,8 +3885,7 @@ 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

View File

@@ -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) {

View File

@@ -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)) {

View File

@@ -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;

View File

@@ -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();

View File

@@ -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;

View File

@@ -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) {

View File

@@ -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;

View File

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