From 4770acb6f4ddbd70a38820be0432b3cbc691d81c Mon Sep 17 00:00:00 2001 From: "cduvall@chromium.org" Date: Thu, 28 Mar 2013 12:40:24 +0000 Subject: Implement API features for the Extension API feature system Now features can be declared in the _api_features.json file, and dependencies of the form "api:" will refer to these features. This patch also prevents schemas for APIs using the feature system from being loaded when calling ExtensionAPI::IsAvailable(). TBR=ben@chromium.org BUG=55316, 120070, 224206 Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=190836 Review URL: https://chromiumcodereview.appspot.com/12846011 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@191133 0039d316-1c4b-4281-b951-d872f2087c98 --- .../extension_api_unittest/api_features.json | 54 ++++++++++++++++++++++ .../is_privileged_features_1.json | 8 ---- .../is_privileged_features_2.json | 8 ---- .../is_privileged_features_3.json | 8 ---- .../is_privileged_features_4.json | 18 -------- .../is_privileged_features_5.json | 18 -------- .../privileged_api_features.json | 32 +++++++++++++ 7 files changed, 86 insertions(+), 60 deletions(-) create mode 100644 chrome/test/data/extensions/extension_api_unittest/api_features.json delete mode 100644 chrome/test/data/extensions/extension_api_unittest/is_privileged_features_1.json delete mode 100644 chrome/test/data/extensions/extension_api_unittest/is_privileged_features_2.json delete mode 100644 chrome/test/data/extensions/extension_api_unittest/is_privileged_features_3.json delete mode 100644 chrome/test/data/extensions/extension_api_unittest/is_privileged_features_4.json delete mode 100644 chrome/test/data/extensions/extension_api_unittest/is_privileged_features_5.json create mode 100644 chrome/test/data/extensions/extension_api_unittest/privileged_api_features.json (limited to 'chrome/test/data') diff --git a/chrome/test/data/extensions/extension_api_unittest/api_features.json b/chrome/test/data/extensions/extension_api_unittest/api_features.json new file mode 100644 index 0000000..476525d --- /dev/null +++ b/chrome/test/data/extensions/extension_api_unittest/api_features.json @@ -0,0 +1,54 @@ +{ + "test1": { + "contexts": ["content_script", "blessed_extension", "unblessed_extension"] + }, + "test2": { + "contexts": ["web_page"], + "matches": [""] + }, + "test2.foo": { + "contexts": ["content_script"] + }, + "test3": { + "contexts": ["content_script"] + }, + "test3.foo": { + "contexts": ["web_page", "blessed_extension"], + "matches": [""] + }, + "test4": { + "contexts": ["blessed_extension"], + "dependencies": ["api:test3.foo"] + }, + "test4.foo": { + "contexts": ["unblessed_extension"], + "dependencies": ["api:test4"] + }, + "test4.foo.foo": { + "contexts": ["content_script"] + }, + "test5": { + "contexts": ["web_page"], + "matches": ["http://foo.com/*"] + }, + "test6": { + "contexts": ["content_script"] + }, + "test6.foo": { + "contexts": ["blessed_extension"] + }, + "test7": { + "contexts": ["web_page"], + "matches": ["http://foo.com/*"] + }, + "test7.foo": { + "contexts": ["web_page"], + "matches": [""], + "dependencies": ["test7"] + }, + "test7.bar": { + "contexts": ["web_page"], + "matches": ["http://bar.com/*"], + "dependencies": ["test7.foo"] + } +} diff --git a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_1.json b/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_1.json deleted file mode 100644 index ae509f69..0000000 --- a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_1.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "namespace": "test", - "uses_feature_system": true, - "extension_types": ["extension"], - "contexts": ["content_script"] - } -] diff --git a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_2.json b/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_2.json deleted file mode 100644 index 91b9d13..0000000 --- a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_2.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "namespace": "test", - "uses_feature_system": true, - "extension_types": ["extension"], - "contexts": ["blessed_extension"] - } -] diff --git a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_3.json b/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_3.json deleted file mode 100644 index 47b1290e..0000000 --- a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_3.json +++ /dev/null @@ -1,8 +0,0 @@ -[ - { - "namespace": "test", - "uses_feature_system": true, - "extension_types": ["extension"], - "contexts": ["content_script", "blessed_extension"] - } -] diff --git a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_4.json b/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_4.json deleted file mode 100644 index 8839ce1..0000000 --- a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_4.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "namespace": "test", - "uses_feature_system": true, - "extension_types": ["extension"], - "contexts": ["blessed_extension"], - "functions": [ - { - "name": "foo", - "contexts": ["content_script", "blessed_extension"] - }, - { - "name": "bar", - "dependencies": ["api:test.foo"] - } - ] - } -] diff --git a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_5.json b/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_5.json deleted file mode 100644 index 9db5b2d..0000000 --- a/chrome/test/data/extensions/extension_api_unittest/is_privileged_features_5.json +++ /dev/null @@ -1,18 +0,0 @@ -[ - { - "namespace": "test", - "uses_feature_system": true, - "extension_types": ["extension"], - "contexts": ["blessed_extension"], - "functions": [ - { - "name": "foo", - "dependencies": ["test2:monkey"] - }, - { - "name": "bar", - "dependencies": ["api:test.foo"] - } - ] - } -] diff --git a/chrome/test/data/extensions/extension_api_unittest/privileged_api_features.json b/chrome/test/data/extensions/extension_api_unittest/privileged_api_features.json new file mode 100644 index 0000000..b32781d --- /dev/null +++ b/chrome/test/data/extensions/extension_api_unittest/privileged_api_features.json @@ -0,0 +1,32 @@ +{ + "test1": { + "contexts": ["content_script"] + }, + "test1.foo": { + "contexts": ["blessed_extension"] + }, + "test2": { + "contexts": ["blessed_extension"], + "dependencies": ["api:test1"] + }, + "test2.foo": { + "contexts": ["content_script"] + }, + "test2.bar": { + "contexts": ["content_script", "blessed_extension"] + }, + "test2.baz": { + "contexts": ["blessed_extension"], + "dependencies": ["api:test2.foo"] + }, + "test3": { + "contexts": ["content_script", "blessed_extension"] + }, + "test3.foo": { + "contexts": ["blessed_extension"] + }, + "test4": { + "contexts": ["content_script"], + "dependencies": ["api:test1.foo"] + } +} -- cgit v1.1