diff options
author | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 15:06:58 +0000 |
---|---|---|
committer | kalman@chromium.org <kalman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-19 15:06:58 +0000 |
commit | 882355828db2028405ab6ea12abdea8c517bc426 (patch) | |
tree | befad563b88edf0892866395f16d02cf4a587ffe | |
parent | f887493a60acc7d48207f3460d167f9d964d1a83 (diff) | |
download | chromium_src-882355828db2028405ab6ea12abdea8c517bc426.zip chromium_src-882355828db2028405ab6ea12abdea8c517bc426.tar.gz chromium_src-882355828db2028405ab6ea12abdea8c517bc426.tar.bz2 |
Revert 195187 "Revert 195143 "Prevent chrome.app JSON schema fro..."
Last revert failed. Who knows why.
> Revert 195143 "Prevent chrome.app JSON schema from loading on ev..."
>
> Small perf regression.
>
> > Prevent chrome.app JSON schema from loading on every page
> >
> > The app API along with app.window and app.runtime have been converted to use
> > the feature system. Bindings are not added to the chrome object for unavailable
> > APIs that are children of available APIs. For example, if chrome.app is
> > available, we will not add lazy bindings to chrome for app.window and
> > app.runtime. This eliminates the need to load the app schema, because we no
> > longer need to get chrome.app to add the app.runtime and app.window bindings.
> >
> > BUG=55316
> >
> > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=194837
> >
> > Review URL: https://chromiumcodereview.appspot.com/13604005
>
> TBR=cduvall@chromium.org
>
> Review URL: https://codereview.chromium.org/14241030
TBR=kalman@chromium.org
Review URL: https://codereview.chromium.org/14328045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@195199 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/common/extensions/api/_api_features.json | 26 | ||||
-rw-r--r-- | chrome/common/extensions/api/app.json | 2 | ||||
-rw-r--r-- | chrome/common/extensions/api/extension_api_unittest.cc | 19 |
3 files changed, 36 insertions, 11 deletions
diff --git a/chrome/common/extensions/api/_api_features.json b/chrome/common/extensions/api/_api_features.json index 1ed1017..e8d9acd 100644 --- a/chrome/common/extensions/api/_api_features.json +++ b/chrome/common/extensions/api/_api_features.json @@ -3,6 +3,26 @@ // found in the LICENSE file. { + "app": { + "channel": "stable", + "extension_types": ["hosted_app", "extension"], + "contexts": [ + "blessed_extension", "unblessed_extension", "content_script", "web_page" + ], + "matches": [ + "http://*/*", "https://*/*", "chrome-extension://*/*", "file://*/*" + ] + }, + "app.runtime": { + "channel": "stable", + "contexts": ["blessed_extension"], + "dependencies": ["permission:app.runtime"] + }, + "app.window": { + "channel": "stable", + "contexts": ["blessed_extension"], + "dependencies": ["permission:app.window"] + }, "app.currentWindowInternal": { "internal": true, "channel": "stable", @@ -21,7 +41,9 @@ "events": { "internal": true, "channel": "stable", - "contexts": ["blessed_extension", "unblessed_extension", "content_script", "web_page"], + "contexts": [ + "blessed_extension", "unblessed_extension", "content_script", "web_page" + ], "matches": ["<all_urls>"] }, "fileBrowserHandlerInternal": { @@ -40,6 +62,6 @@ "extension_types": ["hosted_app"], "contexts": ["blessed_extension", "web_page"], // Any webpage can use the webstore API. - "matches": [ "http://*/*", "https://*/*" ] + "matches": ["http://*/*", "https://*/*"] } } diff --git a/chrome/common/extensions/api/app.json b/chrome/common/extensions/api/app.json index 0faef3c..7735f63 100644 --- a/chrome/common/extensions/api/app.json +++ b/chrome/common/extensions/api/app.json @@ -6,8 +6,6 @@ { "namespace": "app", "nodoc": true, - "unprivileged": true, - "matches": [ "<all_urls>" ], "types": [ { "id": "Details", diff --git a/chrome/common/extensions/api/extension_api_unittest.cc b/chrome/common/extensions/api/extension_api_unittest.cc index f980b57..f32d451 100644 --- a/chrome/common/extensions/api/extension_api_unittest.cc +++ b/chrome/common/extensions/api/extension_api_unittest.cc @@ -172,10 +172,14 @@ TEST(ExtensionAPI, APIFeatures) { { "test2.foo", true, Feature::CONTENT_SCRIPT_CONTEXT, GURL() }, { "test3", false, Feature::WEB_PAGE_CONTEXT, GURL("http://google.com") }, { "test3.foo", true, Feature::WEB_PAGE_CONTEXT, GURL("http://google.com") }, - { "test3.foo", true, Feature::BLESSED_EXTENSION_CONTEXT, GURL() }, - { "test4", true, Feature::BLESSED_EXTENSION_CONTEXT, GURL() }, - { "test4.foo", false, Feature::BLESSED_EXTENSION_CONTEXT, GURL() }, - { "test4.foo", false, Feature::UNBLESSED_EXTENSION_CONTEXT, GURL() }, + { "test3.foo", true, Feature::BLESSED_EXTENSION_CONTEXT, + GURL("http://bad.com") }, + { "test4", true, Feature::BLESSED_EXTENSION_CONTEXT, + GURL("http://bad.com") }, + { "test4.foo", false, Feature::BLESSED_EXTENSION_CONTEXT, + GURL("http://bad.com") }, + { "test4.foo", false, Feature::UNBLESSED_EXTENSION_CONTEXT, + GURL("http://bad.com") }, { "test4.foo.foo", true, Feature::CONTENT_SCRIPT_CONTEXT, GURL() }, { "test5", true, Feature::WEB_PAGE_CONTEXT, GURL("http://foo.com") }, { "test5", false, Feature::WEB_PAGE_CONTEXT, GURL("http://bar.com") }, @@ -380,11 +384,12 @@ TEST_F(ExtensionAPITest, URLMatching) { EXPECT_TRUE(MatchesURL(api.get(), "app", "https://blah.net")); EXPECT_TRUE(MatchesURL(api.get(), "app", "file://somefile.html")); - // But not internal URLs (for chrome-extension:// the app API is injected by - // GetSchemasForExtension). + // But not internal URLs. EXPECT_FALSE(MatchesURL(api.get(), "app", "about:flags")); EXPECT_FALSE(MatchesURL(api.get(), "app", "chrome://flags")); - EXPECT_FALSE(MatchesURL(api.get(), "app", + + // "app" should be available to chrome-extension URLs. + EXPECT_TRUE(MatchesURL(api.get(), "app", "chrome-extension://fakeextension")); // "storage" API (for example) isn't available to any URLs. |