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

Side by Side Diff: third_party/WebKit/Source/modules/presentation/PresentationRequest.cpp

Issue 2566503002: Adds HTTP check to PresentationRequest creation. (Closed)
Patch Set: Updates browser test. Created 3 years, 11 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 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
77 if (urls.isEmpty()) { 77 if (urls.isEmpty()) {
78 exceptionState.throwDOMException(NotSupportedError, 78 exceptionState.throwDOMException(NotSupportedError,
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> parsedUrls(urls.size()); 83 Vector<KURL> parsedUrls(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& parsedUrl = KURL(executionContext->url(), urls[i]); 85 const KURL& parsedUrl = KURL(executionContext->url(), urls[i]);
86 86
87 if (!parsedUrl.isValid() || parsedUrl.protocolIsAbout()) { 87 if (!parsedUrl.isValid() ||
88 !(parsedUrl.protocolIsInHTTPFamily() || parsedUrl.protocolIs("cast"))) {
88 exceptionState.throwDOMException( 89 exceptionState.throwDOMException(
89 SyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL."); 90 SyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL.");
90 return nullptr; 91 return nullptr;
91 } 92 }
92 93
93 if (MixedContentChecker::isMixedContent( 94 if (MixedContentChecker::isMixedContent(
94 executionContext->getSecurityOrigin(), parsedUrl)) { 95 executionContext->getSecurityOrigin(), parsedUrl)) {
95 exceptionState.throwDOMException( 96 exceptionState.throwDOMException(
96 SecurityError, "Presentation of an insecure document [" + urls[i] + 97 SecurityError, "Presentation of an insecure document [" + urls[i] +
97 "] is prohibited from a secure context."); 98 "] is prohibited from a secure context.");
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 visitor->trace(m_availabilityProperty); 222 visitor->trace(m_availabilityProperty);
222 EventTargetWithInlineData::trace(visitor); 223 EventTargetWithInlineData::trace(visitor);
223 ContextLifecycleObserver::trace(visitor); 224 ContextLifecycleObserver::trace(visitor);
224 } 225 }
225 226
226 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, 227 PresentationRequest::PresentationRequest(ExecutionContext* executionContext,
227 const Vector<KURL>& urls) 228 const Vector<KURL>& urls)
228 : ContextLifecycleObserver(executionContext), m_urls(urls) {} 229 : ContextLifecycleObserver(executionContext), m_urls(urls) {}
229 230
230 } // namespace blink 231 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698