Closed Bug 785067 Opened 8 years ago Closed 8 years ago

Outparamdel nsGlobalWindow::SaveWindowState

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla18

People

(Reporter: Ms2ger, Assigned: Ms2ger)

References

Details

Attachments

(1 file)

Attached patch Patch v1Splinter Review
I'll rev the uuid on landing...
Attachment #654605 - Flags: review?(mrbkap)
Comment on attachment 654605 [details] [diff] [review]
Patch v1

Review of attachment 654605 [details] [diff] [review]:
-----------------------------------------------------------------

::: docshell/base/nsDocShell.cpp
@@ +6878,5 @@
>      nsCOMPtr<nsPIDOMWindow> privWin = do_QueryInterface(mScriptGlobal);
>      if (!privWin)
>          return NS_ERROR_FAILURE;
>  
> +    nsCOMPtr<nsISupports> windowState = privWin->SaveWindowState();

You need to null check windowState here and return failure if it's null.

::: dom/base/nsPIDOMWindow.h
@@ +295,5 @@
>    virtual PopupControlState GetPopupControlState() const = 0;
>  
>    // Returns an object containing the window's state.  This also suspends
>    // all running timeouts in the window.
> +  virtual already_AddRefed<nsISupports> SaveWindowState() = 0;

Need to bump the IID.
Attachment #654605 - Flags: review?(mrbkap) → review+
(In reply to Blake Kaplan (:mrbkap) from comment #1)
> Comment on attachment 654605 [details] [diff] [review]
> Patch v1
> 
> Review of attachment 654605 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: docshell/base/nsDocShell.cpp
> @@ +6878,5 @@
> >      nsCOMPtr<nsPIDOMWindow> privWin = do_QueryInterface(mScriptGlobal);
> >      if (!privWin)
> >          return NS_ERROR_FAILURE;
> >  
> > +    nsCOMPtr<nsISupports> windowState = privWin->SaveWindowState();
> 
> You need to null check windowState here and return failure if it's null.

Why? That's not what the code does right now.
(In reply to :Ms2ger from comment #2)
> Why? That's not what the code does right now.

Ah, that's pretty clearly a bug. In the one case where the new code returns null, the old code exited early without creating a window state (but returned NS_OK for some bizarre reason). The only advantage of that is that we would continue saving the window state, except that any attempts to restore a window from that state would throw. If you want to do this in a followup, I suppose that would work for me as well.
Depends on: 785642
Filed bug 785642 for that.
https://hg.mozilla.org/mozilla-central/rev/f1265ac5dbc0
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla18
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.