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

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: Comments addressed 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..cbc9a362577d9adc1dc2e95875d2a0a40b9a6f5a 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"}
];
/**
@@ -34,6 +38,8 @@ WebInspector.DocumentationURLProvider._sources = [
*/
WebInspector.DocumentationURLProvider._urlFormat = "http://docs.webplatform.org/w/api.php?action=query&titles=%s%s&prop=revisions&rvprop=timestamp|content&format=json"
+// FIXME: method hasOwnProperty can be used with every source object.
apavlov 2014/08/13 14:33:30 Please remove these comment lines. Since we check
+// Documentation is only on javascript/Object/hasOwnProperty
WebInspector.DocumentationURLProvider.prototype = {
/**
* @param {string} searchTerm
@@ -41,17 +47,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