| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007 Apple Inc. All rights reserved. | 2 * Copyright (C) 2007 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 86 | 86 |
| 87 if (HistoryItem* historyItem = m_frame->loader().currentItem()) | 87 if (HistoryItem* historyItem = m_frame->loader().currentItem()) |
| 88 return historyItem->stateObject(); | 88 return historyItem->stateObject(); |
| 89 | 89 |
| 90 return 0; | 90 return 0; |
| 91 } | 91 } |
| 92 | 92 |
| 93 void History::setScrollRestoration(const String& value) | 93 void History::setScrollRestoration(const String& value) |
| 94 { | 94 { |
| 95 ASSERT(value == "manual" || value == "auto"); | 95 ASSERT(value == "manual" || value == "auto"); |
| 96 if (!m_frame || !m_frame->loader().client() || !RuntimeEnabledFeatures::scro
llRestorationEnabled()) | 96 if (!m_frame || !m_frame->loader().client()) |
| 97 return; | 97 return; |
| 98 | 98 |
| 99 HistoryScrollRestorationType scrollRestoration = value == "manual" ? ScrollR
estorationManual : ScrollRestorationAuto; | 99 HistoryScrollRestorationType scrollRestoration = value == "manual" ? ScrollR
estorationManual : ScrollRestorationAuto; |
| 100 if (scrollRestoration == scrollRestorationInternal()) | 100 if (scrollRestoration == scrollRestorationInternal()) |
| 101 return; | 101 return; |
| 102 | 102 |
| 103 if (HistoryItem* historyItem = m_frame->loader().currentItem()) { | 103 if (HistoryItem* historyItem = m_frame->loader().currentItem()) { |
| 104 historyItem->setScrollRestorationType(scrollRestoration); | 104 historyItem->setScrollRestorationType(scrollRestoration); |
| 105 m_frame->loader().client()->didUpdateCurrentHistoryItem(); | 105 m_frame->loader().client()->didUpdateCurrentHistoryItem(); |
| 106 } | 106 } |
| 107 } | 107 } |
| 108 | 108 |
| 109 String History::scrollRestoration() | 109 String History::scrollRestoration() |
| 110 { | 110 { |
| 111 return scrollRestorationInternal() == ScrollRestorationManual ? "manual" : "
auto"; | 111 return scrollRestorationInternal() == ScrollRestorationManual ? "manual" : "
auto"; |
| 112 } | 112 } |
| 113 | 113 |
| 114 HistoryScrollRestorationType History::scrollRestorationInternal() const | 114 HistoryScrollRestorationType History::scrollRestorationInternal() const |
| 115 { | 115 { |
| 116 if (m_frame && RuntimeEnabledFeatures::scrollRestorationEnabled()) { | 116 if (m_frame) { |
| 117 if (HistoryItem* historyItem = m_frame->loader().currentItem()) | 117 if (HistoryItem* historyItem = m_frame->loader().currentItem()) |
| 118 return historyItem->scrollRestorationType(); | 118 return historyItem->scrollRestorationType(); |
| 119 } | 119 } |
| 120 | 120 |
| 121 return ScrollRestorationAuto; | 121 return ScrollRestorationAuto; |
| 122 } | 122 } |
| 123 | 123 |
| 124 bool History::stateChanged() const | 124 bool History::stateChanged() const |
| 125 { | 125 { |
| 126 return m_lastStateObjectRequested != stateInternal(); | 126 return m_lastStateObjectRequested != stateInternal(); |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 if (!canChangeToUrl(fullURL, m_frame->document()->getSecurityOrigin(), m_fra
me->document()->url())) { | 211 if (!canChangeToUrl(fullURL, m_frame->document()->getSecurityOrigin(), m_fra
me->document()->url())) { |
| 212 // We can safely expose the URL to JavaScript, as a) no redirection take
s place: JavaScript already had this URL, b) JavaScript can only access a same-o
rigin History object. | 212 // We can safely expose the URL to JavaScript, as a) no redirection take
s place: JavaScript already had this URL, b) JavaScript can only access a same-o
rigin History object. |
| 213 exceptionState.throwSecurityError("A history state object with URL '" +
fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f
rame->document()->getSecurityOrigin()->toString() + "' and URL '" + m_frame->doc
ument()->url().elidedString() + "'."); | 213 exceptionState.throwSecurityError("A history state object with URL '" +
fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f
rame->document()->getSecurityOrigin()->toString() + "' and URL '" + m_frame->doc
ument()->url().elidedString() + "'."); |
| 214 return; | 214 return; |
| 215 } | 215 } |
| 216 | 216 |
| 217 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig
ationHistoryApi, std::move(data), restorationType, type, m_frame->document()); | 217 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig
ationHistoryApi, std::move(data), restorationType, type, m_frame->document()); |
| 218 } | 218 } |
| 219 | 219 |
| 220 } // namespace blink | 220 } // namespace blink |
| OLD | NEW |