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

Unified Diff: chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js

Issue 9423049: Make registering custom hooks with schema_generated_bindings.js safer and (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 8 years, 10 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
Index: chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js
diff --git a/chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js b/chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js
index 029d9c3457432002fec7bf9dac505884f49997be..de47b6c37af3b72225f6c6a1f140cb547370569c 100644
--- a/chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js
+++ b/chrome/renderer/resources/extensions/experimental.declarative_custom_bindings.js
@@ -10,9 +10,8 @@ native function GetChromeHidden();
var chromeHidden = GetChromeHidden();
-chromeHidden.registerCustomHook(
- 'experimental.declarative',
- function(bindingsAPI) {
+chromeHidden.registerCustomHook('experimental.declarative',
+ function(bindingsAPI) {
var apiFunctions = bindingsAPI.apiFunctions;
var sendRequest = bindingsAPI.sendRequest;
var apiDefinitions = bindingsAPI.apiDefinitions;
@@ -23,7 +22,7 @@ chromeHidden.registerCustomHook(
return cachedEventOptions[qualifiedEventName];
// Parse qualifiedEventName into namespace and event name.
- var lastSeparator = qualifiedEventName.lastIndexOf(".");
+ var lastSeparator = qualifiedEventName.lastIndexOf('.');
var eventName = qualifiedEventName.substr(lastSeparator + 1);
var namespace = qualifiedEventName.substr(0, lastSeparator);
@@ -42,9 +41,9 @@ chromeHidden.registerCustomHook(
// data types.
function buildArrayOfChoicesSchema(typesList) {
return {
- "type": "array",
- "items": {
- "choices": typesList.map(function(el) {return {"$ref": el};})
+ 'type': 'array',
+ 'items': {
+ 'choices': typesList.map(function(el) {return {'$ref': el};})
}
};
}
@@ -65,12 +64,12 @@ chromeHidden.registerCustomHook(
})
}
- apiFunctions.setHandleRequest("experimental.declarative.addRules",
- function(eventName, rules, opt_callback) {
+ apiFunctions.setHandleRequest('addRules',
+ function(eventName, rules, opt_callback) {
var eventOptions = getEventOptions(eventName);
if (!eventOptions.conditions || !eventOptions.actions) {
- throw new Error("Event " + eventName + " misses conditions or " +
- "actions in the API specification.");
+ throw new Error('Event ' + eventName + ' misses conditions or ' +
+ 'actions in the API specification.');
}
validateRules(rules,
eventOptions.conditions,

Powered by Google App Engine
This is Rietveld 408576698