Bug 804174 - Inline IsUniversalXPConnectCapable with nsContentUtils::IsCallerChrome. r=mccr8

This commit is contained in:
Nikhil Marathe 2012-10-25 16:10:53 -07:00
parent 814dbc2a57
commit 3a11b37824

View File

@ -72,11 +72,6 @@ using namespace mozilla::dom;
using namespace mozilla::layers;
using namespace mozilla::widget;
static bool IsUniversalXPConnectCapable()
{
return nsContentUtils::IsCallerChrome();
}
DOMCI_DATA(WindowUtils, nsDOMWindowUtils)
NS_INTERFACE_MAP_BEGIN(nsDOMWindowUtils)
@ -133,7 +128,7 @@ nsDOMWindowUtils::GetPresContext()
NS_IMETHODIMP
nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -150,7 +145,7 @@ nsDOMWindowUtils::GetImageAnimationMode(uint16_t *aMode)
NS_IMETHODIMP
nsDOMWindowUtils::SetImageAnimationMode(uint16_t aMode)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -167,7 +162,7 @@ nsDOMWindowUtils::GetDocCharsetIsForced(bool *aIsForced)
{
*aIsForced = false;
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -184,7 +179,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
nsAString& aValue)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -205,7 +200,7 @@ nsDOMWindowUtils::GetDocumentMetadata(const nsAString& aName,
NS_IMETHODIMP
nsDOMWindowUtils::Redraw(uint32_t aCount, uint32_t *aDurationOut)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -236,7 +231,7 @@ nsDOMWindowUtils::Redraw(uint32_t aCount, uint32_t *aDurationOut)
NS_IMETHODIMP
nsDOMWindowUtils::SetCSSViewport(float aWidthPx, float aHeightPx)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -333,7 +328,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
float aWidthPx, float aHeightPx,
nsIDOMElement* aElement)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -410,7 +405,7 @@ nsDOMWindowUtils::SetDisplayPortForElement(float aXPx, float aYPx,
NS_IMETHODIMP
nsDOMWindowUtils::SetResolution(float aXResolution, float aYResolution)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -422,7 +417,7 @@ nsDOMWindowUtils::SetResolution(float aXResolution, float aYResolution)
NS_IMETHODIMP
nsDOMWindowUtils::SetIsFirstPaint(bool aIsFirstPaint)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -437,7 +432,7 @@ nsDOMWindowUtils::SetIsFirstPaint(bool aIsFirstPaint)
NS_IMETHODIMP
nsDOMWindowUtils::GetIsFirstPaint(bool *aIsFirstPaint)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -545,7 +540,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
unsigned short aInputSourceArg,
bool aToWindow)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -626,7 +621,7 @@ nsDOMWindowUtils::SendWheelEvent(float aX,
int32_t aLineOrPageDeltaY,
uint32_t aOptions)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -725,7 +720,7 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
bool aIgnoreRootScrollFrame,
bool *aPreventDefault)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -781,7 +776,7 @@ nsDOMWindowUtils::SendKeyEvent(const nsAString& aType,
uint32_t aAdditionalFlags,
bool* aDefaultActionTaken)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -894,7 +889,7 @@ nsDOMWindowUtils::SendNativeKeyEvent(int32_t aNativeKeyboardLayout,
const nsAString& aCharacters,
const nsAString& aUnmodifiedCharacters)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -914,7 +909,7 @@ nsDOMWindowUtils::SendNativeMouseEvent(int32_t aScreenX,
int32_t aModifierFlags,
nsIDOMElement* aElement)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -938,7 +933,7 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
uint32_t aAdditionalFlags,
nsIDOMElement* aElement)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -959,7 +954,7 @@ nsDOMWindowUtils::SendNativeMouseScrollEvent(int32_t aScreenX,
NS_IMETHODIMP
nsDOMWindowUtils::ActivateNativeMenuItemAt(const nsAString& indexString)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -974,7 +969,7 @@ nsDOMWindowUtils::ActivateNativeMenuItemAt(const nsAString& indexString)
NS_IMETHODIMP
nsDOMWindowUtils::ForceUpdateNativeMenuAt(const nsAString& indexString)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1031,7 +1026,7 @@ nsDOMWindowUtils::GetWidgetForElement(nsIDOMElement* aElement)
NS_IMETHODIMP
nsDOMWindowUtils::Focus(nsIDOMElement* aElement)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1054,7 +1049,7 @@ nsDOMWindowUtils::GarbageCollect(nsICycleCollectorListener *aListener,
SAMPLE_LABEL("GC", "GarbageCollect");
// Always permit this in debug builds.
#ifndef DEBUG
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
#endif
@ -1071,7 +1066,7 @@ nsDOMWindowUtils::CycleCollect(nsICycleCollectorListener *aListener,
{
// Always permit this in debug builds.
#ifndef DEBUG
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
#endif
@ -1089,7 +1084,7 @@ nsDOMWindowUtils::SendSimpleGestureEvent(const nsAString& aType,
int32_t aModifiers,
uint32_t aClickCount)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1144,7 +1139,7 @@ nsDOMWindowUtils::ElementFromPoint(float aX, float aY,
bool aFlushLayout,
nsIDOMElement** aReturn)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1166,7 +1161,7 @@ nsDOMWindowUtils::NodesFromRect(float aX, float aY,
bool aFlushLayout,
nsIDOMNodeList** aReturn)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1203,7 +1198,7 @@ nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement *aCanvas1,
uint32_t* aMaxDifference,
uint32_t* retVal)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1271,7 +1266,7 @@ nsDOMWindowUtils::CompareCanvases(nsIDOMHTMLCanvasElement *aCanvas1,
NS_IMETHODIMP
nsDOMWindowUtils::GetIsMozAfterPaintPending(bool *aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1287,7 +1282,7 @@ nsDOMWindowUtils::GetIsMozAfterPaintPending(bool *aResult)
NS_IMETHODIMP
nsDOMWindowUtils::ClearMozAfterPaintEvents()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1301,7 +1296,7 @@ nsDOMWindowUtils::ClearMozAfterPaintEvents()
NS_IMETHODIMP
nsDOMWindowUtils::DisableNonTestMouseEvents(bool aDisable)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1319,7 +1314,7 @@ nsDOMWindowUtils::DisableNonTestMouseEvents(bool aDisable)
NS_IMETHODIMP
nsDOMWindowUtils::SuppressEventHandling(bool aSuppress)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1341,7 +1336,7 @@ nsDOMWindowUtils::SuppressEventHandling(bool aSuppress)
NS_IMETHODIMP
nsDOMWindowUtils::GetScrollXY(bool aFlushLayout, int32_t* aScrollX, int32_t* aScrollY)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1373,7 +1368,7 @@ nsDOMWindowUtils::GetScrollXY(bool aFlushLayout, int32_t* aScrollX, int32_t* aSc
NS_IMETHODIMP
nsDOMWindowUtils::GetRootBounds(nsIDOMClientRect** aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1410,7 +1405,7 @@ nsDOMWindowUtils::GetRootBounds(nsIDOMClientRect** aResult)
NS_IMETHODIMP
nsDOMWindowUtils::GetIMEIsOpen(bool *aState)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1436,7 +1431,7 @@ nsDOMWindowUtils::GetIMEIsOpen(bool *aState)
NS_IMETHODIMP
nsDOMWindowUtils::GetIMEStatus(uint32_t *aState)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1454,7 +1449,7 @@ nsDOMWindowUtils::GetIMEStatus(uint32_t *aState)
NS_IMETHODIMP
nsDOMWindowUtils::GetFocusedInputType(char** aType)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1474,7 +1469,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::FindElementWithViewId(nsViewID aID,
nsIDOMElement** aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1567,7 +1562,7 @@ nsDOMWindowUtils::SendCompositionEvent(const nsAString& aType,
const nsAString& aData,
const nsAString& aLocale)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1636,7 +1631,7 @@ nsDOMWindowUtils::SendTextEvent(const nsAString& aCompositionString,
int32_t aCaretStart,
int32_t aCaretLength)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1690,7 +1685,7 @@ nsDOMWindowUtils::SendQueryContentEvent(uint32_t aType,
{
*aResult = nullptr;
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1784,7 +1779,7 @@ nsDOMWindowUtils::SendSelectionSetEvent(uint32_t aOffset,
{
*aResult = false;
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1813,7 +1808,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::SendContentCommandEvent(const nsAString& aType,
nsITransferable * aTransferable)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1873,7 +1868,7 @@ nsDOMWindowUtils::GetVisitedDependentComputedStyle(
{
aResult.Truncate();
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1895,7 +1890,7 @@ nsDOMWindowUtils::GetVisitedDependentComputedStyle(
NS_IMETHODIMP
nsDOMWindowUtils::EnterModalState()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1909,7 +1904,7 @@ nsDOMWindowUtils::EnterModalState()
NS_IMETHODIMP
nsDOMWindowUtils::LeaveModalState()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1923,7 +1918,7 @@ nsDOMWindowUtils::LeaveModalState()
NS_IMETHODIMP
nsDOMWindowUtils::EnterModalStateWithWindow(nsIDOMWindow **aWindow)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1938,7 +1933,7 @@ nsDOMWindowUtils::EnterModalStateWithWindow(nsIDOMWindow **aWindow)
NS_IMETHODIMP
nsDOMWindowUtils::LeaveModalStateWithWindow(nsIDOMWindow *aWindow)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1952,7 +1947,7 @@ nsDOMWindowUtils::LeaveModalStateWithWindow(nsIDOMWindow *aWindow)
NS_IMETHODIMP
nsDOMWindowUtils::IsInModalState(bool *retval)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1968,7 +1963,7 @@ nsDOMWindowUtils::GetParent(const JS::Value& aObject,
JSContext* aCx,
JS::Value* aParent)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -1993,7 +1988,7 @@ nsDOMWindowUtils::GetParent(const JS::Value& aObject,
NS_IMETHODIMP
nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2008,7 +2003,7 @@ nsDOMWindowUtils::GetOuterWindowID(uint64_t *aWindowID)
NS_IMETHODIMP
nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2028,7 +2023,7 @@ nsDOMWindowUtils::GetCurrentInnerWindowID(uint64_t *aWindowID)
NS_IMETHODIMP
nsDOMWindowUtils::SuspendTimeouts()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2043,7 +2038,7 @@ nsDOMWindowUtils::SuspendTimeouts()
NS_IMETHODIMP
nsDOMWindowUtils::ResumeTimeouts()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2058,7 +2053,7 @@ nsDOMWindowUtils::ResumeTimeouts()
NS_IMETHODIMP
nsDOMWindowUtils::GetLayerManagerType(nsAString& aType)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2078,7 +2073,7 @@ nsDOMWindowUtils::GetLayerManagerType(nsAString& aType)
NS_IMETHODIMP
nsDOMWindowUtils::StartFrameTimeRecording()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2098,7 +2093,7 @@ nsDOMWindowUtils::StartFrameTimeRecording()
NS_IMETHODIMP
nsDOMWindowUtils::StopFrameTimeRecording(uint32_t *frameCount, float **frames)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2135,7 +2130,7 @@ nsDOMWindowUtils::StopFrameTimeRecording(uint32_t *frameCount, float **frames)
NS_IMETHODIMP
nsDOMWindowUtils::BeginTabSwitch()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2178,7 +2173,7 @@ ComputeAnimationValue(nsCSSProperty aProperty,
NS_IMETHODIMP
nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2190,7 +2185,7 @@ nsDOMWindowUtils::AdvanceTimeAndRefresh(int64_t aMilliseconds)
NS_IMETHODIMP
nsDOMWindowUtils::RestoreNormalRefresh()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2206,7 +2201,7 @@ nsDOMWindowUtils::ComputeAnimationDistance(nsIDOMElement* aElement,
const nsAString& aValue2,
double* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2252,7 +2247,7 @@ nsDOMWindowUtils::RenderDocument(const nsRect& aRect,
nscolor aBackgroundColor,
gfxContext* aThebesContext)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2280,7 +2275,7 @@ nsDOMWindowUtils::RenderDocument(const nsRect& aRect,
NS_IMETHODIMP
nsDOMWindowUtils::GetCursorType(int16_t *aCursor)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2319,7 +2314,7 @@ nsDOMWindowUtils::GetCursorType(int16_t *aCursor)
NS_IMETHODIMP
nsDOMWindowUtils::GetDisplayDPI(float *aDPI)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2337,7 +2332,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::GetOuterWindowWithId(uint64_t aWindowID,
nsIDOMWindow** aWindow)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2350,7 +2345,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::WrapDOMFile(nsIFile *aFile,
nsIDOMFile **aDOMFile)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2397,7 +2392,7 @@ CheckLeafLayers(Layer* aLayer, const nsIntPoint& aOffset, nsIntRegion* aCoveredR
NS_IMETHODIMP
nsDOMWindowUtils::LeafLayersPartitionWindow(bool* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2431,7 +2426,7 @@ nsDOMWindowUtils::LeafLayersPartitionWindow(bool* aResult)
NS_IMETHODIMP
nsDOMWindowUtils::GetMayHaveTouchEventListeners(bool* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2446,7 +2441,7 @@ nsDOMWindowUtils::GetMayHaveTouchEventListeners(bool* aResult)
NS_IMETHODIMP
nsDOMWindowUtils::CheckAndClearPaintedState(nsIDOMElement* aElement, bool* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2474,7 +2469,7 @@ nsDOMWindowUtils::PreventFurtherDialogs()
{
// Permanently disable further dialogs for this window.
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2490,7 +2485,7 @@ GetFileOrBlob(const nsAString& aName, const jsval& aBlobParts,
const jsval& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsISupports** aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2523,7 +2518,7 @@ nsDOMWindowUtils::GetFile(const nsAString& aName, const jsval& aBlobParts,
const jsval& aParameters, JSContext* aCx,
uint8_t aOptionalArgCount, nsIDOMFile** aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2543,7 +2538,7 @@ nsDOMWindowUtils::GetBlob(const jsval& aBlobParts, const jsval& aParameters,
JSContext* aCx, uint8_t aOptionalArgCount,
nsIDOMBlob** aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2562,7 +2557,7 @@ NS_IMETHODIMP
nsDOMWindowUtils::GetFileId(const jsval& aFile, JSContext* aCx,
int64_t* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2595,7 +2590,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName,
int32_t* aDBRefCnt, int32_t* aSliceRefCnt,
bool* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2639,7 +2634,7 @@ nsDOMWindowUtils::GetFileReferences(const nsAString& aDatabaseName,
NS_IMETHODIMP
nsDOMWindowUtils::IsIncrementalGCEnabled(JSContext* cx, bool* aResult)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2650,7 +2645,7 @@ nsDOMWindowUtils::IsIncrementalGCEnabled(JSContext* cx, bool* aResult)
NS_IMETHODIMP
nsDOMWindowUtils::StartPCCountProfiling(JSContext* cx)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2661,7 +2656,7 @@ nsDOMWindowUtils::StartPCCountProfiling(JSContext* cx)
NS_IMETHODIMP
nsDOMWindowUtils::StopPCCountProfiling(JSContext* cx)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2672,7 +2667,7 @@ nsDOMWindowUtils::StopPCCountProfiling(JSContext* cx)
NS_IMETHODIMP
nsDOMWindowUtils::PurgePCCounts(JSContext* cx)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2683,7 +2678,7 @@ nsDOMWindowUtils::PurgePCCounts(JSContext* cx)
NS_IMETHODIMP
nsDOMWindowUtils::GetPCCountScriptCount(JSContext* cx, int32_t *result)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2694,7 +2689,7 @@ nsDOMWindowUtils::GetPCCountScriptCount(JSContext* cx, int32_t *result)
NS_IMETHODIMP
nsDOMWindowUtils::GetPCCountScriptSummary(int32_t script, JSContext* cx, nsAString& result)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2713,7 +2708,7 @@ nsDOMWindowUtils::GetPCCountScriptSummary(int32_t script, JSContext* cx, nsAStri
NS_IMETHODIMP
nsDOMWindowUtils::GetPCCountScriptContents(int32_t script, JSContext* cx, nsAString& result)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2732,7 +2727,7 @@ nsDOMWindowUtils::GetPCCountScriptContents(int32_t script, JSContext* cx, nsAStr
NS_IMETHODIMP
nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2752,7 +2747,7 @@ nsDOMWindowUtils::GetPaintingSuppressed(bool *aPaintingSuppressed)
NS_IMETHODIMP
nsDOMWindowUtils::GetPlugins(JSContext* cx, jsval* aPlugins)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2779,7 +2774,7 @@ nsDOMWindowUtils::GetPlugins(JSContext* cx, jsval* aPlugins)
NS_IMETHODIMP
nsDOMWindowUtils::SetScrollPositionClampingScrollPortSize(float aWidth, float aHeight)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2803,7 +2798,7 @@ nsresult
nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
const nsAString& aNewOrigin)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2820,7 +2815,7 @@ nsDOMWindowUtils::RemoteFrameFullscreenChanged(nsIDOMElement* aFrameElement,
nsresult
nsDOMWindowUtils::RemoteFrameFullscreenReverted()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2837,7 +2832,7 @@ nsDOMWindowUtils::RemoteFrameFullscreenReverted()
nsresult
nsDOMWindowUtils::ExitFullscreen()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2850,7 +2845,7 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
bool *_retval)
{
*_retval = false;
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2921,7 +2916,7 @@ nsDOMWindowUtils::SelectAtPoint(float aX, float aY, uint32_t aSelectBehavior,
NS_IMETHODIMP
nsDOMWindowUtils::LoadSheet(nsIURI *aSheetURI, uint32_t aSheetType)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2952,7 +2947,7 @@ nsDOMWindowUtils::LoadSheet(nsIURI *aSheetURI, uint32_t aSheetType)
NS_IMETHODIMP
nsDOMWindowUtils::RemoveSheet(nsIURI *aSheetURI, uint32_t aSheetType)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2981,7 +2976,7 @@ nsDOMWindowUtils::RemoveSheet(nsIURI *aSheetURI, uint32_t aSheetType)
NS_IMETHODIMP
nsDOMWindowUtils::GetIsHandlingUserInput(bool* aHandlingUserInput)
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
@ -2993,7 +2988,7 @@ nsDOMWindowUtils::GetIsHandlingUserInput(bool* aHandlingUserInput)
NS_IMETHODIMP
nsDOMWindowUtils::AllowScriptsToClose()
{
if (!IsUniversalXPConnectCapable()) {
if (!nsContentUtils::IsCallerChrome()) {
return NS_ERROR_DOM_SECURITY_ERR;
}
nsCOMPtr<nsPIDOMWindow> window = do_QueryReferent(mWindow);