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

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

Issue 1262593004: Prevent ThreadableLoaderClient methods from being called after failure notification (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Rebase Created 5 years, 4 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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 308
309 void EventSource::didFailRedirectCheck() 309 void EventSource::didFailRedirectCheck()
310 { 310 {
311 abortConnectionAttempt(); 311 abortConnectionAttempt();
312 } 312 }
313 313
314 void EventSource::abortConnectionAttempt() 314 void EventSource::abortConnectionAttempt()
315 { 315 {
316 ASSERT(m_state == CONNECTING); 316 ASSERT(m_state == CONNECTING);
317 317
318 if (m_requestInFlight) { 318 m_loader = nullptr;
319 m_loader->cancel(); 319 m_state = CLOSED;
320 } else { 320 networkRequestEnded();
321 m_state = CLOSED;
322 }
323 321
324 ASSERT(m_state == CLOSED);
325 dispatchEvent(Event::create(EventTypeNames::error)); 322 dispatchEvent(Event::create(EventTypeNames::error));
326 } 323 }
327 324
328 void EventSource::parseEventStream() 325 void EventSource::parseEventStream()
329 { 326 {
330 unsigned bufPos = 0; 327 unsigned bufPos = 0;
331 unsigned bufSize = m_receiveBuf.size(); 328 unsigned bufSize = m_receiveBuf.size();
332 while (bufPos < bufSize) { 329 while (bufPos < bufSize) {
333 if (m_discardTrailingNewline) { 330 if (m_discardTrailingNewline) {
334 if (m_receiveBuf[bufPos] == '\n') 331 if (m_receiveBuf[bufPos] == '\n')
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 return event.release(); 442 return event.release();
446 } 443 }
447 444
448 DEFINE_TRACE(EventSource) 445 DEFINE_TRACE(EventSource)
449 { 446 {
450 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); 447 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor);
451 ActiveDOMObject::trace(visitor); 448 ActiveDOMObject::trace(visitor);
452 } 449 }
453 450
454 } // namespace blink 451 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698