| Index: chrome/renderer/extensions/schema_generated_bindings.cc
|
| diff --git a/chrome/renderer/extensions/schema_generated_bindings.cc b/chrome/renderer/extensions/schema_generated_bindings.cc
|
| index 462155a0a73fc46155a38809966226dfe9af5bd6..64eae65bd69940cb2437d10c0dc557b72aa4374b 100644
|
| --- a/chrome/renderer/extensions/schema_generated_bindings.cc
|
| +++ b/chrome/renderer/extensions/schema_generated_bindings.cc
|
| @@ -54,8 +54,6 @@ namespace {
|
| const char* kExtensionDeps[] = {
|
| "extensions/event.js",
|
| "extensions/json_schema.js",
|
| - "extensions/miscellaneous_bindings.js",
|
| - "extensions/apitest.js"
|
| };
|
|
|
| // Contains info relevant to a pending API request.
|
| @@ -151,11 +149,21 @@ class ExtensionImpl : public ChromeV8Extension {
|
| if (dispatcher->IsTestExtensionId(extension_id)) {
|
| ExtensionAPI::GetInstance()->GetDefaultSchemas(filter, &schemas);
|
| } else {
|
| - const ::Extension* extension =
|
| + // UNPRIVILEGED context_type refers to the v8 context this request is
|
| + // from (as opposed to an extension or content script context), and isn't
|
| + // related to "unprivileged" in the extension API sense. This distinction
|
| + // will be sanitized soon, when ExtensionAPI uses Features.
|
| + if (v8_context->context_type() == ChromeV8Context::UNPRIVILEGED) {
|
| + GURL frame_url =
|
| + UserScriptSlave::GetDataSourceURLForFrame(v8_context->web_frame());
|
| + ExtensionAPI::GetInstance()->GetSchemasForURL(frame_url, &schemas);
|
| + } else {
|
| + const ::Extension* extension =
|
| dispatcher->extensions()->GetByID(extension_id);
|
| - CHECK(extension) << extension_id << " not found";
|
| - ExtensionAPI::GetInstance()->GetSchemasForExtension(
|
| - *extension, filter, &schemas);
|
| + CHECK(extension) << extension_id << " not found";
|
| + ExtensionAPI::GetInstance()->GetSchemasForExtension(
|
| + *extension, filter, &schemas);
|
| + }
|
| }
|
|
|
| v8::Persistent<v8::Context> context(v8::Context::New());
|
| @@ -164,8 +172,7 @@ class ExtensionImpl : public ChromeV8Extension {
|
| size_t api_index = 0;
|
| for (ExtensionAPI::SchemaMap::iterator it = schemas.begin();
|
| it != schemas.end(); ++it) {
|
| - std::string api_name = it->first;
|
| - api->Set(api_index, GetV8SchemaForAPI(self, context, api_name));
|
| + api->Set(api_index, GetV8SchemaForAPI(self, context, it->first));
|
| ++api_index;
|
| }
|
|
|
|
|