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

Side by Side Diff: third_party/WebKit/Source/core/page/EventSource.cpp

Issue 1749153002: CORS-RFC1918: Teach ResourceRequest about "external" requests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Jochen's feedback. Created 4 years, 9 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 /* 1 /*
2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved. 2 * Copyright (C) 2009, 2012 Ericsson AB. All rights reserved.
3 * Copyright (C) 2010 Apple Inc. All rights reserved. 3 * Copyright (C) 2010 Apple Inc. All rights reserved.
4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved. 4 * Copyright (C) 2011, Code Aurora Forum. All rights reserved.
5 * 5 *
6 * Redistribution and use in source and binary forms, with or without 6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions 7 * modification, are permitted provided that the following conditions
8 * are met: 8 * are met:
9 * 9 *
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 ASSERT(m_state == CONNECTING); 114 ASSERT(m_state == CONNECTING);
115 ASSERT(!m_loader); 115 ASSERT(!m_loader);
116 ASSERT(executionContext()); 116 ASSERT(executionContext());
117 117
118 ExecutionContext& executionContext = *this->executionContext(); 118 ExecutionContext& executionContext = *this->executionContext();
119 ResourceRequest request(m_url); 119 ResourceRequest request(m_url);
120 request.setHTTPMethod(HTTPNames::GET); 120 request.setHTTPMethod(HTTPNames::GET);
121 request.setHTTPHeaderField(HTTPNames::Accept, "text/event-stream"); 121 request.setHTTPHeaderField(HTTPNames::Accept, "text/event-stream");
122 request.setHTTPHeaderField(HTTPNames::Cache_Control, "no-cache"); 122 request.setHTTPHeaderField(HTTPNames::Cache_Control, "no-cache");
123 request.setRequestContext(WebURLRequest::RequestContextEventSource); 123 request.setRequestContext(WebURLRequest::RequestContextEventSource);
124 request.setExternalRequestStateFromRequestorAddressSpace(executionContext.se curityContext().addressSpace());
124 if (m_parser && !m_parser->lastEventId().isEmpty()) { 125 if (m_parser && !m_parser->lastEventId().isEmpty()) {
125 // HTTP headers are Latin-1 byte strings, but the Last-Event-ID header i s encoded as UTF-8. 126 // HTTP headers are Latin-1 byte strings, but the Last-Event-ID header i s encoded as UTF-8.
126 // TODO(davidben): This should be captured in the type of setHTTPHeaderF ield's arguments. 127 // TODO(davidben): This should be captured in the type of setHTTPHeaderF ield's arguments.
127 CString lastEventIdUtf8 = m_parser->lastEventId().utf8(); 128 CString lastEventIdUtf8 = m_parser->lastEventId().utf8();
128 request.setHTTPHeaderField(HTTPNames::Last_Event_ID, AtomicString(reinte rpret_cast<const LChar*>(lastEventIdUtf8.data()), lastEventIdUtf8.length())); 129 request.setHTTPHeaderField(HTTPNames::Last_Event_ID, AtomicString(reinte rpret_cast<const LChar*>(lastEventIdUtf8.data()), lastEventIdUtf8.length()));
129 } 130 }
130 131
131 SecurityOrigin* origin = executionContext.securityOrigin(); 132 SecurityOrigin* origin = executionContext.securityOrigin();
132 133
133 ThreadableLoaderOptions options; 134 ThreadableLoaderOptions options;
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 348
348 DEFINE_TRACE(EventSource) 349 DEFINE_TRACE(EventSource)
349 { 350 {
350 visitor->trace(m_parser); 351 visitor->trace(m_parser);
351 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); 352 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor);
352 ContextLifecycleObserver::trace(visitor); 353 ContextLifecycleObserver::trace(visitor);
353 EventSourceParser::Client::trace(visitor); 354 EventSourceParser::Client::trace(visitor);
354 } 355 }
355 356
356 } // namespace blink 357 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698