| 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 30 matching lines...) Expand all Loading... |
| 41 #include "wtf/MainThread.h" | 41 #include "wtf/MainThread.h" |
| 42 | 42 |
| 43 namespace blink { | 43 namespace blink { |
| 44 | 44 |
| 45 History::History(LocalFrame* frame) | 45 History::History(LocalFrame* frame) |
| 46 : DOMWindowProperty(frame) | 46 : DOMWindowProperty(frame) |
| 47 , m_lastStateObjectRequested(nullptr) | 47 , m_lastStateObjectRequested(nullptr) |
| 48 { | 48 { |
| 49 } | 49 } |
| 50 | 50 |
| 51 void History::trace(Visitor* visitor) |
| 52 { |
| 53 DOMWindowProperty::trace(visitor); |
| 54 } |
| 55 |
| 51 unsigned History::length() const | 56 unsigned History::length() const |
| 52 { | 57 { |
| 53 if (!m_frame) | 58 if (!m_frame) |
| 54 return 0; | 59 return 0; |
| 55 if (!m_frame->page()) | 60 if (!m_frame->page()) |
| 56 return 0; | 61 return 0; |
| 57 return m_frame->page()->backForward().backForwardListCount(); | 62 return m_frame->page()->backForward().backForwardListCount(); |
| 58 } | 63 } |
| 59 | 64 |
| 60 SerializedScriptValue* History::state() | 65 SerializedScriptValue* History::state() |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 KURL fullURL = urlForState(urlString); | 135 KURL fullURL = urlForState(urlString); |
| 131 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest
(fullURL)) { | 136 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest
(fullURL)) { |
| 132 // 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. | 137 // 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. |
| 133 exceptionState.throwSecurityError("A history state object with URL '" +
fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f
rame->document()->securityOrigin()->toString() + "'."); | 138 exceptionState.throwSecurityError("A history state object with URL '" +
fullURL.elidedString() + "' cannot be created in a document with origin '" + m_f
rame->document()->securityOrigin()->toString() + "'."); |
| 134 return; | 139 return; |
| 135 } | 140 } |
| 136 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig
ationHistoryApi, data, type); | 141 m_frame->loader().updateForSameDocumentNavigation(fullURL, SameDocumentNavig
ationHistoryApi, data, type); |
| 137 } | 142 } |
| 138 | 143 |
| 139 } // namespace blink | 144 } // namespace blink |
| OLD | NEW |