Closed Bug 191800 Opened 22 years ago Closed 21 years ago

Move FIXptr and XPointer into xmlextras

Categories

(Core :: XML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.4beta

People

(Reporter: hjtoi-bugzilla, Assigned: hjtoi-bugzilla)

References

Details

(Keywords: memory-footprint)

Attachments

(1 file, 3 obsolete files)

FIXptr (and XPointer when it lands) live in content/xml/document. However, they
are so rarely used that it would make sense to move their implementation to
xmlextras.
Summary: Move FIXptr and XPointer into xmlextras → Move FIXptr and XPointer into xmlextras
Depends on: 182323
Target Milestone: --- → mozilla1.4beta
Filename change also needed, see 
http://bugzilla.mozilla.org/show_bug.cgi?id=182323#c30

Another issues that could be done here as well is to switch into string
iterators where appropriate, and lazily evaluate result from XPath.
leaf: Could you copy 4 files on the CVS server for me, see the second  attachment
Status: NEW → ASSIGNED
Add this to nsXMLExtrasModule.cpp:

  rv = catman->AddCategoryEntry(JAVASCRIPT_DOM_CLASS,
                                "XPointerResult",
                                XMLEXTRAS_DOMCI_EXTENSION_CONTRACTID,
                                PR_TRUE, PR_TRUE, getter_Copies(previous));
  NS_ENSURE_SUCCESS(rv, rv);

and everything will work. There is one thing that I do not like, though. You can
now do this in JS: |new XPointerResult|. That should not work; the only way to
get XPointerResult object should be the return value from
document.evaluateXPointer(). How do I make that happen?
Hmm, you could try JAVASCRIPT_DOM_INTERFACE but I'm not sure it'll work since
your interface name is the same as your class name (XPointerResult).
jst thinks there is no way to do what I want currently, so we should file a bug
to dynamically add script accessible objects that cannot be created directly.

I will attach a cleaned up patch with this problem still present that can be
fixed later once the infrastructure is in place. There are other objects like
this besides XPointerResult: at least SOAPFault.
Attached patch Fix (obsolete) — Splinter Review
Proposed fix, minus changes in nsFIXptr.* and nsXPointer.* (I need leaf to copy
the files on the CVS server for that).
Attachment #120883 - Attachment is obsolete: true
So there is a way to make it impossible to create objects with new, and that was
to pass null instead of CID as the last parameter to macro
NS_DOMCI_EXTENSION_ENTRY_END_NO_PRIMARY_IF(). Did that, and now |new
XPointerResult()| will throw exception "cannot create object in this context"
which is ok. 
Attached patch Proposed fixSplinter Review
leaf copied the files on the CVS server so this is now the final (?) complete
fix.
Attachment #120884 - Attachment is obsolete: true
Attachment #121004 - Attachment is obsolete: true
Attachment #121330 - Flags: superreview?(jst)
Attachment #121330 - Flags: review?(harishd)
Comment on attachment 121330 [details] [diff] [review]
Proposed fix

sr=jst
Attachment #121330 - Flags: superreview?(jst) → superreview+
Comment on attachment 121330 [details] [diff] [review]
Proposed fix

r=harishd
Attachment #121330 - Flags: superreview?(jst)
Attachment #121330 - Flags: superreview+
Attachment #121330 - Flags: review?(harishd)
Attachment #121330 - Flags: review+
Comment on attachment 121330 [details] [diff] [review]
Proposed fix

harishd wiped this out - it was sr=jst earlier
Attachment #121330 - Flags: superreview?(jst) → superreview+
Checked in.
Status: ASSIGNED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: