OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
285 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible); | 285 web_view_ = WebView::Create(nullptr, kWebPageVisibilityStateVisible); |
286 WebSettings* settings = web_view_->GetSettings(); | 286 WebSettings* settings = web_view_->GetSettings(); |
287 // FIXME: http://crbug.com/363843. This needs to find a better way to | 287 // FIXME: http://crbug.com/363843. This needs to find a better way to |
288 // not create graphics layers. | 288 // not create graphics layers. |
289 settings->SetAcceleratedCompositingEnabled(false); | 289 settings->SetAcceleratedCompositingEnabled(false); |
290 // Currently we block all mixed-content requests from a ServiceWorker. | 290 // Currently we block all mixed-content requests from a ServiceWorker. |
291 // FIXME: When we support FetchEvent.default(), we should relax this | 291 // FIXME: When we support FetchEvent.default(), we should relax this |
292 // restriction. | 292 // restriction. |
293 settings->SetStrictMixedContentChecking(true); | 293 settings->SetStrictMixedContentChecking(true); |
294 settings->SetAllowRunningOfInsecureContent(false); | 294 settings->SetAllowRunningOfInsecureContent(false); |
295 settings->SetDataSaverEnabled(worker_start_data_.data_saver_enabled); | 295 settings->SetDataSaverFlag(worker_start_data_.data_saver_flag); |
296 main_frame_ = ToWebLocalFrameBase(WebLocalFrame::Create( | 296 main_frame_ = ToWebLocalFrameBase(WebLocalFrame::Create( |
297 WebTreeScopeType::kDocument, this, nullptr, nullptr)); | 297 WebTreeScopeType::kDocument, this, nullptr, nullptr)); |
298 web_view_->SetMainFrame(main_frame_.Get()); | 298 web_view_->SetMainFrame(main_frame_.Get()); |
299 main_frame_->SetDevToolsAgentClient(this); | 299 main_frame_->SetDevToolsAgentClient(this); |
300 | 300 |
301 // If we were asked to wait for debugger then it is the good time to do that. | 301 // If we were asked to wait for debugger then it is the good time to do that. |
302 worker_context_client_->WorkerReadyForInspection(); | 302 worker_context_client_->WorkerReadyForInspection(); |
303 if (worker_start_data_.wait_for_debugger_mode == | 303 if (worker_start_data_.wait_for_debugger_mode == |
304 WebEmbeddedWorkerStartData::kWaitForDebugger) { | 304 WebEmbeddedWorkerStartData::kWaitForDebugger) { |
305 waiting_for_debugger_state_ = kWaitingForDebugger; | 305 waiting_for_debugger_state_ = kWaitingForDebugger; |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 ProvideServiceWorkerGlobalScopeClientToWorker( | 424 ProvideServiceWorkerGlobalScopeClientToWorker( |
425 worker_clients, | 425 worker_clients, |
426 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); | 426 ServiceWorkerGlobalScopeClientImpl::Create(*worker_context_client_)); |
427 ProvideServiceWorkerContainerClientToWorker( | 427 ProvideServiceWorkerContainerClientToWorker( |
428 worker_clients, worker_context_client_->CreateServiceWorkerProvider()); | 428 worker_clients, worker_context_client_->CreateServiceWorkerProvider()); |
429 | 429 |
430 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { | 430 if (RuntimeEnabledFeatures::offMainThreadFetchEnabled()) { |
431 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = | 431 std::unique_ptr<WebWorkerFetchContext> web_worker_fetch_context = |
432 worker_context_client_->CreateServiceWorkerFetchContext(); | 432 worker_context_client_->CreateServiceWorkerFetchContext(); |
433 DCHECK(web_worker_fetch_context); | 433 DCHECK(web_worker_fetch_context); |
434 web_worker_fetch_context->SetDataSaverEnabled( | 434 web_worker_fetch_context->SetDataSaverFlag( |
435 document->GetFrame()->GetSettings()->GetDataSaverEnabled()); | 435 document->GetFrame()->GetSettings()->GetDataSaverFlag()); |
436 ProvideWorkerFetchContextToWorker(worker_clients, | 436 ProvideWorkerFetchContextToWorker(worker_clients, |
437 std::move(web_worker_fetch_context)); | 437 std::move(web_worker_fetch_context)); |
438 } | 438 } |
439 | 439 |
440 // We need to set the CSP to both the shadow page's document and the | 440 // We need to set the CSP to both the shadow page's document and the |
441 // ServiceWorkerGlobalScope. | 441 // ServiceWorkerGlobalScope. |
442 document->InitContentSecurityPolicy( | 442 document->InitContentSecurityPolicy( |
443 main_script_loader_->ReleaseContentSecurityPolicy()); | 443 main_script_loader_->ReleaseContentSecurityPolicy()); |
444 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { | 444 if (!main_script_loader_->GetReferrerPolicy().IsNull()) { |
445 document->ParseAndSetReferrerPolicy( | 445 document->ParseAndSetReferrerPolicy( |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 // populate the task runners with null document not to confuse the frame | 480 // populate the task runners with null document not to confuse the frame |
481 // scheduler (which will end up using the thread's default task runner). | 481 // scheduler (which will end up using the thread's default task runner). |
482 worker_thread_->Start(std::move(startup_data), | 482 worker_thread_->Start(std::move(startup_data), |
483 ParentFrameTaskRunners::Create(nullptr)); | 483 ParentFrameTaskRunners::Create(nullptr)); |
484 | 484 |
485 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), | 485 worker_inspector_proxy_->WorkerThreadCreated(document, worker_thread_.get(), |
486 script_url); | 486 script_url); |
487 } | 487 } |
488 | 488 |
489 } // namespace blink | 489 } // namespace blink |
OLD | NEW |