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

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: add annotation to WikiParser._parse() 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 e9ce67a045719a85d94c0e618491a9ce95dacbb6..2221ff94f3c0c355bdda042dbd8518145e794185 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,21 @@ WebInspector.DocumentationView.prototype = {
return;
}
var wikiMarkupText = pages[wikiKeys[0]]["revisions"]["0"]["*"];
- var article = WebInspector.JSArticle.parse(wikiMarkupText);
+ var article;
+ try {
+ article = WebInspector.JSArticle.parse(wikiMarkupText);
+ } catch (error) {
+ this._createEmptyPage();
apavlov 2014/09/10 14:09:23 This and the following line can be dropped: if (!a
iliia 2014/09/11 09:26:30 Done.
+ article = null;
+ console.error(error);
apavlov 2014/09/10 14:09:23 Should this be error.message?
iliia 2014/09/11 09:26:30 Done.
apavlov 2014/09/11 10:40:26 Not done - still, the "error" object is used inste
iliia 2014/09/11 13:26:28 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());
},
@@ -258,7 +266,7 @@ WebInspector.DocumentationView.Renderer.prototype = {
/**
* @param {!WebInspector.WikiParser.ArticleElement} article
- * @return {!Element}
+ * @return {?Element}
apavlov 2014/09/10 14:09:23 Any reason for this being nullable?
iliia 2014/09/11 09:26:30 element could be undefined if something's going wr
*/
_renderBlock: function(article)
{

Powered by Google App Engine
This is Rietveld 408576698