| 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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 119         , m_stackTrace(stackTrace) | 119         , m_stackTrace(stackTrace) | 
| 120         , m_userGestureToken(userGestureToken) | 120         , m_userGestureToken(userGestureToken) | 
| 121     { | 121     { | 
| 122         m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti
      ng(executionContext(), "postMessage"); | 122         m_asyncOperationId = InspectorInstrumentation::traceAsyncOperationStarti
      ng(executionContext(), "postMessage"); | 
| 123     } | 123     } | 
| 124 | 124 | 
| 125     PassRefPtrWillBeRawPtr<MessageEvent> event() const { return m_event.get(); } | 125     PassRefPtrWillBeRawPtr<MessageEvent> event() const { return m_event.get(); } | 
| 126     SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } | 126     SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } | 
| 127     ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } | 127     ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } | 
| 128     UserGestureToken* userGestureToken() const { return m_userGestureToken.get()
      ; } | 128     UserGestureToken* userGestureToken() const { return m_userGestureToken.get()
      ; } | 
|  | 129     virtual void stop() override | 
|  | 130     { | 
|  | 131         SuspendableTimer::stop(); | 
|  | 132         // Will destroy this object | 
|  | 133         m_window->removePostMessageTimer(this); | 
|  | 134     } | 
| 129 | 135 | 
| 130     DEFINE_INLINE_VIRTUAL_TRACE() | 136     DEFINE_INLINE_VIRTUAL_TRACE() | 
| 131     { | 137     { | 
| 132         visitor->trace(m_event); | 138         visitor->trace(m_event); | 
| 133         visitor->trace(m_window); | 139         visitor->trace(m_window); | 
| 134         visitor->trace(m_stackTrace); | 140         visitor->trace(m_stackTrace); | 
| 135         SuspendableTimer::trace(visitor); | 141         SuspendableTimer::trace(visitor); | 
| 136     } | 142     } | 
| 137 | 143 | 
| 138 private: | 144 private: | 
| 139     virtual void fired() override | 145     virtual void fired() override | 
| 140     { | 146     { | 
| 141         InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceA
      syncOperationCompletedCallbackStarting(executionContext(), m_asyncOperationId); | 147         InspectorInstrumentationCookie cookie = InspectorInstrumentation::traceA
      syncOperationCompletedCallbackStarting(executionContext(), m_asyncOperationId); | 
| 142         m_window->postMessageTimerFired(this); | 148         m_window->postMessageTimerFired(this); | 
| 143         // This object is deleted now. | 149         // Will destroy this object | 
|  | 150         m_window->removePostMessageTimer(this); | 
| 144         InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 151         InspectorInstrumentation::traceAsyncCallbackCompleted(cookie); | 
| 145     } | 152     } | 
| 146 | 153 | 
| 147     RefPtrWillBeMember<MessageEvent> m_event; | 154     RefPtrWillBeMember<MessageEvent> m_event; | 
| 148     RawPtrWillBeMember<LocalDOMWindow> m_window; | 155     RawPtrWillBeMember<LocalDOMWindow> m_window; | 
| 149     RefPtr<SecurityOrigin> m_targetOrigin; | 156     RefPtr<SecurityOrigin> m_targetOrigin; | 
| 150     RefPtrWillBeMember<ScriptCallStack> m_stackTrace; | 157     RefPtrWillBeMember<ScriptCallStack> m_stackTrace; | 
| 151     RefPtr<UserGestureToken> m_userGestureToken; | 158     RefPtr<UserGestureToken> m_userGestureToken; | 
| 152     int m_asyncOperationId; | 159     int m_asyncOperationId; | 
| 153 }; | 160 }; | 
| (...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 643     // Schedule the message. | 650     // Schedule the message. | 
| 644     OwnPtrWillBeRawPtr<PostMessageTimer> timer = adoptPtrWillBeNoop(new PostMess
      ageTimer(*this, event, source, target, stackTrace, UserGestureIndicator::current
      Token())); | 651     OwnPtrWillBeRawPtr<PostMessageTimer> timer = adoptPtrWillBeNoop(new PostMess
      ageTimer(*this, event, source, target, stackTrace, UserGestureIndicator::current
      Token())); | 
| 645     timer->startOneShot(0, FROM_HERE); | 652     timer->startOneShot(0, FROM_HERE); | 
| 646     timer->suspendIfNeeded(); | 653     timer->suspendIfNeeded(); | 
| 647     m_postMessageTimers.add(timer.release()); | 654     m_postMessageTimers.add(timer.release()); | 
| 648 } | 655 } | 
| 649 | 656 | 
| 650 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) | 657 void LocalDOMWindow::postMessageTimerFired(PostMessageTimer* timer) | 
| 651 { | 658 { | 
| 652     if (!isCurrentlyDisplayedInFrame()) { | 659     if (!isCurrentlyDisplayedInFrame()) { | 
| 653         m_postMessageTimers.remove(timer); |  | 
| 654         return; | 660         return; | 
| 655     } | 661     } | 
| 656 | 662 | 
| 657     RefPtrWillBeRawPtr<MessageEvent> event = timer->event(); | 663     RefPtrWillBeRawPtr<MessageEvent> event = timer->event(); | 
| 658 | 664 | 
| 659     UserGestureIndicator gestureIndicator(timer->userGestureToken()); | 665     UserGestureIndicator gestureIndicator(timer->userGestureToken()); | 
| 660 | 666 | 
| 661     event->entangleMessagePorts(document()); | 667     event->entangleMessagePorts(document()); | 
| 662     dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
      ckTrace()); | 668     dispatchMessageEventWithOriginCheck(timer->targetOrigin(), event, timer->sta
      ckTrace()); | 
|  | 669 } | 
|  | 670 | 
|  | 671 void LocalDOMWindow::removePostMessageTimer(PostMessageTimer* timer) | 
|  | 672 { | 
| 663     m_postMessageTimers.remove(timer); | 673     m_postMessageTimers.remove(timer); | 
| 664 } | 674 } | 
| 665 | 675 | 
| 666 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
      dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
      tCallStack> stackTrace) | 676 void LocalDOMWindow::dispatchMessageEventWithOriginCheck(SecurityOrigin* intende
      dTargetOrigin, PassRefPtrWillBeRawPtr<Event> event, PassRefPtrWillBeRawPtr<Scrip
      tCallStack> stackTrace) | 
| 667 { | 677 { | 
| 668     if (intendedTargetOrigin) { | 678     if (intendedTargetOrigin) { | 
| 669         // Check target origin now since the target document may have changed si
      nce the timer was scheduled. | 679         // Check target origin now since the target document may have changed si
      nce the timer was scheduled. | 
| 670         if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
      in())) { | 680         if (!intendedTargetOrigin->isSameSchemeHostPort(document()->securityOrig
      in())) { | 
| 671             String message = ExceptionMessages::failedToExecute("postMessage", "
      DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
       "') does not match the recipient window's origin ('" + document()->securityOrig
      in()->toString() + "')."); | 681             String message = ExceptionMessages::failedToExecute("postMessage", "
      DOMWindow", "The target origin provided ('" + intendedTargetOrigin->toString() +
       "') does not match the recipient window's origin ('" + document()->securityOrig
      in()->toString() + "')."); | 
| 672             RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
      create(SecurityMessageSource, ErrorMessageLevel, message); | 682             RefPtrWillBeRawPtr<ConsoleMessage> consoleMessage = ConsoleMessage::
      create(SecurityMessageSource, ErrorMessageLevel, message); | 
| (...skipping 840 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1513     DOMWindow::trace(visitor); | 1523     DOMWindow::trace(visitor); | 
| 1514     DOMWindowLifecycleNotifier::trace(visitor); | 1524     DOMWindowLifecycleNotifier::trace(visitor); | 
| 1515 } | 1525 } | 
| 1516 | 1526 | 
| 1517 LocalFrame* LocalDOMWindow::frame() const | 1527 LocalFrame* LocalDOMWindow::frame() const | 
| 1518 { | 1528 { | 
| 1519     return m_frameObserver->frame(); | 1529     return m_frameObserver->frame(); | 
| 1520 } | 1530 } | 
| 1521 | 1531 | 
| 1522 } // namespace blink | 1532 } // namespace blink | 
| OLD | NEW | 
|---|