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

Side by Side Diff: content/renderer/service_worker/service_worker_script_context.cc

Issue 980383004: Relax same-origin policy for ServiceWorker openWindow() in Chromium. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: reject Created 5 years, 9 months 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/renderer/service_worker/service_worker_script_context.h" 5 #include "content/renderer/service_worker/service_worker_script_context.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "content/child/notifications/notification_data_conversions.h" 10 #include "content/child/notifications/notification_data_conversions.h"
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
479 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client; 479 scoped_ptr<blink::WebServiceWorkerClientInfo> web_client;
480 if (!client.IsEmpty()) { 480 if (!client.IsEmpty()) {
481 DCHECK(client.IsValid()); 481 DCHECK(client.IsValid());
482 web_client.reset(new blink::WebServiceWorkerClientInfo( 482 web_client.reset(new blink::WebServiceWorkerClientInfo(
483 ToWebServiceWorkerClientInfo(client))); 483 ToWebServiceWorkerClientInfo(client)));
484 } 484 }
485 callbacks->onSuccess(web_client.release()); 485 callbacks->onSuccess(web_client.release());
486 pending_client_callbacks_.Remove(request_id); 486 pending_client_callbacks_.Remove(request_id);
487 } 487 }
488 488
489 void ServiceWorkerScriptContext::OnOpenWindowError(int request_id) { 489 void ServiceWorkerScriptContext::OnOpenWindowError(
490 int request_id,
491 const std::string& message) {
490 TRACE_EVENT0("ServiceWorker", 492 TRACE_EVENT0("ServiceWorker",
491 "ServiceWorkerScriptContext::OnOpenWindowError"); 493 "ServiceWorkerScriptContext::OnOpenWindowError");
492 blink::WebServiceWorkerClientCallbacks* callbacks = 494 blink::WebServiceWorkerClientCallbacks* callbacks =
493 pending_client_callbacks_.Lookup(request_id); 495 pending_client_callbacks_.Lookup(request_id);
494 if (!callbacks) { 496 if (!callbacks) {
495 NOTREACHED() << "Got stray response: " << request_id; 497 NOTREACHED() << "Got stray response: " << request_id;
496 return; 498 return;
497 } 499 }
498 scoped_ptr<blink::WebServiceWorkerError> error( 500 scoped_ptr<blink::WebServiceWorkerError> error(
499 new blink::WebServiceWorkerError( 501 new blink::WebServiceWorkerError(
500 blink::WebServiceWorkerError::ErrorTypeUnknown, 502 blink::WebServiceWorkerError::ErrorTypeUnknown,
501 "Something went wrong while trying to open the window.")); 503 blink::WebString::fromLatin1(message)));
falken 2015/03/08 12:23:49 nit: WebString::fromUTF8() is much more widely use
mlamouri (slow - plz ping) 2015/03/08 14:34:12 Done.
502 callbacks->onError(error.release()); 504 callbacks->onError(error.release());
503 pending_client_callbacks_.Remove(request_id); 505 pending_client_callbacks_.Remove(request_id);
504 } 506 }
505 507
506 void ServiceWorkerScriptContext::OnFocusClientResponse( 508 void ServiceWorkerScriptContext::OnFocusClientResponse(
507 int request_id, const ServiceWorkerClientInfo& client) { 509 int request_id, const ServiceWorkerClientInfo& client) {
508 TRACE_EVENT0("ServiceWorker", 510 TRACE_EVENT0("ServiceWorker",
509 "ServiceWorkerScriptContext::OnFocusClientResponse"); 511 "ServiceWorkerScriptContext::OnFocusClientResponse");
510 blink::WebServiceWorkerClientCallbacks* callback = 512 blink::WebServiceWorkerClientCallbacks* callback =
511 pending_client_callbacks_.Lookup(request_id); 513 pending_client_callbacks_.Lookup(request_id);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
572 new blink::WebServiceWorkerError(error_type, message)); 574 new blink::WebServiceWorkerError(error_type, message));
573 callbacks->onError(error.release()); 575 callbacks->onError(error.release());
574 pending_claim_clients_callbacks_.Remove(request_id); 576 pending_claim_clients_callbacks_.Remove(request_id);
575 } 577 }
576 578
577 void ServiceWorkerScriptContext::OnPing() { 579 void ServiceWorkerScriptContext::OnPing() {
578 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID())); 580 Send(new ServiceWorkerHostMsg_Pong(GetRoutingID()));
579 } 581 }
580 582
581 } // namespace content 583 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698