Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(133)

Side by Side Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 1497743005: Allow huge data: URIs only via WebView.loadDataWithBaseUrl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the test Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/child/service_worker/service_worker_dispatcher.h" 5 #include "content/child/service_worker/service_worker_dispatcher.h"
6 6
7 #include "base/lazy_instance.h" 7 #include "base/lazy_instance.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/thread_task_runner_handle.h" 10 #include "base/thread_task_runner_handle.h"
11 #include "base/threading/thread_local.h" 11 #include "base/threading/thread_local.h"
12 #include "base/trace_event/trace_event.h" 12 #include "base/trace_event/trace_event.h"
13 #include "content/child/service_worker/service_worker_handle_reference.h" 13 #include "content/child/service_worker/service_worker_handle_reference.h"
14 #include "content/child/service_worker/service_worker_provider_context.h" 14 #include "content/child/service_worker/service_worker_provider_context.h"
15 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h" 15 #include "content/child/service_worker/service_worker_registration_handle_refere nce.h"
16 #include "content/child/service_worker/web_service_worker_impl.h" 16 #include "content/child/service_worker/web_service_worker_impl.h"
17 #include "content/child/service_worker/web_service_worker_registration_impl.h" 17 #include "content/child/service_worker/web_service_worker_registration_impl.h"
18 #include "content/child/thread_safe_sender.h" 18 #include "content/child/thread_safe_sender.h"
19 #include "content/child/webmessageportchannel_impl.h" 19 #include "content/child/webmessageportchannel_impl.h"
20 #include "content/common/service_worker/service_worker_messages.h" 20 #include "content/common/service_worker/service_worker_messages.h"
21 #include "content/common/service_worker/service_worker_types.h" 21 #include "content/common/service_worker/service_worker_types.h"
22 #include "content/public/common/url_utils.h" 22 #include "content/public/common/content_constants.h"
23 #include "third_party/WebKit/public/platform/WebString.h" 23 #include "third_party/WebKit/public/platform/WebString.h"
24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerProviderClient.h" 24 #include "third_party/WebKit/public/platform/modules/serviceworker/WebServiceWor kerProviderClient.h"
25 25
26 using blink::WebServiceWorkerError; 26 using blink::WebServiceWorkerError;
27 using blink::WebServiceWorkerProvider; 27 using blink::WebServiceWorkerProvider;
28 using base::ThreadLocalPointer; 28 using base::ThreadLocalPointer;
29 29
30 namespace content { 30 namespace content {
31 31
32 namespace { 32 namespace {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 return thread_safe_sender_->Send(msg); 104 return thread_safe_sender_->Send(msg);
105 } 105 }
106 106
107 void ServiceWorkerDispatcher::RegisterServiceWorker( 107 void ServiceWorkerDispatcher::RegisterServiceWorker(
108 int provider_id, 108 int provider_id,
109 const GURL& pattern, 109 const GURL& pattern,
110 const GURL& script_url, 110 const GURL& script_url,
111 WebServiceWorkerRegistrationCallbacks* callbacks) { 111 WebServiceWorkerRegistrationCallbacks* callbacks) {
112 DCHECK(callbacks); 112 DCHECK(callbacks);
113 113
114 if (pattern.possibly_invalid_spec().size() > GetMaxURLChars() || 114 if (pattern.possibly_invalid_spec().size() > kMaxURLChars ||
115 script_url.possibly_invalid_spec().size() > GetMaxURLChars()) { 115 script_url.possibly_invalid_spec().size() > kMaxURLChars) {
116 scoped_ptr<WebServiceWorkerRegistrationCallbacks> 116 scoped_ptr<WebServiceWorkerRegistrationCallbacks>
117 owned_callbacks(callbacks); 117 owned_callbacks(callbacks);
118 std::string error_message(kServiceWorkerRegisterErrorPrefix); 118 std::string error_message(kServiceWorkerRegisterErrorPrefix);
119 error_message += "The provided scriptURL or scope is too long."; 119 error_message += "The provided scriptURL or scope is too long.";
120 callbacks->onError( 120 callbacks->onError(
121 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity, 121 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
122 blink::WebString::fromUTF8(error_message))); 122 blink::WebString::fromUTF8(error_message)));
123 return; 123 return;
124 } 124 }
125 125
(...skipping 29 matching lines...) Expand all
155 thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker( 155 thread_safe_sender_->Send(new ServiceWorkerHostMsg_UnregisterServiceWorker(
156 CurrentWorkerId(), request_id, provider_id, registration_id)); 156 CurrentWorkerId(), request_id, provider_id, registration_id));
157 } 157 }
158 158
159 void ServiceWorkerDispatcher::GetRegistration( 159 void ServiceWorkerDispatcher::GetRegistration(
160 int provider_id, 160 int provider_id,
161 const GURL& document_url, 161 const GURL& document_url,
162 WebServiceWorkerGetRegistrationCallbacks* callbacks) { 162 WebServiceWorkerGetRegistrationCallbacks* callbacks) {
163 DCHECK(callbacks); 163 DCHECK(callbacks);
164 164
165 if (document_url.possibly_invalid_spec().size() > GetMaxURLChars()) { 165 if (document_url.possibly_invalid_spec().size() > kMaxURLChars) {
166 scoped_ptr<WebServiceWorkerGetRegistrationCallbacks> owned_callbacks( 166 scoped_ptr<WebServiceWorkerGetRegistrationCallbacks> owned_callbacks(
167 callbacks); 167 callbacks);
168 std::string error_message(kServiceWorkerGetRegistrationErrorPrefix); 168 std::string error_message(kServiceWorkerGetRegistrationErrorPrefix);
169 error_message += "The provided documentURL is too long."; 169 error_message += "The provided documentURL is too long.";
170 callbacks->onError( 170 callbacks->onError(
171 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity, 171 WebServiceWorkerError(WebServiceWorkerError::ErrorTypeSecurity,
172 blink::WebString::fromUTF8(error_message))); 172 blink::WebString::fromUTF8(error_message)));
173 return; 173 return;
174 } 174 }
175 175
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after
766 return ServiceWorkerRegistrationHandleReference::Adopt( 766 return ServiceWorkerRegistrationHandleReference::Adopt(
767 info, thread_safe_sender_.get()); 767 info, thread_safe_sender_.get());
768 } 768 }
769 769
770 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt( 770 scoped_ptr<ServiceWorkerHandleReference> ServiceWorkerDispatcher::Adopt(
771 const ServiceWorkerObjectInfo& info) { 771 const ServiceWorkerObjectInfo& info) {
772 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get()); 772 return ServiceWorkerHandleReference::Adopt(info, thread_safe_sender_.get());
773 } 773 }
774 774
775 } // namespace content 775 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl_unittest.cc ('k') | content/common/common_param_traits_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698