| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 253 } | 253 } |
| 254 | 254 |
| 255 void ApplicationCacheHost::dispatchDOMEvent( | 255 void ApplicationCacheHost::dispatchDOMEvent( |
| 256 EventID id, | 256 EventID id, |
| 257 int progressTotal, | 257 int progressTotal, |
| 258 int progressDone, | 258 int progressDone, |
| 259 WebApplicationCacheHost::ErrorReason errorReason, | 259 WebApplicationCacheHost::ErrorReason errorReason, |
| 260 const String& errorURL, | 260 const String& errorURL, |
| 261 int errorStatus, | 261 int errorStatus, |
| 262 const String& errorMessage) { | 262 const String& errorMessage) { |
| 263 if (!m_domApplicationCache) | 263 // Don't dispatch an event if the window is detached. |
| 264 if (!m_domApplicationCache || !m_domApplicationCache->domWindow()) |
| 264 return; | 265 return; |
| 265 | 266 |
| 266 const AtomicString& eventType = ApplicationCache::toEventType(id); | 267 const AtomicString& eventType = ApplicationCache::toEventType(id); |
| 267 if (eventType.isEmpty() || !m_domApplicationCache->getExecutionContext()) | 268 if (eventType.isEmpty()) |
| 268 return; | 269 return; |
| 269 Event* event = nullptr; | 270 Event* event = nullptr; |
| 270 if (id == kProgressEvent) { | 271 if (id == kProgressEvent) { |
| 271 event = ProgressEvent::create(eventType, true, progressDone, progressTotal); | 272 event = ProgressEvent::create(eventType, true, progressDone, progressTotal); |
| 272 } else if (id == kErrorEvent) { | 273 } else if (id == kErrorEvent) { |
| 273 event = ApplicationCacheErrorEvent::create(errorReason, errorURL, | 274 event = ApplicationCacheErrorEvent::create(errorReason, errorURL, |
| 274 errorStatus, errorMessage); | 275 errorStatus, errorMessage); |
| 275 } else { | 276 } else { |
| 276 event = Event::create(eventType); | 277 event = Event::create(eventType); |
| 277 } | 278 } |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 336 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status, | 337 notifyApplicationCache(kErrorEvent, 0, 0, reason, url.string(), status, |
| 337 message); | 338 message); |
| 338 } | 339 } |
| 339 | 340 |
| 340 DEFINE_TRACE(ApplicationCacheHost) { | 341 DEFINE_TRACE(ApplicationCacheHost) { |
| 341 visitor->trace(m_domApplicationCache); | 342 visitor->trace(m_domApplicationCache); |
| 342 visitor->trace(m_documentLoader); | 343 visitor->trace(m_documentLoader); |
| 343 } | 344 } |
| 344 | 345 |
| 345 } // namespace blink | 346 } // namespace blink |
| OLD | NEW |