Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2155)

Unified Diff: Source/devtools/front_end/documentation/DocumentationView.js

Issue 539353004: DevTools: [Documentation] Update parser for WikiText (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: comments addressed Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/devtools/front_end/documentation/DocumentationView.js
diff --git a/Source/devtools/front_end/documentation/DocumentationView.js b/Source/devtools/front_end/documentation/DocumentationView.js
index 042f0a243dfb3d91978eae87abf3857b071e2a0b..52e13299c12b1faacffe8e9f7d34878dc99e843a 100644
--- a/Source/devtools/front_end/documentation/DocumentationView.js
+++ b/Source/devtools/front_end/documentation/DocumentationView.js
@@ -22,6 +22,7 @@ WebInspector.DocumentationView.showDocumentationURL = function(url, searchItem)
if (!WebInspector.DocumentationView._view)
WebInspector.DocumentationView._view = new WebInspector.DocumentationView();
var view = WebInspector.DocumentationView._view;
+ view.element.removeChildren();
WebInspector.inspectorView.showCloseableViewInDrawer("documentation", WebInspector.UIString("Documentation"), view);
view.showDocumentation(url, searchItem);
}
@@ -61,14 +62,18 @@ WebInspector.DocumentationView.prototype = {
return;
}
var wikiMarkupText = pages[wikiKeys[0]]["revisions"]["0"]["*"];
- var article = WebInspector.JSArticle.parse(wikiMarkupText);
+ try {
+ var article = WebInspector.JSArticle.parse(wikiMarkupText);
lushnikov 2014/09/09 12:40:46 lets avoid varaibel hoisting and declare it outsid
iliia 2014/09/09 14:29:17 Done.
+ } catch (error) {
+ this._createEmptyPage();
lushnikov 2014/09/09 12:40:46 article = null; console.error(error);
iliia 2014/09/09 14:29:17 Done.
+ }
if (!article) {
this._createEmptyPage();
return;
}
- var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem);
this.element.removeChildren();
+ var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem);
this.element.appendChild(renderer.renderJSArticle());
},
@@ -214,7 +219,8 @@ WebInspector.DocumentationView.Renderer.prototype = {
liveUrl.href = examples[i].liveUrl;
liveUrl.textContent = WebInspector.UIString("Example");
}
- exampleDescription.appendChild(this._renderBlock(examples[i].description));
+ if (examples[i].description)
+ exampleDescription.appendChild(this._renderBlock(examples[i].description));
var code = example.createChild("div", "documentation-example-code");
code.classList.add("source-code");
code.textContent = examples[i].code;
@@ -227,7 +233,7 @@ WebInspector.DocumentationView.Renderer.prototype = {
/**
* @param {!WebInspector.WikiParser.ArticleElement} article
- * @return {!Element}
+ * @return {?Element}
*/
_renderBlock: function(article)
{

Powered by Google App Engine
This is Rietveld 408576698