Closed Bug 1441165 Opened 6 years ago Closed 6 years ago

Use NotNull for nsINode::OwnerDoc()

Categories

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

enhancement
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: emk, Assigned: emk)

References

Details

Attachments

(1 file)

      No description provided.
Attachment #8954001 - Flags: review?(bugs)
Assignee: nobody → VYV03354
Status: NEW → ASSIGNED
Comment on attachment 8954001 [details] [diff] [review]
Use NotNull for nsINode::OwnerDoc()

>+++ b/dom/base/NodeInfo.h
>@@ -276,17 +277,17 @@ protected:
>     bool              mHashInitialized;
>   };
> 
>   // nsNodeInfoManager needs to pass mInner to the hash table.
>   friend class ::nsNodeInfoManager;
> 
>   // This is a non-owning reference, but it's safe since it's set to nullptr
>   // by nsNodeInfoManager::DropDocumentReference when the document is destroyed.
>-  nsIDocument* MOZ_NON_OWNING_REF mDocument; // Cache of mOwnerManager->mDocument
>+  NotNull<nsIDocument*> MOZ_NON_OWNING_REF mDocument; // Cache of mOwnerManager->mDocument
this isn't right. The NodeInfo for Document may overlive Document itself, and NodeInfo::mDocument should be set to null in that case.

>-// static
>-int
>-nsNodeInfoManager::DropNodeInfoDocument(PLHashEntry *he, int hashIndex, void *arg)
>-{
>-  static_cast<mozilla::dom::NodeInfo*>(he->value)->mDocument = nullptr;
>-  return HT_ENUMERATE_NEXT;
>-}
>-
> void
> nsNodeInfoManager::DropDocumentReference()
> {
>   if (mBindingManager) {
>     mBindingManager->DropDocumentReference();
>   }
> 
>-  // This is probably not needed anymore.
>-  PL_HashTableEnumerateEntries(mNodeInfoHash, DropNodeInfoDocument, nullptr);
>-
So I don't see how this can be removed
Attachment #8954001 - Flags: review?(bugs) → review-
So this is not possible, unfortunately :(
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → WONTFIX
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: