| 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 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 #include "wtf/text/WTFString.h" | 105 #include "wtf/text/WTFString.h" |
| 106 #include <algorithm> | 106 #include <algorithm> |
| 107 | 107 |
| 108 using std::min; | 108 using std::min; |
| 109 using std::max; | 109 using std::max; |
| 110 | 110 |
| 111 namespace WebCore { | 111 namespace WebCore { |
| 112 | 112 |
| 113 class PostMessageTimer FINAL : public SuspendableTimer { | 113 class PostMessageTimer FINAL : public SuspendableTimer { |
| 114 public: | 114 public: |
| 115 PostMessageTimer(DOMWindow& window, PassRefPtr<SerializedScriptValue> messag
e, const String& sourceOrigin, PassRefPtr<DOMWindow> source, PassOwnPtr<MessageP
ortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<ScriptCallSt
ack> stackTrace) | 115 PostMessageTimer(DOMWindow& window, PassRefPtr<SerializedScriptValue> messag
e, const String& sourceOrigin, PassRefPtrWillBeRawPtr<DOMWindow> source, PassOwn
Ptr<MessagePortChannelArray> channels, SecurityOrigin* targetOrigin, PassRefPtr<
ScriptCallStack> stackTrace) |
| 116 : SuspendableTimer(window.document()) | 116 : SuspendableTimer(window.document()) |
| 117 , m_window(window) | 117 , m_window(&window) |
| 118 , m_message(message) | 118 , m_message(message) |
| 119 , m_origin(sourceOrigin) | 119 , m_origin(sourceOrigin) |
| 120 , m_source(source) | 120 , m_source(source) |
| 121 , m_channels(channels) | 121 , m_channels(channels) |
| 122 , m_targetOrigin(targetOrigin) | 122 , m_targetOrigin(targetOrigin) |
| 123 , m_stackTrace(stackTrace) | 123 , m_stackTrace(stackTrace) |
| 124 { | 124 { |
| 125 } | 125 } |
| 126 | 126 |
| 127 PassRefPtr<MessageEvent> event() | 127 PassRefPtr<MessageEvent> event() |
| 128 { | 128 { |
| 129 return MessageEvent::create(m_channels.release(), m_message, m_origin, S
tring(), m_source); | 129 return MessageEvent::create(m_channels.release(), m_message, m_origin, S
tring(), m_source.get()); |
| 130 | 130 |
| 131 } | 131 } |
| 132 SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } | 132 SecurityOrigin* targetOrigin() const { return m_targetOrigin.get(); } |
| 133 ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } | 133 ScriptCallStack* stackTrace() const { return m_stackTrace.get(); } |
| 134 | 134 |
| 135 private: | 135 private: |
| 136 virtual void fired() OVERRIDE | 136 virtual void fired() OVERRIDE |
| 137 { | 137 { |
| 138 m_window->postMessageTimerFired(adoptPtr(this)); | 138 m_window->postMessageTimerFired(adoptPtr(this)); |
| 139 // This object is deleted now. | 139 // This object is deleted now. |
| 140 } | 140 } |
| 141 | 141 |
| 142 RefPtr<DOMWindow> m_window; | 142 RefPtrWillBePersistent<DOMWindow> m_window; |
| 143 RefPtr<SerializedScriptValue> m_message; | 143 RefPtr<SerializedScriptValue> m_message; |
| 144 String m_origin; | 144 String m_origin; |
| 145 RefPtr<DOMWindow> m_source; | 145 RefPtrWillBePersistent<DOMWindow> m_source; |
| 146 OwnPtr<MessagePortChannelArray> m_channels; | 146 OwnPtr<MessagePortChannelArray> m_channels; |
| 147 RefPtr<SecurityOrigin> m_targetOrigin; | 147 RefPtr<SecurityOrigin> m_targetOrigin; |
| 148 RefPtr<ScriptCallStack> m_stackTrace; | 148 RefPtr<ScriptCallStack> m_stackTrace; |
| 149 }; | 149 }; |
| 150 | 150 |
| 151 static void disableSuddenTermination() | 151 static void disableSuddenTermination() |
| 152 { | 152 { |
| 153 blink::Platform::current()->suddenTerminationChanged(false); | 153 blink::Platform::current()->suddenTerminationChanged(false); |
| 154 } | 154 } |
| 155 | 155 |
| (...skipping 1597 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1753 // FIXME: The name canAccess seems to be a roundabout way to ask "can ex
ecute script". | 1753 // FIXME: The name canAccess seems to be a roundabout way to ask "can ex
ecute script". |
| 1754 // Can we name the SecurityOrigin function better to make this more clea
r? | 1754 // Can we name the SecurityOrigin function better to make this more clea
r? |
| 1755 if (callingWindow.document()->securityOrigin()->canAccess(document()->se
curityOrigin())) | 1755 if (callingWindow.document()->securityOrigin()->canAccess(document()->se
curityOrigin())) |
| 1756 return false; | 1756 return false; |
| 1757 } | 1757 } |
| 1758 | 1758 |
| 1759 printErrorMessage(crossDomainAccessErrorMessage(&callingWindow)); | 1759 printErrorMessage(crossDomainAccessErrorMessage(&callingWindow)); |
| 1760 return true; | 1760 return true; |
| 1761 } | 1761 } |
| 1762 | 1762 |
| 1763 PassRefPtr<DOMWindow> DOMWindow::open(const String& urlString, const AtomicStrin
g& frameName, const String& windowFeaturesString, | 1763 PassRefPtrWillBeRawPtr<DOMWindow> DOMWindow::open(const String& urlString, const
AtomicString& frameName, const String& windowFeaturesString, |
| 1764 DOMWindow* callingWindow, DOMWindow* enteredWindow) | 1764 DOMWindow* callingWindow, DOMWindow* enteredWindow) |
| 1765 { | 1765 { |
| 1766 if (!isCurrentlyDisplayedInFrame()) | 1766 if (!isCurrentlyDisplayedInFrame()) |
| 1767 return nullptr; | 1767 return nullptr; |
| 1768 Document* activeDocument = callingWindow->document(); | 1768 Document* activeDocument = callingWindow->document(); |
| 1769 if (!activeDocument) | 1769 if (!activeDocument) |
| 1770 return nullptr; | 1770 return nullptr; |
| 1771 LocalFrame* firstFrame = enteredWindow->frame(); | 1771 LocalFrame* firstFrame = enteredWindow->frame(); |
| 1772 if (!firstFrame) | 1772 if (!firstFrame) |
| 1773 return nullptr; | 1773 return nullptr; |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1859 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier() | 1859 DOMWindowLifecycleNotifier& DOMWindow::lifecycleNotifier() |
| 1860 { | 1860 { |
| 1861 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); | 1861 return static_cast<DOMWindowLifecycleNotifier&>(LifecycleContext<DOMWindow>:
:lifecycleNotifier()); |
| 1862 } | 1862 } |
| 1863 | 1863 |
| 1864 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() | 1864 PassOwnPtr<LifecycleNotifier<DOMWindow> > DOMWindow::createLifecycleNotifier() |
| 1865 { | 1865 { |
| 1866 return DOMWindowLifecycleNotifier::create(this); | 1866 return DOMWindowLifecycleNotifier::create(this); |
| 1867 } | 1867 } |
| 1868 | 1868 |
| 1869 void DOMWindow::trace(Visitor* visitor) |
| 1870 { |
| 1871 visitor->trace(m_screen); |
| 1872 visitor->trace(m_history); |
| 1873 visitor->trace(m_locationbar); |
| 1874 visitor->trace(m_menubar); |
| 1875 visitor->trace(m_personalbar); |
| 1876 visitor->trace(m_scrollbars); |
| 1877 visitor->trace(m_statusbar); |
| 1878 visitor->trace(m_toolbar); |
| 1879 visitor->trace(m_console); |
| 1880 visitor->trace(m_navigator); |
| 1881 visitor->trace(m_location); |
| 1882 visitor->trace(m_sessionStorage); |
| 1883 visitor->trace(m_localStorage); |
| 1884 visitor->trace(m_applicationCache); |
| 1885 visitor->trace(m_performance); |
| 1886 } |
| 1869 | 1887 |
| 1870 } // namespace WebCore | 1888 } // namespace WebCore |
| OLD | NEW |