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

Unified Diff: chrome/renderer/resources/extension_process_bindings.js

Issue 7104002: Does not crash with unexpected function in debug build. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: update Created 9 years, 6 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 | « chrome/common/extensions/api/extension_api.json ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/renderer/resources/extension_process_bindings.js
diff --git a/chrome/renderer/resources/extension_process_bindings.js b/chrome/renderer/resources/extension_process_bindings.js
index af682c07e189a3c97fa5363260f7862ab0a1cc22..6c67d06089c58e9b1b96955d8807a37f113aaba2 100644
--- a/chrome/renderer/resources/extension_process_bindings.js
+++ b/chrome/renderer/resources/extension_process_bindings.js
@@ -522,7 +522,29 @@ var chrome = chrome || {};
// for api functions that wish to insert themselves into the call.
var apiDefinitions = chromeHidden.JSON.parse(GetExtensionAPIDefinition());
+ // Get the platform from navigator.appVersion.
+ var platform = "unknown";
Matt Perry 2011/06/07 00:15:52 nit: can you move this block into a separate getPl
Peng 2011/06/07 19:17:30 Done.
+ var platforms = [
+ [/CrOS Touch/, "chromeos touch"],
+ [/CrOS/, "chromeos"],
+ [/Linux/, "linux"],
+ [/Mac/, "mac"],
+ [/Win/, "win"],
+ ];
+
+ for (var i = 0; i < platforms.length; i++) {
+ if (platforms[i][0].test(navigator.appVersion)) {
+ platform = platforms[i][1];
+ break;
+ }
+ }
+
apiDefinitions.forEach(function(apiDef) {
+ // Check platform, if apiDef has platforms key.
+ if (apiDef.platforms && apiDef.platforms.indexOf(platform) == -1) {
+ return;
+ }
+
var module = chrome;
var namespaces = apiDef.namespace.split('.');
for (var index = 0, name; name = namespaces[index]; index++) {
« no previous file with comments | « chrome/common/extensions/api/extension_api.json ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698