Bug 914026 - Check mDocShell before use. r=khuey, a=lsblakk
authorKan-Ru Chen (???) <kanru@kanru.info>
Thu, 26 Sep 2013 17:13:41 +0800
changeset 286429 bfd0f8d7509f3395381fb651015de16a166701bc
parent 286428 8f44e7a03c4cec983fe5e50ce64cdaf04ef33698
child 286430 2a42d4d730da1772f079171e456a40b229dabe7b
push id218
push userryanvm@gmail.com
push dateWed, 16 Dec 2015 22:58:33 +0000
reviewerskhuey, lsblakk
bugs914026
milestone26.0
Bug 914026 - Check mDocShell before use. r=khuey, a=lsblakk
dom/base/nsGlobalWindow.cpp
--- a/dom/base/nsGlobalWindow.cpp
+++ b/dom/base/nsGlobalWindow.cpp
@@ -5985,17 +5985,17 @@ NS_IMETHODIMP
 nsGlobalWindow::ResizeTo(int32_t aWidth, int32_t aHeight)
 {
   FORWARD_TO_OUTER(ResizeTo, (aWidth, aHeight), NS_ERROR_NOT_INITIALIZED);
 
   /*
    * If caller is a browser-element then dispatch a resize event to
    * the embedder.
    */
-  if (mDocShell->GetIsBrowserOrApp()) {
+  if (mDocShell && mDocShell->GetIsBrowserOrApp()) {
     nsIntSize size(aWidth, aHeight);
     if (!DispatchResizeEvent(size)) {
       // The embedder chose to prevent the default action for this
       // event, so let's not resize this window after all...
       return NS_OK;
     }
   }
 
@@ -6025,17 +6025,17 @@ NS_IMETHODIMP
 nsGlobalWindow::ResizeBy(int32_t aWidthDif, int32_t aHeightDif)
 {
   FORWARD_TO_OUTER(ResizeBy, (aWidthDif, aHeightDif), NS_ERROR_NOT_INITIALIZED);
 
   /*
    * If caller is a browser-element then dispatch a resize event to
    * parent.
    */
-  if (mDocShell->GetIsBrowserOrApp()) {
+  if (mDocShell && mDocShell->GetIsBrowserOrApp()) {
     CSSIntSize size;
     nsresult rv = GetInnerSize(size);
     NS_ENSURE_SUCCESS(rv, NS_OK);
 
     size.width += aWidthDif;
     size.height += aHeightDif;
 
     if (!DispatchResizeEvent(nsIntSize(size.width, size.height))) {