diff options
43 files changed, 413 insertions, 311 deletions
diff --git a/chrome/app/generated_resources.grd b/chrome/app/generated_resources.grd index ebb8b7c..b72ba48 100644 --- a/chrome/app/generated_resources.grd +++ b/chrome/app/generated_resources.grd @@ -3425,7 +3425,7 @@ each locale. --> Manifest file is invalid. </message> <message name="IDS_EXTENSION_OVERLAPPING_WEB_EXTENT" desc="Error message when a user tries to install an app with a web extent that overlaps another installed app."> - Could not install application because it conflicts with '<ph name="APP_NAME">$1<ex>Google Mail</ex></ph>', which is already installed. + This app claims to own '<ph name="APP_OVERLAPPING_URL">$2<ex>http://google.com/mail</ex></ph>' which already belongs to installed app '<ph name="APP_NAME">$1<ex>Google Mail</ex></ph>'. </message> <message name="IDS_EXTENSION_LOCALES_NO_DEFAULT_LOCALE_SPECIFIED" desc=""> Localization used, but default_locale wasn't specified in the manifest. diff --git a/chrome/browser/download/download_manager.cc b/chrome/browser/download/download_manager.cc index b795816..63e2d64 100644 --- a/chrome/browser/download/download_manager.cc +++ b/chrome/browser/download/download_manager.cc @@ -1471,7 +1471,7 @@ void DownloadManager::OpenChromeExtension(const FilePath& full_path, ExtensionsService::IsDownloadFromGallery(download_url, referrer_url); installer->set_allow_privilege_increase(true); installer->set_original_url(download_url); - installer->set_limit_web_extent_to_download_host(!is_gallery_download); + installer->set_force_web_origin_to_download_url(!is_gallery_download); installer->InstallCrx(full_path); } } else { diff --git a/chrome/browser/extensions/crx_installer.cc b/chrome/browser/extensions/crx_installer.cc index 70f8146..3609320 100644 --- a/chrome/browser/extensions/crx_installer.cc +++ b/chrome/browser/extensions/crx_installer.cc @@ -43,7 +43,7 @@ CrxInstaller::CrxInstaller(const FilePath& install_directory, install_source_(Extension::INTERNAL), delete_source_(false), allow_privilege_increase_(false), - limit_web_extent_to_download_host_(false), + force_web_origin_to_download_url_(false), create_app_shortcut_(false), frontend_(frontend), client_(client) { @@ -84,6 +84,10 @@ void CrxInstaller::InstallCrx(const FilePath& source_file) { g_browser_process->resource_dispatcher_host(), this)); + if (force_web_origin_to_download_url_) { + unpacker->set_web_origin(original_url_.GetOrigin()); + } + ChromeThread::PostTask( ChromeThread::FILE, FROM_HERE, NewRunnableMethod( @@ -160,22 +164,6 @@ void CrxInstaller::OnUnpackSuccess(const FilePath& temp_dir, return; } - // Require that apps are served from the domain they claim in their extent, - // or some ancestor domain. - if (extension_->is_app() && limit_web_extent_to_download_host_) { - URLPattern pattern; - pattern.set_host(original_url_.host()); - pattern.set_match_subdomains(true); - - for (size_t i = 0; i < extension_->web_extent().patterns().size(); ++i) { - if (!pattern.MatchesHost(extension_->web_extent().patterns()[i].host())) { - ReportFailureFromFileThread(StringPrintf( - "Apps must be served from the host that they affect.")); - return; - } - } - } - if (client_ || extension_->GetFullLaunchURL().is_valid()) { Extension::DecodeIcon(extension_.get(), Extension::EXTENSION_ICON_LARGE, &install_icon_); @@ -197,11 +185,13 @@ void CrxInstaller::ConfirmInstall() { GURL overlapping_url; Extension* overlapping_extension = - frontend_->GetExtensionByOverlappingWebExtent(extension_->web_extent()); + frontend_->GetExtensionByOverlappingWebExtent( + extension_->web_extent(), &overlapping_url); if (overlapping_extension) { ReportFailureFromUIThread(l10n_util::GetStringFUTF8( IDS_EXTENSION_OVERLAPPING_WEB_EXTENT, - UTF8ToUTF16(overlapping_extension->name()))); + UTF8ToUTF16(overlapping_extension->name()), + UTF8ToUTF16(overlapping_url.spec()))); return; } diff --git a/chrome/browser/extensions/crx_installer.h b/chrome/browser/extensions/crx_installer.h index 905a3f2..d64f668 100644 --- a/chrome/browser/extensions/crx_installer.h +++ b/chrome/browser/extensions/crx_installer.h @@ -83,11 +83,11 @@ class CrxInstaller allow_privilege_increase_ = val; } - bool limit_web_extent_to_download_host() const { - return limit_web_extent_to_download_host_; + bool force_web_origin_to_download_url() const { + return force_web_origin_to_download_url_; } - void set_limit_web_extent_to_download_host(bool val) { - limit_web_extent_to_download_host_ = val; + void set_force_web_origin_to_download_url(bool val) { + force_web_origin_to_download_url_ = val; } private: @@ -151,9 +151,11 @@ class CrxInstaller // either. Defaults to false. bool allow_privilege_increase_; - // Limits the web extent to the app being installed to the host of the - // download URL. If the crx being installed is not an app, this is a no-op. - bool limit_web_extent_to_download_host_; + // If true and the installed extension uses web content, the web origin will + // be forced to the origin of |original_url_|. Defaults to false. This is used + // for non-gallery installs, where we don't trust the origin given in the + // manifest. + bool force_web_origin_to_download_url_; // Whether to create an app shortcut after successful installation. This is // set based on the user's selection in the UI and can only ever be true for diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 108a214..a416f17 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -264,7 +264,7 @@ void ExtensionsService::UpdateExtension(const std::string& id, client)); installer->set_expected_id(id); installer->set_delete_source(true); - installer->set_limit_web_extent_to_download_host(true); + installer->set_force_web_origin_to_download_url(true); installer->set_original_url(download_url); installer->InstallCrx(extension_path); } @@ -984,8 +984,16 @@ Extension* ExtensionsService::GetExtensionByWebExtent(const GURL& url) { } Extension* ExtensionsService::GetExtensionByOverlappingWebExtent( - const ExtensionExtent& extent) { - // TODO(aa): Make this work for the new extents. http://crbug.com/47445. + const ExtensionExtent& extent, GURL* overlapping_url) { + for (size_t i = 0; i < extensions_.size(); ++i) { + for (size_t j = 0; j < extent.paths().size(); ++j) { + GURL url(extent.origin().Resolve(extent.paths()[j])); + if (extensions_[i]->web_extent().ContainsURL(url)) { + *overlapping_url = url; + return extensions_[i]; + } + } + } return NULL; } diff --git a/chrome/browser/extensions/extensions_service.h b/chrome/browser/extensions/extensions_service.h index a5725ef..f019630 100644 --- a/chrome/browser/extensions/extensions_service.h +++ b/chrome/browser/extensions/extensions_service.h @@ -269,8 +269,10 @@ class ExtensionsService Extension* GetExtensionByWebExtent(const GURL& url); // Returns an extension that contains any URL that overlaps with the given - // extent, if one exists. - Extension* GetExtensionByOverlappingWebExtent(const ExtensionExtent& extent); + // extent, if one exists. Also fills |overlapping_url| with the first URL that + // overlaps. + Extension* GetExtensionByOverlappingWebExtent(const ExtensionExtent& extent, + GURL* overlapping_url); // Clear all ExternalExtensionProviders. void ClearProvidersForTesting(); diff --git a/chrome/browser/extensions/extensions_service_unittest.cc b/chrome/browser/extensions/extensions_service_unittest.cc index 5618648..cc50bab 100644 --- a/chrome/browser/extensions/extensions_service_unittest.cc +++ b/chrome/browser/extensions/extensions_service_unittest.cc @@ -1034,9 +1034,8 @@ TEST_F(ExtensionsServiceTest, InstallApps) { ValidatePrefKeyCount(++pref_count); // A third app whose extent overlaps the first. Should fail. - // TODO(aa): bring this back when overlap is fixed. http://crbug.com/47445. - // PackAndInstallExtension(extensions_path.AppendASCII("app3"), false); - // ValidatePrefKeyCount(pref_count); + PackAndInstallExtension(extensions_path.AppendASCII("app3"), false); + ValidatePrefKeyCount(pref_count); } // Test that when an extension version is reinstalled, nothing happens. diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.cc b/chrome/browser/extensions/sandboxed_extension_unpacker.cc index eda5e3f..ab72325 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.cc +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.cc @@ -34,7 +34,8 @@ SandboxedExtensionUnpacker::SandboxedExtensionUnpacker( SandboxedExtensionUnpackerClient* client) : crx_path_(crx_path), temp_path_(temp_path), thread_identifier_(ChromeThread::ID_COUNT), - rdh_(rdh), client_(client), got_response_(false) { + rdh_(rdh), client_(client), got_response_(false), + force_web_origin_override_(false) { } void SandboxedExtensionUnpacker::Start() { @@ -275,6 +276,29 @@ DictionaryValue* SandboxedExtensionUnpacker::RewriteManifestFile( static_cast<DictionaryValue*>(manifest.DeepCopy())); final_manifest->SetString(extension_manifest_keys::kPublicKey, public_key_); + if (final_manifest->HasKey(extension_manifest_keys::kApp)) { + bool has_web_origin = + final_manifest->Get(extension_manifest_keys::kWebOrigin, NULL); + if (force_web_origin_override_) { + if (has_web_origin) { + ReportFailure("Error: untrusted extension should have no web_origin."); + return NULL; + } + if (!web_origin_override_.is_valid() || + web_origin_override_.SchemeIsFile()) { + ReportFailure( + "Error: untrusted extension has an invalid download origin."); + return NULL; + } + + final_manifest->SetString(extension_manifest_keys::kWebOrigin, + web_origin_override_.spec()); + } else if (!has_web_origin) { + ReportFailure("Error: trusted extension should have a web_origin."); + return NULL; + } + } + std::string manifest_json; JSONStringValueSerializer serializer(&manifest_json); serializer.set_pretty_print(true); diff --git a/chrome/browser/extensions/sandboxed_extension_unpacker.h b/chrome/browser/extensions/sandboxed_extension_unpacker.h index 60d02a9..4c89082 100644 --- a/chrome/browser/extensions/sandboxed_extension_unpacker.h +++ b/chrome/browser/extensions/sandboxed_extension_unpacker.h @@ -97,6 +97,12 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client { ResourceDispatcherHost* rdh, SandboxedExtensionUnpackerClient* cilent); + const GURL& web_origin() const { return web_origin_override_; } + void set_web_origin(const GURL& val) { + web_origin_override_ = val; + force_web_origin_override_ = true; + } + // Start unpacking the extension. The client is called with the results. void Start(); @@ -167,6 +173,15 @@ class SandboxedExtensionUnpacker : public UtilityProcessHost::Client { // The public key that was extracted from the CRX header. std::string public_key_; + + // If the app uses web content, its origin will be set to this value. This is + // used when an app is self-hosted. The only valid origin is the origin it is + // served from. + GURL web_origin_override_; + + // If true, we require the web_origin field to be empty in the manifest. + // Instead, we use the one given in web_origin_override_. Defaults to false. + bool force_web_origin_override_; }; #endif // CHROME_BROWSER_EXTENSIONS_SANDBOXED_EXTENSION_UNPACKER_H_ diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 38b8b01..887c04a 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -664,7 +664,7 @@ void BrowserRenderProcessHost::SendExtensionExtentsUpdate() { ViewMsg_ExtensionExtentsUpdated_Params params; for (size_t i = 0; i < service->extensions()->size(); ++i) { Extension* extension = service->extensions()->at(i); - if (!extension->web_extent().is_empty()) { + if (!extension->web_extent().origin().is_empty()) { params.extension_apps.push_back( make_pair(extension->id(), extension->web_extent())); } @@ -941,7 +941,7 @@ void BrowserRenderProcessHost::Observe(NotificationType type, case NotificationType::EXTENSION_LOADED: case NotificationType::EXTENSION_UNLOADED: { Extension* extension = Details<Extension>(details).ptr(); - if (!extension->web_extent().is_empty()) + if (!extension->web_extent().origin().is_empty()) SendExtensionExtentsUpdate(); break; } diff --git a/chrome/browser/resources/calendar_app/manifest.json b/chrome/browser/resources/calendar_app/manifest.json index 11ec952..04416fe 100644 --- a/chrome/browser/resources/calendar_app/manifest.json +++ b/chrome/browser/resources/calendar_app/manifest.json @@ -10,10 +10,10 @@ "48": "48.png"
},
"app": {
- "urls": [
- "http://www.google.com/calendar/",
- "https://www.google.com/calendar/"
- ],
+ "web_content": {
+ "origin": "https://www.google.com/",
+ "paths": [ "calendar" ]
+ },
"launch": {
"container": "tab",
"web_url": "https://www.google.com/calendar/"
diff --git a/chrome/browser/resources/docs_app/manifest.json b/chrome/browser/resources/docs_app/manifest.json index d4b56fc4..fb38a49 100644 --- a/chrome/browser/resources/docs_app/manifest.json +++ b/chrome/browser/resources/docs_app/manifest.json @@ -9,54 +9,9 @@ "48": "48.png"
},
"app": {
- "urls": [
- "http://www.google.com/docs/",
- "https://www.google.com/docs/",
- "http://docs.google.com/",
- "https://docs.google.com/",
- "http://docs0.google.com/",
- "https://docs0.google.com/",
- "http://docs1.google.com/",
- "https://docs1.google.com/",
- "http://docs2.google.com/",
- "https://docs2.google.com/",
- "http://docs3.google.com/",
- "https://docs3.google.com/",
- "http://docs4.google.com/",
- "https://docs4.google.com/",
- "http://docs5.google.com/",
- "https://docs5.google.com/",
- "http://docs6.google.com/",
- "https://docs6.google.com/",
- "http://docs7.google.com/",
- "https://docs7.google.com/",
- "http://docs8.google.com/",
- "https://docs8.google.com/",
- "http://docs9.google.com/",
- "https://docs9.google.com/",
- "http://spreadsheets.google.com/",
- "https://spreadsheets.google.com/",
- "http://spreadsheets0.google.com/",
- "https://spreadsheets0.google.com/",
- "http://spreadsheets1.google.com/",
- "https://spreadsheets1.google.com/",
- "http://spreadsheets2.google.com/",
- "https://spreadsheets2.google.com/",
- "http://spreadsheets3.google.com/",
- "https://spreadsheets3.google.com/",
- "http://spreadsheets4.google.com/",
- "https://spreadsheets4.google.com/",
- "http://spreadsheets5.google.com/",
- "https://spreadsheets5.google.com/",
- "http://spreadsheets6.google.com/",
- "https://spreadsheets6.google.com/",
- "http://spreadsheets7.google.com/",
- "https://spreadsheets7.google.com/",
- "http://spreadsheets8.google.com/",
- "https://spreadsheets8.google.com/",
- "http://spreadsheets9.google.com/",
- "https://spreadsheets9.google.com/"
- ],
+ "web_content": {
+ "origin": "https://docs.google.com/"
+ },
"launch": {
"web_url": "https://docs.google.com/"
}
diff --git a/chrome/browser/resources/gmail_app/manifest.json b/chrome/browser/resources/gmail_app/manifest.json index 378a2a9..1ce5fa4 100644 --- a/chrome/browser/resources/gmail_app/manifest.json +++ b/chrome/browser/resources/gmail_app/manifest.json @@ -10,16 +10,12 @@ },
"permissions": [ "notifications" ],
"app": {
- "urls": [
- "http://mail.google.com/mail/",
- "https://mail.google.com/mail/",
- "http://gmail.com/",
- "https://gmail.com/",
- "http://www.gmail.com/",
- "https://www.gmail.com/"
- ],
+ "web_content": {
+ "origin": "https://mail.google.com/",
+ "paths": [ "mail" ]
+ },
"launch": {
- "web_url": "https://mail.google.com/mail/"
+ "web_url": "https://mail.google.com/"
}
}
}
diff --git a/chrome/common/extensions/docs/examples/extensions/maps_app/manifest.json b/chrome/common/extensions/docs/examples/extensions/maps_app/manifest.json index d402a74..7ac6a16 100644 --- a/chrome/common/extensions/docs/examples/extensions/maps_app/manifest.json +++ b/chrome/common/extensions/docs/examples/extensions/maps_app/manifest.json @@ -2,13 +2,12 @@ "name": "Google Maps", "version": "3", "icons": { "24": "24.png", "128": "128.png" }, - "app": { - "urls": [ - "http://maps.google.com/" - ], - "launch": { - "web_url": "http://maps.google.com/" - } + "launch": { + "web_url": "http://maps.google.com/" }, "permissions": ["geolocation"], + "web_content": { + "enabled": true, + "origin": "http://maps.google.com" + } } diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index 97ee0201..3631af0 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -532,43 +532,77 @@ bool Extension::LoadIsApp(const DictionaryValue* manifest, return true; } -bool Extension::LoadWebURLs(const DictionaryValue* manifest, - std::string* error) { +bool Extension::LoadWebOrigin(const DictionaryValue* manifest, + std::string* error) { Value* temp = NULL; - if (!manifest->Get(keys::kWebURLs, &temp)) + if (!manifest->Get(keys::kWebOrigin, &temp)) return true; - if (temp->GetType() != Value::TYPE_LIST) { - *error = errors::kInvalidWebURLs; + // Check datatype. + std::string origin_string; + if (!temp->GetAsString(&origin_string)) { + *error = errors::kInvalidWebOrigin; return false; } - ListValue* pattern_list = static_cast<ListValue*>(temp); - for (size_t i = 0; i < pattern_list->GetSize(); ++i) { - std::string pattern_string; - if (!pattern_list->GetString(i, &pattern_string)) { - *error = ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, UintToString(i)); - return false; - } + // Origin must be a valid URL. + GURL origin_gurl(origin_string); + if (!origin_gurl.is_valid() || origin_gurl.is_empty()) { + *error = errors::kInvalidWebOrigin; + return false; + } - URLPattern pattern; - if (!pattern.Parse(pattern_string)) { + // Origins can only be http or https. + if (!origin_gurl.SchemeIs(chrome::kHttpScheme) && + !origin_gurl.SchemeIs(chrome::kHttpsScheme)) { + *error = errors::kInvalidWebOrigin; + return false; + } + + // Check that the origin doesn't include any extraneous information. + if (origin_gurl.GetOrigin() != origin_gurl) { + *error = errors::kInvalidWebOrigin; + return false; + } + + web_extent_.set_origin(origin_gurl); + return true; +} + +bool Extension::LoadWebPaths(const DictionaryValue* manifest, + std::string* error) { + Value* temp = NULL; + if (!manifest->Get(keys::kWebPaths, &temp)) + return true; + + // Check datatype. + if (!temp->IsType(Value::TYPE_LIST)) { + *error = errors::kInvalidWebPaths; + return false; + } + + ListValue* web_paths = static_cast<ListValue*>(temp); + for (size_t i = 0; i < web_paths->GetSize(); ++i) { + // Get item and check datatype. + std::string item; + if (!web_paths->GetString(i, &item) || item.empty()) { *error = ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, UintToString(i)); + errors::kInvalidWebPath, IntToString(i)); return false; } - // We do not allow authors to put wildcards in their paths. Instead, we - // imply one at the end. - if (pattern.path().find('*') != std::string::npos) { + // Ensure the path is a valid relative URL by resolving it against the + // extension root. + // TODO(aa): This is hacky. Is there another way to know whether a string + // is a valid relative URL? + GURL resolved = extension_url_.Resolve(item); + if (!resolved.is_valid() || resolved.GetOrigin() != extension_url_) { *error = ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, UintToString(i)); + errors::kInvalidWebPath, IntToString(i)); return false; } - pattern.set_path(pattern.path() + '*'); - web_extent_.AddPattern(pattern); + web_extent_.add_path(item); } return true; @@ -578,8 +612,8 @@ bool Extension::LoadLaunchURL(const DictionaryValue* manifest, std::string* error) { Value* temp = NULL; - // launch URL can be either local (to chrome-extension:// root) or an absolute - // web URL. + // launch URL can be either local (to chrome-extension:// root) or web (either + // relative to the origin, or an absolute URL). if (manifest->Get(keys::kLaunchLocalPath, &temp)) { if (manifest->Get(keys::kLaunchWebURL, NULL)) { *error = errors::kLaunchPathAndURLAreExclusive; @@ -607,8 +641,8 @@ bool Extension::LoadLaunchURL(const DictionaryValue* manifest, return false; } - // Ensure the launch URL is a valid absolute URL. - if (!GURL(launch_url).is_valid()) { + // Ensure the launch URL is a valid relative or absolute URL. + if (!extension_url_.Resolve(launch_url).is_valid()) { *error = errors::kInvalidLaunchWebURL; return false; } @@ -619,16 +653,6 @@ bool Extension::LoadLaunchURL(const DictionaryValue* manifest, return false; } - // If there is no extent, we default the extent based on the launch URL. - if (web_extent_.is_empty() && !launch_web_url_.empty()) { - GURL launch_url(launch_web_url_); - URLPattern pattern; - pattern.set_scheme(launch_url.scheme()); - pattern.set_host(launch_url.host()); - pattern.set_path("/*"); - web_extent_.AddPattern(pattern); - } - return true; } @@ -1455,7 +1479,8 @@ bool Extension::InitFromValue(const DictionaryValue& source, bool require_key, } if (!LoadIsApp(manifest_value_.get(), error) || - !LoadWebURLs(manifest_value_.get(), error) || + !LoadWebOrigin(manifest_value_.get(), error) || + !LoadWebPaths(manifest_value_.get(), error) || !LoadLaunchURL(manifest_value_.get(), error) || !LoadLaunchContainer(manifest_value_.get(), error) || !LoadLaunchFullscreen(manifest_value_.get(), error)) { @@ -1532,10 +1557,18 @@ std::set<FilePath> Extension::GetBrowserImages() { } GURL Extension::GetFullLaunchURL() const { - if (!launch_local_path_.empty()) + if (!launch_local_path_.empty()) { return extension_url_.Resolve(launch_local_path_); - else - return GURL(launch_web_url_); + } else if (!launch_web_url_.empty()) { + // If there is a web origin, we interpret the launch URL relatively to that. + // Otherwise, hopefully it was an absolute URL. + if (web_extent_.origin().is_valid()) + return web_extent_.origin().Resolve(launch_web_url_); + else + return GURL(launch_web_url_); + } else { + return GURL(); + } } bool Extension::GetBackgroundPageReady() { diff --git a/chrome/common/extensions/extension.h b/chrome/common/extensions/extension.h index 8748deb..0d4c10a 100644 --- a/chrome/common/extensions/extension.h +++ b/chrome/common/extensions/extension.h @@ -397,7 +397,8 @@ class Extension { // Helpers to load various chunks of the manifest. bool LoadIsApp(const DictionaryValue* manifest, std::string* error); - bool LoadWebURLs(const DictionaryValue* manifest, std::string* error); + bool LoadWebOrigin(const DictionaryValue* manifest, std::string* error); + bool LoadWebPaths(const DictionaryValue* manifest, std::string* error); bool LoadLaunchContainer(const DictionaryValue* manifest, std::string* error); bool LoadLaunchFullscreen(const DictionaryValue* manifest, std::string* error); diff --git a/chrome/common/extensions/extension_constants.cc b/chrome/common/extensions/extension_constants.cc index e4f368a..423d491 100644 --- a/chrome/common/extensions/extension_constants.cc +++ b/chrome/common/extensions/extension_constants.cc @@ -17,9 +17,7 @@ const wchar_t* kCss = L"css"; const wchar_t* kCurrentLocale = L"current_locale"; const wchar_t* kDefaultLocale = L"default_locale"; const wchar_t* kDescription = L"description"; -const wchar_t* kExcludeGlobs = L"exclude_globs"; const wchar_t* kIcons = L"icons"; -const wchar_t* kIncludeGlobs = L"include_globs"; const wchar_t* kJs = L"js"; const wchar_t* kLaunch = L"app.launch"; const wchar_t* kLaunchContainer = L"app.launch.container"; @@ -30,8 +28,9 @@ const wchar_t* kLaunchWebURL = L"app.launch.web_url"; const wchar_t* kLaunchWidth = L"app.launch.width"; const wchar_t* kMatches = L"matches"; const wchar_t* kMinimumChromeVersion = L"minimum_chrome_version"; +const wchar_t* kIncludeGlobs = L"include_globs"; +const wchar_t* kExcludeGlobs = L"exclude_globs"; const wchar_t* kName = L"name"; -const wchar_t* kOmniboxKeyword = L"omnibox_keyword"; const wchar_t* kPageActionId = L"id"; const wchar_t* kPageAction = L"page_action"; const wchar_t* kPageActions = L"page_actions"; @@ -62,7 +61,10 @@ const wchar_t* kType = L"type"; const wchar_t* kVersion = L"version"; const wchar_t* kUpdateURL = L"update_url"; const wchar_t* kOptionsPage = L"options_page"; -const wchar_t* kWebURLs = L"app.urls"; +const wchar_t* kWebContent = L"app.web_content"; +const wchar_t* kWebOrigin = L"app.web_content.origin"; +const wchar_t* kWebPaths = L"app.web_content.paths"; +const wchar_t* kOmniboxKeyword = L"omnibox_keyword"; } // namespace extension_manifest_keys namespace extension_manifest_values { @@ -216,10 +218,14 @@ const char* kInvalidThemeTints = "Invalid value for theme images - tints must be decimal numbers."; const char* kInvalidUpdateURL = "Invalid value for update url: '[*]'."; -const char* kInvalidWebURLs = - "Invalid value for 'app.urls'."; -const char* kInvalidWebURL = - "Invalid value for 'app.urls[*]'."; +const char* kInvalidWebContentEnabled = + "Invalid value for 'app.web_content.enabled'."; +const char* kInvalidWebOrigin = + "Invalid value for 'app.web_content.origin'."; +const char* kInvalidWebPaths = + "Invalid value for 'app.web_content.paths'."; +const char* kInvalidWebPath = + "Invalid value for 'app.web_contents.paths[*]'."; const char* kInvalidDefaultLocale = "Invalid value for default locale - locale name must be a string."; const char* kOneUISurfaceOnly = diff --git a/chrome/common/extensions/extension_constants.h b/chrome/common/extensions/extension_constants.h index a2a972b..b7f9ec8 100644 --- a/chrome/common/extensions/extension_constants.h +++ b/chrome/common/extensions/extension_constants.h @@ -32,7 +32,6 @@ namespace extension_manifest_keys { extern const wchar_t* kJs; extern const wchar_t* kMatches; extern const wchar_t* kName; - extern const wchar_t* kOmniboxKeyword; extern const wchar_t* kPageActionId; extern const wchar_t* kPageAction; extern const wchar_t* kPageActions; @@ -63,8 +62,11 @@ namespace extension_manifest_keys { extern const wchar_t* kVersion; extern const wchar_t* kUpdateURL; extern const wchar_t* kOptionsPage; + extern const wchar_t* kWebContent; extern const wchar_t* kWebLaunchUrl; - extern const wchar_t* kWebURLs; + extern const wchar_t* kWebOrigin; + extern const wchar_t* kWebPaths; + extern const wchar_t* kOmniboxKeyword; } // namespace extension_manifest_keys // Some values expected in manifests. @@ -142,8 +144,10 @@ namespace extension_manifest_errors { extern const char* kInvalidThemeImages; extern const char* kInvalidThemeColors; extern const char* kInvalidThemeTints; - extern const char* kInvalidWebURLs; - extern const char* kInvalidWebURL; + extern const char* kInvalidWebContentEnabled; + extern const char* kInvalidWebOrigin; + extern const char* kInvalidWebPaths; + extern const char* kInvalidWebPath; extern const char* kOneUISurfaceOnly; extern const char* kThemesCannotContainExtensions; extern const char* kManifestParseError; diff --git a/chrome/common/extensions/extension_extent.cc b/chrome/common/extensions/extension_extent.cc index b479c5b..f716291 100644 --- a/chrome/common/extensions/extension_extent.cc +++ b/chrome/common/extensions/extension_extent.cc @@ -4,11 +4,24 @@ #include "chrome/common/extensions/extension_extent.h" +#include "base/string_util.h" + bool ExtensionExtent::ContainsURL(const GURL& url) const { - for (PatternList::const_iterator pattern = patterns_.begin(); - pattern != patterns_.end(); ++pattern) { - if (pattern->MatchesUrl(url)) + if (origin_.is_empty() || !url.is_valid()) + return false; + + if (url.GetOrigin() != origin_) + return false; + + if (paths_.empty()) + return true; + + for (size_t i = 0; i < paths_.size(); ++i) { + if (StartsWithASCII(url.path(), + std::string("/") + paths_[i], + false)) { // not case sensitive return true; + } } return false; diff --git a/chrome/common/extensions/extension_extent.h b/chrome/common/extensions/extension_extent.h index df8d02d..187303d 100644 --- a/chrome/common/extensions/extension_extent.h +++ b/chrome/common/extensions/extension_extent.h @@ -8,25 +8,27 @@ #include <string> #include <vector> -#include "chrome/common/extensions/url_pattern.h" #include "googleurl/src/gurl.h" // Represents the set of URLs an extension uses for web content. class ExtensionExtent { public: - typedef std::vector<URLPattern> PatternList; + const std::vector<std::string>& paths() const { return paths_; } + void add_path(const std::string& val) { paths_.push_back(val); } + void clear_paths() { paths_.clear(); } - bool is_empty() const { return patterns_.empty(); } - - const PatternList& patterns() const { return patterns_; } - void AddPattern(const URLPattern& pattern) { patterns_.push_back(pattern); } - void ClearPaths() { patterns_.clear(); } + const GURL& origin() const { return origin_; } + void set_origin(const GURL& val) { origin_ = val; } bool ContainsURL(const GURL& url) const; private: - // The list of URL patterns that comprise the extent. - PatternList patterns_; + // The security origin (scheme+host+port) of the extent. + GURL origin_; + + // A set of path prefixes that further restrict the set of valid URLs below + // origin_. This may be empty. + std::vector<std::string> paths_; }; #endif // CHROME_COMMON_EXTENSIONS_EXTENSION_EXTENT_H_ diff --git a/chrome/common/extensions/extension_extent_unittest.cc b/chrome/common/extensions/extension_extent_unittest.cc index 41f2d15..4e308fa 100644 --- a/chrome/common/extensions/extension_extent_unittest.cc +++ b/chrome/common/extensions/extension_extent_unittest.cc @@ -14,22 +14,44 @@ TEST(ExtensionExtentTest, Empty) { EXPECT_FALSE(extent.ContainsURL(GURL("invalid"))); } -TEST(ExtensionExtentTest, One) { +TEST(ExtensionExtentTest, OriginOnly) { ExtensionExtent extent; - extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); + extent.set_origin(GURL("http://www.google.com/")); EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo/bar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/?stuff#here"))); + EXPECT_FALSE(extent.ContainsURL(GURL("https://www.google.com/"))); - EXPECT_FALSE(extent.ContainsURL(GURL("https://www.microsoft.com/"))); + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com:8080/"))); } -TEST(ExtensionExtentTest, Two) { +TEST(ExtensionExtentTest, OriginAndOnePath) { ExtensionExtent extent; - extent.AddPattern(*URLPattern::CreateFromString("http://www.google.com/*")); - extent.AddPattern(*URLPattern::CreateFromString("http://www.yahoo.com/*")); + extent.set_origin(GURL("http://www.google.com/")); + extent.add_path("foo"); + + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/"))); + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/fo"))); + + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/FOO"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo/bar"))); +} + +TEST(ExtensionExtentTest, OriginAndTwoPaths) { + ExtensionExtent extent; + extent.set_origin(GURL("http://www.google.com/")); + extent.add_path("foo"); + extent.add_path("hot"); + + EXPECT_FALSE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/monkey"))); - EXPECT_TRUE(extent.ContainsURL(GURL("http://www.yahoo.com/monkey"))); - EXPECT_FALSE(extent.ContainsURL(GURL("https://www.apple.com/monkey"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foo"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/hot"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/foobar"))); + EXPECT_TRUE(extent.ContainsURL(GURL("http://www.google.com/hotdog"))); } diff --git a/chrome/common/extensions/extension_manifests_unittest.cc b/chrome/common/extensions/extension_manifests_unittest.cc index f91fdef..21f38537 100644 --- a/chrome/common/extensions/extension_manifests_unittest.cc +++ b/chrome/common/extensions/extension_manifests_unittest.cc @@ -87,34 +87,35 @@ TEST_F(ManifestTest, AppsDisabledByDefault) { TEST_F(ManifestTest, ValidApp) { scoped_ptr<Extension> extension(LoadAndExpectSuccess("valid_app.json")); - ASSERT_EQ(2u, extension->web_extent().patterns().size()); - EXPECT_EQ("http://www.google.com/mail/*", - extension->web_extent().patterns()[0].GetAsString()); - EXPECT_EQ("http://www.google.com/foobar/*", - extension->web_extent().patterns()[1].GetAsString()); + EXPECT_EQ(GURL("http://www.google.com/"), extension->web_extent().origin()); + EXPECT_EQ(2u, extension->web_extent().paths().size()); + EXPECT_EQ("mail/", extension->web_extent().paths()[0]); + EXPECT_EQ("foobar/", extension->web_extent().paths()[1]); EXPECT_EQ(Extension::LAUNCH_WINDOW, extension->launch_container()); EXPECT_EQ(false, extension->launch_fullscreen()); - EXPECT_EQ("http://www.google.com/mail/", extension->launch_web_url()); + EXPECT_EQ("mail/", extension->launch_web_url()); } -TEST_F(ManifestTest, AppWebUrls) { - LoadAndExpectError("web_urls_wrong_type.json", - errors::kInvalidWebURLs); - LoadAndExpectError("web_urls_invalid_1.json", - ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, "0")); - LoadAndExpectError("web_urls_invalid_2.json", +TEST_F(ManifestTest, AppWebOrigin) { + LoadAndExpectError("web_origin_wrong_type.json", + errors::kInvalidWebOrigin); + LoadAndExpectError("web_origin_invalid_1.json", + errors::kInvalidWebOrigin); + LoadAndExpectError("web_origin_invalid_2.json", + errors::kInvalidWebOrigin); + LoadAndExpectError("web_origin_invalid_3.json", + errors::kInvalidWebOrigin); +} + +TEST_F(ManifestTest, AppWebPaths) { + LoadAndExpectError("web_paths_wrong_type.json", + errors::kInvalidWebPaths); + LoadAndExpectError("web_paths_invalid_path_1.json", ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, "0")); - LoadAndExpectError("web_urls_invalid_3.json", + errors::kInvalidWebPath, "0")); + LoadAndExpectError("web_paths_invalid_path_2.json", ExtensionErrorUtils::FormatErrorMessage( - errors::kInvalidWebURL, "0")); - - scoped_ptr<Extension> extension( - LoadAndExpectSuccess("web_urls_default.json")); - ASSERT_EQ(1u, extension->web_extent().patterns().size()); - EXPECT_EQ("http://www.google.com/*", - extension->web_extent().patterns()[0].GetAsString()); + errors::kInvalidWebPath, "0")); } TEST_F(ManifestTest, AppLaunchContainer) { @@ -174,8 +175,9 @@ TEST_F(ManifestTest, AppLaunchURL) { EXPECT_EQ(extension->url().spec() + "launch.html", extension->GetFullLaunchURL().spec()); - LoadAndExpectError("launch_web_url_relative.json", - errors::kInvalidLaunchWebURL); + extension.reset(LoadAndExpectSuccess("launch_web_url_relative.json")); + EXPECT_EQ(GURL("http://www.google.com/launch.html"), + extension->GetFullLaunchURL()); extension.reset(LoadAndExpectSuccess("launch_web_url_absolute.json")); EXPECT_EQ(GURL("http://www.google.com/launch.html"), diff --git a/chrome/common/extensions/url_pattern.cc b/chrome/common/extensions/url_pattern.cc index 1aae528..e129903 100644 --- a/chrome/common/extensions/url_pattern.cc +++ b/chrome/common/extensions/url_pattern.cc @@ -4,7 +4,6 @@ #include "chrome/common/extensions/url_pattern.h" -#include "base/scoped_ptr.h" #include "base/string_piece.h" #include "base/string_util.h" #include "chrome/common/url_constants.h" @@ -22,15 +21,6 @@ static const char* kValidSchemes[] = { static const char kPathSeparator[] = "/"; // static -URLPattern* URLPattern::CreateFromString(const std::string& pattern_string) { - scoped_ptr<URLPattern> pattern(new URLPattern); - if (pattern->Parse(pattern_string)) - return pattern.release(); - else - return NULL; -} - -// static bool URLPattern::IsValidScheme(const std::string& scheme) { for (size_t i = 0; i < arraysize(kValidSchemes); ++i) { if (scheme == kValidSchemes[i]) @@ -88,7 +78,6 @@ bool URLPattern::Parse(const std::string& pattern) { } path_ = pattern.substr(path_start_pos); - return true; } @@ -105,14 +94,6 @@ bool URLPattern::MatchesUrl(const GURL &test) const { return true; } -bool URLPattern::MatchesHost(const std::string& host) const { - std::string test(chrome::kHttpScheme); - test += chrome::kStandardSchemeSeparator; - test += host; - test += "/"; - return MatchesHost(GURL(test)); -} - bool URLPattern::MatchesHost(const GURL& test) const { // If the hosts are exactly equal, we have a match. if (test.host() == host_) diff --git a/chrome/common/extensions/url_pattern.h b/chrome/common/extensions/url_pattern.h index e25faaf..dba393a 100644 --- a/chrome/common/extensions/url_pattern.h +++ b/chrome/common/extensions/url_pattern.h @@ -73,9 +73,6 @@ class URLPattern { // otherwise. static bool IsValidScheme(const std::string& scheme); - // Convenience to create a pattern from a string. - static URLPattern* CreateFromString(const std::string& pattern); - URLPattern() : match_subdomains_(false) {} // Initializes this instance by parsing the provided string. On failure, the @@ -85,13 +82,6 @@ class URLPattern { // Returns true if this instance matches the specified URL. bool MatchesUrl(const GURL& url) const; - // Returns true if |test| matches our host. - bool MatchesHost(const std::string& host) const; - bool MatchesHost(const GURL& test) const; - - // Returns true if |test| matches our path. - bool MatchesPath(const GURL& test) const; - std::string GetAsString() const; // Get the scheme the pattern matches. This will always return a valid scheme @@ -117,6 +107,12 @@ class URLPattern { } private: + // Returns true if |test| matches our host. + bool MatchesHost(const GURL& test) const; + + // Returns true if |test| matches our path. + bool MatchesPath(const GURL& test) const; + // The scheme for the pattern. std::string scheme_; diff --git a/chrome/common/render_messages.h b/chrome/common/render_messages.h index 061a236..2b757e9 100644 --- a/chrome/common/render_messages.h +++ b/chrome/common/render_messages.h @@ -2683,21 +2683,25 @@ template <> struct ParamTraits<ExtensionExtent> { typedef ExtensionExtent param_type; static void Write(Message* m, const param_type& p) { - WriteParam(m, p.patterns()); + WriteParam(m, p.origin()); + WriteParam(m, p.paths()); } static bool Read(const Message* m, void** iter, param_type* p) { - std::vector<URLPattern> patterns; + GURL origin; + std::vector<std::string> paths; bool success = - ReadParam(m, iter, &patterns); + ReadParam(m, iter, &origin) && + ReadParam(m, iter, &paths); if (!success) return false; - for (size_t i = 0; i < patterns.size(); ++i) - p->AddPattern(patterns[i]); + p->set_origin(origin); + for (size_t i = 0; i < paths.size(); ++i) + p->add_path(paths[i]); return true; } static void Log(const param_type& p, std::wstring* l) { - LogParam(p.patterns(), l); + LogParam(p.origin(), l); } }; diff --git a/chrome/test/data/extensions/api_test/app_background_page/app_has_permission/manifest.json b/chrome/test/data/extensions/api_test/app_background_page/app_has_permission/manifest.json index e3b9689..765a6c9 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/app_has_permission/manifest.json +++ b/chrome/test/data/extensions/api_test/app_background_page/app_has_permission/manifest.json @@ -2,9 +2,9 @@ "name": "App", "version": "0.1", "app": { - "urls": [ - "http://a.com:1337/" - ], + "web_content": { + "origin": "http://a.com:1337" + }, "launch": { "web_url": "/" } diff --git a/chrome/test/data/extensions/api_test/app_background_page/app_lacks_permission/manifest.json b/chrome/test/data/extensions/api_test/app_background_page/app_lacks_permission/manifest.json index ac4571f..aa27fae 100644 --- a/chrome/test/data/extensions/api_test/app_background_page/app_lacks_permission/manifest.json +++ b/chrome/test/data/extensions/api_test/app_background_page/app_lacks_permission/manifest.json @@ -2,9 +2,9 @@ "name": "App", "version": "0.1", "app": { - "urls": [ - "http://a.com:1337/" - ], + "web_content": { + "origin": "http://a.com:1337" + }, "launch": { "web_url": "/" } diff --git a/chrome/test/data/extensions/api_test/app_process/manifest.json b/chrome/test/data/extensions/api_test/app_process/manifest.json index eecde07..19a31f6 100644 --- a/chrome/test/data/extensions/api_test/app_process/manifest.json +++ b/chrome/test/data/extensions/api_test/app_process/manifest.json @@ -5,9 +5,12 @@ "background_page": "test.html", "permissions": ["tabs"], "app": { - "urls": [ - "http://localhost:1337/files/extensions/api_test/app_process/path1", - "http://localhost:1337/files/extensions/api_test/app_process/path2" + "web_content": { + "origin": "http://localhost:1337/", + "paths": [ + "files/extensions/api_test/app_process/path1", + "files/extensions/api_test/app_process/path2" + ] }, "launch": { "web_url": "foo.html" diff --git a/chrome/test/data/extensions/app1/manifest.json b/chrome/test/data/extensions/app1/manifest.json index c3e1eee..9692490 100644 --- a/chrome/test/data/extensions/app1/manifest.json +++ b/chrome/test/data/extensions/app1/manifest.json @@ -2,12 +2,12 @@ "name": "Test App 1", "version": "1", "app": { - "urls": [ - "http://www.example.com/path1", - "http://www.example.com/path2" - ], + "web_content": { + "origin": "http://www.example.com/", + "paths": ["path1", "path2"] + }, "launch": { - "web_url": "http://www.example.com/path1/foo.html" + "web_url": "foo.html" } } } diff --git a/chrome/test/data/extensions/app2/manifest.json b/chrome/test/data/extensions/app2/manifest.json index 195e21d..b32b5c2 100644 --- a/chrome/test/data/extensions/app2/manifest.json +++ b/chrome/test/data/extensions/app2/manifest.json @@ -2,12 +2,12 @@ "name": "Test App 2", "version": "1", "app": { - "urls": [ - "http://www.example.com/path3", - "http://www.example.com/path4" - ], + "web_content": { + "origin": "http://www.example.com/", + "paths": ["path3", "path4"] + }, "launch": { - "web_url": "http://www.examle.com/path4/foo.html" + "web_url": "foo.html" } } } diff --git a/chrome/test/data/extensions/app3/manifest.json b/chrome/test/data/extensions/app3/manifest.json index 5c59f4f..08c616d 100644 --- a/chrome/test/data/extensions/app3/manifest.json +++ b/chrome/test/data/extensions/app3/manifest.json @@ -2,12 +2,12 @@ "name": "Test App 3", "version": "1", "app": { - "urls": [ - "http://www.example.com/path1/should_overlap", - "http://www.example.com/path5" - ], + "web_content": { + "origin": "http://www.example.com/", + "paths": ["path1/should_overlap", "path5"] + }, "launch": { - "web_url": "http://www.example.com/path5/foo.html" + "web_url": "foo.html" } } } diff --git a/chrome/test/data/extensions/manifest_tests/launch_web_url_relative.json b/chrome/test/data/extensions/manifest_tests/launch_web_url_relative.json index 7e2e867..1652c36 100644 --- a/chrome/test/data/extensions/manifest_tests/launch_web_url_relative.json +++ b/chrome/test/data/extensions/manifest_tests/launch_web_url_relative.json @@ -2,9 +2,9 @@ "name": "test", "version": "1", "app": { - "urls": [ - "http://www.google.com/" - ], + "web_content": { + "origin": "http://www.google.com/" + }, "launch": { "web_url": "launch.html" } diff --git a/chrome/test/data/extensions/manifest_tests/valid_app.json b/chrome/test/data/extensions/manifest_tests/valid_app.json index c829abc..db53b3b 100644 --- a/chrome/test/data/extensions/manifest_tests/valid_app.json +++ b/chrome/test/data/extensions/manifest_tests/valid_app.json @@ -2,13 +2,16 @@ "name": "test", "version": "1", "app": { - "urls": [ - "http://www.google.com/mail/", - "http://www.google.com/foobar/" - ], + "web_content": { + "origin": "http://www.google.com/", + "paths": [ + "mail/", + "foobar/" + ] + }, "launch": { "container": "window", - "web_url": "http://www.google.com/mail/" + "web_url": "mail/" } }, "permissions": [ diff --git a/chrome/test/data/extensions/manifest_tests/web_origin_invalid_1.json b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_1.json new file mode 100644 index 0000000..171745a --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_1.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "origin": "wiggity" + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_origin_invalid_2.json b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_2.json new file mode 100644 index 0000000..e8ec0ef --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_2.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "origin": "ftp://www.google.com/" + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_origin_invalid_3.json b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_3.json new file mode 100644 index 0000000..af93225 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_origin_invalid_3.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "origin": "https://www.google.com/monkey" + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_origin_wrong_type.json b/chrome/test/data/extensions/manifest_tests/web_origin_wrong_type.json new file mode 100644 index 0000000..930038b --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_origin_wrong_type.json @@ -0,0 +1,12 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "origin": 42 + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_1.json b/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_1.json new file mode 100644 index 0000000..f29782e --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_1.json @@ -0,0 +1,14 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "paths": [ + 42 + ] + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_2.json b/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_2.json new file mode 100644 index 0000000..faa9460 --- /dev/null +++ b/chrome/test/data/extensions/manifest_tests/web_paths_invalid_path_2.json @@ -0,0 +1,14 @@ +{ + "name": "test", + "version": "1", + "app": { + "web_content": { + "paths": [ + "http://www.google.com/monkey" + ] + }, + "launch": { + "web_url": "foo.html" + } + } +} diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_wrong_type.json b/chrome/test/data/extensions/manifest_tests/web_paths_wrong_type.json index bdfcce3..356e6a2 100644 --- a/chrome/test/data/extensions/manifest_tests/web_urls_wrong_type.json +++ b/chrome/test/data/extensions/manifest_tests/web_paths_wrong_type.json @@ -2,9 +2,11 @@ "name": "test", "version": "1", "app": { - "urls": 42, + "web_content": { + "paths": 42 + }, "launch": { - "web_url": "http://www.google.com/foo.html" + "web_url": "foo.html" } } } diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_1.json b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_1.json deleted file mode 100644 index 3ebb985..0000000 --- a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_1.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "test", - "version": "1", - "app": { - "urls": [ - 42 - ], - "launch": { - "web_url": "http://www.google.com/foo.html" - } - } -} diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_2.json b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_2.json deleted file mode 100644 index a5a3c69..0000000 --- a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_2.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "test", - "version": "1", - "app": { - "urls": [ - "monkey" - ], - "launch": { - "web_url": "http://www.google.com/foo.html" - } - } -} diff --git a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_3.json b/chrome/test/data/extensions/manifest_tests/web_urls_invalid_3.json deleted file mode 100644 index b48b356..0000000 --- a/chrome/test/data/extensions/manifest_tests/web_urls_invalid_3.json +++ /dev/null @@ -1,12 +0,0 @@ -{ - "name": "test", - "version": "1", - "app": { - "urls": [ - "http://www.google.com/mon*key" - ], - "launch": { - "web_url": "http://www.google.com/foo.html" - } - } -} |