Closed Bug 894642 Opened 13 years ago Closed 13 years ago

Make XULWindow::GetWindowDOMElement return dom::Element*

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: dzbarsky, Assigned: dzbarsky)

Details

Attachments

(1 file)

No description provided.
Attached patch Patch — — Splinter Review
Assignee: nobody → dzbarsky
Status: NEW → ASSIGNED
Attachment #776722 - Flags: review?(Ms2ger)
Comment on attachment 776722 [details] [diff] [review] Patch Review of attachment 776722 [details] [diff] [review]: ----------------------------------------------------------------- lgtm, though I deny knowing anything about this code. ::: xpfe/appshell/src/nsChromeTreeOwner.cpp @@ +26,5 @@ > #include "nsIXULBrowserWindow.h" > +#include "mozilla/dom/Element.h" > + > +using namespace mozilla; > +using namespace mozilla::dom; I prefer using dom:: prefixes outside DOM code. @@ +288,5 @@ > FIND_PERSIST_STRING(gLiterals->kSizemode, aPersistSizeMode); > > + ErrorResult rv; > + if (saveString) > + docShellElement->SetAttribute(gLiterals->kPersist, persistString, rv); {} @@ +293,2 @@ > > + return rv.ErrorCode(); Please leave this ::: xpfe/appshell/src/nsContentTreeOwner.cpp @@ +375,2 @@ > > + return rv.ErrorCode(); Id @@ +775,5 @@ > } > } > } > } > + nsIDocument* document = docShellElement->GetOwnerDocument(); For elements, this is equivalent to OwnerDoc(), and then you can drop the null-check. @@ +931,5 @@ > #if defined(XP_MACOSX) > class nsContentTitleSettingEvent : public nsRunnable > { > public: > + nsContentTitleSettingEvent(Element *dse, const nsAString& wtm) * to the left @@ +938,5 @@ > > NS_IMETHOD Run() > { > + ErrorResult rv; > + mElement->SetAttribute(NS_LITERAL_STRING("titledefault"), mTitleDefault, rv); You didn't check for failure here @@ +940,5 @@ > { > + ErrorResult rv; > + mElement->SetAttribute(NS_LITERAL_STRING("titledefault"), mTitleDefault, rv); > + mElement->RemoveAttribute(NS_LITERAL_STRING("titlemodifier"), rv); > + return rv.ErrorCode(); I have no idea what happens—if anything—if you return failure from a Run() call. Please check with someone who does know, or return NS_OK. ::: xpfe/appshell/src/nsXULWindow.cpp @@ +1234,3 @@ > // zlevel > + windowElement->GetAttribute(ZLEVEL_ATTRIBUTE, stateString); > + if (stateString.Length() > 0) { !IsEmpty() @@ +1376,5 @@ > nsAutoString attr; > > // "hidechrome" attribute > + windowElement->GetAttribute(NS_LITERAL_STRING("hidechrome"), attr); > + if (attr.EqualsLiteral("true")) { windowElement->AttrValueIs...? @@ +1459,5 @@ > nsAutoString sizeString; > nsAutoString windowElementId; > nsCOMPtr<nsIDOMXULDocument> ownerXULDoc; > > { // fetch docShellElement's ID and XUL owner document No need for this block @@ +1460,5 @@ > nsAutoString windowElementId; > nsCOMPtr<nsIDOMXULDocument> ownerXULDoc; > > { // fetch docShellElement's ID and XUL owner document > + ownerXULDoc = do_QueryInterface(docShellElement->GetOwnerDocument()); OwnerDoc() @@ +1529,5 @@ > } > } > > mPersistentAttributesDirty = 0; > + return rv.ErrorCode(); Failure here probably has been ignored for a decade, please leave it be. @@ +2042,2 @@ > > + return rv.ErrorCode(); Ditto
Attachment #776722 - Flags: review?(Ms2ger) → review+
Comment on attachment 776722 [details] [diff] [review] Patch Review of attachment 776722 [details] [diff] [review]: ----------------------------------------------------------------- ::: xpfe/appshell/src/nsContentTreeOwner.cpp @@ +940,5 @@ > { > + ErrorResult rv; > + mElement->SetAttribute(NS_LITERAL_STRING("titledefault"), mTitleDefault, rv); > + mElement->RemoveAttribute(NS_LITERAL_STRING("titlemodifier"), rv); > + return rv.ErrorCode(); I'll just change these to preserve existing behavior by returning NS_OK
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: