From 1ac239a53521eec197f18cf6f6fea48aa404e50a Mon Sep 17 00:00:00 2001 From: "pinkerton%netscape.com" Date: Fri, 14 Jun 2002 21:40:04 +0000 Subject: [PATCH] Null params are allowed to be passed to GetDimensions. Just check when they're being accessed. bug 151885 git-svn-id: svn://10.0.0.236/trunk@123351 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/camino/CHBrowserView.mm | 47 +++++++------------ mozilla/camino/src/embedding/CHBrowserView.mm | 47 +++++++------------ mozilla/chimera/CHBrowserView.mm | 47 +++++++------------ .../chimera/src/embedding/CHBrowserView.mm | 47 +++++++------------ 4 files changed, 72 insertions(+), 116 deletions(-) diff --git a/mozilla/camino/CHBrowserView.mm b/mozilla/camino/CHBrowserView.mm index 7d5bc993729..7a752484fcc 100644 --- a/mozilla/camino/CHBrowserView.mm +++ b/mozilla/camino/CHBrowserView.mm @@ -359,20 +359,14 @@ nsCocoaBrowserListener::ExitModalEventLoop(nsresult aStatus) // Implementation of nsIEmbeddingSiteWindow /* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::SetDimensions(PRUint32 flags, - PRInt32 x, - PRInt32 y, - PRInt32 cx, - PRInt32 cy) +nsCocoaBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { NSPoint origin; @@ -399,40 +393,35 @@ nsCocoaBrowserListener::SetDimensions(PRUint32 flags, /* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::GetDimensions(PRUint32 flags, - PRInt32 *x, - PRInt32 *y, - PRInt32 *cx, - PRInt32 *cy) +nsCocoaBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) { - NS_ENSURE_ARG_POINTER(x); - NS_ENSURE_ARG_POINTER(y); - NS_ENSURE_ARG_POINTER(cx); - NS_ENSURE_ARG_POINTER(cy); - - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } NSRect frame = [window frame]; if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - *x = (PRInt32)frame.origin.x; - *y = (PRInt32)frame.origin.y; + if ( x ) + *x = (PRInt32)frame.origin.x; + if ( y ) + *y = (PRInt32)frame.origin.y; } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - *cx = (PRInt32)frame.size.width; - *cy = (PRInt32)frame.size.height; + if ( cx ) + *cx = (PRInt32)frame.size.width; + if ( cy ) + *cy = (PRInt32)frame.size.height; } else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { NSView* contentView = [window contentView]; NSRect contentFrame = [contentView frame]; - *cx = (PRInt32)contentFrame.size.width; - *cy = (PRInt32)contentFrame.size.height; + if ( cx ) + *cx = (PRInt32)contentFrame.size.width; + if ( cy ) + *cy = (PRInt32)contentFrame.size.height; } return NS_OK; diff --git a/mozilla/camino/src/embedding/CHBrowserView.mm b/mozilla/camino/src/embedding/CHBrowserView.mm index 7d5bc993729..7a752484fcc 100644 --- a/mozilla/camino/src/embedding/CHBrowserView.mm +++ b/mozilla/camino/src/embedding/CHBrowserView.mm @@ -359,20 +359,14 @@ nsCocoaBrowserListener::ExitModalEventLoop(nsresult aStatus) // Implementation of nsIEmbeddingSiteWindow /* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::SetDimensions(PRUint32 flags, - PRInt32 x, - PRInt32 y, - PRInt32 cx, - PRInt32 cy) +nsCocoaBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { NSPoint origin; @@ -399,40 +393,35 @@ nsCocoaBrowserListener::SetDimensions(PRUint32 flags, /* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::GetDimensions(PRUint32 flags, - PRInt32 *x, - PRInt32 *y, - PRInt32 *cx, - PRInt32 *cy) +nsCocoaBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) { - NS_ENSURE_ARG_POINTER(x); - NS_ENSURE_ARG_POINTER(y); - NS_ENSURE_ARG_POINTER(cx); - NS_ENSURE_ARG_POINTER(cy); - - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } NSRect frame = [window frame]; if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - *x = (PRInt32)frame.origin.x; - *y = (PRInt32)frame.origin.y; + if ( x ) + *x = (PRInt32)frame.origin.x; + if ( y ) + *y = (PRInt32)frame.origin.y; } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - *cx = (PRInt32)frame.size.width; - *cy = (PRInt32)frame.size.height; + if ( cx ) + *cx = (PRInt32)frame.size.width; + if ( cy ) + *cy = (PRInt32)frame.size.height; } else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { NSView* contentView = [window contentView]; NSRect contentFrame = [contentView frame]; - *cx = (PRInt32)contentFrame.size.width; - *cy = (PRInt32)contentFrame.size.height; + if ( cx ) + *cx = (PRInt32)contentFrame.size.width; + if ( cy ) + *cy = (PRInt32)contentFrame.size.height; } return NS_OK; diff --git a/mozilla/chimera/CHBrowserView.mm b/mozilla/chimera/CHBrowserView.mm index 7d5bc993729..7a752484fcc 100644 --- a/mozilla/chimera/CHBrowserView.mm +++ b/mozilla/chimera/CHBrowserView.mm @@ -359,20 +359,14 @@ nsCocoaBrowserListener::ExitModalEventLoop(nsresult aStatus) // Implementation of nsIEmbeddingSiteWindow /* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::SetDimensions(PRUint32 flags, - PRInt32 x, - PRInt32 y, - PRInt32 cx, - PRInt32 cy) +nsCocoaBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { NSPoint origin; @@ -399,40 +393,35 @@ nsCocoaBrowserListener::SetDimensions(PRUint32 flags, /* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::GetDimensions(PRUint32 flags, - PRInt32 *x, - PRInt32 *y, - PRInt32 *cx, - PRInt32 *cy) +nsCocoaBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) { - NS_ENSURE_ARG_POINTER(x); - NS_ENSURE_ARG_POINTER(y); - NS_ENSURE_ARG_POINTER(cx); - NS_ENSURE_ARG_POINTER(cy); - - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } NSRect frame = [window frame]; if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - *x = (PRInt32)frame.origin.x; - *y = (PRInt32)frame.origin.y; + if ( x ) + *x = (PRInt32)frame.origin.x; + if ( y ) + *y = (PRInt32)frame.origin.y; } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - *cx = (PRInt32)frame.size.width; - *cy = (PRInt32)frame.size.height; + if ( cx ) + *cx = (PRInt32)frame.size.width; + if ( cy ) + *cy = (PRInt32)frame.size.height; } else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { NSView* contentView = [window contentView]; NSRect contentFrame = [contentView frame]; - *cx = (PRInt32)contentFrame.size.width; - *cy = (PRInt32)contentFrame.size.height; + if ( cx ) + *cx = (PRInt32)contentFrame.size.width; + if ( cy ) + *cy = (PRInt32)contentFrame.size.height; } return NS_OK; diff --git a/mozilla/chimera/src/embedding/CHBrowserView.mm b/mozilla/chimera/src/embedding/CHBrowserView.mm index 7d5bc993729..7a752484fcc 100644 --- a/mozilla/chimera/src/embedding/CHBrowserView.mm +++ b/mozilla/chimera/src/embedding/CHBrowserView.mm @@ -359,20 +359,14 @@ nsCocoaBrowserListener::ExitModalEventLoop(nsresult aStatus) // Implementation of nsIEmbeddingSiteWindow /* void setDimensions (in unsigned long flags, in long x, in long y, in long cx, in long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::SetDimensions(PRUint32 flags, - PRInt32 x, - PRInt32 y, - PRInt32 cx, - PRInt32 cy) +nsCocoaBrowserListener::SetDimensions(PRUint32 flags, PRInt32 x, PRInt32 y, PRInt32 cx, PRInt32 cy) { - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { NSPoint origin; @@ -399,40 +393,35 @@ nsCocoaBrowserListener::SetDimensions(PRUint32 flags, /* void getDimensions (in unsigned long flags, out long x, out long y, out long cx, out long cy); */ NS_IMETHODIMP -nsCocoaBrowserListener::GetDimensions(PRUint32 flags, - PRInt32 *x, - PRInt32 *y, - PRInt32 *cx, - PRInt32 *cy) +nsCocoaBrowserListener::GetDimensions(PRUint32 flags, PRInt32 *x, PRInt32 *y, PRInt32 *cx, PRInt32 *cy) { - NS_ENSURE_ARG_POINTER(x); - NS_ENSURE_ARG_POINTER(y); - NS_ENSURE_ARG_POINTER(cx); - NS_ENSURE_ARG_POINTER(cy); - - if (!mView) { + if (!mView) return NS_ERROR_FAILURE; - } NSWindow* window = [mView window]; - if (!window) { + if (!window) return NS_ERROR_FAILURE; - } NSRect frame = [window frame]; if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_POSITION) { - *x = (PRInt32)frame.origin.x; - *y = (PRInt32)frame.origin.y; + if ( x ) + *x = (PRInt32)frame.origin.x; + if ( y ) + *y = (PRInt32)frame.origin.y; } if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_OUTER) { - *cx = (PRInt32)frame.size.width; - *cy = (PRInt32)frame.size.height; + if ( cx ) + *cx = (PRInt32)frame.size.width; + if ( cy ) + *cy = (PRInt32)frame.size.height; } else if (flags & nsIEmbeddingSiteWindow::DIM_FLAGS_SIZE_INNER) { NSView* contentView = [window contentView]; NSRect contentFrame = [contentView frame]; - *cx = (PRInt32)contentFrame.size.width; - *cy = (PRInt32)contentFrame.size.height; + if ( cx ) + *cx = (PRInt32)contentFrame.size.width; + if ( cy ) + *cy = (PRInt32)contentFrame.size.height; } return NS_OK;