| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2010 Apple Inc. All rights reserved. |
| 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) | 3 * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) |
| 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) | 4 * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
orchmobile.com/) |
| 5 * Copyright (C) 2009 Adam Barth. All rights reserved. | 5 * Copyright (C) 2009 Adam Barth. All rights reserved. |
| 6 * | 6 * |
| 7 * Redistribution and use in source and binary forms, with or without | 7 * Redistribution and use in source and binary forms, with or without |
| 8 * modification, are permitted provided that the following conditions | 8 * modification, are permitted provided that the following conditions |
| 9 * are met: | 9 * are met: |
| 10 * | 10 * |
| (...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 bool m_wasUserGesture; | 101 bool m_wasUserGesture; |
| 102 RefPtr<UserGestureToken> m_userGestureToken; | 102 RefPtr<UserGestureToken> m_userGestureToken; |
| 103 }; | 103 }; |
| 104 | 104 |
| 105 class ScheduledURLNavigation : public ScheduledNavigation { | 105 class ScheduledURLNavigation : public ScheduledNavigation { |
| 106 protected: | 106 protected: |
| 107 ScheduledURLNavigation(double delay, Document* originDocument, const String&
url, bool replacesCurrentItem, bool isLocationChange) | 107 ScheduledURLNavigation(double delay, Document* originDocument, const String&
url, bool replacesCurrentItem, bool isLocationChange) |
| 108 : ScheduledNavigation(delay, originDocument, replacesCurrentItem, isLoca
tionChange) | 108 : ScheduledNavigation(delay, originDocument, replacesCurrentItem, isLoca
tionChange) |
| 109 , m_url(url) | 109 , m_url(url) |
| 110 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy
) | 110 , m_shouldCheckMainWorldContentSecurityPolicy(CheckContentSecurityPolicy
) |
| 111 , m_originWorld(nullptr) |
| 111 { | 112 { |
| 112 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument)) | 113 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument)) |
| 113 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur
ityPolicy; | 114 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur
ityPolicy; |
| 115 |
| 116 // Store the world id of the frame requesting the navigation in case it'
s a 'javascript:...' url. |
| 117 if (v8::Isolate::GetCurrent()->InContext()) { |
| 118 m_originWorld = PassRefPtr<DOMWrapperWorld>(DOMWrapperWorld::current
(v8::Isolate::GetCurrent()).originWorld()); |
| 119 } |
| 114 } | 120 } |
| 115 | 121 |
| 116 void fire(LocalFrame* frame) override | 122 void fire(LocalFrame* frame) override |
| 117 { | 123 { |
| 118 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat
or(); | 124 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat
or(); |
| 125 // Ensure the origin world gets propagated to the navigation and is rese
t afterwards. |
| 126 DOMWrapperWorld::OriginWorldScope worldScope(m_originWorld); |
| 119 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck
MainWorldContentSecurityPolicy); | 127 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck
MainWorldContentSecurityPolicy); |
| 120 request.setReplacesCurrentItem(replacesCurrentItem()); | 128 request.setReplacesCurrentItem(replacesCurrentItem()); |
| 121 request.setClientRedirect(ClientRedirect); | 129 request.setClientRedirect(ClientRedirect); |
| 122 frame->loader().load(request); | 130 frame->loader().load(request); |
| 123 } | 131 } |
| 124 | 132 |
| 125 String url() const { return m_url; } | 133 String url() const { return m_url; } |
| 126 | 134 |
| 127 private: | 135 private: |
| 128 String m_url; | 136 String m_url; |
| 137 RefPtr<DOMWrapperWorld> m_originWorld; |
| 129 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy
; | 138 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy
; |
| 130 }; | 139 }; |
| 131 | 140 |
| 132 class ScheduledRedirect final : public ScheduledURLNavigation { | 141 class ScheduledRedirect final : public ScheduledURLNavigation { |
| 133 public: | 142 public: |
| 134 static PassOwnPtrWillBeRawPtr<ScheduledRedirect> create(double delay, Docume
nt* originDocument, const String& url, bool replacesCurrentItem) | 143 static PassOwnPtrWillBeRawPtr<ScheduledRedirect> create(double delay, Docume
nt* originDocument, const String& url, bool replacesCurrentItem) |
| 135 { | 144 { |
| 136 return adoptPtrWillBeNoop(new ScheduledRedirect(delay, originDocument, u
rl, replacesCurrentItem)); | 145 return adoptPtrWillBeNoop(new ScheduledRedirect(delay, originDocument, u
rl, replacesCurrentItem)); |
| 137 } | 146 } |
| 138 | 147 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 m_redirect.clear(); | 440 m_redirect.clear(); |
| 432 } | 441 } |
| 433 | 442 |
| 434 DEFINE_TRACE(NavigationScheduler) | 443 DEFINE_TRACE(NavigationScheduler) |
| 435 { | 444 { |
| 436 visitor->trace(m_frame); | 445 visitor->trace(m_frame); |
| 437 visitor->trace(m_redirect); | 446 visitor->trace(m_redirect); |
| 438 } | 447 } |
| 439 | 448 |
| 440 } // namespace blink | 449 } // namespace blink |
| OLD | NEW |