summaryrefslogtreecommitdiffstats
path: root/extensions/renderer
diff options
context:
space:
mode:
authoranthonyvd <anthonyvd@chromium.org>2015-10-26 14:55:05 -0700
committerCommit bot <commit-bot@chromium.org>2015-10-26 21:56:39 +0000
commit5708524cd0517ad825093d8cb4e9171ca99b3f42 (patch)
treecd97bf671009f3907dcd5957b4c32b3f0f2abf7b /extensions/renderer
parent1ec8f0200769b6975989cc0b9c74ec8c5e4d0e11 (diff)
downloadchromium_src-5708524cd0517ad825093d8cb4e9171ca99b3f42.zip
chromium_src-5708524cd0517ad825093d8cb4e9171ca99b3f42.tar.gz
chromium_src-5708524cd0517ad825093d8cb4e9171ca99b3f42.tar.bz2
Revert of [Extensions] Migrate ServiceWorker off behavior feature system (patchset #1 id:1 of https://codereview.chromium.org/1417563005/ )
Reason for revert: Reverting because this CL appears to be causing failures on this bot: https://build.chromium.org/p/chromium.win/builders/Win%20x64%20Builder%20%28dbg%29/builds/14499 . Original issue's description: > [Extensions] Migrate ServiceWorker off behavior feature system > > The FeatureSystem is failing to retrieve the behavior feature for service > workers, but the only reason this seems to be the case is because of > potential corruption in the JSON files (or the JSON parser otherwise choking). > For now, to reduce the crash rates, just migrate the service worker restriction > off the behavior feature system. > > BUG=461915 > > Committed: https://crrev.com/2507a2fcd25244dadb7dfcc316426bee7b1df275 > Cr-Commit-Position: refs/heads/master@{#356123} TBR=rockot@chromium.org,rdevlin.cronin@chromium.org NOPRESUBMIT=true NOTREECHECKS=true NOTRY=true BUG=461915 Review URL: https://codereview.chromium.org/1412683007 Cr-Commit-Position: refs/heads/master@{#356137}
Diffstat (limited to 'extensions/renderer')
-rw-r--r--extensions/renderer/dispatcher.cc10
-rw-r--r--extensions/renderer/dispatcher.h3
2 files changed, 13 insertions, 0 deletions
diff --git a/extensions/renderer/dispatcher.cc b/extensions/renderer/dispatcher.cc
index 7f3a28f..fa73ccc 100644
--- a/extensions/renderer/dispatcher.cc
+++ b/extensions/renderer/dispatcher.cc
@@ -1069,6 +1069,7 @@ void Dispatcher::OnMessageInvoke(const std::string& extension_id,
void Dispatcher::OnSetChannel(int channel) {
delegate_->SetChannel(channel);
+ AddChannelSpecificFeatures();
}
void Dispatcher::OnSetScriptingWhitelist(
@@ -1599,4 +1600,13 @@ void Dispatcher::RequireGuestViewModules(ScriptContext* context) {
}
}
+void Dispatcher::AddChannelSpecificFeatures() {
+ // chrome-extension: resources should be allowed to register a Service Worker.
+ if (FeatureProvider::GetBehaviorFeature(BehaviorFeature::kServiceWorker)
+ ->IsAvailableToEnvironment()
+ .is_available())
+ WebSecurityPolicy::registerURLSchemeAsAllowingServiceWorkers(
+ WebString::fromUTF8(kExtensionScheme));
+}
+
} // namespace extensions
diff --git a/extensions/renderer/dispatcher.h b/extensions/renderer/dispatcher.h
index 434dcde..09cb0d4 100644
--- a/extensions/renderer/dispatcher.h
+++ b/extensions/renderer/dispatcher.h
@@ -246,6 +246,9 @@ class Dispatcher : public content::RenderProcessObserver,
// |context|.
void RequireGuestViewModules(ScriptContext* context);
+ // Adds features that are specific to the current channel.
+ void AddChannelSpecificFeatures();
+
// The delegate for this dispatcher. Not owned, but must extend beyond the
// Dispatcher's own lifetime.
DispatcherDelegate* delegate_;