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

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, 3 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 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
312 312
313 void EventSource::didFailRedirectCheck() 313 void EventSource::didFailRedirectCheck()
314 { 314 {
315 abortConnectionAttempt(); 315 abortConnectionAttempt();
316 } 316 }
317 317
318 void EventSource::abortConnectionAttempt() 318 void EventSource::abortConnectionAttempt()
319 { 319 {
320 ASSERT(m_state == CONNECTING); 320 ASSERT(m_state == CONNECTING);
321 321
322 if (m_requestInFlight) { 322 m_loader = nullptr;
323 m_loader->cancel(); 323 m_state = CLOSED;
324 } else { 324 networkRequestEnded();
325 m_state = CLOSED;
326 }
327 325
328 ASSERT(m_state == CLOSED);
329 dispatchEvent(Event::create(EventTypeNames::error)); 326 dispatchEvent(Event::create(EventTypeNames::error));
330 } 327 }
331 328
332 void EventSource::parseEventStream() 329 void EventSource::parseEventStream()
333 { 330 {
334 unsigned bufPos = 0; 331 unsigned bufPos = 0;
335 unsigned bufSize = m_receiveBuf.size(); 332 unsigned bufSize = m_receiveBuf.size();
336 while (bufPos < bufSize) { 333 while (bufPos < bufSize) {
337 if (m_discardTrailingNewline) { 334 if (m_discardTrailingNewline) {
338 if (m_receiveBuf[bufPos] == '\n') 335 if (m_receiveBuf[bufPos] == '\n')
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 return event.release(); 446 return event.release();
450 } 447 }
451 448
452 DEFINE_TRACE(EventSource) 449 DEFINE_TRACE(EventSource)
453 { 450 {
454 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor); 451 RefCountedGarbageCollectedEventTargetWithInlineData::trace(visitor);
455 ActiveDOMObject::trace(visitor); 452 ActiveDOMObject::trace(visitor);
456 } 453 }
457 454
458 } // namespace blink 455 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698