| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 } | 369 } |
| 370 | 370 |
| 371 void LocalDOMWindow::enqueueDocumentEvent(Event* event) { | 371 void LocalDOMWindow::enqueueDocumentEvent(Event* event) { |
| 372 if (!m_eventQueue) | 372 if (!m_eventQueue) |
| 373 return; | 373 return; |
| 374 event->setTarget(m_document.get()); | 374 event->setTarget(m_document.get()); |
| 375 m_eventQueue->enqueueEvent(event); | 375 m_eventQueue->enqueueEvent(event); |
| 376 } | 376 } |
| 377 | 377 |
| 378 void LocalDOMWindow::dispatchWindowLoadEvent() { | 378 void LocalDOMWindow::dispatchWindowLoadEvent() { |
| 379 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 379 #if DCHECK_IS_ON() |
| 380 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 381 #endif |
| 380 // Delay 'load' event if we are in EventQueueScope. This is a short-term | 382 // Delay 'load' event if we are in EventQueueScope. This is a short-term |
| 381 // workaround to avoid Editing code crashes. We should always dispatch | 383 // workaround to avoid Editing code crashes. We should always dispatch |
| 382 // 'load' event asynchronously. crbug.com/569511. | 384 // 'load' event asynchronously. crbug.com/569511. |
| 383 if (ScopedEventQueue::instance()->shouldQueueEvents() && m_document) { | 385 if (ScopedEventQueue::instance()->shouldQueueEvents() && m_document) { |
| 384 m_document->postTask( | 386 m_document->postTask( |
| 385 BLINK_FROM_HERE, | 387 BLINK_FROM_HERE, |
| 386 createSameThreadTask(&LocalDOMWindow::dispatchLoadEvent, | 388 createSameThreadTask(&LocalDOMWindow::dispatchLoadEvent, |
| 387 wrapPersistent(this))); | 389 wrapPersistent(this))); |
| 388 return; | 390 return; |
| 389 } | 391 } |
| (...skipping 1022 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1412 owner->dispatchLoad(); | 1414 owner->dispatchLoad(); |
| 1413 | 1415 |
| 1414 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad", | 1416 TRACE_EVENT_INSTANT1("devtools.timeline", "MarkLoad", |
| 1415 TRACE_EVENT_SCOPE_THREAD, "data", | 1417 TRACE_EVENT_SCOPE_THREAD, "data", |
| 1416 InspectorMarkLoadEvent::data(frame())); | 1418 InspectorMarkLoadEvent::data(frame())); |
| 1417 InspectorInstrumentation::loadEventFired(frame()); | 1419 InspectorInstrumentation::loadEventFired(frame()); |
| 1418 } | 1420 } |
| 1419 | 1421 |
| 1420 DispatchEventResult LocalDOMWindow::dispatchEvent(Event* event, | 1422 DispatchEventResult LocalDOMWindow::dispatchEvent(Event* event, |
| 1421 EventTarget* target) { | 1423 EventTarget* target) { |
| 1422 ASSERT(!EventDispatchForbiddenScope::isEventDispatchForbidden()); | 1424 #if DCHECK_IS_ON() |
| 1425 DCHECK(!EventDispatchForbiddenScope::isEventDispatchForbidden()); |
| 1426 #endif |
| 1423 | 1427 |
| 1424 event->setTrusted(true); | 1428 event->setTrusted(true); |
| 1425 event->setTarget(target ? target : this); | 1429 event->setTarget(target ? target : this); |
| 1426 event->setCurrentTarget(this); | 1430 event->setCurrentTarget(this); |
| 1427 event->setEventPhase(Event::kAtTarget); | 1431 event->setEventPhase(Event::kAtTarget); |
| 1428 | 1432 |
| 1429 TRACE_EVENT1("devtools.timeline", "EventDispatch", "data", | 1433 TRACE_EVENT1("devtools.timeline", "EventDispatch", "data", |
| 1430 InspectorEventDispatchEvent::data(*event)); | 1434 InspectorEventDispatchEvent::data(*event)); |
| 1431 return fireEventListeners(event); | 1435 return fireEventListeners(event); |
| 1432 } | 1436 } |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1554 | 1558 |
| 1555 LocalFrame* LocalDOMWindow::frame() const { | 1559 LocalFrame* LocalDOMWindow::frame() const { |
| 1556 // If the LocalDOMWindow still has a frame reference, that frame must point | 1560 // If the LocalDOMWindow still has a frame reference, that frame must point |
| 1557 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1561 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
| 1558 // where script execution leaks between different LocalDOMWindows. | 1562 // where script execution leaks between different LocalDOMWindows. |
| 1559 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); | 1563 SECURITY_DCHECK(!m_frame || m_frame->domWindow() == this); |
| 1560 return m_frame; | 1564 return m_frame; |
| 1561 } | 1565 } |
| 1562 | 1566 |
| 1563 } // namespace blink | 1567 } // namespace blink |
| OLD | NEW |