Closed Bug 560273 Opened 14 years ago Closed 14 years ago

Stop using DOM tearoffs from quickstubs

Categories

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

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a5

People

(Reporter: peterv, Assigned: peterv)

References

(Blocks 1 open bug)

Details

Attachments

(13 files, 8 obsolete files)

26.50 KB, patch
jst
: review+
Details | Diff | Splinter Review
11.32 KB, patch
jst
: review+
Details | Diff | Splinter Review
9.08 KB, patch
jst
: review+
Details | Diff | Splinter Review
6.77 KB, patch
jst
: review+
Details | Diff | Splinter Review
10.50 KB, patch
jst
: review+
Details | Diff | Splinter Review
10.55 KB, patch
jst
: review+
Details | Diff | Splinter Review
35.10 KB, patch
sicking
: review+
Details | Diff | Splinter Review
18.30 KB, patch
jst
: review+
Details | Diff | Splinter Review
21.82 KB, patch
jst
: review+
Details | Diff | Splinter Review
25.30 KB, patch
jst
: review+
Details | Diff | Splinter Review
9.33 KB, patch
jst
: review+
Details | Diff | Splinter Review
31.07 KB, patch
jst
: review+
Details | Diff | Splinter Review
11.77 KB, patch
jst
: review+
Details | Diff | Splinter Review
      No description provided.
Blocks: 560289
No longer blocks: 560289
Blocks: 560462
Depends on: 560199
Blocks: domperf
Attached patch Part 1 (nsINode::GetBaseURI) v1 (obsolete) — Splinter Review
Assignee: nobody → peterv
Status: NEW → ASSIGNED
Attached patch Part 11 (nsIDOMNSElement) v1 (obsolete) — Splinter Review
Attached patch Part 13 (stop using tearoffs) v1 (obsolete) — Splinter Review
Adds a virtual nsINode::GetBaseURI() and a non-virtual nsINode::GetBaseURI(nsAString&). The latter is not inline, though maybe it should be? (have to pull in nsIURI if so) Also renamed non-addrefing nsIDocument::GetBaseURI to nsIDocument::GetDocumentBaseURI.
Attachment #440783 - Attachment is obsolete: true
Attachment #442383 - Flags: review?(jonas)
Comment on attachment 440784 [details] [diff] [review]
Part 2 (move code) v1

Just moving code around, should have no functional changes.
Attachment #440784 - Flags: review?(jst)
Attachment #440785 - Flags: review?(jst)
Comment on attachment 440786 [details] [diff] [review]
Part 4 (nsGenericTextNode) v1

Add a nsGenericTextNode between nsGenericDOMDataNode and nsTextNode and nsXMLCDATASection for implementing nsIDOM3Text (quickstubs will be able to cast to nsGenericTextNode instead of QI'ing).
Attachment #440786 - Flags: review?(jst)
Attachment #440787 - Attachment is obsolete: true
Attachment #442399 - Flags: review?(jst)
Attachment #440788 - Flags: review?(jst)
Attachment #440790 - Flags: review?(jst)
Attachment #440791 - Attachment is obsolete: true
Attachment #442411 - Flags: review?(jst)
Attachment #442411 - Attachment is obsolete: true
Attachment #442412 - Flags: review?(jst)
Attachment #442411 - Flags: review?(jst)
Attachment #440792 - Attachment is obsolete: true
Attachment #440793 - Attachment is obsolete: true
Attachment #442489 - Flags: review?(jst)
Comment on attachment 440794 [details] [diff] [review]
Part 12 (change 'canFail' default and allow missing 'code') v1

This inverts the default value for canFail from False to True, so that if we by accident forget to add it we'll get a compile error (|rv = foo();| with foo returning void won't compile) or just check a return value that'll always be NS_OK. Currently, if we forget to add canFail it'll compile, but ignore the nsresult return value.
The patch also allows us to not add any custom code even if a thisType is specified, so that we can call functions with the same signature as the one we're stubbing but on a different interface/class, without having to write custom code.
Attachment #440794 - Flags: review?(jst)
Comment on attachment 440784 [details] [diff] [review]
Part 2 (move code) v1

- In nsContentUtils.cpp:

+struct ClassMatchingInfo {
+  nsCOMArray<nsIAtom> mClasses;
+  nsCaseTreatment mCaseTreatment;
+};
+
+// static
+PRBool
+nsDocument::MatchClassNames(nsIContent* aContent,
+                            PRInt32 aNamespaceID,
+                            nsIAtom* aAtom, void* aData)

I don't see why this is important... I get why you move ClassMatchingInfo, but could we not put that in a header file and leave the nsDocument method implementations in nsDocument.cpp rather than separating the implementations of some class methods from others? Same goes for sticking nsContentUtils methods in nsGenericElement.cpp.
Attachment #440785 - Flags: review?(jst) → review+
Attachment #440786 - Flags: review?(jst) → review+
Attachment #440788 - Flags: review?(jst) → review+
Attachment #440790 - Flags: review?(jst) → review+
Attachment #440794 - Flags: review?(jst) → review+
Comment on attachment 442383 [details] [diff] [review]
Part 1 (nsINode::GetBaseURI) v1.1

Uber Nit: Feel free to name the function GetDocBaseURI as that's shorter and we want people to use it. Totally up to you.

>diff --git a/content/base/src/nsGenericDOMDataNode.cpp b/content/base/src/nsGenericDOMDataNode.cpp
> nsGenericDOMDataNode::GetBaseURI() const
> {
>   // DOM Data Node inherits the base from its parent element/document
>   nsIContent *parent = GetParent();
>   if (parent) {
>     return parent->GetBaseURI();
>   }
> 
>-  nsIURI *uri;
>   nsIDocument *doc = GetOwnerDoc();
>-  if (doc) {
>-    NS_IF_ADDREF(uri = doc->GetBaseURI());
>-  }
>-  else {
>-    uri = nsnull;
>-  }
> 
>-  return uri;
>+  return doc ? doc->GetBaseURI() : nsnull;

Nit: You could use GetDocumentBaseURI here, right?

r=me
Attachment #442383 - Flags: review?(jonas) → review+
Attachment #442399 - Flags: review?(jst) → review+
Attachment #442409 - Flags: review?(jst) → review+
Comment on attachment 442409 [details] [diff] [review]
Part 7 (nsINode::IsEqualNode/CompareDocumentPosition/IsSameNode) v1.1

This will conflict with bz's changes in bug 562688, but should be fairly straight forward to update.
(In reply to comment #24)
> I don't see why this is important...

Ok, I'll leave GetElementsByClassName on nsDocument. But later patches actually move those nsNodeUtils and nsContentUtils methods to nsINode (see for example attachment 442409 [details] [diff] [review] for s/nsContentUtils::ComparePosition/nsINode::CompareDocumentPosition/). Are you objecting to that too?

(In reply to comment #25)
> > nsGenericDOMDataNode::GetBaseURI() const

> >+  return doc ? doc->GetBaseURI() : nsnull;
> 
> Nit: You could use GetDocumentBaseURI here, right?

Well, GetDocumentBaseURI returns a non-addrefed pointer but GetBaseURI returns an already_AddRefed so I don't think that would work as is, I'd need to NS_IF_ADDREF.
Comment on attachment 442412 [details] [diff] [review]
Part 9 (nsNode3Tearoff for all nodes) v1

 NS_INTERFACE_TABLE_HEAD(nsDocument)
   NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
   NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
-    NS_INTERFACE_TABLE_ENTRY(nsDocument, nsINode)

This is either wrong, or I'm really confused.

r=jst with that sorted out or explained.
Attachment #442412 - Flags: review?(jst) → review+
Attachment #440784 - Flags: review?(jst) → review+
Attachment #442485 - Flags: review?(jst) → review+
Attachment #442489 - Flags: review?(jst) → review+
I'll file a bug about making nsDocumentFragment not inherit from nsGenericElement and mention the number in the comment in nsDOMQS.h.
Attachment #440795 - Attachment is obsolete: true
Attachment #443003 - Flags: review?(jst)
(In reply to comment #27)
> (In reply to comment #24)
> > I don't see why this is important...
> 
> Ok, I'll leave GetElementsByClassName on nsDocument.

I started doing that, but it turns out it's a bit of a hassle to inline GetElementsByClassName in nsGenericElement then, so I ended up keeping the attached patch.

(In reply to comment #28)
> (From update of attachment 442412 [details] [diff] [review])
>  NS_INTERFACE_TABLE_HEAD(nsDocument)
>    NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
>    NS_DOCUMENT_INTERFACE_TABLE_BEGIN(nsDocument)
> -    NS_INTERFACE_TABLE_ENTRY(nsDocument, nsINode)
> 
> This is either wrong, or I'm really confused.

Ah, sorry, forgot to mention that when asking for review. Turns out that these were redundant, NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN adds nsINode already (NS_DOCUMENT_INTERFACE_TABLE_BEGIN calls NS_NODE_OFFSET_AND_INTERFACE_TABLE_BEGIN, same thing for NS_NODE_INTERFACE_TABLE* in nsDOMAttribute.cpp).
Attachment #443003 - Flags: review?(jst) → review+
Depends on: 564079
Depends on: 564114
Depends on: 582601
Depends on: 614058
No longer depends on: 614058
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: