Chromium Code Reviews| 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..37ec59a5139b20e29539701acdcfb3b7fcb5c189 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(); |
|
lushnikov
2014/09/08 14:08:29
why do we need this?
iliia
2014/09/08 15:20:49
We discuss it with offline.
On 2014/09/08 14:08:29
|
| 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); |
| + } catch (error) { |
| + this._createPageForError(error); |
|
lushnikov
2014/09/08 14:08:29
let's fallback to empty page for now. We'll do a "
iliia
2014/09/08 15:20:50
Done.
|
| + } |
| if (!article) { |
| this._createEmptyPage(); |
| return; |
| } |
| - var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem); |
| this.element.removeChildren(); |
|
lushnikov
2014/09/08 14:08:29
why this change?
iliia
2014/09/08 15:20:49
We discuss it offline.
On 2014/09/08 14:08:29, lus
|
| + var renderer = new WebInspector.DocumentationView.Renderer(article, searchItem); |
| this.element.appendChild(renderer.renderJSArticle()); |
| }, |
| @@ -79,6 +84,15 @@ WebInspector.DocumentationView.prototype = { |
| pageTitle.textContent = WebInspector.UIString("Documentation not available"); |
| }, |
| + _createPageForError: function(message) |
| + { |
| + this.element.removeChildren(); |
| + var pageTitle = this.element.createChild("div", "documentation-page-title"); |
| + pageTitle.textContent = WebInspector.UIString("We have some problems"); |
| + var error = this.element.createChild("div", "documentation-text"); |
| + error.textContent = WebInspector.UIString("Error message: " + message); |
| + }, |
| + |
| __proto__: WebInspector.View.prototype |
| } |
| @@ -227,7 +241,7 @@ WebInspector.DocumentationView.Renderer.prototype = { |
| /** |
| * @param {!WebInspector.WikiParser.ArticleElement} article |
| - * @return {!Element} |
| + * @return {?Element} |
| */ |
| _renderBlock: function(article) |
| { |
| @@ -237,7 +251,6 @@ WebInspector.DocumentationView.Renderer.prototype = { |
| switch (article.type()) { |
| case elementTypes.Inline: |
| element = document.createElement("span"); |
| - break; |
|
lushnikov
2014/09/08 14:08:30
I believe you still want "break" statement
iliia
2014/09/08 15:20:49
Done.
|
| case elementTypes.Link: |
| element = document.createElementWithClass("a", "documentation-link"); |
| element.href = article.url(); |