Index: Source/devtools/front_end/documentation/DocumentationURLProvider.js |
diff --git a/Source/devtools/front_end/documentation/DocumentationURLProvider.js b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
index 2387a4d3e8cf322969fbf90cc3d00fb539e09c58..49454c01efbad402132bb8e72a5e2104fd0636b6 100644 |
--- a/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
+++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js |
@@ -74,7 +74,7 @@ WebInspector.DocumentationURLProvider.ItemDescriptor.prototype = { |
/** |
* @constructor |
- * FIXME: source parameter is not annotated property due to crbug.com/407097 |
+ * FIXME: source parameter is not annotated properly due to crbug.com/407097 |
* @param {*} source |
* @param {string} url |
* @param {string} name |
@@ -162,8 +162,10 @@ WebInspector.DocumentationURLProvider.prototype = { |
*/ |
itemDescriptors: function(searchTerm) |
{ |
- if (this._state === WebInspector.DocumentationURLProvider.DownloadStates.Finished) |
- return this._articleList.get(searchTerm) || []; |
+ if (this._state === WebInspector.DocumentationURLProvider.DownloadStates.Finished) { |
+ if (searchTerm.toUpperCase() !== searchTerm) |
+ return this._articleList.get(searchTerm) || []; |
loislo
2014/09/09 09:10:14
this construction looks strange
|
+ } |
// If download of available articles list is not finished yet, use approximate method. |
if (this._state === WebInspector.DocumentationURLProvider.DownloadStates.NotStarted) |
this._loadArticleList(); |
@@ -172,7 +174,7 @@ WebInspector.DocumentationURLProvider.prototype = { |
var sources = WebInspector.DocumentationURLProvider._sources; |
var propertyName = searchTerm.toUpperCase() === searchTerm ? "constants" : searchTerm; |
for (var i = 0; i < sources.length; ++i) { |
- if (!sources[i].source().hasOwnProperty(propertyName)) |
+ if (!sources[i].source().hasOwnProperty(searchTerm) || this._inheritedFromFunction(sources[i].source(), searchTerm)) |
continue; |
descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescriptor(sources[i], propertyName)); |
} |
@@ -233,19 +235,29 @@ WebInspector.DocumentationURLProvider.prototype = { |
var lastSlashIndex = itemPath.lastIndexOf("/"); |
if (lastSlashIndex === -1) |
return; |
+ var sourceName = itemPath.substring(0, lastSlashIndex + 1); |
// There are some properties which have several words in their name. |
// In article list they are written through gap, while in URL they are written through underscore. |
// We are creating URL for current property, so we have to replace all the gaps with underscores. |
- var correctedItemPath = itemPath.replace(" ", "_"); |
- var sourceName = correctedItemPath.substring(0, lastSlashIndex + 1); |
- var propertyName = correctedItemPath.substring(lastSlashIndex + 1); |
+ var propertyName = itemPath.substring(lastSlashIndex + 1).replace(" ", "_"); |
var sources = WebInspector.DocumentationURLProvider._sources; |
for (var i = 0; i < sources.length; ++i) { |
- if (sources[i].url() !== sourceName || !sources[i].source().hasOwnProperty(propertyName)) |
+ if (sources[i].url() !== sourceName || !sources[i].source().hasOwnProperty(propertyName) || this._inheritedFromFunction(sources[i].source(), propertyName)) |
continue; |
var descriptors = this._articleList.get(propertyName) || []; |
descriptors.push(new WebInspector.DocumentationURLProvider.ItemDescriptor(sources[i], propertyName)); |
this._articleList.set(propertyName, descriptors); |
} |
+ }, |
+ |
+ /** |
+ * FIXME: object parameter is not annotated properly due to crbug.com/407097 |
+ * @param {*} object |
+ * @param {string} propertyName |
+ * @return {boolean} |
+ */ |
+ _inheritedFromFunction: function(object, propertyName) |
+ { |
+ return (object instanceof Function && object.hasOwnProperty(propertyName) && Function.hasOwnProperty(propertyName)); |
} |
} |