spdx/spdx-license-diff

Diff results fail to display and status box shows "Diffing results"

alandtse opened this issue · 2 comments

Error is caused by the webpage rejecting the injected html.

gitweb.cgi:1 Error in event handler for runtime.onMessage: SyntaxError: Failed to set the 'innerHTML' property on 'Element': The provided markup is invalid XML, and therefore cannot be inserted into an XML document.

The root cause is that the update to the BubbleDom innerHTML is feeding in data from diff-match-patch's html generator. That generator provides characters that apparently aren't valid xml (despite passing online validators?)

This includes (others may be causing it):

- <br> should be <br />
- style attribute
- &para;

Also href's target attribute is invalid but that is in the contentscript code so can be easily removed.

The workaround is to remove the invalid tokens prior to injecting innerHTML but the resulting display looks ugly. This may mean catching this exception and using a different set of html.