| 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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 | 427 |
| 428 void LocalDOMWindow::enqueueHashchangeEvent(const String& oldURL, const String&
newURL) | 428 void LocalDOMWindow::enqueueHashchangeEvent(const String& oldURL, const String&
newURL) |
| 429 { | 429 { |
| 430 enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL)); | 430 enqueueWindowEvent(HashChangeEvent::create(oldURL, newURL)); |
| 431 } | 431 } |
| 432 | 432 |
| 433 void LocalDOMWindow::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stat
eObject) | 433 void LocalDOMWindow::enqueuePopstateEvent(PassRefPtr<SerializedScriptValue> stat
eObject) |
| 434 { | 434 { |
| 435 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs
to fire asynchronously | 435 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=36202 Popstate event needs
to fire asynchronously |
| 436 dispatchEvent(PopStateEvent::create(stateObject, history())); | 436 dispatchEvent(PopStateEvent::create(std::move(stateObject), history())); |
| 437 } | 437 } |
| 438 | 438 |
| 439 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) | 439 void LocalDOMWindow::statePopped(PassRefPtr<SerializedScriptValue> stateObject) |
| 440 { | 440 { |
| 441 if (!frame()) | 441 if (!frame()) |
| 442 return; | 442 return; |
| 443 | 443 |
| 444 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we | 444 // Per step 11 of section 6.5.9 (history traversal) of the HTML5 spec, we |
| 445 // defer firing of popstate until we're in the complete state. | 445 // defer firing of popstate until we're in the complete state. |
| 446 if (document()->isLoadCompleted()) | 446 if (document()->isLoadCompleted()) |
| 447 enqueuePopstateEvent(stateObject); | 447 enqueuePopstateEvent(std::move(stateObject)); |
| 448 else | 448 else |
| 449 m_pendingStateObject = stateObject; | 449 m_pendingStateObject = stateObject; |
| 450 } | 450 } |
| 451 | 451 |
| 452 LocalDOMWindow::~LocalDOMWindow() | 452 LocalDOMWindow::~LocalDOMWindow() |
| 453 { | 453 { |
| 454 // Cleared when detaching document. | 454 // Cleared when detaching document. |
| 455 ASSERT(!m_eventQueue); | 455 ASSERT(!m_eventQueue); |
| 456 } | 456 } |
| 457 | 457 |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 if (!m_navigator) | 649 if (!m_navigator) |
| 650 m_navigator = Navigator::create(frame()); | 650 m_navigator = Navigator::create(frame()); |
| 651 return m_navigator.get(); | 651 return m_navigator.get(); |
| 652 } | 652 } |
| 653 | 653 |
| 654 void LocalDOMWindow::schedulePostMessage(MessageEvent* event, PassRefPtr<Securit
yOrigin> target, Document* source) | 654 void LocalDOMWindow::schedulePostMessage(MessageEvent* event, PassRefPtr<Securit
yOrigin> target, Document* source) |
| 655 { | 655 { |
| 656 // Allowing unbounded amounts of messages to build up for a suspended contex
t | 656 // Allowing unbounded amounts of messages to build up for a suspended contex
t |
| 657 // is problematic; consider imposing a limit or other restriction if this | 657 // is problematic; consider imposing a limit or other restriction if this |
| 658 // surfaces often as a problem (see crbug.com/587012). | 658 // surfaces often as a problem (see crbug.com/587012). |
| 659 PostMessageTimer* timer = new PostMessageTimer(*this, event, target, SourceL
ocation::capture(source), UserGestureIndicator::currentToken()); | 659 PostMessageTimer* timer = new PostMessageTimer(*this, event, std::move(targe
t), SourceLocation::capture(source), UserGestureIndicator::currentToken()); |
| 660 timer->startOneShot(0, BLINK_FROM_HERE); | 660 timer->startOneShot(0, BLINK_FROM_HERE); |
| 661 timer->suspendIfNeeded(); | 661 timer->suspendIfNeeded(); |
| 662 m_postMessageTimers.add(timer); | 662 m_postMessageTimers.add(timer); |
| 663 } | 663 } |
| 664 | 664 |
| 665 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) | 665 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) |
| 666 { | 666 { |
| 667 if (!isCurrentlyDisplayedInFrame()) | 667 if (!isCurrentlyDisplayedInFrame()) |
| 668 return; | 668 return; |
| 669 | 669 |
| (...skipping 864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1534 { | 1534 { |
| 1535 // If the LocalDOMWindow still has a frame reference, that frame must point | 1535 // If the LocalDOMWindow still has a frame reference, that frame must point |
| 1536 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation | 1536 // back to this LocalDOMWindow: otherwise, it's easy to get into a situation |
| 1537 // where script execution leaks between different LocalDOMWindows. | 1537 // where script execution leaks between different LocalDOMWindows. |
| 1538 if (m_frameObserver->frame()) | 1538 if (m_frameObserver->frame()) |
| 1539 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); | 1539 ASSERT_WITH_SECURITY_IMPLICATION(m_frameObserver->frame()->domWindow() =
= this); |
| 1540 return m_frameObserver->frame(); | 1540 return m_frameObserver->frame(); |
| 1541 } | 1541 } |
| 1542 | 1542 |
| 1543 } // namespace blink | 1543 } // namespace blink |
| OLD | NEW |