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

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

Issue 2642213002: [Presentation API] fix DCHECK failure if PresentationRequest::create() throws SecurityError (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
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() || parsedUrl.protocolIsAbout()) {
88 exceptionState.throwDOMException( 88 exceptionState.throwDOMException(
89 SyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL."); 89 SyntaxError, "'" + urls[i] + "' can't be resolved to a valid URL.");
90 return nullptr; 90 return nullptr;
91 } 91 }
92 92
93 if (MixedContentChecker::isMixedContent( 93 if (MixedContentChecker::isMixedContent(
94 executionContext->getSecurityOrigin(), parsedUrl)) { 94 executionContext->getSecurityOrigin(), parsedUrl)) {
95 exceptionState.throwDOMException( 95 exceptionState.throwSecurityError(
96 SecurityError, "Presentation of an insecure document [" + urls[i] + 96 "Presentation of an insecure document [" + urls[i] +
97 "] is prohibited from a secure context."); 97 "] is prohibited from a secure context.");
98 return nullptr; 98 return nullptr;
99 } 99 }
100 100
101 parsedUrls[i] = parsedUrl; 101 parsedUrls[i] = parsedUrl;
102 } 102 }
103 return new PresentationRequest(executionContext, parsedUrls); 103 return new PresentationRequest(executionContext, parsedUrls);
104 } 104 }
105 105
106 const AtomicString& PresentationRequest::interfaceName() const { 106 const AtomicString& PresentationRequest::interfaceName() const {
107 return EventTargetNames::PresentationRequest; 107 return EventTargetNames::PresentationRequest;
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 visitor->trace(m_availabilityProperty); 221 visitor->trace(m_availabilityProperty);
222 EventTargetWithInlineData::trace(visitor); 222 EventTargetWithInlineData::trace(visitor);
223 ContextLifecycleObserver::trace(visitor); 223 ContextLifecycleObserver::trace(visitor);
224 } 224 }
225 225
226 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, 226 PresentationRequest::PresentationRequest(ExecutionContext* executionContext,
227 const Vector<KURL>& urls) 227 const Vector<KURL>& urls)
228 : ContextLifecycleObserver(executionContext), m_urls(urls) {} 228 : ContextLifecycleObserver(executionContext), m_urls(urls) {}
229 229
230 } // namespace blink 230 } // namespace blink
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698