Closed Bug 333673 Opened 19 years ago Closed 15 years ago

document.implementation != document.implementation

Categories

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

defect
Not set
minor

Tracking

()

RESOLVED FIXED

People

(Reporter: erik, Assigned: smaug)

Details

Attachments

(2 files)

Why doesn't multiple read of document.implementation return the same object?
Assignee: general → nobody
QA Contact: ian → general
Attachment #396221 - Flags: review?(peterv)
Assignee: nobody → Olli.Pettay
Comment on attachment 396221 [details] [diff] [review] parity with other engines >+ if (mDOMImplementation) { >+ NS_ADDREF(*aImplementation = mDOMImplementation); >+ return NS_OK; >+ } > nsCOMPtr<nsIURI> uri; > NS_NewURI(getter_AddRefs(uri), "about:blank"); > NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY); > PRBool hasHadScriptObject = PR_TRUE; > nsIScriptGlobalObject* scriptObject = > GetScriptHandlingObject(hasHadScriptObject); > NS_ENSURE_STATE(scriptObject || !hasHadScriptObject); > *aImplementation = new nsDOMImplementation(scriptObject, uri, uri, > NodePrincipal()); > if (!*aImplementation) { > return NS_ERROR_OUT_OF_MEMORY; > } > >+ mDOMImplementation = *aImplementation; > NS_ADDREF(*aImplementation); I think I'd rather see this as: if (!mDOMImplementation) { nsCOMPtr<nsIURI> uri; NS_NewURI(getter_AddRefs(uri), "about:blank"); NS_ENSURE_TRUE(uri, NS_ERROR_OUT_OF_MEMORY); PRBool hasHadScriptObject = PR_TRUE; nsIScriptGlobalObject* scriptObject = GetScriptHandlingObject(hasHadScriptObject); NS_ENSURE_STATE(scriptObject || !hasHadScriptObject); mDOMImplementation = new nsDOMImplementation(scriptObject, uri, uri, NodePrincipal()); if (!mDOMImplementation) { return NS_ERROR_OUT_OF_MEMORY; } } NS_ADDREF(*aImplementation = mDOMImplementation); return NS_OK;
Attachment #396221 - Flags: review?(peterv) → review+
Attached patch v2Splinter Review
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
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: