| 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 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 const String& urlString, | 196 const String& urlString, |
| 197 HistoryScrollRestorationType restorationType, | 197 HistoryScrollRestorationType restorationType, |
| 198 FrameLoadType type, | 198 FrameLoadType type, |
| 199 ExceptionState& exceptionState) { | 199 ExceptionState& exceptionState) { |
| 200 if (!frame() || !frame()->page() || !frame()->loader().documentLoader()) | 200 if (!frame() || !frame()->page() || !frame()->loader().documentLoader()) |
| 201 return; | 201 return; |
| 202 | 202 |
| 203 KURL fullURL = urlForState(urlString); | 203 KURL fullURL = urlForState(urlString); |
| 204 if (!canChangeToUrl(fullURL, frame()->document()->getSecurityOrigin(), | 204 if (!canChangeToUrl(fullURL, frame()->document()->getSecurityOrigin(), |
| 205 frame()->document()->url())) { | 205 frame()->document()->url())) { |
| 206 // We can safely expose the URL to JavaScript, as a) no redirection takes pl
ace: JavaScript already had this URL, b) JavaScript can only access a same-origi
n History object. | 206 // We can safely expose the URL to JavaScript, as a) no redirection takes |
| 207 // place: JavaScript already had this URL, b) JavaScript can only access a |
| 208 // same-origin History object. |
| 207 exceptionState.throwSecurityError( | 209 exceptionState.throwSecurityError( |
| 208 "A history state object with URL '" + fullURL.elidedString() + | 210 "A history state object with URL '" + fullURL.elidedString() + |
| 209 "' cannot be created in a document with origin '" + | 211 "' cannot be created in a document with origin '" + |
| 210 frame()->document()->getSecurityOrigin()->toString() + "' and URL '" + | 212 frame()->document()->getSecurityOrigin()->toString() + "' and URL '" + |
| 211 frame()->document()->url().elidedString() + "'."); | 213 frame()->document()->url().elidedString() + "'."); |
| 212 return; | 214 return; |
| 213 } | 215 } |
| 214 | 216 |
| 215 frame()->loader().updateForSameDocumentNavigation( | 217 frame()->loader().updateForSameDocumentNavigation( |
| 216 fullURL, SameDocumentNavigationHistoryApi, std::move(data), | 218 fullURL, SameDocumentNavigationHistoryApi, std::move(data), |
| 217 restorationType, type, frame()->document()); | 219 restorationType, type, frame()->document()); |
| 218 } | 220 } |
| 219 | 221 |
| 220 } // namespace blink | 222 } // namespace blink |
| OLD | NEW |