| 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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 { | 111 { |
| 112 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument)) | 112 if (ContentSecurityPolicy::shouldBypassMainWorld(originDocument)) |
| 113 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur
ityPolicy; | 113 m_shouldCheckMainWorldContentSecurityPolicy = DoNotCheckContentSecur
ityPolicy; |
| 114 |
| 115 // Store the world id of the frame requesting the navigation in case it'
s a 'javascript:...' url. |
| 116 if (v8::Isolate::GetCurrent()->InContext()) { |
| 117 DOMWrapperWorld& creatingWorld = DOMWrapperWorld::current(v8::Isolat
e::GetCurrent()); |
| 118 m_originWorldId = creatingWorld.originWorldId(); |
| 119 } else { |
| 120 m_originWorldId = 0; |
| 121 } |
| 114 } | 122 } |
| 115 | 123 |
| 116 void fire(LocalFrame* frame) override | 124 void fire(LocalFrame* frame) override |
| 117 { | 125 { |
| 118 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat
or(); | 126 OwnPtr<UserGestureIndicator> gestureIndicator = createUserGestureIndicat
or(); |
| 127 // Ensure the parent world id gets propagated to the navigation and is r
eset afterwards. |
| 128 DOMWrapperWorld::ParentWorldIdPusher worldIdPusher(ScriptState::forMainW
orld(frame)->world(), m_originWorldId); |
| 119 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck
MainWorldContentSecurityPolicy); | 129 FrameLoadRequest request(originDocument(), m_url, "_self", m_shouldCheck
MainWorldContentSecurityPolicy); |
| 120 request.setReplacesCurrentItem(replacesCurrentItem()); | 130 request.setReplacesCurrentItem(replacesCurrentItem()); |
| 121 request.setClientRedirect(ClientRedirect); | 131 request.setClientRedirect(ClientRedirect); |
| 122 frame->loader().load(request); | 132 frame->loader().load(request); |
| 123 } | 133 } |
| 124 | 134 |
| 125 String url() const { return m_url; } | 135 String url() const { return m_url; } |
| 126 | 136 |
| 127 private: | 137 private: |
| 128 String m_url; | 138 String m_url; |
| 139 int m_originWorldId; |
| 129 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy
; | 140 ContentSecurityPolicyDisposition m_shouldCheckMainWorldContentSecurityPolicy
; |
| 130 }; | 141 }; |
| 131 | 142 |
| 132 class ScheduledRedirect final : public ScheduledURLNavigation { | 143 class ScheduledRedirect final : public ScheduledURLNavigation { |
| 133 public: | 144 public: |
| 134 static PassOwnPtrWillBeRawPtr<ScheduledRedirect> create(double delay, Docume
nt* originDocument, const String& url, bool replacesCurrentItem) | 145 static PassOwnPtrWillBeRawPtr<ScheduledRedirect> create(double delay, Docume
nt* originDocument, const String& url, bool replacesCurrentItem) |
| 135 { | 146 { |
| 136 return adoptPtrWillBeNoop(new ScheduledRedirect(delay, originDocument, u
rl, replacesCurrentItem)); | 147 return adoptPtrWillBeNoop(new ScheduledRedirect(delay, originDocument, u
rl, replacesCurrentItem)); |
| 137 } | 148 } |
| 138 | 149 |
| (...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 m_redirect.clear(); | 442 m_redirect.clear(); |
| 432 } | 443 } |
| 433 | 444 |
| 434 DEFINE_TRACE(NavigationScheduler) | 445 DEFINE_TRACE(NavigationScheduler) |
| 435 { | 446 { |
| 436 visitor->trace(m_frame); | 447 visitor->trace(m_frame); |
| 437 visitor->trace(m_redirect); | 448 visitor->trace(m_redirect); |
| 438 } | 449 } |
| 439 | 450 |
| 440 } // namespace blink | 451 } // namespace blink |
| OLD | NEW |