OLD | NEW |
---|---|
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
446 | 446 |
447 /** | 447 /** |
448 * @param {!Runtime.Extension} extension | 448 * @param {!Runtime.Extension} extension |
449 * @param {?function(function(new:Object)):boolean} predicate | 449 * @param {?function(function(new:Object)):boolean} predicate |
450 * @return {boolean} | 450 * @return {boolean} |
451 */ | 451 */ |
452 _checkExtensionApplicability: function(extension, predicate) | 452 _checkExtensionApplicability: function(extension, predicate) |
453 { | 453 { |
454 if (!predicate) | 454 if (!predicate) |
455 return false; | 455 return false; |
456 var contextTypes = /** @type {!Array.<string>|undefined} */ (extension.d escriptor().contextTypes); | 456 var contextTypes = extension.descriptor().contextTypes; |
457 if (!contextTypes) | 457 if (!contextTypes) |
458 return true; | 458 return true; |
459 for (var i = 0; i < contextTypes.length; ++i) { | 459 for (var i = 0; i < contextTypes.length; ++i) { |
460 var contextType = this._resolve(contextTypes[i]); | 460 var contextType = this._resolve(contextTypes[i]); |
461 var isMatching = !!contextType && predicate(contextType); | 461 var isMatching = !!contextType && predicate(contextType); |
462 if (isMatching) | 462 if (isMatching) |
463 return true; | 463 return true; |
464 } | 464 } |
465 return false; | 465 return false; |
466 }, | 466 }, |
(...skipping 447 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
914 return new constructorFunction(this); | 914 return new constructorFunction(this); |
915 }, | 915 }, |
916 | 916 |
917 /** | 917 /** |
918 * @return {string} | 918 * @return {string} |
919 */ | 919 */ |
920 title: function() | 920 title: function() |
921 { | 921 { |
922 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar e yet. | 922 // FIXME: should be WebInspector.UIString() but runtime is not l10n awar e yet. |
923 return this._descriptor["title-" + Runtime._platform] || this._descripto r["title"]; | 923 return this._descriptor["title-" + Runtime._platform] || this._descripto r["title"]; |
924 }, | |
925 | |
926 /** | |
927 * @param {function(new:Object)} contextType | |
928 * @return {boolean} | |
929 */ | |
930 hasContextType: function(contextType) | |
931 { | |
932 var contextTypes = this.descriptor().contextTypes; | |
933 if (!contextTypes) | |
alph
2016/09/06 23:07:13
nit:
return contextTypes && contextTypes.some(type
| |
934 return false; | |
935 for (var i = 0; i < contextTypes.length; ++i) { | |
936 if (contextType === this._module._manager._resolve(contextTypes[i])) | |
937 return true; | |
938 } | |
939 return false; | |
924 } | 940 } |
925 } | 941 } |
926 | 942 |
927 /** | 943 /** |
928 * @constructor | 944 * @constructor |
929 */ | 945 */ |
930 Runtime.ExperimentsSupport = function() | 946 Runtime.ExperimentsSupport = function() |
931 { | 947 { |
932 this._supportEnabled = Runtime.queryParam("experiments") !== null; | 948 this._supportEnabled = Runtime.queryParam("experiments") !== null; |
933 this._experiments = []; | 949 this._experiments = []; |
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1125 { | 1141 { |
1126 var sourceURL = self.location.href; | 1142 var sourceURL = self.location.href; |
1127 if (self.location.search) | 1143 if (self.location.search) |
1128 sourceURL = sourceURL.replace(self.location.search, ""); | 1144 sourceURL = sourceURL.replace(self.location.search, ""); |
1129 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; | 1145 sourceURL = sourceURL.substring(0, sourceURL.lastIndexOf("/") + 1) + path; |
1130 return "\n/*# sourceURL=" + sourceURL + " */"; | 1146 return "\n/*# sourceURL=" + sourceURL + " */"; |
1131 } | 1147 } |
1132 | 1148 |
1133 /** @type {!Runtime} */ | 1149 /** @type {!Runtime} */ |
1134 var runtime; | 1150 var runtime; |
OLD | NEW |