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

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

Issue 472483002: DevTools: Add properties and constants support to "Documentation" module (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Remove mistaken commentary Created 6 years, 4 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
« no previous file with comments | « no previous file | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 1527136a7af67384e28df4e1b9ce2dfdaedacf58..bba7b65eb14fb74e722ea3375a3291d7f76dcdbc 100644
--- a/Source/devtools/front_end/documentation/DocumentationURLProvider.js
+++ b/Source/devtools/front_end/documentation/DocumentationURLProvider.js
@@ -26,7 +26,11 @@ WebInspector.DocumentationURLProvider._sources = [
{ source: window.String, url: "javascript/String/", name: "String" },
{ source: window.Date.prototype, url: "javascript/Date/", name: "Date.prototype" },
{ source: window.Date, url: "javascript/Date/", name: "Date" },
- { source: window.JSON, url: "javascript/JSON/", name: "JSON" }
+ { source: window.JSON, url: "javascript/JSON/", name: "JSON" },
+ { source: window.Number, url: "javascript/Number/", name: "Number"},
+ { source: window.Number.prototype, url: "javascript/Number/", name: "Number.prototype"},
+ { source: window.Error.prototype, url: "javascript/Error/", name: "Error.prototype"},
+ { source: window.RegExp.prototype, url: "javascript/RegExp/", name: "RegExp.prototype"}
];
/**
@@ -41,17 +45,25 @@ WebInspector.DocumentationURLProvider.prototype = {
*/
itemDescriptors: function(searchTerm)
{
- var possibleProperties = [];
+ var descriptors = [];
for (var i = 0; i < WebInspector.DocumentationURLProvider._sources.length; ++i) {
var sourceRef = WebInspector.DocumentationURLProvider._sources[i];
- if (sourceRef.source[searchTerm] instanceof Function) {
- var property = {
- url: String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm),
- name: sourceRef.name
- };
- possibleProperties.push(property);
- }
+ if (!sourceRef.source.hasOwnProperty(searchTerm))
+ continue;
+ descriptors.push(createDescriptor(searchTerm.toUpperCase() === searchTerm ? "constants" : searchTerm));
+ }
+ return descriptors;
+
+ /**
+ * @param {string} searchTerm
+ * @return {{url: string, name: string}}
+ */
+ function createDescriptor(searchTerm)
+ {
+ return {
+ url: String.sprintf(WebInspector.DocumentationURLProvider._urlFormat, sourceRef.url, searchTerm),
+ name: sourceRef.name
+ };
}
- return possibleProperties;
}
}
« no previous file with comments | « no previous file | Source/devtools/front_end/documentation/DocumentationView.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698