remove use of nsISAXXMLReader in XMPP
Categories
(Chat Core :: XMPP, task, P2)
Tracking
(thunderbird_esr78 wontfix, thunderbird88 wontfix)
People
(Reporter: mkmelin, Assigned: rnons)
References
Details
Attachments
(2 files)
+++ This bug was initially created as a clone of Bug #1514669 +++
Bug 1447707 removed nsISAXXMLReader from m-c, and forked to commm-central in bug 1518552. This bug is to remove the nsISAXXMLReader usage from XMPP. See also bug 1514666
Comment 1•4 years ago
|
||
Curious what the reasoning is behind this? Is there a reasonable replacement?
Reporter | ||
Comment 2•4 years ago
|
||
It's the last use of nsISAXXMLReader in the whole code base except CalDAV, which should be reasonably straight forward to use normal DOM parsing). It's c++, so not web compatible.
I don't know what the reasonable replacement is - someone will have to investigate. Either it's reasonable to use DOM parsing instead, or maybe there's some JavaScript SAX library available we could use.
Comment 3•4 years ago
|
||
Thanks! One somewhat annoying thing with XMPP is that you don't get a full document for every message, so you do need some kind of incremental parsing. Not sure if that's doable with DOM parsing or not though!
DOMParser
does not support incremental parsing. XHR should, but it's up to you to remove the old nodes from the DOM in order to avoid the DOM growing without bounds.
Reporter | ||
Comment 5•4 years ago
|
||
It looks like https://developer.mozilla.org/en-US/docs/Web/API/Streams_API could also provide a solution.
Reporter | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Assignee | ||
Comment 6•4 years ago
|
||
I tried and found DOMParser unsuitable for this. A few cases that doesn't work
-
Tag is often not closed
<?xml version='1.0'?><stream:stream ...><stream:features>...</stream:features>
-
No xmlns:stream in stream:features. In a full document, xmlns can be inherited from the parent node, but if only one stanza is passed to DOMParser, it will error
<stream:features>...</stream:features>
-
No single root node and redundant closing tag
<presence .../><presence .../></presence>
I can work around some of the problems but I think it's unreliable.
I found a JS lib https://www.npmjs.com/package/tag-soup, but haven't tried it yet. What I see is to use it we need to copy 10+ files into c-c, should I give it a try?
Reporter | ||
Comment 7•4 years ago
|
||
Could be worth a shot.
Assignee | ||
Comment 8•4 years ago
|
||
Assignee | ||
Updated•4 years ago
|
Reporter | ||
Updated•4 years ago
|
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/e16a0dcabced
Use sax-js to replace nsISAXXMLReader in xmpp-xml.jsm. r=clokep
Comment 10•4 years ago
|
||
Assignee | ||
Comment 11•4 years ago
|
||
(In reply to Pulsebot from comment #10)
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/cfddb5081f1f
add sax-js license notice (ISC). rs=me
The license file was already added in comment 9 at comm/chat/protocols/xmpp/lib/sax/LICENSE
Comment 12•4 years ago
|
||
Assignee | ||
Comment 13•4 years ago
|
||
Reporter | ||
Updated•4 years ago
|
Comment 14•4 years ago
|
||
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/7bf3d75971bb
Remove unused nsISAXXMLReader. r=mkmelin
Description
•