Page MenuHomePhabricator

Parsoid: Editing a page that starts with a comment causes Parsoid to crash
Closed, ResolvedPublic

Description

Contents of [[Parsoidcrash]]:
<!-- Foo -->
Bar

Load page into the editor, change Bar to Baar, and save. You'll get an error. Wireshark reveals that the following happened:

POST /localhost/Parsoidcrash HTTP/1.0
Host: localhost:8000
Accept: */*
Accept-Encoding: deflate, gzip
Referer: http://localhost/wiki/API
User-Agent: MediaWiki/1.21alpha
Content-Length: 254
Content-Type: multipart/form-data; boundary=----------------------------5e7e7b667ce1

------------------------------5e7e7b667ce1
Content-Disposition: form-data; name="content"

<!-- Foo -->

<p data-ve-changed="{&quot;content&quot;:1}" data-parsoid="{&quot;dsr&quot;:[14,17,0,0]}">Baar</p>
------------------------------5e7e7b667ce1--
HTTP/1.1 500 Internal Server Error
X-Powered-By: Express
Content-Type: text/x-mediawiki; charset=UTF-8
Content-Length: 602
Connection: close

TypeError: Cannot call method 'cloneNode' of undefined

at [object Object].serializeDOM (/var/lib/parsoid/Parsoid/js/lib/mediawiki.WikitextSerializer.js:2330:16)
at /var/lib/parsoid/Parsoid/js/api/ParserService.js:593:55
at /var/lib/parsoid/Parsoid/js/api/ParserService.js:284:4
at /var/lib/parsoid/Parsoid/js/lib/mediawiki.parser.environment.js:185:3
at [object Object].<anonymous> (/var/lib/parsoid/Parsoid/js/lib/mediawiki.parser.environment.js:209:4)
at Array.1 (/var/lib/parsoid/Parsoid/js/lib/mediawiki.ApiRequest.js:60:4)
at EventEmitter._tickCallback (node.js:192:40)

Version: unspecified
Severity: critical

Details

Reference
bz44970

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 1:25 AM
bzimport added a project: Parsoid.
bzimport set Reference to bz44970.

This is the same fragment parsing issue you ran into earlier while implementing the iframe trick. The comment ends up outside of the implicit HTML element in the DOM, which breaks our path to the body. We shall make sure that we always wrap things at least in a body tag when parsing a fragment.

[Parsoid component reorg by merging JS/General and General. See bug 50685 for more information. Filter bugmail on this comment. parsoidreorg20130704]