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

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

Issue 2566503002: Adds HTTP check to PresentationRequest creation. (Closed)
Patch Set: Created 4 years 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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 } 63 }
64 64
65 } // anonymous namespace 65 } // anonymous namespace
66 66
67 // static 67 // static
68 PresentationRequest* PresentationRequest::create( 68 PresentationRequest* PresentationRequest::create(
69 ExecutionContext* executionContext, 69 ExecutionContext* executionContext,
70 const String& url, 70 const String& url,
71 ExceptionState& exceptionState) { 71 ExceptionState& exceptionState) {
72 KURL parsedUrl = KURL(executionContext->url(), url); 72 KURL parsedUrl = KURL(executionContext->url(), url);
73 if (!parsedUrl.isValid() || parsedUrl.protocolIsAbout()) { 73 if (!parsedUrl.isValid() || !parsedUrl.protocolIsInHTTPFamily() ||
zhaobin 2016/12/09 18:53:02 Remove parsedUrl.protocolIsAbout() check if we alr
CJ 2016/12/13 02:12:38 I'm not seeing how they overlap with each other. P
zhaobin 2016/12/13 19:06:02 !protocolIsInHTTPFamily() means not http or https.
CJ 2016/12/13 21:34:23 Done.
74 parsedUrl.protocolIsAbout()) {
74 exceptionState.throwTypeError("'" + url + 75 exceptionState.throwTypeError("'" + url +
75 "' can't be resolved to a valid URL."); 76 "' can't be resolved to a valid URL.");
76 return nullptr; 77 return nullptr;
77 } 78 }
78 79
79 PresentationRequest* request = 80 PresentationRequest* request =
80 new PresentationRequest(executionContext, parsedUrl); 81 new PresentationRequest(executionContext, parsedUrl);
81 request->suspendIfNeeded(); 82 request->suspendIfNeeded();
82 return request; 83 return request;
83 } 84 }
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
208 ActiveDOMObject::trace(visitor); 209 ActiveDOMObject::trace(visitor);
209 } 210 }
210 211
211 PresentationRequest::PresentationRequest(ExecutionContext* executionContext, 212 PresentationRequest::PresentationRequest(ExecutionContext* executionContext,
212 const KURL& url) 213 const KURL& url)
213 : ActiveScriptWrappable(this), 214 : ActiveScriptWrappable(this),
214 ActiveDOMObject(executionContext), 215 ActiveDOMObject(executionContext),
215 m_url(url) {} 216 m_url(url) {}
216 217
217 } // namespace blink 218 } // 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