| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "modules/presentation/PresentationRequest.h" | 5 #include "modules/presentation/PresentationRequest.h" |
| 6 | 6 |
| 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" | 7 #include "bindings/core/v8/CallbackPromiseAdapter.h" |
| 8 #include "bindings/core/v8/ExceptionState.h" | 8 #include "bindings/core/v8/ExceptionState.h" |
| 9 #include "bindings/core/v8/ScriptPromise.h" | 9 #include "bindings/core/v8/ScriptPromise.h" |
| 10 #include "bindings/core/v8/ScriptPromiseResolver.h" | 10 #include "bindings/core/v8/ScriptPromiseResolver.h" |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 if (urls.IsEmpty()) { | 77 if (urls.IsEmpty()) { |
| 78 exception_state.ThrowDOMException(kNotSupportedError, | 78 exception_state.ThrowDOMException(kNotSupportedError, |
| 79 "Do not support empty sequence of URLs."); | 79 "Do not support empty sequence of URLs."); |
| 80 return nullptr; | 80 return nullptr; |
| 81 } | 81 } |
| 82 | 82 |
| 83 Vector<KURL> parsed_urls(urls.size()); | 83 Vector<KURL> parsed_urls(urls.size()); |
| 84 for (size_t i = 0; i < urls.size(); ++i) { | 84 for (size_t i = 0; i < urls.size(); ++i) { |
| 85 const KURL& parsed_url = KURL(execution_context->Url(), urls[i]); | 85 const KURL& parsed_url = KURL(execution_context->Url(), urls[i]); |
| 86 | 86 |
| 87 if (!parsed_url.IsValid() || !(parsed_url.ProtocolIsInHTTPFamily() || | 87 if (!parsed_url.IsValid()) { |
| 88 parsed_url.ProtocolIs("cast"))) { | |
| 89 exception_state.ThrowDOMException( | 88 exception_state.ThrowDOMException( |
| 90 kSyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL."); | 89 kSyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL."); |
| 91 return nullptr; | 90 return nullptr; |
| 92 } | 91 } |
| 93 | 92 |
| 94 if (MixedContentChecker::IsMixedContent( | 93 if (parsed_url.ProtocolIsInHTTPFamily() && |
| 94 MixedContentChecker::IsMixedContent( |
| 95 execution_context->GetSecurityOrigin(), parsed_url)) { | 95 execution_context->GetSecurityOrigin(), parsed_url)) { |
| 96 exception_state.ThrowSecurityError( | 96 exception_state.ThrowSecurityError( |
| 97 "Presentation of an insecure document [" + urls[i] + | 97 "Presentation of an insecure document [" + urls[i] + |
| 98 "] is prohibited from a secure context."); | 98 "] is prohibited from a secure context."); |
| 99 return nullptr; | 99 return nullptr; |
| 100 } | 100 } |
| 101 | 101 |
| 102 parsed_urls[i] = parsed_url; | 102 parsed_urls[i] = parsed_url; |
| 103 } | 103 } |
| 104 return new PresentationRequest(execution_context, parsed_urls); | 104 return new PresentationRequest(execution_context, parsed_urls); |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 if (execution_context->IsSecureContext()) { | 231 if (execution_context->IsSecureContext()) { |
| 232 UseCounter::Count(execution_context, | 232 UseCounter::Count(execution_context, |
| 233 UseCounter::kPresentationRequestSecureOrigin); | 233 UseCounter::kPresentationRequestSecureOrigin); |
| 234 } else { | 234 } else { |
| 235 UseCounter::Count(execution_context, | 235 UseCounter::Count(execution_context, |
| 236 UseCounter::kPresentationRequestInsecureOrigin); | 236 UseCounter::kPresentationRequestInsecureOrigin); |
| 237 } | 237 } |
| 238 } | 238 } |
| 239 | 239 |
| 240 } // namespace blink | 240 } // namespace blink |
| OLD | NEW |