Skip to content
This repository has been archived by the owner on Jun 7, 2024. It is now read-only.

Commit

Permalink
fix(core/webidl): escape IDL code for fix suggestions (speced#2578)
Browse files Browse the repository at this point in the history
  • Loading branch information
saschanaz authored Nov 20, 2019
1 parent 30fa375 commit 0c9f5bd
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/core/webidl.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@
// - It could be useful to report parsed IDL items as events
// - don't use generated content in the CSS!
import { decorateDfn, findDfn } from "./dfn-finder.js";
import { flatten, showInlineError, showInlineWarning } from "./utils.js";
import {
flatten,
showInlineError,
showInlineWarning,
xmlEscape,
} from "./utils.js";
import { hyperHTML, webidl2 } from "./import-maps.js";
import { fetchAsset } from "./text-loader.js";
import { registerDefinition } from "./dfn-map.js";
Expand Down Expand Up @@ -365,8 +370,10 @@ export async function run() {
let details = `<pre>${validation.context}</pre>`;
if (validation.autofix) {
validation.autofix();
const idlToFix = webidl2.write(astArray[validation.sourceName]);
const escaped = xmlEscape(idlToFix);
details += `Try fixing as:
<pre>${webidl2.write(astArray[validation.sourceName])}</pre>`;
<pre>${escaped}</pre>`;
}
showInlineError(
idls[validation.sourceName],
Expand Down

0 comments on commit 0c9f5bd

Please sign in to comment.