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 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 | 113 |
114 return KURL(baseURL, urlString); | 114 return KURL(baseURL, urlString); |
115 } | 115 } |
116 | 116 |
117 void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const Str
ing& title, const String& urlString, StateObjectType stateObjectType, ExceptionC
ode& ec) | 117 void History::stateObjectAdded(PassRefPtr<SerializedScriptValue> data, const Str
ing& title, const String& urlString, StateObjectType stateObjectType, ExceptionC
ode& ec) |
118 { | 118 { |
119 if (!m_frame || !m_frame->page()) | 119 if (!m_frame || !m_frame->page()) |
120 return; | 120 return; |
121 | 121 |
122 KURL fullURL = urlForState(urlString); | 122 KURL fullURL = urlForState(urlString); |
123 RefPtr<SecurityOrigin> origin = SecurityOrigin::create(fullURL); | 123 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->canRequest
(fullURL)) { |
124 if (!fullURL.isValid() || !m_frame->document()->securityOrigin()->isSameSche
meHostPort(origin.get())) { | |
125 ec = SECURITY_ERR; | 124 ec = SECURITY_ERR; |
126 return; | 125 return; |
127 } | 126 } |
128 | 127 |
129 if (stateObjectType == StateObjectPush) | 128 if (stateObjectType == StateObjectPush) |
130 m_frame->loader()->history()->pushState(data, title, fullURL.string()); | 129 m_frame->loader()->history()->pushState(data, title, fullURL.string()); |
131 else if (stateObjectType == StateObjectReplace) | 130 else if (stateObjectType == StateObjectReplace) |
132 m_frame->loader()->history()->replaceState(data, title, fullURL.string()
); | 131 m_frame->loader()->history()->replaceState(data, title, fullURL.string()
); |
133 | 132 |
134 if (!urlString.isEmpty()) | 133 if (!urlString.isEmpty()) |
135 m_frame->document()->updateURLForPushOrReplaceState(fullURL); | 134 m_frame->document()->updateURLForPushOrReplaceState(fullURL); |
136 | 135 |
137 if (stateObjectType == StateObjectPush) | 136 if (stateObjectType == StateObjectPush) |
138 m_frame->loader()->client()->dispatchDidPushStateWithinPage(); | 137 m_frame->loader()->client()->dispatchDidPushStateWithinPage(); |
139 else if (stateObjectType == StateObjectReplace) | 138 else if (stateObjectType == StateObjectReplace) |
140 m_frame->loader()->client()->dispatchDidReplaceStateWithinPage(); | 139 m_frame->loader()->client()->dispatchDidReplaceStateWithinPage(); |
141 } | 140 } |
142 | 141 |
143 } // namespace WebCore | 142 } // namespace WebCore |
OLD | NEW |